|
static String | convertToLike (String value) |
|
static String | convertToPartialLike (String value) |
|
static String | convertToIn (Collection collection) |
|
static String | quoteTokensForIn (String inValue) |
|
static WhereClause | getWhereClause (String[] fields, String value) |
|
static WhereClause | getWhereClause (WhereClause wc, String[] fields, String value) |
|
static WhereClause | getWhereClause (String[] fields, String value, String regexp) |
|
static WhereClause | getWhereClause (WhereClause wc, String[] fields, String value, String regexp) |
|
static WhereClause | getWhereClause (String[] fields, String[] values) |
|
static WhereClause | getWhereClause (WhereClause wc, String[] fields, String[] values) |
|
static WhereClause | getWhereClause (String[] fields, String[] values, boolean namedValues) |
|
static WhereClause | getWhereClause (WhereClause wc, String[] fields, String[] values, boolean namedValues) |
|
- Author
- Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g
Definition at line 27 of file SQLHelper.java.
◆ convertToIn()
static String org.turro.elephant.db.SQLHelper.convertToIn |
( |
Collection |
collection | ) |
|
|
static |
Definition at line 43 of file SQLHelper.java.
45 for(Object o : collection) {
46 if(o instanceof String) {
47 result = (result ==
null) ? (
"'" + o +
"'") : (result +
",'" + o +
"'");
49 result = (String) ((result ==
null) ? o +
"" : (result +
"," + o));
◆ convertToLike()
static String org.turro.elephant.db.SQLHelper.convertToLike |
( |
String |
value | ) |
|
|
static |
Definition at line 33 of file SQLHelper.java.
34 if(value ==
null)
return null;
35 return value.replaceAll(
"\\*",
"%").replaceAll(
"\\?",
"_");
◆ convertToPartialLike()
static String org.turro.elephant.db.SQLHelper.convertToPartialLike |
( |
String |
value | ) |
|
|
static |
Definition at line 38 of file SQLHelper.java.
39 if(value ==
null)
return null;
40 return "%" + value.replaceAll(
"\\*",
"%").replaceAll(
"\\?",
"_") +
"%";
◆ getWhereClause() [1/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
String[] |
fields, |
|
|
String |
value |
|
) |
| |
|
static |
Definition at line 64 of file SQLHelper.java.
static WhereClause getWhereClause(String[] fields, String value)
◆ getWhereClause() [2/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
String[] |
fields, |
|
|
String |
value, |
|
|
String |
regexp |
|
) |
| |
|
static |
◆ getWhereClause() [3/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
String[] |
fields, |
|
|
String[] |
values |
|
) |
| |
|
static |
◆ getWhereClause() [4/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
String[] |
fields, |
|
|
String[] |
values, |
|
|
boolean |
namedValues |
|
) |
| |
|
static |
◆ getWhereClause() [5/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
WhereClause |
wc, |
|
|
String[] |
fields, |
|
|
String |
value |
|
) |
| |
|
static |
Definition at line 68 of file SQLHelper.java.
69 if(wc ==
null) wc =
new WhereClause();
71 if(value.startsWith(
"=")) {
73 value = value.substring(1);
75 }
else if(value.startsWith(
"?")) {
77 wc.addClause(value.substring(1));
◆ getWhereClause() [6/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
WhereClause |
wc, |
|
|
String[] |
fields, |
|
|
String |
value, |
|
|
String |
regexp |
|
) |
| |
|
static |
◆ getWhereClause() [7/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
WhereClause |
wc, |
|
|
String[] |
fields, |
|
|
String[] |
values |
|
) |
| |
|
static |
◆ getWhereClause() [8/8]
static WhereClause org.turro.elephant.db.SQLHelper.getWhereClause |
( |
WhereClause |
wc, |
|
|
String[] |
fields, |
|
|
String[] |
values, |
|
|
boolean |
namedValues |
|
) |
| |
|
static |
Definition at line 111 of file SQLHelper.java.
112 if(wc ==
null) wc =
new WhereClause();
114 String result =
"", partial, param;
116 for(
int f = 0; f < fields.length; f++) {
118 for(
int v = 0; v < values.length; v++) {
119 if(!Strings.isBlank(values[v])) {
120 if(partial.length() > 0) {
121 partial +=
" " + wc.getFieldOcurrence() +
" ";
124 param = fields[f].replaceAll(
"\\.",
"_") + wc.getUniqueSuffix();
125 partial +=
"UCASE(" + fields[f] +
") like :" + param;
126 if(
"%".equals(values[v])) {
127 wc.addNamedValue(param,
"%");
129 wc.addNamedValue(param,
"%" + values[v].toUpperCase() +
"%");
132 partial +=
"UCASE(" + fields[f] +
") like ?";
133 if(
"%".equals(values[v])) {
136 wc.addValue(
"%" + values[v].toUpperCase() +
"%");
142 if(partial.length() > 0) {
143 if(result.length() > 0) {
146 result +=
"(" + partial +
")";
150 if(result.length() > 0) {
151 result = wc.getPrefix() +
" (" + result +
") ";
154 wc.addClause(result);
◆ quoteTokensForIn()
static String org.turro.elephant.db.SQLHelper.quoteTokensForIn |
( |
String |
inValue | ) |
|
|
static |
Definition at line 55 of file SQLHelper.java.
56 String[] tokens = inValue.split(
",");
58 for(String s : tokens) {
59 result = (result ==
null) ? (
"'" + s +
"'") : (result +
",'" + s +
"'");
The documentation for this class was generated from the following file: