Revision 47168 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/test/java/org/gvsig/expressionevaluator/TestGrammarCompiler.java
TestGrammarCompiler.java | ||
---|---|---|
451 | 451 |
checkEquals("testSelectWhereOrderLimit", "( SELECT * FROM \"countries\" WHERE (\"LASTCENSUS\" > 0) ORDER BY \"LASTCENSUS\" DESC NULLS LAST LIMIT 3 )", code.toString()); |
452 | 452 |
} |
453 | 453 |
|
454 |
public void testSelectWhereOrderLimit2() { |
|
455 |
try { |
|
456 |
StringBuilder source = new StringBuilder(); |
|
457 |
source.append("((((GETATTR(\"ARENA2_ACCIDENTES\", 'TITULARIDAD_VIA') = 2) AND (GETATTR(\"ARENA2_ACCIDENTES\", 'FECHA_ACCIDENTE') >= DATE('2020-01-01'))) AND (GETATTR(\"ARENA2_ACCIDENTES\", 'FECHA_ACCIDENTE') <= DATE('2020-12-31'))) AND (EXISTS(SELECT(\"LID_ACCIDENTE\", \"ARENA2_VEHICULOS\", ((GETATTR(\"ARENA2_VEHICULOS\", 'ID_ACCIDENTE') = GETATTR(\"ARENA2_ACCIDENTES\", 'LID_ACCIDENTE')) AND (GETATTR(\"ARENA2_VEHICULOS\", 'TIPO_VEHICULO') = 4)), TUPLE(), TUPLE(), 1), 'EXISTSaa58b804d9094968ba04664f0c4c8553') OR EXISTS(SELECT(\"LID_ACCIDENTE\", \"ARENA2_VEHICULOS\", ((GETATTR(\"ARENA2_VEHICULOS\", 'ID_ACCIDENTE') = GETATTR(\"ARENA2_ACCIDENTES\", 'LID_ACCIDENTE')) AND (GETATTR(\"ARENA2_VEHICULOS\", 'TIPO_VEHICULO') = 30)), TUPLE(), TUPLE(), 1), 'EXISTSb67e753993c54d1da722ff25a00c2a02')))"); |
|
458 |
|
|
459 |
Compiler compiler = createCompiler(); |
|
460 |
|
|
461 |
Code code = compiler.compileExpression(source.toString()); |
|
462 |
link(code); |
|
463 |
checkEquals("((((\"ARENA2_ACCIDENTES\".\"TITULARIDAD_VIA\" = 2) AND (\"ARENA2_ACCIDENTES\".\"FECHA_ACCIDENTE\" >= DATE('2020-01-01'))) AND (\"ARENA2_ACCIDENTES\".\"FECHA_ACCIDENTE\" <= DATE('2020-12-31'))) AND (EXISTS((SELECT \"LID_ACCIDENTE\" FROM \"ARENA2_VEHICULOS\" WHERE ((\"ARENA2_VEHICULOS\".\"ID_ACCIDENTE\" = \"ARENA2_ACCIDENTES\".\"LID_ACCIDENTE\") AND (\"ARENA2_VEHICULOS\".\"TIPO_VEHICULO\" = 4)) LIMIT 1), 'EXISTSaa58b804d9094968ba04664f0c4c8553') OR EXISTS((SELECT \"LID_ACCIDENTE\" FROM \"ARENA2_VEHICULOS\" WHERE ((\"ARENA2_VEHICULOS\".\"ID_ACCIDENTE\" = \"ARENA2_ACCIDENTES\".\"LID_ACCIDENTE\") AND (\"ARENA2_VEHICULOS\".\"TIPO_VEHICULO\" = 30)) LIMIT 1), 'EXISTSb67e753993c54d1da722ff25a00c2a02')))", code.toString()); |
|
464 |
} catch (Exception ex) { |
|
465 |
ex.printStackTrace(); |
|
466 |
throw ex; |
|
467 |
} |
|
468 |
} |
|
469 |
|
|
454 | 470 |
public void testSelectLimit() { |
455 | 471 |
StringBuilder source = new StringBuilder(); |
456 | 472 |
source.append("SELECT * FROM countries "); |
Also available in: Unified diff