Revision 47579
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/fetchFeatureProviderByReference.sql | ||
---|---|---|
1 | 1 |
|
2 | 2 |
-- Count SQL |
3 |
SELECT "PUBLIC"."test"."ID",
|
|
4 |
"PUBLIC"."test"."Byte",
|
|
5 |
"PUBLIC"."test"."Bool1",
|
|
6 |
"PUBLIC"."test"."Long",
|
|
7 |
"PUBLIC"."test"."Timestamp",
|
|
8 |
"PUBLIC"."test"."Date",
|
|
9 |
"PUBLIC"."test"."Time",
|
|
10 |
"PUBLIC"."test"."Bool2",
|
|
11 |
"PUBLIC"."test"."String",
|
|
12 |
"PUBLIC"."test"."Bool3",
|
|
13 |
"PUBLIC"."test"."Double",
|
|
14 |
"PUBLIC"."test"."Bool4",
|
|
15 |
"PUBLIC"."test"."Float",
|
|
16 |
"PUBLIC"."test"."Bool5",
|
|
17 |
"PUBLIC"."test"."Decimal",
|
|
18 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL)
|
|
19 |
FROM "PUBLIC"."test"
|
|
20 |
WHERE ( ("PUBLIC"."test"."ID") = (?) )
|
|
3 |
SELECT "test"."ID", |
|
4 |
"test"."Byte", |
|
5 |
"test"."Bool1", |
|
6 |
"test"."Long", |
|
7 |
"test"."Timestamp", |
|
8 |
"test"."Date", |
|
9 |
"test"."Time", |
|
10 |
"test"."Bool2", |
|
11 |
"test"."String", |
|
12 |
"test"."Bool3", |
|
13 |
"test"."Double", |
|
14 |
"test"."Bool4", |
|
15 |
"test"."Float", |
|
16 |
"test"."Bool5", |
|
17 |
"test"."Decimal", |
|
18 |
"test"."Geometry"
|
|
19 |
FROM "test" |
|
20 |
WHERE ( ("test"."ID") = (?) ) |
|
21 | 21 |
LIMIT 1; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/calculateEnvelope.sql | ||
---|---|---|
1 | 1 |
|
2 |
-- Count SQL
|
|
2 |
-- Calculate envelope SQL
|
|
3 | 3 |
SELECT |
4 |
NVL2(ST_Extent("PUBLIC"."test"."Geometry"),ST_AsBinary(ST_Extent("PUBLIC"."test"."Geometry")),NULL) |
|
5 |
FROM "PUBLIC"."test" |
|
6 |
WHERE ( ("PUBLIC"."test"."Geometry") IS NOT NULL ); |
|
4 |
IIF(ST_ExtentAggregate("test"."Geometry") IS NULL,NULL, |
|
5 |
ST_AsBinary(ST_ExtentAggregate("test"."Geometry"))) |
|
6 |
FROM "test" |
|
7 |
WHERE ( ("test"."Geometry") IS NOT NULL ); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/testMultipleExpansionOfCalculatedField.sql | ||
---|---|---|
2 | 2 |
-- testToDoubleWithSpecialFunctions SQL |
3 | 3 |
|
4 | 4 |
-- Select |
5 |
SELECT "PUBLIC"."ARENA2_CONDUCTORES"."LID_CONDUCTOR", "PUBLIC"."ARENA2_CONDUCTORES"."ID_ACCIDENTE",
|
|
6 |
"PUBLIC"."ARENA2_CONDUCTORES"."LID_VEHICULO", "PUBLIC"."ARENA2_CONDUCTORES"."ID_VEHICULO",
|
|
7 |
"PUBLIC"."ARENA2_CONDUCTORES"."POSIBLE_RESPONSABLE", "PUBLIC"."ARENA2_CONDUCTORES"."FECHA_NACIMIENTO",
|
|
8 |
"PUBLIC"."ARENA2_CONDUCTORES"."SEXO", "PUBLIC"."ARENA2_CONDUCTORES"."NACIONALIDAD",
|
|
9 |
"PUBLIC"."ARENA2_CONDUCTORES"."PAIS_RESIDENCIA", "PUBLIC"."ARENA2_CONDUCTORES"."PROVINCIA_RESIDENCIA",
|
|
10 |
"PUBLIC"."ARENA2_CONDUCTORES"."MUNICIPIO_RESIDENCIA", "PUBLIC"."ARENA2_CONDUCTORES"."ASISTENCIA_SANITARIA",
|
|
11 |
"PUBLIC"."ARENA2_CONDUCTORES"."INFLU_FACT_ATENCION", "PUBLIC"."ARENA2_CONDUCTORES"."FACTORES_ATENCION",
|
|
12 |
"PUBLIC"."ARENA2_CONDUCTORES"."INFLU_PRES_ERROR", "PUBLIC"."ARENA2_CONDUCTORES"."PRESUNTOS_ERRORES",
|
|
13 |
"PUBLIC"."ARENA2_CONDUCTORES"."CARACT_PERMISO", "PUBLIC"."ARENA2_CONDUCTORES"."CLASE_PERMISO",
|
|
14 |
"PUBLIC"."ARENA2_CONDUCTORES"."FECHA_PERMISO", "PUBLIC"."ARENA2_CONDUCTORES"."MOTIVO_DESPLAZAMIENTO",
|
|
15 |
"PUBLIC"."ARENA2_CONDUCTORES"."DESPLAZAMIENTO_PREVISTO", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_CINTURON",
|
|
16 |
"PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_CASCO", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_BRAZOS",
|
|
17 |
"PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_ESPALDA", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_TORSO",
|
|
18 |
"PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_MANOS", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_PIERNAS",
|
|
19 |
"PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_PIES", "PUBLIC"."ARENA2_CONDUCTORES"."ACC_SEG_PRENDA_REF",
|
|
20 |
"PUBLIC"."ARENA2_CONDUCTORES"."INFLU_ALCOHOL", "PUBLIC"."ARENA2_CONDUCTORES"."PRUEBA_ALCOHOLEMIA",
|
|
21 |
"PUBLIC"."ARENA2_CONDUCTORES"."TASA_ALCOHOLEMIA1", "PUBLIC"."ARENA2_CONDUCTORES"."TASA_ALCOHOLEMIA2",
|
|
22 |
"PUBLIC"."ARENA2_CONDUCTORES"."PRUEBA_ALC_SANGRE", "PUBLIC"."ARENA2_CONDUCTORES"."SIGNOS_INFLU_ALCOHOL",
|
|
23 |
"PUBLIC"."ARENA2_CONDUCTORES"."INFLU_DROGAS", "PUBLIC"."ARENA2_CONDUCTORES"."PRUEBA_DROGAS",
|
|
24 |
"PUBLIC"."ARENA2_CONDUCTORES"."AMP", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_AMP",
|
|
25 |
"PUBLIC"."ARENA2_CONDUCTORES"."BDZ", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_BDZ",
|
|
26 |
"PUBLIC"."ARENA2_CONDUCTORES"."COC", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_COC", "PUBLIC"."ARENA2_CONDUCTORES"."THC",
|
|
27 |
"PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_THC", "PUBLIC"."ARENA2_CONDUCTORES"."METH",
|
|
28 |
"PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_METH", "PUBLIC"."ARENA2_CONDUCTORES"."OPI", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_OPI",
|
|
29 |
"PUBLIC"."ARENA2_CONDUCTORES"."OTRAS", "PUBLIC"."ARENA2_CONDUCTORES"."CONFIRMADO_OTRAS",
|
|
30 |
"PUBLIC"."ARENA2_CONDUCTORES"."SIGNOS_INFLU_DROGAS", "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_PRES_INFRAC_COND",
|
|
31 |
"PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_COND", "PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_SIN_LUCES",
|
|
32 |
"PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_SIN_TRIANGULO", "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_PRES_INFRAC_VEL",
|
|
33 |
"PUBLIC"."ARENA2_CONDUCTORES"."PRES_INFRAC_VEL_COND", "PUBLIC"."ARENA2_CONDUCTORES"."INFLU_OTRA_INFRAC",
|
|
34 |
"PUBLIC"."ARENA2_CONDUCTORES"."OTRA_INFRAC_COND", "PUBLIC"."ARENA2_CONDUCTORES"."EXTRA",
|
|
35 |
"PUBLIC"."ARENA2_ACCIDENTES"."KM" AS "AccKm0",
|
|
36 |
("PUBLIC"."ARENA2_ACCIDENTES"."KM" * 100) AS "AccKm1",
|
|
37 |
("PUBLIC"."ARENA2_ACCIDENTES"."KM" * 222) AS "AccKm2",
|
|
38 |
"PUBLIC"."ARENA2_ACCIDENTES"."KM"
|
|
39 |
FROM "PUBLIC"."ARENA2_CONDUCTORES"
|
|
40 |
LEFT JOIN "PUBLIC"."ARENA2_ACCIDENTES" ON ( ("PUBLIC"."ARENA2_CONDUCTORES"."ID_ACCIDENTE") = ("PUBLIC"."ARENA2_ACCIDENTES"."ID_ACCIDENTE") )
|
|
5 |
SELECT "ARENA2_CONDUCTORES"."LID_CONDUCTOR", "ARENA2_CONDUCTORES"."ID_ACCIDENTE",
|
|
6 |
"ARENA2_CONDUCTORES"."LID_VEHICULO", "ARENA2_CONDUCTORES"."ID_VEHICULO",
|
|
7 |
"ARENA2_CONDUCTORES"."POSIBLE_RESPONSABLE", "ARENA2_CONDUCTORES"."FECHA_NACIMIENTO",
|
|
8 |
"ARENA2_CONDUCTORES"."SEXO", "ARENA2_CONDUCTORES"."NACIONALIDAD",
|
|
9 |
"ARENA2_CONDUCTORES"."PAIS_RESIDENCIA", "ARENA2_CONDUCTORES"."PROVINCIA_RESIDENCIA",
|
|
10 |
"ARENA2_CONDUCTORES"."MUNICIPIO_RESIDENCIA", "ARENA2_CONDUCTORES"."ASISTENCIA_SANITARIA",
|
|
11 |
"ARENA2_CONDUCTORES"."INFLU_FACT_ATENCION", "ARENA2_CONDUCTORES"."FACTORES_ATENCION",
|
|
12 |
"ARENA2_CONDUCTORES"."INFLU_PRES_ERROR", "ARENA2_CONDUCTORES"."PRESUNTOS_ERRORES",
|
|
13 |
"ARENA2_CONDUCTORES"."CARACT_PERMISO", "ARENA2_CONDUCTORES"."CLASE_PERMISO",
|
|
14 |
"ARENA2_CONDUCTORES"."FECHA_PERMISO", "ARENA2_CONDUCTORES"."MOTIVO_DESPLAZAMIENTO",
|
|
15 |
"ARENA2_CONDUCTORES"."DESPLAZAMIENTO_PREVISTO", "ARENA2_CONDUCTORES"."ACC_SEG_CINTURON",
|
|
16 |
"ARENA2_CONDUCTORES"."ACC_SEG_CASCO", "ARENA2_CONDUCTORES"."ACC_SEG_BRAZOS",
|
|
17 |
"ARENA2_CONDUCTORES"."ACC_SEG_ESPALDA", "ARENA2_CONDUCTORES"."ACC_SEG_TORSO",
|
|
18 |
"ARENA2_CONDUCTORES"."ACC_SEG_MANOS", "ARENA2_CONDUCTORES"."ACC_SEG_PIERNAS",
|
|
19 |
"ARENA2_CONDUCTORES"."ACC_SEG_PIES", "ARENA2_CONDUCTORES"."ACC_SEG_PRENDA_REF",
|
|
20 |
"ARENA2_CONDUCTORES"."INFLU_ALCOHOL", "ARENA2_CONDUCTORES"."PRUEBA_ALCOHOLEMIA",
|
|
21 |
"ARENA2_CONDUCTORES"."TASA_ALCOHOLEMIA1", "ARENA2_CONDUCTORES"."TASA_ALCOHOLEMIA2",
|
|
22 |
"ARENA2_CONDUCTORES"."PRUEBA_ALC_SANGRE", "ARENA2_CONDUCTORES"."SIGNOS_INFLU_ALCOHOL",
|
|
23 |
"ARENA2_CONDUCTORES"."INFLU_DROGAS", "ARENA2_CONDUCTORES"."PRUEBA_DROGAS",
|
|
24 |
"ARENA2_CONDUCTORES"."AMP", "ARENA2_CONDUCTORES"."CONFIRMADO_AMP",
|
|
25 |
"ARENA2_CONDUCTORES"."BDZ", "ARENA2_CONDUCTORES"."CONFIRMADO_BDZ",
|
|
26 |
"ARENA2_CONDUCTORES"."COC", "ARENA2_CONDUCTORES"."CONFIRMADO_COC", "ARENA2_CONDUCTORES"."THC",
|
|
27 |
"ARENA2_CONDUCTORES"."CONFIRMADO_THC", "ARENA2_CONDUCTORES"."METH",
|
|
28 |
"ARENA2_CONDUCTORES"."CONFIRMADO_METH", "ARENA2_CONDUCTORES"."OPI", "ARENA2_CONDUCTORES"."CONFIRMADO_OPI",
|
|
29 |
"ARENA2_CONDUCTORES"."OTRAS", "ARENA2_CONDUCTORES"."CONFIRMADO_OTRAS",
|
|
30 |
"ARENA2_CONDUCTORES"."SIGNOS_INFLU_DROGAS", "ARENA2_CONDUCTORES"."INFLU_PRES_INFRAC_COND",
|
|
31 |
"ARENA2_CONDUCTORES"."PRES_INFRAC_COND", "ARENA2_CONDUCTORES"."PRES_INFRAC_SIN_LUCES",
|
|
32 |
"ARENA2_CONDUCTORES"."PRES_INFRAC_SIN_TRIANGULO", "ARENA2_CONDUCTORES"."INFLU_PRES_INFRAC_VEL",
|
|
33 |
"ARENA2_CONDUCTORES"."PRES_INFRAC_VEL_COND", "ARENA2_CONDUCTORES"."INFLU_OTRA_INFRAC",
|
|
34 |
"ARENA2_CONDUCTORES"."OTRA_INFRAC_COND", "ARENA2_CONDUCTORES"."EXTRA",
|
|
35 |
"ARENA2_ACCIDENTES"."KM" AS "AccKm0", |
|
36 |
("ARENA2_ACCIDENTES"."KM" * 100) AS "AccKm1", |
|
37 |
("ARENA2_ACCIDENTES"."KM" * 222) AS "AccKm2", |
|
38 |
"ARENA2_ACCIDENTES"."KM" |
|
39 |
FROM "ARENA2_CONDUCTORES" |
|
40 |
LEFT JOIN "ARENA2_ACCIDENTES" ON ( ("ARENA2_CONDUCTORES"."ID_ACCIDENTE") = ("ARENA2_ACCIDENTES"."ID_ACCIDENTE") )
|
|
41 | 41 |
ORDER BY "LID_CONDUCTOR" ASC NULLS LAST LIMIT 15; |
42 | 42 |
|
43 | 43 |
-- Count |
44 |
SELECT COUNT(*) FROM "PUBLIC"."ARENA2_CONDUCTORES"; |
|
44 |
SELECT COUNT(*) FROM "ARENA2_CONDUCTORES"; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/testSTDistance.sql | ||
---|---|---|
1 | 1 |
|
2 | 2 |
-- testSTDistance SQL |
3 | 3 |
|
4 |
-- testSTDistance |
|
4 |
-- testSTDistanceWithoutSpatialIndex
|
|
5 | 5 |
SELECT |
6 |
"PUBLIC"."test"."ID", "PUBLIC"."test"."Byte", "PUBLIC"."test"."Bool1", "PUBLIC"."test"."Long", |
|
7 |
"PUBLIC"."test"."Timestamp", "PUBLIC"."test"."Date", "PUBLIC"."test"."Time", "PUBLIC"."test"."Bool2", |
|
8 |
"PUBLIC"."test"."String", "PUBLIC"."test"."Bool3", "PUBLIC"."test"."Double", "PUBLIC"."test"."Bool4", |
|
9 |
"PUBLIC"."test"."Float", "PUBLIC"."test"."Bool5", "PUBLIC"."test"."Decimal", |
|
10 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL) |
|
11 |
FROM "PUBLIC"."test" |
|
12 |
WHERE ( ((ST_GeomFromWKB(X'00000000030000000100000021402600000000000040240000000000004025f6297cff75cb40239c1d1f0e59684025d906bcf328d440233c10eaca8ab54025a9b66290ea1a4022e38c4c65197440256a09e667f3bd402295f619980c4340251c73b39ae68d402256499d6f15e64024c3ef1535754b402226f9430cd72c402463e2e0f1a698402209d683008a354024000000000000402200000000000040239c1d1f0e5968402209d683008a3540233c10eaca8ab5402226f9430cd72c4022e38c4c651974402256499d6f15e6402295f619980c43402295f619980c43402256499d6f15e64022e38c4c651974402226f9430cd72c40233c10eaca8ab5402209d683008a3540239c1d1f0e596840220000000000004024000000000000402209d683008a35402463e2e0f1a699402226f9430cd72c4024c3ef1535754c402256499d6f15e640251c73b39ae68d402295f619980c4440256a09e667f3bd4022e38c4c6519744025a9b66290ea1b40233c10eaca8ab64025d906bcf328d540239c1d1f0e59694025f6297cff75cb40240000000000014026000000000000402463e2e0f1a69a4025f6297cff75cb4024c3ef1535754d4025d906bcf328d440251c73b39ae68e4025a9b66290ea1940256a09e667f3be40256a09e667f3bb4025a9b66290ea1b40251c73b39ae68b4025d906bcf328d54024c3ef153575494025f6297cff75cb402463e2e0f1a69640260000000000004024000000000000', 4326)) && ("PUBLIC"."test"."Geometry")) AND |
|
13 |
ST_Intersects((ST_GeomFromWKB(X'00000000030000000100000021402600000000000040240000000000004025f6297cff75cb40239c1d1f0e59684025d906bcf328d440233c10eaca8ab54025a9b66290ea1a4022e38c4c65197440256a09e667f3bd402295f619980c4340251c73b39ae68d402256499d6f15e64024c3ef1535754b402226f9430cd72c402463e2e0f1a698402209d683008a354024000000000000402200000000000040239c1d1f0e5968402209d683008a3540233c10eaca8ab5402226f9430cd72c4022e38c4c651974402256499d6f15e6402295f619980c43402295f619980c43402256499d6f15e64022e38c4c651974402226f9430cd72c40233c10eaca8ab5402209d683008a3540239c1d1f0e596840220000000000004024000000000000402209d683008a35402463e2e0f1a699402226f9430cd72c4024c3ef1535754c402256499d6f15e640251c73b39ae68d402295f619980c4440256a09e667f3bd4022e38c4c6519744025a9b66290ea1b40233c10eaca8ab64025d906bcf328d540239c1d1f0e59694025f6297cff75cb40240000000000014026000000000000402463e2e0f1a69a4025f6297cff75cb4024c3ef1535754d4025d906bcf328d440251c73b39ae68e4025a9b66290ea1940256a09e667f3be40256a09e667f3bb4025a9b66290ea1b40251c73b39ae68b4025d906bcf328d54024c3ef153575494025f6297cff75cb402463e2e0f1a69640260000000000004024000000000000', 4326)),("PUBLIC"."test"."Geometry") )) |
|
14 |
ORDER BY ST_Distance(ST_GeomFromWKB(X'00000000030000000100000021402600000000000040240000000000004025f6297cff75cb40239c1d1f0e59684025d906bcf328d440233c10eaca8ab54025a9b66290ea1a4022e38c4c65197440256a09e667f3bd402295f619980c4340251c73b39ae68d402256499d6f15e64024c3ef1535754b402226f9430cd72c402463e2e0f1a698402209d683008a354024000000000000402200000000000040239c1d1f0e5968402209d683008a3540233c10eaca8ab5402226f9430cd72c4022e38c4c651974402256499d6f15e6402295f619980c43402295f619980c43402256499d6f15e64022e38c4c651974402226f9430cd72c40233c10eaca8ab5402209d683008a3540239c1d1f0e596840220000000000004024000000000000402209d683008a35402463e2e0f1a699402226f9430cd72c4024c3ef1535754c402256499d6f15e640251c73b39ae68d402295f619980c4440256a09e667f3bd4022e38c4c6519744025a9b66290ea1b40233c10eaca8ab64025d906bcf328d540239c1d1f0e59694025f6297cff75cb40240000000000014026000000000000402463e2e0f1a69a4025f6297cff75cb4024c3ef1535754d4025d906bcf328d440251c73b39ae68e4025a9b66290ea1940256a09e667f3be40256a09e667f3bb4025a9b66290ea1b40251c73b39ae68b4025d906bcf328d54024c3ef153575494025f6297cff75cb402463e2e0f1a69640260000000000004024000000000000', 4326), "Geometry") ASC NULLS LAST, |
|
15 |
"PUBLIC"."test"."ID" ASC |
|
16 |
LIMIT 1; |
|
6 |
"test"."ID", "test"."Byte", "test"."Bool1", "test"."Long", |
|
7 |
"test"."Timestamp", "test"."Date", "test"."Time", "test"."Bool2", |
|
8 |
"test"."String", "test"."Bool3", "test"."Double", "test"."Bool4", |
|
9 |
"test"."Float", "test"."Bool5", "test"."Decimal", "test"."Geometry" |
|
10 |
FROM "test" |
|
11 |
WHERE ST_Intersects((ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326)),("test"."Geometry")) |
|
12 |
ORDER BY ST_Distance(ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326), "Geometry") ASC NULLS LAST, |
|
13 |
"test"."ID" ASC LIMIT 1; |
|
14 |
|
|
15 |
-- testSTDistanceWithSpatialIndex |
|
16 |
SELECT |
|
17 |
"test"."ID", "test"."Byte", "test"."Bool1", "test"."Long", |
|
18 |
"test"."Timestamp", "test"."Date", "test"."Time", "test"."Bool2", |
|
19 |
"test"."String", "test"."Bool3", "test"."Double", "test"."Bool4", |
|
20 |
"test"."Float", "test"."Bool5", "test"."Decimal", "test"."Geometry" FROM "test" WHERE ( (("ID" IN (SELECT "rtree_test_Geometry"."id" |
|
21 |
FROM "rtree_test_Geometry" |
|
22 |
WHERE "rtree_test_Geometry"."minx" <= (1.0) AND |
|
23 |
"rtree_test_Geometry"."miny" <= (41.0) AND |
|
24 |
"rtree_test_Geometry"."maxx" >= (-1.0) AND |
|
25 |
"rtree_test_Geometry"."maxy" >= (39.0)))) AND |
|
26 |
ST_Intersects((ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326)),("test"."Geometry") )) |
|
27 |
ORDER BY ST_Distance(ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326), "Geometry") ASC NULLS LAST, |
|
28 |
"test"."ID" ASC |
|
29 |
LIMIT 1; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/tableIsEmpty.sql | ||
---|---|---|
1 | 1 |
|
2 | 2 |
-- Table is empty |
3 |
SELECT 1 FROM "PUBLIC"."test" LIMIT 1; |
|
3 |
SELECT 1 FROM "test" LIMIT 1; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/performChanges.sql | ||
---|---|---|
1 | 1 |
|
2 | 2 |
-- Insert SQL |
3 |
INSERT INTO "PUBLIC"."test" (
|
|
3 |
INSERT INTO "test" ( |
|
4 | 4 |
"ID", "Byte", "Bool1", "Long", "Timestamp", "Date", "Time", |
5 | 5 |
"Bool2", "String", "Bool3", "Double", "Bool4", "Float", "Bool5", |
6 | 6 |
"Decimal", "Geometry" |
7 | 7 |
) |
8 | 8 |
VALUES ( |
9 |
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ST_GeomFromWKB((?), (?))
|
|
9 |
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
10 | 10 |
); |
11 | 11 |
|
12 | 12 |
-- Delete SQL |
13 |
DELETE FROM "PUBLIC"."test" WHERE ( ("ID") = (?) );
|
|
13 |
DELETE FROM "test" WHERE ( ("ID") = (?) ); |
|
14 | 14 |
|
15 | 15 |
-- Update SQL |
16 |
UPDATE "PUBLIC"."test"
|
|
16 |
UPDATE "test" |
|
17 | 17 |
SET |
18 | 18 |
"Byte" = ?, |
19 | 19 |
"Bool1" = ?, |
... | ... | |
29 | 29 |
"Float" = ?, |
30 | 30 |
"Bool5" = ?, |
31 | 31 |
"Decimal" = ?, |
32 |
"Geometry" = ST_GeomFromWKB((?), (?))
|
|
32 |
"Geometry" = ?
|
|
33 | 33 |
WHERE |
34 | 34 |
( ("ID") = (?) ); |
35 | 35 |
|
36 | 36 |
-- Update Table SQL |
37 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Byte" TINYINT DEFAULT NULL NULL;
|
|
38 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Bool1" BOOLEAN DEFAULT NULL NULL;
|
|
39 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Long" BIGINT DEFAULT NULL NULL;
|
|
40 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Timestamp" TIMESTAMP DEFAULT NULL NULL;
|
|
41 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Date" DATE DEFAULT NULL NULL;
|
|
42 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Time" TIME DEFAULT NULL NULL;
|
|
43 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Bool2" BOOLEAN DEFAULT NULL NULL;
|
|
44 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "String" VARCHAR(30) DEFAULT NULL NULL;
|
|
45 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Bool3" BOOLEAN DEFAULT NULL NULL;
|
|
46 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Double" DOUBLE DEFAULT NULL NULL;
|
|
47 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Bool4" BOOLEAN DEFAULT NULL NULL;
|
|
48 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Float" REAL DEFAULT NULL NULL;
|
|
49 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Bool5" BOOLEAN DEFAULT NULL NULL;
|
|
50 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Decimal" DECIMAL(6,3) DEFAULT NULL NULL;
|
|
51 |
ALTER TABLE "PUBLIC"."test" ADD COLUMN "Geometry" GEOMETRY(1) DEFAULT NULL NULL;
|
|
52 |
ALTER TABLE "PUBLIC"."test" ADD CONSTRAINT
|
|
53 |
IF NOT EXISTS "test_GEOM_Geometry" |
|
54 |
CHECK NVL2( |
|
55 |
"Geometry", |
|
56 |
ST_GeometryTypeCode("Geometry") = 1 AND |
|
57 |
ST_CoordDim("Geometry") = 2 AND |
|
58 |
ST_SRID("Geometry") = 4326, |
|
59 |
TRUE |
|
60 |
);
|
|
37 |
ALTER TABLE "test" ADD COLUMN "Byte" TINYINT DEFAULT NULL NULL; |
|
38 |
ALTER TABLE "test" ADD COLUMN "Bool1" BOOLEAN DEFAULT NULL NULL; |
|
39 |
ALTER TABLE "test" ADD COLUMN "Long" BIGINT DEFAULT NULL NULL; |
|
40 |
ALTER TABLE "test" ADD COLUMN "Timestamp" DATETIME DEFAULT NULL NULL;
|
|
41 |
ALTER TABLE "test" ADD COLUMN "Date" DATE DEFAULT NULL NULL; |
|
42 |
ALTER TABLE "test" ADD COLUMN "Time" TIME DEFAULT NULL NULL; |
|
43 |
ALTER TABLE "test" ADD COLUMN "Bool2" BOOLEAN DEFAULT NULL NULL; |
|
44 |
ALTER TABLE "test" ADD COLUMN "String" VARCHAR(30) DEFAULT NULL NULL; |
|
45 |
ALTER TABLE "test" ADD COLUMN "Bool3" BOOLEAN DEFAULT NULL NULL; |
|
46 |
ALTER TABLE "test" ADD COLUMN "Double" DOUBLE PRECISION DEFAULT NULL NULL;
|
|
47 |
ALTER TABLE "test" ADD COLUMN "Bool4" BOOLEAN DEFAULT NULL NULL; |
|
48 |
ALTER TABLE "test" ADD COLUMN "Float" FLOAT DEFAULT NULL NULL;
|
|
49 |
ALTER TABLE "test" ADD COLUMN "Bool5" BOOLEAN DEFAULT NULL NULL; |
|
50 |
ALTER TABLE "test" ADD COLUMN "Decimal" DECIMAL(6,3) DEFAULT NULL NULL; |
|
51 |
ALTER TABLE "test" ADD COLUMN "Geometry" BLOB DEFAULT NULL NULL;
|
|
52 |
--ALTER TABLE "test" ADD CONSTRAINT
|
|
53 |
-- IF NOT EXISTS "test_GEOM_Geometry"
|
|
54 |
-- CHECK NVL2(
|
|
55 |
-- "Geometry",
|
|
56 |
-- ST_GeometryTypeCode("Geometry") = 1 AND
|
|
57 |
-- ST_CoordDim("Geometry") = 2 AND
|
|
58 |
-- ST_SRID("Geometry") = 4326,
|
|
59 |
-- TRUE
|
|
60 |
-- )
|
|
61 | 61 |
|
62 | 62 |
|
63 | 63 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/testJsonValue.sql | ||
---|---|---|
2 | 2 |
-- test Json Value Function SQL |
3 | 3 |
|
4 | 4 |
-- JsonValueWhere |
5 |
SELECT "PUBLIC"."test"."ID", "PUBLIC"."test"."Byte", "PUBLIC"."test"."Bool1", "PUBLIC"."test"."Long", "PUBLIC"."test"."Timestamp", "PUBLIC"."test"."Date", "PUBLIC"."test"."Time", "PUBLIC"."test"."Bool2", "PUBLIC"."test"."String", "PUBLIC"."test"."Bool3", "PUBLIC"."test"."Double", "PUBLIC"."test"."Bool4", "PUBLIC"."test"."Float", "PUBLIC"."test"."Bool5", "PUBLIC"."test"."Decimal", NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL), JSON_VALUE("PUBLIC"."test"."String", '$.acc_cit') AS "JsonValue1" FROM "PUBLIC"."test" WHERE (JSON_VALUE("PUBLIC"."test"."String", '$.acc_cit') = 1) ORDER BY "PUBLIC"."test"."ID" ASC;
|
|
5 |
SELECT "test"."ID", "test"."Byte", "test"."Bool1", "test"."Long", "test"."Timestamp", "test"."Date", "test"."Time", "test"."Bool2", "test"."String", "test"."Bool3", "test"."Double", "test"."Bool4", "test"."Float", "test"."Bool5", "test"."Decimal", NVL2("test"."Geometry",ST_AsBinary("test"."Geometry"),NULL), JSON_VALUE("test"."String", '$.acc_cit') AS "JsonValue1" FROM "test" WHERE (JSON_VALUE("test"."String", '$.acc_cit') = 1) ORDER BY "test"."ID" ASC;
|
|
6 | 6 |
|
7 | 7 |
-- Count |
8 | 8 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/append.sql | ||
---|---|---|
1 | 1 |
|
2 |
-- Previous SQLs |
|
3 |
SET LOG 1; |
|
4 |
SET LOCK_MODE 1; |
|
5 |
SET UNDO_LOG 0; |
|
6 |
|
|
7 | 2 |
-- Inser SQL |
8 |
INSERT INTO "PUBLIC"."test" (
|
|
3 |
INSERT INTO "test" ( |
|
9 | 4 |
"ID", "Byte", "Bool1", "Long", "Timestamp", "Date", "Time", |
10 | 5 |
"Bool2", "String", "Bool3", "Double", "Bool4", "Float", "Bool5", |
11 | 6 |
"Decimal", "Geometry" |
12 | 7 |
) |
13 | 8 |
VALUES ( |
14 |
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ST_GeomFromWKB((?), (?)) |
|
15 |
); |
|
16 |
|
|
17 |
-- Post SQLs |
|
18 |
SET LOG 2; |
|
19 |
SET LOCK_MODE 3; |
|
20 |
SET UNDO_LOG 1; |
|
9 |
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? |
|
10 |
); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/fetchFeatureType.sql | ||
---|---|---|
1 | 1 |
|
2 | 2 |
-- FetchFeatureType first row SQL |
3 |
SELECT * FROM "PUBLIC"."test" LIMIT 0;
|
|
3 |
SELECT * FROM "test" LIMIT 0; |
|
4 | 4 |
|
5 | 5 |
-- FetchFeatureType get primery keys SQL |
6 |
SELECT |
|
7 |
"COLUMN_LIST", "CONSTRAINT_TYPE" |
|
8 |
FROM "INFORMATION_SCHEMA"."CONSTRAINTS" |
|
9 |
WHERE |
|
10 |
((( ("TABLE_NAME") LIKE ('test') ) AND |
|
11 |
( ("TABLE_SCHEMA") LIKE ('PUBLIC') )) AND |
|
12 |
( ("CONSTRAINT_TYPE") = ('PRIMARY KEY') ) |
|
13 |
); |
|
14 |
|
|
6 |
SELECT |
|
7 |
"COLUMN_NAME", "CONSTRAINT_TYPE" |
|
8 |
FROM INFORMATION_SCHEMA.table_constraints t_cons inner join INFORMATION_SCHEMA.key_column_usage c on c.constraint_catalog = t_cons.constraint_catalog and c.table_schema = t_cons.table_schema and c.table_name = t_cons.table_name and c.constraint_name = t_cons.constraint_name |
|
9 |
WHERE (( (c.TABLE_NAME) LIKE ('test') ) AND ( ("CONSTRAINT_TYPE") = ('PRIMARY KEY') )); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/createTable.sql | ||
---|---|---|
2 | 2 |
-- Se usa en TestCreateTable. |
3 | 3 |
-- Se corresponde con el fichero CSV "testCreateSource1.csv". |
4 | 4 |
|
5 |
CREATE TABLE "PUBLIC"."test" (
|
|
6 |
"ID" INTEGER PRIMARY KEY NOT NULL, |
|
7 |
"Byte" TINYINT DEFAULT NULL, |
|
8 |
"Bool1" BOOLEAN DEFAULT NULL, |
|
9 |
"Long" BIGINT DEFAULT NULL, |
|
10 |
"Timestamp" TIMESTAMP DEFAULT NULL, |
|
11 |
"Date" DATE DEFAULT NULL, |
|
12 |
"Time" TIME DEFAULT NULL, |
|
13 |
"Bool2" BOOLEAN DEFAULT NULL, |
|
14 |
"String" VARCHAR(30) DEFAULT NULL, |
|
15 |
"Bool3" BOOLEAN DEFAULT NULL, |
|
16 |
"Double" DOUBLE DEFAULT NULL, |
|
17 |
"Bool4" BOOLEAN DEFAULT NULL, |
|
18 |
"Float" REAL DEFAULT NULL, |
|
19 |
"Bool5" BOOLEAN DEFAULT NULL, |
|
20 |
"Decimal" DECIMAL(6,3) DEFAULT NULL, |
|
5 |
--CREATE TABLE "test" (
|
|
6 |
-- "ID" INTEGER PRIMARY KEY NOT NULL,
|
|
7 |
-- "Byte" TINYINT DEFAULT NULL,
|
|
8 |
-- "Bool1" BOOLEAN DEFAULT NULL,
|
|
9 |
-- "Long" BIGINT DEFAULT NULL,
|
|
10 |
-- "Timestamp" TIMESTAMP DEFAULT NULL,
|
|
11 |
-- "Date" DATE DEFAULT NULL,
|
|
12 |
-- "Time" TIME DEFAULT NULL,
|
|
13 |
-- "Bool2" BOOLEAN DEFAULT NULL,
|
|
14 |
-- "String" VARCHAR(30) DEFAULT NULL,
|
|
15 |
-- "Bool3" BOOLEAN DEFAULT NULL,
|
|
16 |
-- "Double" DOUBLE DEFAULT NULL,
|
|
17 |
-- "Bool4" BOOLEAN DEFAULT NULL,
|
|
18 |
-- "Float" REAL DEFAULT NULL,
|
|
19 |
-- "Bool5" BOOLEAN DEFAULT NULL,
|
|
20 |
-- "Decimal" DECIMAL(6,3) DEFAULT NULL,
|
|
21 | 21 |
-- H2 Spatial usa la constraint para averiguar el tipo de geometria, |
22 | 22 |
-- la dimension de esta (2D,3D,...) y el SRID. |
23 |
"Geometry" GEOMETRY(1) CHECK NVL2("Geometry", ST_GeometryTypeCode("Geometry") = 1 AND ST_CoordDim("Geometry") = 2 AND ST_SRID("Geometry") = 4326, TRUE) |
|
23 |
-- "Geometry" GEOMETRY(1) CHECK NVL2("Geometry", ST_GeometryTypeCode("Geometry") = 1 AND ST_CoordDim("Geometry") = 2 AND ST_SRID("Geometry") = 4326, TRUE) |
|
24 |
--); |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
CREATE TABLE IF NOT EXISTS gpkg_contents (table_name TEXT NOT NULL PRIMARY KEY,data_type TEXT NOT NULL,identifier TEXT UNIQUE,description TEXT DEFAULT '',last_change DATETIME NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')),min_x DOUBLE, min_y DOUBLE,max_x DOUBLE, max_y DOUBLE,srs_id INTEGER,CONSTRAINT fk_gc_r_srs_id FOREIGN KEY (srs_id) REFERENCES gpkg_spatial_ref_sys(srs_id)); |
|
29 |
|
|
30 |
CREATE TABLE IF NOT EXISTS gpkg_extensions ( |
|
31 |
table_name TEXT, |
|
32 |
column_name TEXT, |
|
33 |
extension_name TEXT NOT NULL, |
|
34 |
definition TEXT NOT NULL, |
|
35 |
scope TEXT NOT NULL, |
|
36 |
CONSTRAINT ge_tce UNIQUE (table_name, column_name, extension_name) ); |
|
37 |
|
|
38 |
CREATE TABLE IF NOT EXISTS "gpkg_geometry_columns" ( |
|
39 |
"table_name" TEXT NOT NULL, |
|
40 |
"column_name" TEXT NOT NULL, |
|
41 |
"geometry_type_name" TEXT NOT NULL, |
|
42 |
"srs_id" INTEGER NOT NULL, |
|
43 |
"z" TINYINT NOT NULL, |
|
44 |
"m" TINYINT NOT NULL, |
|
45 |
CONSTRAINT "pk_geom_cols" PRIMARY KEY("table_name","column_name"), |
|
46 |
CONSTRAINT "fk_gc_tn" FOREIGN KEY("table_name") REFERENCES "gpkg_contents"("table_name"), |
|
47 |
CONSTRAINT "uk_gc_table_name" UNIQUE("table_name"), |
|
48 |
CONSTRAINT "fk_gc_srs" FOREIGN KEY("srs_id") REFERENCES "gpkg_spatial_ref_sys"("srs_id") |
|
24 | 49 |
); |
50 |
|
|
51 |
INSERT INTO "main"."gpkg_contents" ("table_name", "data_type", "identifier", "description", "last_change", "min_x", "min_y", "max_x", "max_y", "srs_id") VALUES ('test', 'features', 'test', '', '2023-10-31 10:41:12.628', NULL, NULL, NULL, NULL, NULL); |
|
52 |
|
|
53 |
CREATE TABLE "test" ("ID" MEDIUMINT PRIMARY KEY NOT NULL, "Byte" TINYINT DEFAULT NULL, "Bool1" BOOLEAN DEFAULT NULL, "Long" BIGINT DEFAULT NULL, "Timestamp" DATETIME DEFAULT NULL, "Date" DATE DEFAULT NULL, "Time" TIME DEFAULT NULL, "Bool2" BOOLEAN DEFAULT NULL, "String" VARCHAR(30) DEFAULT NULL, "Bool3" BOOLEAN DEFAULT NULL, "Double" DOUBLE PRECISION DEFAULT NULL, "Bool4" BOOLEAN DEFAULT NULL, "Float" FLOAT DEFAULT NULL, "Bool5" BOOLEAN DEFAULT NULL, "Decimal" DECIMAL(6,3) DEFAULT NULL, "Geometry" BLOB DEFAULT NULL ); |
|
54 |
|
|
55 |
INSERT INTO "main"."gpkg_geometry_columns" ("table_name", "column_name", "geometry_type_name", "srs_id", "z", "m") VALUES ('test', 'Geometry', 'POINT', '4326', '0', '0'); |
|
56 |
|
|
57 |
CREATE TABLE IF NOT EXISTS gpkg_extensions ( |
|
58 |
table_name TEXT, |
|
59 |
column_name TEXT, |
|
60 |
extension_name TEXT NOT NULL, |
|
61 |
definition TEXT NOT NULL, |
|
62 |
scope TEXT NOT NULL, |
|
63 |
CONSTRAINT ge_tce UNIQUE (table_name, column_name, extension_name) ); |
|
64 |
|
|
65 |
CREATE VIRTUAL TABLE "rtree_test_Geometry" USING rtree(id, minx, maxx, miny, maxy); |
|
66 |
|
|
67 |
CREATE TRIGGER "rtree_test_Geometry_delete" AFTER DELETE ON "test" |
|
68 |
WHEN old."Geometry" NOT NULL |
|
69 |
BEGIN |
|
70 |
DELETE FROM "rtree_test_Geometry" WHERE ID = OLD."ID"; |
|
71 |
END; |
|
72 |
|
|
73 |
CREATE TRIGGER "rtree_test_Geometry_insert" AFTER INSERT ON "test" |
|
74 |
WHEN (new."Geometry" NOT NULL AND NOT ST_IsEmpty(NEW."Geometry")) |
|
75 |
BEGIN |
|
76 |
INSERT OR REPLACE INTO "rtree_test_Geometry" VALUES ( |
|
77 |
NEW."ID", |
|
78 |
ST_MinX(NEW."Geometry"), ST_MaxX(NEW."Geometry"), |
|
79 |
ST_MinY(NEW."Geometry"), ST_MaxY(NEW."Geometry") |
|
80 |
); |
|
81 |
END; |
|
82 |
|
|
83 |
CREATE TRIGGER "rtree_test_Geometry_update1" AFTER UPDATE OF "Geometry" ON "test" |
|
84 |
WHEN OLD."ID" = NEW."ID" AND |
|
85 |
(NEW."Geometry" NOTNULL AND NOT ST_IsEmpty(NEW."Geometry")) |
|
86 |
BEGIN |
|
87 |
INSERT OR REPLACE INTO "rtree_test_Geometry" VALUES ( |
|
88 |
NEW."ID", |
|
89 |
ST_MinX(NEW."Geometry"), ST_MaxX(NEW."Geometry"), |
|
90 |
ST_MinY(NEW."Geometry"), ST_MaxY(NEW."Geometry") |
|
91 |
); |
|
92 |
END; |
|
93 |
|
|
94 |
CREATE TRIGGER "rtree_test_Geometry_update2" AFTER UPDATE OF "Geometry" ON "test" |
|
95 |
WHEN OLD."ID" = NEW."ID" AND |
|
96 |
(NEW."Geometry" ISNULL OR ST_IsEmpty(NEW."Geometry")) |
|
97 |
BEGIN |
|
98 |
DELETE FROM "rtree_test_Geometry" WHERE ID = OLD."ID"; |
|
99 |
END; |
|
100 |
|
|
101 |
CREATE TRIGGER "rtree_test_Geometry_update3" AFTER UPDATE ON "test" |
|
102 |
WHEN OLD."ID" != NEW."ID" AND |
|
103 |
(NEW."Geometry" NOTNULL AND NOT ST_IsEmpty(NEW."Geometry")) |
|
104 |
BEGIN |
|
105 |
DELETE FROM "rtree_test_Geometry" WHERE ID = OLD."ID"; |
|
106 |
INSERT OR REPLACE INTO "rtree_test_Geometry" VALUES ( |
|
107 |
NEW."ID", |
|
108 |
ST_MinX(NEW."Geometry"), ST_MaxX(NEW."Geometry"), |
|
109 |
ST_MinY(NEW."Geometry"), ST_MaxY(NEW."Geometry") |
|
110 |
); |
|
111 |
END; |
|
112 |
|
|
113 |
CREATE TRIGGER "rtree_test_Geometry_update4" AFTER UPDATE ON "test" |
|
114 |
WHEN OLD."ID" != NEW."ID" AND |
|
115 |
(NEW."Geometry" ISNULL OR ST_IsEmpty(NEW."Geometry")) |
|
116 |
BEGIN |
|
117 |
DELETE FROM "rtree_test_Geometry" WHERE ID IN (OLD."ID", NEW."ID"); |
|
118 |
END; |
|
119 |
|
|
120 |
INSERT INTO "gpkg_extensions" ( |
|
121 |
"table_name", |
|
122 |
"column_name", |
|
123 |
"extension_name", |
|
124 |
"definition", |
|
125 |
"scope" |
|
126 |
) VALUES ( |
|
127 |
'test', |
|
128 |
'Geometry', |
|
129 |
'gpkg_rtree_index', |
|
130 |
'http://www.geopackage.org/spec/#extension_rtree', |
|
131 |
'read-write' |
|
132 |
); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/dropTable.sql | ||
---|---|---|
1 | 1 |
|
2 | 2 |
-- Count SQL |
3 |
DROP TABLE "PUBLIC"."test"; |
|
3 |
DELETE FROM gpkg_geometry_columns WHERE table_name = "test"; |
|
4 |
|
|
5 |
DELETE FROM "main"."gpkg_contents" WHERE "identifier" = 'test'; |
|
6 |
|
|
7 |
DELETE FROM "main"."gpkg_extensions" WHERE "table_name" = 'test'; |
|
8 |
|
|
9 |
DROP TABLE "test"; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/date.sql | ||
---|---|---|
3 | 3 |
|
4 | 4 |
-- Simple |
5 | 5 |
SELECT |
6 |
"PUBLIC"."test"."ID", "PUBLIC"."test"."Byte", "PUBLIC"."test"."Bool1", "PUBLIC"."test"."Long", |
|
7 |
"PUBLIC"."test"."Timestamp", "PUBLIC"."test"."Date", "PUBLIC"."test"."Time", "PUBLIC"."test"."Bool2", |
|
8 |
"PUBLIC"."test"."String", "PUBLIC"."test"."Bool3", "PUBLIC"."test"."Double", "PUBLIC"."test"."Bool4", |
|
9 |
"PUBLIC"."test"."Float", "PUBLIC"."test"."Bool5", "PUBLIC"."test"."Decimal", |
|
10 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL) |
|
11 |
FROM "PUBLIC"."test" |
|
6 |
"test"."ID", "test"."Byte", "test"."Bool1", "test"."Long", |
|
7 |
"test"."Timestamp", "test"."Date", "test"."Time", "test"."Bool2", |
|
8 |
"test"."String", "test"."Bool3", "test"."Double", "test"."Bool4", |
|
9 |
"test"."Float", "test"."Bool5", "test"."Decimal", "test"."Geometry" |
|
10 |
FROM "test" |
|
12 | 11 |
WHERE |
13 |
((("PUBLIC"."test"."Time" > TIME '01:02:03') AND ("PUBLIC"."test"."Time" < TIME '20:52:55')) OR
|
|
14 |
(("PUBLIC"."test"."Date" > DATE '2019-02-17') AND ("PUBLIC"."test"."Date" < DATE '2020-02-23')))
|
|
15 |
ORDER BY "PUBLIC"."test"."ID" ASC;
|
|
12 |
((("test"."Time" > ('01:02:03')) AND ("test"."Time" < ('20:52:55'))) OR
|
|
13 |
(("test"."Date" > ('2019-02-17')) AND ("test"."Date" < ('2020-02-23'))))
|
|
14 |
ORDER BY "test"."ID" ASC; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/resultSetForSetProvider.sql | ||
---|---|---|
8 | 8 |
-- trim-end true |
9 | 9 |
|
10 | 10 |
-- begin testSimple |
11 |
SELECT "PUBLIC"."test"."ID",
|
|
12 |
"PUBLIC"."test"."Byte",
|
|
13 |
"PUBLIC"."test"."Bool1",
|
|
14 |
"PUBLIC"."test"."Long",
|
|
15 |
"PUBLIC"."test"."Timestamp",
|
|
16 |
"PUBLIC"."test"."Date",
|
|
17 |
"PUBLIC"."test"."Time",
|
|
18 |
"PUBLIC"."test"."Bool2",
|
|
19 |
"PUBLIC"."test"."String",
|
|
20 |
"PUBLIC"."test"."Bool3",
|
|
21 |
"PUBLIC"."test"."Double",
|
|
22 |
"PUBLIC"."test"."Bool4",
|
|
23 |
"PUBLIC"."test"."Float",
|
|
24 |
"PUBLIC"."test"."Bool5",
|
|
25 |
"PUBLIC"."test"."Decimal",
|
|
26 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL)
|
|
27 |
FROM "PUBLIC"."test"
|
|
28 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
11 |
SELECT "test"."ID", |
|
12 |
"test"."Byte", |
|
13 |
"test"."Bool1", |
|
14 |
"test"."Long", |
|
15 |
"test"."Timestamp", |
|
16 |
"test"."Date", |
|
17 |
"test"."Time", |
|
18 |
"test"."Bool2", |
|
19 |
"test"."String", |
|
20 |
"test"."Bool3", |
|
21 |
"test"."Double", |
|
22 |
"test"."Bool4", |
|
23 |
"test"."Float", |
|
24 |
"test"."Bool5", |
|
25 |
"test"."Decimal", |
|
26 |
"test"."Geometry"
|
|
27 |
FROM "test" |
|
28 |
ORDER BY "test"."ID" ASC |
|
29 | 29 |
-- end testSimple |
30 | 30 |
|
31 | 31 |
-- begin testSimpleGroup |
32 |
SELECT MIN("PUBLIC"."test"."ID") AS "ID",
|
|
33 |
MAX("PUBLIC"."test"."Byte") AS "Byte",
|
|
32 |
SELECT MIN("test"."ID") AS "ID", |
|
33 |
MAX("test"."Byte") AS "Byte", |
|
34 | 34 |
NULL AS "Bool1", |
35 |
"PUBLIC"."test"."Long",
|
|
35 |
"test"."Long", |
|
36 | 36 |
NULL AS "Timestamp", |
37 | 37 |
NULL AS "Date", |
38 | 38 |
NULL AS "Time", |
39 | 39 |
NULL AS "Bool2", |
40 | 40 |
NULL AS "String", |
41 | 41 |
NULL AS "Bool3", |
42 |
SUM("PUBLIC"."test"."Double") AS "Double",
|
|
42 |
SUM("test"."Double") AS "Double", |
|
43 | 43 |
NULL AS "Bool4", |
44 | 44 |
NULL AS "Float", |
45 | 45 |
NULL AS "Bool5", |
46 | 46 |
NULL AS "Decimal", |
47 | 47 |
NULL AS "Geometry" |
48 |
FROM "PUBLIC"."test"
|
|
49 |
GROUP BY "PUBLIC"."test"."Long"
|
|
50 |
ORDER BY "PUBLIC"."test"."Long" ASC NULLS LAST
|
|
48 |
FROM "test" |
|
49 |
GROUP BY "test"."Long" |
|
50 |
ORDER BY "test"."Long" ASC NULLS LAST |
|
51 | 51 |
-- end testSimpleGroup |
52 | 52 |
|
53 | 53 |
-- begin testSubselect |
54 |
SELECT "PUBLIC"."test"."ID",
|
|
55 |
"PUBLIC"."test"."Byte",
|
|
56 |
"PUBLIC"."test"."Bool1",
|
|
57 |
"PUBLIC"."test"."Long",
|
|
58 |
"PUBLIC"."test"."Timestamp",
|
|
59 |
"PUBLIC"."test"."Date",
|
|
60 |
"PUBLIC"."test"."Time",
|
|
61 |
"PUBLIC"."test"."Bool2",
|
|
62 |
"PUBLIC"."test"."String",
|
|
63 |
"PUBLIC"."test"."Bool3",
|
|
64 |
"PUBLIC"."test"."Double",
|
|
65 |
"PUBLIC"."test"."Bool4",
|
|
66 |
"PUBLIC"."test"."Float",
|
|
67 |
"PUBLIC"."test"."Bool5",
|
|
68 |
"PUBLIC"."test"."Decimal",
|
|
69 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL),
|
|
70 |
NVL2(COALESCE(( SELECT "countries"."ISO_A2" FROM "countries" WHERE (("PUBLIC"."test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) LIMIT 1 )),TRUE,FALSE) AS "EXISTS62a964cd7bc24f409b97c03b9170408d"
|
|
71 |
FROM "PUBLIC"."test"
|
|
54 |
SELECT "test"."ID", |
|
55 |
"test"."Byte", |
|
56 |
"test"."Bool1", |
|
57 |
"test"."Long", |
|
58 |
"test"."Timestamp", |
|
59 |
"test"."Date", |
|
60 |
"test"."Time", |
|
61 |
"test"."Bool2", |
|
62 |
"test"."String", |
|
63 |
"test"."Bool3", |
|
64 |
"test"."Double", |
|
65 |
"test"."Bool4", |
|
66 |
"test"."Float", |
|
67 |
"test"."Bool5", |
|
68 |
"test"."Decimal", |
|
69 |
"test"."Geometry",
|
|
70 |
NVL2(COALESCE(( SELECT "countries"."ISO_A2" FROM "countries" WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) LIMIT 1 )),TRUE,FALSE) AS "EXISTS62a964cd7bc24f409b97c03b9170408d" |
|
71 |
FROM "test" |
|
72 | 72 |
WHERE NVL2(COALESCE(( SELECT "countries"."ISO_A2" |
73 | 73 |
FROM "countries" |
74 |
WHERE (("PUBLIC"."test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0))
|
|
74 |
WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) |
|
75 | 75 |
LIMIT 1 )),TRUE,FALSE) |
76 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
76 |
ORDER BY "test"."ID" ASC |
|
77 | 77 |
-- end testSubselect |
78 | 78 |
|
79 | 79 |
-- begin testSubselect2 |
80 |
SELECT "PUBLIC"."test"."ID",
|
|
81 |
"PUBLIC"."test"."Byte",
|
|
82 |
"PUBLIC"."test"."Bool1",
|
|
83 |
"PUBLIC"."test"."Long",
|
|
84 |
"PUBLIC"."test"."Timestamp",
|
|
85 |
"PUBLIC"."test"."Date",
|
|
86 |
"PUBLIC"."test"."Time",
|
|
87 |
"PUBLIC"."test"."Bool2",
|
|
88 |
"PUBLIC"."test"."String",
|
|
89 |
"PUBLIC"."test"."Bool3",
|
|
90 |
"PUBLIC"."test"."Double",
|
|
91 |
"PUBLIC"."test"."Bool4",
|
|
92 |
"PUBLIC"."test"."Float",
|
|
93 |
"PUBLIC"."test"."Bool5",
|
|
94 |
"PUBLIC"."test"."Decimal",
|
|
95 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL),
|
|
96 |
NVL2(COALESCE(( SELECT "PUBLIC"."test"."Long" FROM "countries" WHERE (("PUBLIC"."test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) LIMIT 1 )),TRUE,FALSE) AS "EXISTS62a964cd7bc24f409b97c03b9170408d"
|
|
97 |
FROM "PUBLIC"."test"
|
|
98 |
WHERE NVL2(COALESCE(( SELECT "PUBLIC"."test"."Long"
|
|
80 |
SELECT "test"."ID", |
|
81 |
"test"."Byte", |
|
82 |
"test"."Bool1", |
|
83 |
"test"."Long", |
|
84 |
"test"."Timestamp", |
|
85 |
"test"."Date", |
|
86 |
"test"."Time", |
|
87 |
"test"."Bool2", |
|
88 |
"test"."String", |
|
89 |
"test"."Bool3", |
|
90 |
"test"."Double", |
|
91 |
"test"."Bool4", |
|
92 |
"test"."Float", |
|
93 |
"test"."Bool5", |
|
94 |
"test"."Decimal", |
|
95 |
"test"."Geometry",
|
|
96 |
NVL2(COALESCE(( SELECT "test"."Long" FROM "countries" WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) LIMIT 1 )),TRUE,FALSE) AS "EXISTS62a964cd7bc24f409b97c03b9170408d"
|
|
97 |
FROM "test" |
|
98 |
WHERE NVL2(COALESCE(( SELECT "test"."Long" |
|
99 | 99 |
FROM "countries" |
100 |
WHERE (("PUBLIC"."test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0))
|
|
100 |
WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) |
|
101 | 101 |
LIMIT 1 )),TRUE,FALSE) |
102 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
102 |
ORDER BY "test"."ID" ASC |
|
103 | 103 |
-- end testSubselect2 |
104 | 104 |
|
105 | 105 |
-- begin testGroupAndSubselect |
106 |
SELECT MIN("PUBLIC"."test"."ID") AS "ID",
|
|
107 |
MAX("PUBLIC"."test"."Byte") AS "Byte",
|
|
106 |
SELECT MIN("test"."ID") AS "ID", |
|
107 |
MAX("test"."Byte") AS "Byte", |
|
108 | 108 |
NULL AS "Bool1", |
109 |
"PUBLIC"."test"."Long",
|
|
109 |
"test"."Long", |
|
110 | 110 |
NULL AS "Timestamp", |
111 | 111 |
NULL AS "Date", |
112 | 112 |
NULL AS "Time", |
113 | 113 |
NULL AS "Bool2", |
114 | 114 |
NULL AS "String", |
115 | 115 |
NULL AS "Bool3", |
116 |
SUM("PUBLIC"."test"."Double") AS "Double",
|
|
116 |
SUM("test"."Double") AS "Double", |
|
117 | 117 |
NULL AS "Bool4", |
118 | 118 |
NULL AS "Float", |
119 | 119 |
NULL AS "Bool5", |
120 | 120 |
NULL AS "Decimal", |
121 | 121 |
NULL AS "Geometry" |
122 |
FROM "PUBLIC"."test"
|
|
122 |
FROM "test" |
|
123 | 123 |
WHERE NVL2(COALESCE(( SELECT "countries"."ISO_A2" |
124 | 124 |
FROM "countries" |
125 |
WHERE (("PUBLIC"."test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0))
|
|
125 |
WHERE (("test"."STRING" = "countries"."CONTINENT") AND ("countries"."LASTCENSUS" < 0)) |
|
126 | 126 |
LIMIT 1 )),TRUE,FALSE) |
127 |
GROUP BY "PUBLIC"."test"."Long"
|
|
128 |
ORDER BY "PUBLIC"."test"."Long" ASC NULLS LAST
|
|
127 |
GROUP BY "test"."Long" |
|
128 |
ORDER BY "test"."Long" ASC NULLS LAST |
|
129 | 129 |
-- end testGroupAndSubselect |
130 | 130 |
|
131 | 131 |
-- begin testConstantColumnPrimaryKey |
132 |
SELECT "PUBLIC"."test"."ID",
|
|
133 |
"PUBLIC"."test"."Byte",
|
|
134 |
"PUBLIC"."test"."Bool1",
|
|
135 |
"PUBLIC"."test"."Long",
|
|
136 |
"PUBLIC"."test"."Timestamp",
|
|
137 |
"PUBLIC"."test"."Date",
|
|
138 |
"PUBLIC"."test"."Time",
|
|
139 |
"PUBLIC"."test"."Bool2",
|
|
140 |
"PUBLIC"."test"."String",
|
|
141 |
"PUBLIC"."test"."Bool3",
|
|
142 |
"PUBLIC"."test"."Double",
|
|
143 |
"PUBLIC"."test"."Bool4",
|
|
144 |
"PUBLIC"."test"."Float",
|
|
145 |
"PUBLIC"."test"."Bool5",
|
|
146 |
"PUBLIC"."test"."Decimal",
|
|
147 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL)
|
|
148 |
FROM "PUBLIC"."test"
|
|
149 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
132 |
SELECT "test"."ID", |
|
133 |
"test"."Byte", |
|
134 |
"test"."Bool1", |
|
135 |
"test"."Long", |
|
136 |
"test"."Timestamp", |
|
137 |
"test"."Date", |
|
138 |
"test"."Time", |
|
139 |
"test"."Bool2", |
|
140 |
"test"."String", |
|
141 |
"test"."Bool3", |
|
142 |
"test"."Double", |
|
143 |
"test"."Bool4", |
|
144 |
"test"."Float", |
|
145 |
"test"."Bool5", |
|
146 |
"test"."Decimal", |
|
147 |
"test"."Geometry"
|
|
148 |
FROM "test" |
|
149 |
ORDER BY "test"."ID" ASC |
|
150 | 150 |
-- end testConstantColumnPrimaryKey |
151 | 151 |
|
152 | 152 |
-- begin testComputedAttribute |
153 |
SELECT "PUBLIC"."test"."ID",
|
|
154 |
"PUBLIC"."test"."Byte",
|
|
155 |
"PUBLIC"."test"."Bool1",
|
|
156 |
"PUBLIC"."test"."Long",
|
|
157 |
"PUBLIC"."test"."Timestamp",
|
|
158 |
"PUBLIC"."test"."Date",
|
|
159 |
"PUBLIC"."test"."Time",
|
|
160 |
"PUBLIC"."test"."Bool2",
|
|
161 |
"PUBLIC"."test"."String",
|
|
162 |
"PUBLIC"."test"."Bool3",
|
|
163 |
"PUBLIC"."test"."Double",
|
|
164 |
"PUBLIC"."test"."Bool4",
|
|
165 |
"PUBLIC"."test"."Float",
|
|
166 |
"PUBLIC"."test"."Bool5",
|
|
167 |
"PUBLIC"."test"."Decimal",
|
|
168 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL),
|
|
169 |
("PUBLIC"."test"."ID" * 2) AS "Compu1"
|
|
170 |
FROM "PUBLIC"."test"
|
|
171 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
153 |
SELECT "test"."ID", |
|
154 |
"test"."Byte", |
|
155 |
"test"."Bool1", |
|
156 |
"test"."Long", |
|
157 |
"test"."Timestamp", |
|
158 |
"test"."Date", |
|
159 |
"test"."Time", |
|
160 |
"test"."Bool2", |
|
161 |
"test"."String", |
|
162 |
"test"."Bool3", |
|
163 |
"test"."Double", |
|
164 |
"test"."Bool4", |
|
165 |
"test"."Float", |
|
166 |
"test"."Bool5", |
|
167 |
"test"."Decimal", |
|
168 |
"test"."Geometry",
|
|
169 |
("test"."ID" * 2) AS "Compu1" |
|
170 |
FROM "test" |
|
171 |
ORDER BY "test"."ID" ASC |
|
172 | 172 |
-- end testComputedAttribute |
173 | 173 |
|
174 | 174 |
-- begin testComputedAttribute2 |
175 |
SELECT "PUBLIC"."test"."ID",
|
|
176 |
"PUBLIC"."test"."Byte",
|
|
177 |
"PUBLIC"."test"."Bool1",
|
|
178 |
"PUBLIC"."test"."Long",
|
|
179 |
"PUBLIC"."test"."Timestamp",
|
|
180 |
"PUBLIC"."test"."Date",
|
|
181 |
"PUBLIC"."test"."Time",
|
|
182 |
"PUBLIC"."test"."Bool2",
|
|
183 |
"PUBLIC"."test"."String",
|
|
184 |
"PUBLIC"."test"."Bool3",
|
|
185 |
"PUBLIC"."test"."Double",
|
|
186 |
"PUBLIC"."test"."Bool4",
|
|
187 |
"PUBLIC"."test"."Float",
|
|
188 |
"PUBLIC"."test"."Bool5",
|
|
189 |
"PUBLIC"."test"."Decimal",
|
|
190 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL),
|
|
191 |
("PUBLIC"."test"."ID" * 2) AS "Compu1",
|
|
192 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) AS "Compu2"
|
|
193 |
FROM "PUBLIC"."test"
|
|
194 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
175 |
SELECT "test"."ID", |
|
176 |
"test"."Byte", |
|
177 |
"test"."Bool1", |
|
178 |
"test"."Long", |
|
179 |
"test"."Timestamp", |
|
180 |
"test"."Date", |
|
181 |
"test"."Time", |
|
182 |
"test"."Bool2", |
|
183 |
"test"."String", |
|
184 |
"test"."Bool3", |
|
185 |
"test"."Double", |
|
186 |
"test"."Bool4", |
|
187 |
"test"."Float", |
|
188 |
"test"."Bool5", |
|
189 |
"test"."Decimal", |
|
190 |
"test"."Geometry",
|
|
191 |
("test"."ID" * 2) AS "Compu1", |
|
192 |
(("test"."Long" + 10) + ("test"."ID" * 2)) AS "Compu2"
|
|
193 |
FROM "test" |
|
194 |
ORDER BY "test"."ID" ASC |
|
195 | 195 |
-- end testComputedAttribute2 |
196 | 196 |
|
197 | 197 |
-- begin testComputedExtraColumn |
198 |
SELECT "PUBLIC"."test"."ID",
|
|
199 |
"PUBLIC"."test"."Byte",
|
|
200 |
"PUBLIC"."test"."Bool1",
|
|
201 |
"PUBLIC"."test"."Long",
|
|
202 |
"PUBLIC"."test"."Timestamp",
|
|
203 |
"PUBLIC"."test"."Date",
|
|
204 |
"PUBLIC"."test"."Time",
|
|
205 |
"PUBLIC"."test"."Bool2",
|
|
206 |
"PUBLIC"."test"."String",
|
|
207 |
"PUBLIC"."test"."Bool3",
|
|
208 |
"PUBLIC"."test"."Double",
|
|
209 |
"PUBLIC"."test"."Bool4",
|
|
210 |
"PUBLIC"."test"."Float",
|
|
211 |
"PUBLIC"."test"."Bool5",
|
|
212 |
"PUBLIC"."test"."Decimal",
|
|
213 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL),
|
|
214 |
("PUBLIC"."test"."ID" * 2) AS "Compu1",
|
|
215 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) AS "Extra1"
|
|
216 |
FROM "PUBLIC"."test"
|
|
217 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
198 |
SELECT "test"."ID", |
|
199 |
"test"."Byte", |
|
200 |
"test"."Bool1", |
|
201 |
"test"."Long", |
|
202 |
"test"."Timestamp", |
|
203 |
"test"."Date", |
|
204 |
"test"."Time", |
|
205 |
"test"."Bool2", |
|
206 |
"test"."String", |
|
207 |
"test"."Bool3", |
|
208 |
"test"."Double", |
|
209 |
"test"."Bool4", |
|
210 |
"test"."Float", |
|
211 |
"test"."Bool5", |
|
212 |
"test"."Decimal", |
|
213 |
"test"."Geometry",
|
|
214 |
("test"."ID" * 2) AS "Compu1", |
|
215 |
(("test"."Long" + 10) + ("test"."ID" * 2)) AS "Extra1"
|
|
216 |
FROM "test" |
|
217 |
ORDER BY "test"."ID" ASC |
|
218 | 218 |
-- end testComputedExtraColumn |
219 | 219 |
|
220 | 220 |
-- begin testComputedExtraColumn2 |
221 |
SELECT "PUBLIC"."test"."ID",
|
|
222 |
"PUBLIC"."test"."Byte",
|
|
223 |
"PUBLIC"."test"."Bool1",
|
|
224 |
"PUBLIC"."test"."Long",
|
|
225 |
"PUBLIC"."test"."Timestamp",
|
|
226 |
"PUBLIC"."test"."Date",
|
|
227 |
"PUBLIC"."test"."Time",
|
|
228 |
"PUBLIC"."test"."Bool2",
|
|
229 |
"PUBLIC"."test"."String",
|
|
230 |
"PUBLIC"."test"."Bool3",
|
|
231 |
"PUBLIC"."test"."Double",
|
|
232 |
"PUBLIC"."test"."Bool4",
|
|
233 |
"PUBLIC"."test"."Float",
|
|
234 |
"PUBLIC"."test"."Bool5",
|
|
235 |
"PUBLIC"."test"."Decimal",
|
|
236 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL),
|
|
237 |
("PUBLIC"."test"."ID" * 2) AS "Extra1",
|
|
238 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) AS "Extra2"
|
|
239 |
FROM "PUBLIC"."test"
|
|
240 |
ORDER BY "PUBLIC"."test"."ID" ASC
|
|
221 |
SELECT "test"."ID", |
|
222 |
"test"."Byte", |
|
223 |
"test"."Bool1", |
|
224 |
"test"."Long", |
|
225 |
"test"."Timestamp", |
|
226 |
"test"."Date", |
|
227 |
"test"."Time", |
|
228 |
"test"."Bool2", |
|
229 |
"test"."String", |
|
230 |
"test"."Bool3", |
|
231 |
"test"."Double", |
|
232 |
"test"."Bool4", |
|
233 |
"test"."Float", |
|
234 |
"test"."Bool5", |
|
235 |
"test"."Decimal", |
|
236 |
"test"."Geometry",
|
|
237 |
("test"."ID" * 2) AS "Extra1", |
|
238 |
(("test"."Long" + 10) + ("test"."ID" * 2)) AS "Extra2"
|
|
239 |
FROM "test" |
|
240 |
ORDER BY "test"."ID" ASC |
|
241 | 241 |
-- end testComputedExtraColumn2 |
242 | 242 |
|
243 | 243 |
-- begin testComputedExtraColumnWithWhere |
244 |
SELECT "PUBLIC"."test"."ID",
|
|
245 |
"PUBLIC"."test"."Byte",
|
|
246 |
"PUBLIC"."test"."Bool1",
|
|
247 |
"PUBLIC"."test"."Long",
|
|
248 |
"PUBLIC"."test"."Timestamp",
|
|
249 |
"PUBLIC"."test"."Date",
|
|
250 |
"PUBLIC"."test"."Time",
|
|
251 |
"PUBLIC"."test"."Bool2",
|
|
252 |
"PUBLIC"."test"."String",
|
|
253 |
"PUBLIC"."test"."Bool3",
|
|
254 |
"PUBLIC"."test"."Double",
|
|
255 |
"PUBLIC"."test"."Bool4",
|
|
256 |
"PUBLIC"."test"."Float",
|
|
257 |
"PUBLIC"."test"."Bool5",
|
|
258 |
"PUBLIC"."test"."Decimal",
|
|
259 |
NVL2("PUBLIC"."test"."Geometry",ST_AsBinary("PUBLIC"."test"."Geometry"),NULL),
|
|
260 |
("PUBLIC"."test"."ID" * 2) AS "Compu1",
|
|
261 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) AS "Extra1"
|
|
262 |
FROM "PUBLIC"."test"
|
|
263 |
WHERE ((("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) > 10)
|
|
244 |
SELECT "test"."ID", |
|
245 |
"test"."Byte", |
|
246 |
"test"."Bool1", |
|
247 |
"test"."Long", |
|
248 |
"test"."Timestamp", |
|
249 |
"test"."Date", |
|
250 |
"test"."Time", |
|
251 |
"test"."Bool2", |
|
252 |
"test"."String", |
|
253 |
"test"."Bool3", |
|
254 |
"test"."Double", |
|
255 |
"test"."Bool4", |
|
256 |
"test"."Float", |
|
257 |
"test"."Bool5", |
|
258 |
"test"."Decimal", |
|
259 |
"test"."Geometry",
|
|
260 |
("test"."ID" * 2) AS "Compu1", |
|
261 |
(("test"."Long" + 10) + ("test"."ID" * 2)) AS "Extra1"
|
|
262 |
FROM "test" |
|
263 |
WHERE ((("test"."Long" + 10) + ("test"."ID" * 2)) > 10)
|
|
264 | 264 |
ORDER BY "Extra1" ASC NULLS LAST, |
265 |
"PUBLIC"."test"."ID" ASC
|
|
265 |
"test"."ID" ASC |
|
266 | 266 |
-- end testComputedExtraColumnWithWhere |
267 | 267 |
|
268 | 268 |
-- begin testGroupByComputed |
269 |
SELECT MIN("PUBLIC"."test"."ID") AS "ID",
|
|
270 |
MAX("PUBLIC"."test"."Byte") AS "Byte",
|
|
269 |
SELECT MIN("test"."ID") AS "ID", |
|
270 |
MAX("test"."Byte") AS "Byte", |
|
271 | 271 |
NULL AS "Bool1", |
272 |
"PUBLIC"."test"."Long",
|
|
272 |
"test"."Long", |
|
273 | 273 |
NULL AS "Timestamp", |
274 | 274 |
NULL AS "Date", |
275 | 275 |
NULL AS "Time", |
276 | 276 |
NULL AS "Bool2", |
277 | 277 |
NULL AS "String", |
278 | 278 |
NULL AS "Bool3", |
279 |
SUM("PUBLIC"."test"."Double") AS "Double",
|
|
279 |
SUM("test"."Double") AS "Double", |
|
280 | 280 |
NULL AS "Bool4", |
281 | 281 |
NULL AS "Float", |
282 | 282 |
NULL AS "Bool5", |
283 | 283 |
NULL AS "Decimal", |
284 | 284 |
NULL AS "Geometry", |
285 |
("PUBLIC"."test"."ID" * 2) AS "Compu1",
|
|
286 |
SUM(("PUBLIC"."test"."Long" + 300)) AS "Compu2",
|
|
285 |
("test"."ID" * 2) AS "Compu1", |
|
286 |
SUM(("test"."Long" + 300)) AS "Compu2", |
|
287 | 287 |
SUM(1) AS "Compu3", |
288 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) AS "Extra1",
|
|
289 |
SUM(((20 + "PUBLIC"."test"."Byte") + ("PUBLIC"."test"."ID" * 2))) AS "Extra2"
|
|
290 |
FROM "PUBLIC"."test"
|
|
291 |
GROUP BY "PUBLIC"."test"."Long",
|
|
292 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)),
|
|
293 |
("PUBLIC"."test"."ID" * 2)
|
|
294 |
ORDER BY "PUBLIC"."test"."Long" ASC NULLS LAST,
|
|
295 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) ASC NULLS LAST,
|
|
296 |
("PUBLIC"."test"."ID" * 2) ASC NULLS LAST
|
|
288 |
(("test"."Long" + 10) + ("test"."ID" * 2)) AS "Extra1",
|
|
289 |
SUM(((20 + "test"."Byte") + ("test"."ID" * 2))) AS "Extra2"
|
|
290 |
FROM "test" |
|
291 |
GROUP BY "test"."Long", |
|
292 |
(("test"."Long" + 10) + ("test"."ID" * 2)),
|
|
293 |
("test"."ID" * 2) |
|
294 |
ORDER BY "test"."Long" ASC NULLS LAST, |
|
295 |
(("test"."Long" + 10) + ("test"."ID" * 2)) ASC NULLS LAST,
|
|
296 |
("test"."ID" * 2) ASC NULLS LAST |
|
297 | 297 |
-- end testGroupByComputed |
298 | 298 |
|
299 | 299 |
-- begin testGroupByAndOrderByComputed |
300 |
SELECT MIN("PUBLIC"."test"."ID") AS "ID",
|
|
301 |
MAX("PUBLIC"."test"."Byte") AS "Byte",
|
|
300 |
SELECT MIN("test"."ID") AS "ID", |
|
301 |
MAX("test"."Byte") AS "Byte", |
|
302 | 302 |
NULL AS "Bool1", |
303 |
"PUBLIC"."test"."Long",
|
|
303 |
"test"."Long", |
|
304 | 304 |
NULL AS "Timestamp", |
305 | 305 |
NULL AS "Date", |
306 | 306 |
NULL AS "Time", |
307 | 307 |
NULL AS "Bool2", |
308 | 308 |
NULL AS "String", |
309 | 309 |
NULL AS "Bool3", |
310 |
SUM("PUBLIC"."test"."Double") AS "Double",
|
|
310 |
SUM("test"."Double") AS "Double", |
|
311 | 311 |
NULL AS "Bool4", |
312 | 312 |
NULL AS "Float", |
313 | 313 |
NULL AS "Bool5", |
314 | 314 |
NULL AS "Decimal", |
315 | 315 |
NULL AS "Geometry", |
316 |
("PUBLIC"."test"."ID" * 2) AS "Compu1",
|
|
317 |
SUM(("PUBLIC"."test"."Long" + 300)) AS "Compu2",
|
|
316 |
("test"."ID" * 2) AS "Compu1", |
|
317 |
SUM(("test"."Long" + 300)) AS "Compu2", |
|
318 | 318 |
SUM(1) AS "Compu3", |
319 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)) AS "Extra1",
|
|
320 |
SUM(((20 + "PUBLIC"."test"."Byte") + ("PUBLIC"."test"."ID" * 2))) AS "Extra2",
|
|
319 |
(("test"."Long" + 10) + ("test"."ID" * 2)) AS "Extra1",
|
|
320 |
SUM(((20 + "test"."Byte") + ("test"."ID" * 2))) AS "Extra2",
|
|
321 | 321 |
NULL AS "Extra3" |
322 |
FROM "PUBLIC"."test"
|
|
323 |
GROUP BY "PUBLIC"."test"."Long",
|
|
324 |
(("PUBLIC"."test"."Long" + 10) + ("PUBLIC"."test"."ID" * 2)),
|
|
325 |
("PUBLIC"."test"."ID" * 2)
|
|
322 |
FROM "test" |
|
323 |
GROUP BY "test"."Long", |
|
324 |
(("test"."Long" + 10) + ("test"."ID" * 2)),
|
|
325 |
("test"."ID" * 2) |
|
326 | 326 |
ORDER BY (("Long" + 10) + ("ID" * 2)) ASC NULLS LAST, |
327 | 327 |
SUM(((20 + "Byte") + ("ID" * 2))) ASC NULLS LAST |
328 | 328 |
-- end testGroupByAndOrderByComputed |
329 | 329 |
|
330 | 330 |
-- begin testSimpleAggregateAndOrder |
331 |
SELECT MIN("PUBLIC"."test"."ID") AS "ID",
|
|
332 |
MAX("PUBLIC"."test"."Byte") AS "Byte",
|
|
331 |
SELECT MIN("test"."ID") AS "ID", |
|
332 |
MAX("test"."Byte") AS "Byte", |
|
333 | 333 |
NULL AS "Bool1", |
334 | 334 |
NULL AS "Long", |
335 | 335 |
NULL AS "Timestamp", |
... | ... | |
338 | 338 |
NULL AS "Bool2", |
339 | 339 |
NULL AS "String", |
340 | 340 |
NULL AS "Bool3", |
341 |
SUM("PUBLIC"."test"."Double") AS "Double",
|
|
341 |
SUM("test"."Double") AS "Double", |
|
342 | 342 |
NULL AS "Bool4", |
343 | 343 |
NULL AS "Float", |
344 | 344 |
NULL AS "Bool5", |
345 | 345 |
NULL AS "Decimal", |
346 | 346 |
NULL AS "Geometry", |
347 |
SUM(("PUBLIC"."test"."Long" + 10)) AS "Extra1",
|
|
347 |
SUM(("test"."Long" + 10)) AS "Extra1", |
|
348 | 348 |
NULL AS "Extra2" |
349 |
FROM "PUBLIC"."test"
|
|
350 |
ORDER BY MIN("PUBLIC"."test"."ID") ASC,
|
|
349 |
FROM "test" |
|
350 |
ORDER BY MIN("test"."ID") ASC, |
|
351 | 351 |
SUM(("Long" + 10)) ASC NULLS LAST |
352 | 352 |
-- end testSimpleAggregateAndOrder |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/resources/org/gvsig/sqlite/dal/count.sql | ||
---|---|---|
6 | 6 |
-- trim-end true |
7 | 7 |
|
8 | 8 |
-- begin count |
9 |
SELECT COUNT(*) FROM "PUBLIC"."test"
|
|
9 |
SELECT COUNT(*) FROM "test" |
|
10 | 10 |
-- end count |
11 | 11 |
|
12 | 12 |
-- begin testAggregatesAndGroup |
13 | 13 |
-- rem Count with aggregates and group SQL |
14 | 14 |
SELECT COUNT(*) |
15 |
FROM ( SELECT MAX("PUBLIC"."test"."Byte") AS "Byte",
|
|
16 |
MIN("PUBLIC"."test"."ID") AS "ID",
|
|
17 |
SUM("PUBLIC"."test"."Double") AS "Double"
|
|
18 |
FROM "PUBLIC"."test"
|
|
19 |
GROUP BY "PUBLIC"."test"."Long") AS _subquery_alias_
|
|
15 |
FROM ( SELECT MAX("test"."Byte") AS "Byte", |
|
16 |
MIN("test"."ID") AS "ID", |
|
17 |
SUM("test"."Double") AS "Double" |
|
18 |
FROM "test" |
|
19 |
GROUP BY "test"."Long") AS _subquery_alias_ |
|
20 | 20 |
-- end testAggregatesAndGroup |
21 | 21 |
|
22 | 22 |
-- begin testGroup |
23 | 23 |
-- rem Count with group SQL |
24 | 24 |
SELECT COUNT(*) |
25 |
FROM ( SELECT "PUBLIC"."test"."Long"
|
|
26 |
FROM "PUBLIC"."test"
|
|
27 |
GROUP BY "PUBLIC"."test"."Long") AS _subquery_alias_
|
|
25 |
FROM ( SELECT "test"."Long" |
|
26 |
FROM "test" |
|
27 |
GROUP BY "test"."Long") AS _subquery_alias_ |
|
28 | 28 |
-- end testGroup |
29 | 29 |
|
30 | 30 |
-- begin testAggregates |
31 | 31 |
-- rem Count with aggregates |
32 | 32 |
SELECT COUNT(*) |
33 |
FROM ( SELECT MAX("PUBLIC"."test"."Byte") AS "Byte",
|
|
34 |
MIN("PUBLIC"."test"."ID") AS "ID",
|
|
35 |
SUM("PUBLIC"."test"."Double") AS "Double"
|
|
36 |
FROM "PUBLIC"."test") AS _subquery_alias_
|
|
33 |
FROM ( SELECT MAX("test"."Byte") AS "Byte", |
|
34 |
MIN("test"."ID") AS "ID", |
|
35 |
SUM("test"."Double") AS "Double" |
|
36 |
FROM "test") AS _subquery_alias_ |
|
37 | 37 |
-- end testAggregates |
38 | 38 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/java/org/gvsig/sqlite/dal/RunSQL.java | ||
---|---|---|
1 |
package org.gvsig.sqlite.dal; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.sql.Connection; |
|
5 |
import java.sql.ResultSet; |
|
6 |
import java.sql.ResultSetMetaData; |
|
7 |
import java.sql.SQLException; |
|
8 |
import java.sql.Statement; |
|
9 |
import java.util.ArrayList; |
|
10 |
import java.util.List; |
|
11 |
import java.util.Objects; |
|
12 |
import org.apache.commons.io.FilenameUtils; |
|
13 |
import org.apache.commons.lang3.StringUtils; |
|
14 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_CONFIGURATION_NAME; |
|
15 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_CONFIGURATION_VALUE; |
|
16 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_RESOURCES_NAME; |
|
17 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.FIELD_RESOURCES_RESOURCE; |
|
18 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_CONFIGURATION_NAME; |
|
19 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_RESOURCES_NAME; |
|
20 |
import org.gvsig.fmap.dal.store.jdbc.exception.JDBCDriverClassNotFoundException; |
|
21 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCUtils; |
|
22 |
import org.gvsig.sqlite.dal.functions.Functions; |
|
23 |
import org.gvsig.sqlite.dal.geopackage.GeopackageUtils; |
|
24 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
|
25 |
import org.slf4j.Logger; |
|
26 |
import org.slf4j.LoggerFactory; |
|
27 |
import org.sqlite.SQLiteConfig; |
|
28 |
import org.sqlite.SQLiteConnection; |
|
29 |
import org.sqlite.SQLiteOpenMode; |
|
30 |
|
|
31 |
public class RunSQL { |
|
32 |
|
|
33 |
private static final Logger LOGGER = LoggerFactory.getLogger(RunSQL.class); |
|
34 |
|
|
35 |
public static final String DBNAME = "testCreate"; |
|
36 |
|
|
37 |
public static void main(String[] args) throws Exception { |
|
38 |
new DefaultLibrariesInitializer().fullInitialize(); |
|
39 |
|
|
40 |
//Modificar estas tres l?neas para cada test |
|
41 |
//Test date |
|
42 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\" FROM \"test\" WHERE (((\"test\".\"Time\" > ('01:02:03')) AND (\"test\".\"Time\" < ('20:52:55'))) OR ((\"test\".\"Date\" > ('2019-08-01')) AND (\"test\".\"Date\" < ('2020-02-23')))) ORDER BY \"test\".\"ID\" ASC"; |
|
43 |
|
|
44 |
//Test drop table (Sin ejecutar) |
|
45 |
// String sql = "DELETE FROM gpkg_geometry_columns WHERE table_name = \"test\""; |
|
46 |
// String sql = "DELETE FROM \"main\".\"gpkg_contents\" WHERE \"identifier\" = 'test'"; |
|
47 |
// String sql = "DELETE FROM \"main\".\"gpkg_extensions\" WHERE \"table_name\" = 'test'"; |
|
48 |
// String sql = "DROP TABLE \"test\""; |
|
49 |
|
|
50 |
//Test fetch feature type by reference |
|
51 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\" FROM \"test\" WHERE ( (\"test\".\"ID\") = (4) ) LIMIT 1"; |
|
52 |
|
|
53 |
//FetchFeatureType first row SQL |
|
54 |
// String sql = "SELECT * FROM \"test\" LIMIT 0"; |
|
55 |
|
|
56 |
//Test fetch feature type (CHUNGO REVISAR) |
|
57 |
// String sql = "SELECT \n" + |
|
58 |
// " \"COLUMN_NAME\", \"CONSTRAINT_TYPE\" \n" + |
|
59 |
// "FROM INFORMATION_SCHEMA.table_constraints t_cons inner join INFORMATION_SCHEMA.key_column_usage c on c.constraint_catalog = t_cons.constraint_catalog and c.table_schema = t_cons.table_schema and c.table_name = t_cons.table_name and c.constraint_name = t_cons.constraint_name \n" + |
|
60 |
// "WHERE (( (c.TABLE_NAME) LIKE ('test') ) AND ( (\"CONSTRAINT_TYPE\") = ('PRIMARY KEY') ))"; |
|
61 |
|
|
62 |
|
|
63 |
//Test Subselect (CHUNGO REVISAR) |
|
64 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", " |
|
65 |
// + "\"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", " |
|
66 |
// + "\"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", " |
|
67 |
// + "\"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", " |
|
68 |
// + "EXISTS(( SELECT \"countries\".\"ISO_A2\" " |
|
69 |
// + "FROM \"countries\" " |
|
70 |
// + "WHERE ((\"test\".\"STRING\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)) LIMIT 1 )) AS \"EXISTS62a964cd7bc24f409b97c03b9170408d\" " |
|
71 |
// + "FROM \"test\" " |
|
72 |
// + "WHERE EXISTS(( SELECT \"countries\".\"ISO_A2\" " |
|
73 |
// + "FROM \"countries\" " |
|
74 |
// + "WHERE ((\"test\".\"STRING\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)) LIMIT 1 )) " |
|
75 |
// + "ORDER BY \"test\".\"ID\" ASC"; |
|
76 |
|
|
77 |
|
|
78 |
//Test STDistance (He a?adido la funcion ST_DISTANCE) |
|
79 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\" FROM \"test\" WHERE ( ((\"ID\" IN (SELECT \"rtree_test_Geometry\".\"id\" FROM \"rtree_test_Geometry\" WHERE \"rtree_test_Geometry\".\"minx\" <= (1.0) AND \"rtree_test_Geometry\".\"miny\" <= (41.0) AND \"rtree_test_Geometry\".\"maxx\" >= (-1.0) AND \"rtree_test_Geometry\".\"maxy\" >= (39.0)))) AND ST_Intersects((ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326)),(\"test\".\"Geometry\") )) ORDER BY ST_Distance(ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326), \"Geometry\") ASC NULLS LAST, \"test\".\"ID\" ASC LIMIT 1"; |
|
80 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\" FROM \"test\" WHERE ST_Intersects((ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326)),(\"test\".\"Geometry\")) ORDER BY ST_Distance(ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326), \"Geometry\") ASC NULLS LAST, \"test\".\"ID\" ASC LIMIT 1"; |
|
81 |
|
|
82 |
//Test Perform changes |
|
83 |
// List<String> sqls = new ArrayList(); |
|
84 |
//###### SQL[insert]: |
|
85 |
// sqls.add("INSERT INTO \"test\" ( \"ID\", \"Byte\", \"Bool1\", \"Long\", \"Timestamp\", \"Date\", \"Time\", \"Bool2\", \"String\", \"Bool3\", \"Double\", \"Bool4\", \"Float\", \"Bool5\", \"Decimal\", \"Geometry\" ) VALUES ( 30, 30, TRUE, 30000, CURRENT_TIMESTAMP, CURRENT_DATE, CURRENT_TIME, TRUE, 'Treinta', FALSE, 30.3030, TRUE, 30.3030, TRUE, 30.303, ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326) )"); |
|
86 |
//###### SQL[delete]: |
|
87 |
// sqls.add("DELETE FROM \"test\" WHERE ( (\"ID\") = (30) )"); |
|
88 |
//###### SQL[update]: |
|
89 |
// sqls.add("UPDATE \"test\" SET \"Byte\" = 31, \"Bool1\" = FALSE, \"Long\" = 313131, \"Timestamp\" = CURRENT_TIMESTAMP, \"Date\" = CURRENT_DATE, \"Time\" = CURRENT_TIME, \"Bool2\" = FALSE, \"String\" = 'Treinta y uno', \"Bool3\" = FALSE, \"Double\" = 31.3131, \"Bool4\" = FALSE, \"Float\" = 31.3131, \"Bool5\" = FALSE, \"Decimal\" = 31.313, \"Geometry\" = ST_GeomFromWKB((X'000000000300000001000000213ff000000000000040440000000000003fef6297cff75cb04043e70747c3965a3fed906bcf328d464043cf043ab2a2ad3fea9b66290ea1a34043b8e31319465d3fe6a09e667f3bcd4043a57d866603113fe1c73b39ae68c940439592675bc5793fd87de2a6aea964404389be50c335cb3fc8f8b83c69a60d40438275a0c0228d3c91a62633145c074043800000000000bfc8f8b83c69a60840438275a0c0228dbfd87de2a6aea962404389be50c335cbbfe1c73b39ae68c640439592675bc579bfe6a09e667f3bcc4043a57d86660311bfea9b66290ea1a44043b8e31319465dbfed906bcf328d474043cf043ab2a2adbfef6297cff75cb14043e70747c3965abff00000000000004044000000000000bfef6297cff75cae404418f8b83c69a6bfed906bcf328d42404430fbc54d5d53bfea9b66290ea19c4044471cece6b9a3bfe6a09e667f3bc240445a827999fcefbfe1c73b39ae68bb40446a6d98a43a87bfd87de2a6aea94140447641af3cca35bfc8f8b83c69a5bb40447d8a5f3fdd733ce6586c6b36175f40448000000000003fc8f8b83c69a66a40447d8a5f3fdd733fd87de2a6aea99340447641af3cca353fe1c73b39ae68e040446a6d98a43a863fe6a09e667f3be240445a827999fcef3fea9b66290ea1b54044471cece6b9a33fed906bcf328d53404430fbc54d5d523fef6297cff75cb7404418f8b83c69a53ff00000000000004044000000000000'), 4326) WHERE ( (\"ID\") = (30) )"); |
|
90 |
//###### SQL[updatetable 0]: |
|
91 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Byte10\" TINYINT DEFAULT NULL NULL"); |
|
92 |
// //###### SQL[updatetable 1]: |
|
93 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Bool101\" BOOLEAN DEFAULT NULL NULL"); |
|
94 |
// //###### SQL[updatetable 2]: |
|
95 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Long10\" BIGINT DEFAULT NULL NULL"); |
|
96 |
// //###### SQL[updatetable 3]: |
|
97 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Timestamp10\" DATETIME DEFAULT NULL NULL"); |
|
98 |
// //###### SQL[updatetable 4]: |
|
99 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Date10\" DATE DEFAULT NULL NULL"); |
|
100 |
// //###### SQL[updatetable 5]: |
|
101 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Time10\" TIME DEFAULT NULL NULL"); |
|
102 |
// //###### SQL[updatetable 6]: |
|
103 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Bool102\" BOOLEAN DEFAULT NULL NULL"); |
|
104 |
// //###### SQL[updatetable 7]: |
|
105 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"String10\" VARCHAR(30) DEFAULT NULL NULL"); |
|
106 |
// //###### SQL[updatetable 8]: |
|
107 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Bool103\" BOOLEAN DEFAULT NULL NULL"); |
|
108 |
// //###### SQL[updatetable 9]: |
|
109 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Double10\" DOUBLE PRECISION DEFAULT NULL NULL"); |
|
110 |
// //###### SQL[updatetable 10]: |
|
111 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Bool104\" BOOLEAN DEFAULT NULL NULL"); |
|
112 |
// //###### SQL[updatetable 11]: |
|
113 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Float10\" FLOAT DEFAULT NULL NULL"); |
|
114 |
// //###### SQL[updatetable 12]: |
|
115 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Bool105\" BOOLEAN DEFAULT NULL NULL"); |
|
116 |
// //###### SQL[updatetable 13]: |
|
117 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Decimal10\" DECIMAL(6,3) DEFAULT NULL NULL"); |
|
118 |
// //###### SQL[updatetable 14]: |
|
119 |
// sqls.add("ALTER TABLE \"test\" ADD COLUMN \"Geometry10\" BLOB DEFAULT NULL NULL"); |
|
120 |
// |
|
121 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Byte10\""); |
|
122 |
// //###### SQL[updatetable 1]: |
|
123 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Bool101\""); |
|
124 |
// //###### SQL[updatetable 2]: |
|
125 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Long10\""); |
|
126 |
// //###### SQL[updatetable 3]: |
|
127 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Timestamp10\""); |
|
128 |
// //###### SQL[updatetable 4]: |
|
129 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Date10\""); |
|
130 |
// //###### SQL[updatetable 5]: |
|
131 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Time10\""); |
|
132 |
// //###### SQL[updatetable 6]: |
|
133 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Bool102\""); |
|
134 |
// //###### SQL[updatetable 7]: |
|
135 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"String10\""); |
|
136 |
// //###### SQL[updatetable 8]: |
|
137 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Bool103\""); |
|
138 |
// //###### SQL[updatetable 9]: |
|
139 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Double10\""); |
|
140 |
// //###### SQL[updatetable 10]: |
|
141 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Bool104\""); |
|
142 |
// //###### SQL[updatetable 11]: |
|
143 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Float10\""); |
|
144 |
// //###### SQL[updatetable 12]: |
|
145 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Bool105\""); |
|
146 |
// //###### SQL[updatetable 13]: |
|
147 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Decimal10\""); |
|
148 |
// //###### SQL[updatetable 14]: |
|
149 |
// sqls.add("ALTER TABLE \"test\" DROP COLUMN \"Geometry10\""); |
|
150 |
|
|
151 |
|
|
152 |
//ResultSetForSetProvider |
|
153 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\" FROM \"test\" ORDER BY \"test\".\"ID\" ASC"; |
|
154 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", (\"test\".\"ID\" * 2) AS \"Compu1\" FROM \"test\" ORDER BY \"test\".\"ID\" ASC"; |
|
155 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", (\"test\".\"ID\" * 2) AS \"Compu1\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)) AS \"Compu2\" FROM \"test\" ORDER BY \"test\".\"ID\" ASC"; |
|
156 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", (\"test\".\"ID\" * 2) AS \"Compu1\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)) AS \"Extra1\" FROM \"test\" ORDER BY \"test\".\"ID\" ASC"; |
|
157 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", (\"test\".\"ID\" * 2) AS \"Extra1\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)) AS \"Extra2\" FROM \"test\" ORDER BY \"test\".\"ID\" ASC"; |
|
158 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", (\"test\".\"ID\" * 2) AS \"Extra1\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)) AS \"Extra2\" FROM \"test\" ORDER BY \"test\".\"ID\" ASC"; |
|
159 |
// String sql = "SELECT MIN(\"test\".\"ID\") AS \"ID\", MAX(\"test\".\"Byte\") AS \"Byte\", NULL AS \"Bool1\", \"test\".\"Long\", NULL AS \"Timestamp\", NULL AS \"Date\", NULL AS \"Time\", NULL AS \"Bool2\", NULL AS \"String\", NULL AS \"Bool3\", SUM(\"test\".\"Double\") AS \"Double\", NULL AS \"Bool4\", NULL AS \"Float\", NULL AS \"Bool5\", NULL AS \"Decimal\", NULL AS \"Geometry\" FROM \"test\" GROUP BY \"test\".\"Long\" ORDER BY \"test\".\"Long\" ASC NULLS LAST"; |
|
160 |
// String sql = "SELECT MIN(\"test\".\"ID\") AS \"ID\", MAX(\"test\".\"Byte\") AS \"Byte\", NULL AS \"Bool1\", NULL AS \"Long\", NULL AS \"Timestamp\", NULL AS \"Date\", NULL AS \"Time\", NULL AS \"Bool2\", NULL AS \"String\", NULL AS \"Bool3\", SUM(\"test\".\"Double\") AS \"Double\", NULL AS \"Bool4\", NULL AS \"Float\", NULL AS \"Bool5\", NULL AS \"Decimal\", NULL AS \"Geometry\", SUM((\"test\".\"Long\" + 10)) AS \"Extra1\", NULL AS \"Extra2\" FROM \"test\" ORDER BY MIN(\"test\".\"ID\") ASC, SUM((\"Long\" + 10)) ASC NULLS LAST"; |
|
161 |
// String sql = "SELECT MIN(\"test\".\"ID\") AS \"ID\", MAX(\"test\".\"Byte\") AS \"Byte\", NULL AS \"Bool1\", \"test\".\"Long\", NULL AS \"Timestamp\", NULL AS \"Date\", NULL AS \"Time\", NULL AS \"Bool2\", NULL AS \"String\", NULL AS \"Bool3\", SUM(\"test\".\"Double\") AS \"Double\", NULL AS \"Bool4\", NULL AS \"Float\", NULL AS \"Bool5\", NULL AS \"Decimal\", NULL AS \"Geometry\", (\"test\".\"ID\" * 2) AS \"Compu1\", SUM((\"test\".\"Long\" + 300)) AS \"Compu2\", SUM(1) AS \"Compu3\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)) AS \"Extra1\", SUM(((20 + \"test\".\"Byte\") + (\"test\".\"ID\" * 2))) AS \"Extra2\" FROM \"test\" GROUP BY \"test\".\"Long\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)), (\"test\".\"ID\" * 2) ORDER BY \"test\".\"Long\" ASC NULLS LAST, ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)) ASC NULLS LAST, (\"test\".\"ID\" * 2) ASC NULLS LAST"; |
|
162 |
// String sql = "SELECT MIN(\"test\".\"ID\") AS \"ID\", MAX(\"test\".\"Byte\") AS \"Byte\", NULL AS \"Bool1\", \"test\".\"Long\", NULL AS \"Timestamp\", NULL AS \"Date\", NULL AS \"Time\", NULL AS \"Bool2\", NULL AS \"String\", NULL AS \"Bool3\", SUM(\"test\".\"Double\") AS \"Double\", NULL AS \"Bool4\", NULL AS \"Float\", NULL AS \"Bool5\", NULL AS \"Decimal\", NULL AS \"Geometry\", (\"test\".\"ID\" * 2) AS \"Compu1\", SUM((\"test\".\"Long\" + 300)) AS \"Compu2\", SUM(1) AS \"Compu3\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)) AS \"Extra1\", SUM(((20 + \"test\".\"Byte\") + (\"test\".\"ID\" * 2))) AS \"Extra2\", NULL AS \"Extra3\" FROM \"test\" GROUP BY \"test\".\"Long\", ((\"test\".\"Long\" + 10) + (\"test\".\"ID\" * 2)), (\"test\".\"ID\" * 2) ORDER BY ((\"Long\" + 10) + (\"ID\" * 2)) ASC NULLS LAST, SUM(((20 + \"Byte\") + (\"ID\" * 2))) ASC NULLS LAST"; |
|
163 |
|
|
164 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", EXISTS(( SELECT \"countries\".\"ISO_A2\" FROM \"countries\" WHERE ((\"test\".\"STRING\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)) LIMIT 1 )) AS \"EXISTS62a964cd7bc24f409b97c03b9170408d\" FROM \"test\" WHERE EXISTS(( SELECT \"countries\".\"ISO_A2\" FROM \"countries\" WHERE ((\"test\".\"STRING\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)) LIMIT 1 )) ORDER BY \"test\".\"ID\" ASC"; //* |
|
165 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\", EXISTS(( SELECT \"test\".\"Long\" FROM \"countries\" WHERE ((\"test\".\"STRING\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)) LIMIT 1 )) AS \"EXISTS62a964cd7bc24f409b97c03b9170408d\" FROM \"test\" WHERE EXISTS(( SELECT \"test\".\"Long\" FROM \"countries\" WHERE ((\"test\".\"STRING\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)) LIMIT 1 )) ORDER BY \"test\".\"ID\" ASC"; //* |
|
166 |
// String sql = "SELECT MIN(\"test\".\"ID\") AS \"ID\", MAX(\"test\".\"Byte\") AS \"Byte\", NULL AS \"Bool1\", \"test\".\"Long\", NULL AS \"Timestamp\", NULL AS \"Date\", NULL AS \"Time\", NULL AS \"Bool2\", NULL AS \"String\", NULL AS \"Bool3\", SUM(\"test\".\"Double\") AS \"Double\", NULL AS \"Bool4\", NULL AS \"Float\", NULL AS \"Bool5\", NULL AS \"Decimal\", NULL AS \"Geometry\" FROM \"test\" WHERE EXISTS(( SELECT \"countries\".\"ISO_A2\" FROM \"countries\" WHERE ((\"test\".\"STRING\" = \"countries\".\"CONTINENT\") AND (\"countries\".\"LASTCENSUS\" < 0)) LIMIT 1 )) GROUP BY \"test\".\"Long\" ORDER BY \"test\".\"Long\" ASC NULLS LAST"; //* |
|
167 |
|
|
168 |
// String sql = "SELECT \"test\".\"ID\", \"test\".\"Byte\", \"test\".\"Bool1\", \"test\".\"Long\", \"test\".\"Timestamp\", \"test\".\"Date\", \"test\".\"Time\", \"test\".\"Bool2\", \"test\".\"String\", \"test\".\"Bool3\", \"test\".\"Double\", \"test\".\"Bool4\", \"test\".\"Float\", \"test\".\"Bool5\", \"test\".\"Decimal\", \"test\".\"Geometry\" FROM \"test\" ORDER BY \"test\".\"ID\" ASC"; |
|
169 |
|
|
170 |
String sql = ""; |
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
String dbPath = "/home/fdiaz/projects/gvSIG/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/target/test-dbs/"; |
|
175 |
String dbName = "testCreate-1699008328746-001.gpkg"; |
|
176 |
|
|
177 |
System.out.println(dbPath+dbName); |
|
178 |
|
|
179 |
// for (String sql : sqls) { |
|
180 |
|
|
181 |
|
|
182 |
String table = "testCreateTarget1"; |
|
183 |
sql = sql.replaceAll("_test_", "_"+table+"_"); |
|
184 |
sql = sql.replaceAll("\"test\"", "\""+table+"\""); |
|
185 |
|
|
186 |
System.out.println("SQL " + sql); |
|
187 |
|
|
188 |
Connection conn = getConnection(dbPath + dbName); |
|
189 |
Statement stmt = conn.createStatement(); |
|
190 |
stmt.execute(sql); |
|
191 |
ResultSet rs3 = stmt.executeQuery(sql); |
|
192 |
ResultSetMetaData rsMetadata = rs3.getMetaData(); |
|
193 |
int columnCount = rsMetadata.getColumnCount(); |
|
194 |
int[] colsizes = new int[columnCount + 1]; |
|
195 |
int recordsCount = 0; |
|
196 |
for (int i = 1; i <= columnCount; i++) { |
|
197 |
colsizes[i] = rsMetadata.getColumnName(i).length() + 1; |
|
198 |
} |
|
199 |
while (rs3.next()) { |
|
200 |
for (int i = 1; i <= columnCount; i++) { |
|
201 |
int l = Objects.toString(rs3.getObject(i)).length() + 1; |
|
202 |
if (l > colsizes[i]) { |
|
203 |
colsizes[i] = l; |
|
204 |
} |
|
205 |
} |
|
206 |
recordsCount++; |
|
207 |
} |
|
208 |
rs3.close(); |
|
209 |
System.out.println("Records " + recordsCount); |
|
210 |
|
|
211 |
ResultSet rs = stmt.executeQuery(sql); |
|
212 |
rsMetadata = rs.getMetaData(); |
|
213 |
|
|
214 |
for (int i = 1; i <= columnCount; i++) { |
|
215 |
System.out.print(StringUtils.rightPad(rsMetadata.getColumnName(i), colsizes[i])); |
|
216 |
} |
|
217 |
System.out.println(); |
|
218 |
for (int i = 1; i <= columnCount; i++) { |
|
219 |
System.out.print(StringUtils.repeat("-", colsizes[i] - 1) + " "); |
|
220 |
} |
|
221 |
System.out.println(); |
|
222 |
while (rs.next()) { |
|
223 |
for (int i = 1; i <= columnCount; i++) { |
|
224 |
System.out.print(StringUtils.rightPad(Objects.toString(rs.getObject(i)), colsizes[i])); |
|
225 |
} |
|
226 |
System.out.println(); |
|
227 |
} |
|
228 |
rs.close(); |
|
229 |
System.out.println(); |
|
230 |
JDBCUtils.close(conn); |
|
231 |
// } |
|
232 |
} |
|
233 |
|
|
234 |
public static Connection getConnection(String fName) throws SQLException { |
|
235 |
registerDriver(); |
|
236 |
|
|
237 |
File f = new File(fName); |
|
238 |
boolean newdb = f != null && !f.exists(); |
|
239 |
|
|
240 |
SQLiteConfig config = new SQLiteConfig(); |
|
241 |
config.setSharedCache(true); |
|
242 |
config.enableLoadExtension(true); |
|
243 |
config.setTransactionMode(SQLiteConfig.TransactionMode.IMMEDIATE); |
|
244 |
config.setOpenMode(SQLiteOpenMode.NOMUTEX); |
|
245 |
|
|
246 |
// config.setJournalMode(SQLiteConfig.JournalMode.WAL); |
|
247 |
// config.setTransactionMode(SQLiteConfig.TransactionMode.DEFERRED); |
|
248 |
// config.setSynchronous(SQLiteConfig.SynchronousMode.OFF); |
|
249 |
// config.setOpenMode(SQLiteOpenMode.FULLMUTEX); |
|
250 |
config.setPragma(SQLiteConfig.Pragma.CASE_SENSITIVE_LIKE, "true"); |
|
251 |
|
|
252 |
SQLiteConnection conn; |
|
253 |
|
|
254 |
try { |
|
255 |
conn = org.sqlite.JDBC.createConnection(getConnectionURL(f), config.toProperties()); |
|
256 |
} catch (Throwable th) { |
|
257 |
throw th; |
|
258 |
} |
|
259 |
|
|
260 |
Functions.register_all(conn); |
|
261 |
|
|
262 |
if (newdb) { |
|
263 |
String[] sqls2 = new String[]{ |
|
264 |
"CREATE TABLE IF NOT EXISTS \"" + TABLE_RESOURCES_NAME + "\"(\"" + FIELD_RESOURCES_NAME + "\" VARCHAR(150) NOT NULL, \"" + FIELD_RESOURCES_RESOURCE + "\" BLOB DEFAULT NULL , PRIMARY KEY(\"" + FIELD_RESOURCES_NAME + "\"))", |
|
265 |
"CREATE TABLE IF NOT EXISTS \"" + TABLE_CONFIGURATION_NAME + "\"(\"" + FIELD_CONFIGURATION_NAME + "\" VARCHAR(200) NOT NULL, \"" + FIELD_CONFIGURATION_VALUE + "\" CLOB DEFAULT NULL, PRIMARY KEY(\"" + FIELD_CONFIGURATION_NAME + "\"))" |
|
266 |
}; |
|
267 |
for (String sql : sqls2) { |
|
268 |
try { |
|
269 |
conn.createStatement().execute(sql); |
|
270 |
} catch (SQLException ex) { |
|
271 |
LOGGER.debug("Can't configure gvsig tables.", ex); |
|
272 |
LOGGER.warn("Can't configure gvsig tables. " + sql); |
|
273 |
// Ignore this error. |
|
274 |
} |
|
275 |
} |
|
276 |
} |
|
277 |
return conn; |
|
278 |
} |
|
279 |
|
|
280 |
public static String getConnectionURL(File dbFile) { |
|
281 |
String fname = dbFile.getAbsolutePath().replace("\\", "/"); |
|
282 |
if (StringUtils.isBlank(FilenameUtils.getExtension(fname))) { |
|
283 |
if (fname.endsWith(".")) { |
|
284 |
fname = fname + GeopackageUtils.EXTENSION; |
|
285 |
} else { |
|
286 |
fname = fname + "." + GeopackageUtils.EXTENSION; |
|
287 |
} |
|
288 |
} |
|
289 |
String connectionURL = "jdbc:sqlite:" + fname; |
|
290 |
return connectionURL; |
|
291 |
} |
|
292 |
|
|
293 |
private static void registerDriver() throws SQLException { |
|
294 |
String className = "org.sqlite.JDBC"; |
|
295 |
if (className == null) { |
|
296 |
return; |
|
297 |
} |
|
298 |
try { |
|
299 |
Class theClass = Class.forName(className); |
|
300 |
if (theClass == null) { |
|
301 |
throw new JDBCDriverClassNotFoundException(SQLiteLibrary.NAME, className); |
|
302 |
} |
|
303 |
} catch (Exception e) { |
|
304 |
throw new SQLException("Can't register JDBC driver '" + className + "'.", e); |
|
305 |
} |
|
306 |
} |
|
307 |
|
|
308 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.sqlite/org.gvsig.sqlite.provider/src/test/java/org/gvsig/sqlite/dal/TestCreate.java | ||
---|---|---|
53 | 53 |
// public void testHello() {} |
54 | 54 |
|
55 | 55 |
protected String getProviderName() { |
56 |
return DataStore.H2SPATIAL_PROVIDER_NAME; |
|
56 |
return SQLiteLibrary.NAME; |
Also available in: Unified diff