Revision 44191 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.expressionevaluator/org.gvsig.expressionevaluator.lib/org.gvsig.expressionevaluator.lib.impl/src/main/java/org/gvsig/expressionevaluator/impl/DefaultInterpreter.java
DefaultInterpreter.java | ||
---|---|---|
6 | 6 |
import java.util.HashMap; |
7 | 7 |
import java.util.List; |
8 | 8 |
import java.util.Map; |
9 |
import java.util.Objects; |
|
9 | 10 |
import org.apache.commons.lang3.tuple.Pair; |
10 | 11 |
import org.gvsig.expressionevaluator.SymbolTable; |
11 | 12 |
import org.gvsig.expressionevaluator.Interpreter; |
... | ... | |
87 | 88 |
private Code currentCode; |
88 | 89 |
private Cache cache; |
89 | 90 |
private int maxRecursionLimit; |
91 |
private boolean sqlCompatible = false; |
|
90 | 92 |
|
91 | 93 |
public DefaultInterpreter() { |
92 | 94 |
this.cache = new DefaultCache(); |
... | ... | |
139 | 141 |
} |
140 | 142 |
|
141 | 143 |
@Override |
144 |
public void setSQLCompatible(boolean sqlCompatible) { |
|
145 |
this.sqlCompatible = sqlCompatible; |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
|
149 |
public boolean isSQLCompatible() { |
|
150 |
return sqlCompatible; |
|
151 |
} |
|
152 |
|
|
153 |
@Override |
|
142 | 154 |
public Object run(Code code) { |
143 | 155 |
try { |
144 | 156 |
return this.runCode(code); |
... | ... | |
220 | 232 |
} |
221 | 233 |
caller.function(function); |
222 | 234 |
} |
235 |
if( !function.isSQLCompatible() && this.sqlCompatible ) { |
|
236 |
throw new ExpressionRuntimeException(code, I18N.Cant_use_non_SQL_compatible_functions(function.name())); |
|
237 |
} |
|
223 | 238 |
Codes args = caller.args(); |
224 | 239 |
try { |
225 | 240 |
switch( caller.type() ) { |
... | ... | |
260 | 275 |
} catch (Exception ex) { |
261 | 276 |
String argsstr = "???"; |
262 | 277 |
try { |
263 |
argsstr = args.toString();
|
|
278 |
argsstr = Objects.toString(args);
|
|
264 | 279 |
} catch(Exception ex2) { |
265 | 280 |
// Ignore. |
266 | 281 |
} |
Also available in: Unified diff