Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | implementing support for Temporary Geometries |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
85303929511546476f41aa1798d7e459 |
User & Date: | sandro 2020-03-12 19:45:10 |
Context
2020-03-31
| ||
15:19 | implementing CurvosityIndex() and UphillHeight() / DownhillHeight() check-in: c7f67038bf user: sandro tags: trunk | |
2020-03-12
| ||
19:45 | implementing support for Temporary Geometries check-in: 8530392951 user: sandro tags: trunk | |
2020-03-10
| ||
16:13 | implenting support for RL2 Map Configuration check-in: 4d809cf60a user: sandro tags: trunk | |
Changes
Changes to spatialite-sql-latest.html.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 .... 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 .... 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 |
<html><head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <title>SpatiaLite SQL functions reference list</title> <style type="text/css"> h2 {color:navy; text-align:center;} h3 {color:blue;} b {color:brown;} i {color:navy;} </style> </head><body bgcolor="#fffff0"> <h2>SpatiaLite 5.0.0-beta1 SQL functions reference list</h2> <a href="https://www.gaia-gis.it/fossil/libspatialite">back</a> <ul> <li><a href="#version">SQL Version Info [and build options testing] functions</a></li> ................................................................................ Please note: the <b>dimension</b> argument is optional; when specified, if specified, iy's expected to be consistent with the declared <b>geom_type</b><hr> the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE<hr> the optional 6th arg [<b>not_null</b>] is a non-standard extension required by the peculiar SQLite arch:<ul> <li>if set to <b>0</b> [<i>false</i>], then the Geometry column will accept NULL values as well. This is the <u>default</u> behaviour</li> <li>if set to any <b><> 0 value</b> [<i>true</i>], then the Geometry will be defined using a <b>NOT NULL</b> clause</li> </ul></td></tr> <tr><td><b>RecoverGeometryColumn</b></td> <td>RecoverGeometryColumn( table <i>String</i> , column <i>String</i> , srid <i>Integer</i> , geom_type <i>String</i> [ , dimension <i>Integer</i> ] ) : <i>Integer</i></td> <td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Validates an existing ordinary column in order to possibly transform it in a real <u>geometry column</u>, thus updating the Spatial Metadata tables and creating any required <u>trigger</u> in order to enforce constraints<hr> ................................................................................ <td>CreateSpatialIndex( table <i>String</i> , column <i>String</i> ) : <i>Integer</i></td> <td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Builds an RTree <b>Spatial Index</b> on a <u>geometry column</u>, creating any required <u>trigger</u> required in order to enforce full data coherency between the main table and Spatial Index<hr> the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE<hr> -1 will be returned if any physical column named "rowid" (caseless) shadowing the real ROWID is detected.</td></tr> <tr><td><b>CreateMbrCache</b></td> <td>CreateMbrCache( table <i>String</i> , column <i>String</i> ) : <i>Integer</i></td> <td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Builds an <b>MbrCache</b> on a <u>geometry column</u>, creating any required <u>trigger</u> required in order to enforce full data coherency between the main table and the MbrCache<hr> the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE</td></tr> |
> > > > > > > > > > > > > > > > > > > > > > > > > > > |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 .... 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 .... 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 |
<html><head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <title>SpatiaLite SQL functions reference list</title> <style type="text/css"> h2 {color:navy; text-align:center;} h3 {color:blue;} b {color:brown;} b.black {color:navy;} i {color:navy;} </style> </head><body bgcolor="#fffff0"> <h2>SpatiaLite 5.0.0-beta1 SQL functions reference list</h2> <a href="https://www.gaia-gis.it/fossil/libspatialite">back</a> <ul> <li><a href="#version">SQL Version Info [and build options testing] functions</a></li> ................................................................................ Please note: the <b>dimension</b> argument is optional; when specified, if specified, iy's expected to be consistent with the declared <b>geom_type</b><hr> the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE<hr> the optional 6th arg [<b>not_null</b>] is a non-standard extension required by the peculiar SQLite arch:<ul> <li>if set to <b>0</b> [<i>false</i>], then the Geometry column will accept NULL values as well. This is the <u>default</u> behaviour</li> <li>if set to any <b><> 0 value</b> [<i>true</i>], then the Geometry will be defined using a <b>NOT NULL</b> clause</li> </ul></td></tr> <tr><td><b>AddTemporaryGeometryColumn</b></td> <td>AddTemporaryGeometryColumn( db-prefix <i>String</i> , table <i>String</i> , column <i>String</i> , srid <i>Integer</i> , geom_type <i>String</i> [ , dimension <i>String</i> [ , not_null <i>Integer</i> ] ] ) : <i>Integer</i></td> <td></td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Almost the same as <b>AddGeometryColumn()</b>, with a critical difference: <ul> <li><b>db-prefix</b> is the <i>schema-name</i> of some <b>attached database</b></li> <li>Such an <i>Attached Database</i> must necessarily be of the <b>:memory:</b> type being previously created by issuing an SQL statement like:<br> <b class="black">ATTACH DATABASE ':memory:' AS prefix;</b></li> <li>If the above prerequisite is not fullfilled this function will always fail.</li> </ul> </td></tr> <tr><td><b>RecoverGeometryColumn</b></td> <td>RecoverGeometryColumn( table <i>String</i> , column <i>String</i> , srid <i>Integer</i> , geom_type <i>String</i> [ , dimension <i>Integer</i> ] ) : <i>Integer</i></td> <td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Validates an existing ordinary column in order to possibly transform it in a real <u>geometry column</u>, thus updating the Spatial Metadata tables and creating any required <u>trigger</u> in order to enforce constraints<hr> ................................................................................ <td>CreateSpatialIndex( table <i>String</i> , column <i>String</i> ) : <i>Integer</i></td> <td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Builds an RTree <b>Spatial Index</b> on a <u>geometry column</u>, creating any required <u>trigger</u> required in order to enforce full data coherency between the main table and Spatial Index<hr> the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE<hr> -1 will be returned if any physical column named "rowid" (caseless) shadowing the real ROWID is detected.</td></tr> <tr><td><b>CreateTemporarySpatialIndex</b></td> <td>CreateTemporarySpatialIndex( db-prefix <i>String</i> , table <i>String</i> , column <i>String</i> ) : <i>Integer</i></td> <td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Almost the same as <b>CreateSpatialIndex()</b>, but specifically intended to support Geometry columns created by <b>AddTemporaryGeometryColumn()</b> <ul> <li><b>db-prefix</b> is the <i>schema-name</i> of some <b>attached database</b></li> <li>Such an <i>Attached Database</i> must necessarily be of the <b>:memory:</b> type being previously created by issuing an SQL statement like:<br> <b class="black">ATTACH DATABASE ':memory:' AS prefix;</b></li> <li><b>table</b> and <b>column</b> must identify an already existing Temporary Geometry located on that Database.</li> <li>If the above prerequisites are not fullfilled this function will always fail.</li> </ul> </td></tr> <tr><td><b>CreateMbrCache</b></td> <td>CreateMbrCache( table <i>String</i> , column <i>String</i> ) : <i>Integer</i></td> <td></td> <td align="center" bgcolor="#d0f0d0">base</td> <td>Builds an <b>MbrCache</b> on a <u>geometry column</u>, creating any required <u>trigger</u> required in order to enforce full data coherency between the main table and the MbrCache<hr> the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE</td></tr> |
Changes to src/headers/spatialite_private.h.
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
...
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
|
SPATIALITE_PRIVATE void updateSpatiaLiteHistory (void *sqlite, const char *table, const char *geom, const char *operation); SPATIALITE_PRIVATE int createGeometryColumns (void *p_sqlite); SPATIALITE_PRIVATE int check_layer_statistics (void *p_sqlite); SPATIALITE_PRIVATE int check_views_layer_statistics (void *p_sqlite); SPATIALITE_PRIVATE int check_virts_layer_statistics (void *p_sqlite); SPATIALITE_PRIVATE void updateGeometryTriggers (void *p_sqlite, const char *table, const char *column); SPATIALITE_PRIVATE int upgradeGeometryTriggers (void *p_sqlite); SPATIALITE_PRIVATE int getRealSQLnames (void *p_sqlite, const char *table, const char *column, char **real_table, char **real_column); /* DEPRECATED - always use buildSpatialIndexEx */ SPATIALITE_PRIVATE void buildSpatialIndex (void *p_sqlite, const unsigned char *table, const char *column); SPATIALITE_PRIVATE int buildSpatialIndexEx (void *p_sqlite, const unsigned char *table, const char *column); SPATIALITE_PRIVATE int validateRowid (void *p_sqlite, const char *table); SPATIALITE_PRIVATE int doComputeFieldInfos (void *p_sqlite, const char *table, const char *column, int stat_type, void *p_lyr); SPATIALITE_PRIVATE void getProjParams (void *p_sqlite, int srid, ................................................................................ const char *group_name, int style_id, const char *style_name); SPATIALITE_PRIVATE int register_map_configuration (void *p_sqlite, const unsigned char *p_blob, int n_bytes); SPATIALITE_PRIVATE int unregister_map_configuration (void *p_sqlite, int id, const char *name); SPATIALITE_PRIVATE int reload_map_configuration (void *p_sqlite, int id, const char *name, const unsigned char *p_blob, int n_bytes); SPATIALITE_PRIVATE int createIsoMetadataTables (void *p_sqlite, int relaxed); SPATIALITE_PRIVATE int get_iso_metadata_id (void *p_sqlite, const char *fileIdentifier, void *p_id); |
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
...
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
|
SPATIALITE_PRIVATE void updateSpatiaLiteHistory (void *sqlite, const char *table, const char *geom, const char *operation); SPATIALITE_PRIVATE int createGeometryColumns (void *p_sqlite); SPATIALITE_PRIVATE int createTemporarySpatialRefSys (void *p_sqlite, const char *db_prefix); SPATIALITE_PRIVATE int createTemporaryGeometryColumns (void *p_sqlite, const char *db_prefix); SPATIALITE_PRIVATE int check_layer_statistics (void *p_sqlite); SPATIALITE_PRIVATE int check_views_layer_statistics (void *p_sqlite); SPATIALITE_PRIVATE int check_virts_layer_statistics (void *p_sqlite); SPATIALITE_PRIVATE void updateGeometryTriggers (void *p_sqlite, const char *table, const char *column); SPATIALITE_PRIVATE void updateTemporaryGeometryTriggers (void *p_sqlite, const char *db_prefix, const char *table, const char *column); SPATIALITE_PRIVATE int upgradeGeometryTriggers (void *p_sqlite); SPATIALITE_PRIVATE int getRealSQLnames (void *p_sqlite, const char *table, const char *column, char **real_table, char **real_column); SPATIALITE_PRIVATE int getRealSQLnamesTemporary (void *p_sqlite, const char *db_prefix, const char *table, const char *column, char **real_table, char **real_column); /* DEPRECATED - always use buildSpatialIndexEx */ SPATIALITE_PRIVATE void buildSpatialIndex (void *p_sqlite, const unsigned char *table, const char *column); SPATIALITE_PRIVATE int buildSpatialIndexEx (void *p_sqlite, const unsigned char *table, const char *column); SPATIALITE_PRIVATE int buildTemporarySpatialIndex (void *p_sqlite, const char *db_prefix, const unsigned char *table, const char *column); SPATIALITE_PRIVATE int validateRowid (void *p_sqlite, const char *table); SPATIALITE_PRIVATE int validateTemporaryRowid (void *p_sqlite, const char *db_prefix, const char *table); SPATIALITE_PRIVATE int doComputeFieldInfos (void *p_sqlite, const char *table, const char *column, int stat_type, void *p_lyr); SPATIALITE_PRIVATE void getProjParams (void *p_sqlite, int srid, ................................................................................ const char *group_name, int style_id, const char *style_name); SPATIALITE_PRIVATE int register_map_configuration (void *p_sqlite, const unsigned char *p_blob, int n_bytes); SPATIALITE_PRIVATE int unregister_map_configuration (void *p_sqlite, int id, const char *name); SPATIALITE_PRIVATE int reload_map_configuration (void *p_sqlite, int id, const char *name, const unsigned char *p_blob, int n_bytes); SPATIALITE_PRIVATE int createIsoMetadataTables (void *p_sqlite, int relaxed); SPATIALITE_PRIVATE int get_iso_metadata_id (void *p_sqlite, const char *fileIdentifier, void *p_id); |
Changes to src/spatialite/metatables.c.
3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 .... 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 .... 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 .... 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 .... 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 .... 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 |
sqlite3_free (errMsg); return 0; } updateSpatiaLiteHistory (sqlite, "geometry_columns", NULL, "trigger 'geometry_columns_coord_dimension_update' successfully created"); return 1; } SPATIALITE_PRIVATE int upgradeGeometryTriggers (void *p_sqlite) { /* upgrading all triggers for any Spatial Column */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; int ret; ................................................................................ &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; } /* deleting the old INSERT trigger SPATIAL_INDEX [if any] */ raw = sqlite3_mprintf ("gid_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS main.\"%s\"", quoted_trigger); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); ................................................................................ curr_idx = next_idx; } if (p_table) free (p_table); if (p_column) free (p_column); } SPATIALITE_PRIVATE void buildSpatialIndex (void *p_sqlite, const unsigned char *table, const char *column) { /* DEPRECATED - always use buildSpatialIndexEx as a safer replacement */ buildSpatialIndexEx (p_sqlite, table, column); ................................................................................ char **results; int rows; int columns; char *quoted_table = gaiaDoubleQuotedSql (table); sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", quoted_table); ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); sqlite3_free (sql); free (quoted_table); if (ret != SQLITE_OK) return 0; if (rows < 1) ; else { ................................................................................ { spatialite_e ("buildSpatialIndex error: \"%s\"\n", errMsg); sqlite3_free (errMsg); return -1; } return 0; } SPATIALITE_PRIVATE int getRealSQLnames (void *p_sqlite, const char *table, const char *column, char **real_table, char **real_column) { /* attempting to retrieve the "real" table and column names (upper/lowercase) */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; ................................................................................ sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("real_names: error %d \"%s\"\n", sqlite3_errcode (sqlite), sqlite3_errmsg (sqlite)); free (p_table); return 0; } while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 .... 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 .... 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 .... 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 .... 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 .... 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 |
sqlite3_free (errMsg); return 0; } updateSpatiaLiteHistory (sqlite, "geometry_columns", NULL, "trigger 'geometry_columns_coord_dimension_update' successfully created"); return 1; } SPATIALITE_PRIVATE int createTemporarySpatialRefSys (void *p_sqlite, const char *db_prefix) { sqlite3 *sqlite = (sqlite3 *) p_sqlite; char *sql_statement; sqlite3_stmt *stmt; int ret; char *prefix; int already_defined = 0; char *errMsg = NULL; /* checking if already defined */ prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("SELECT name " "FROM \"%s\".sqlite_master WHERE type = 'table' " "AND Lower(name) = 'spatial_ref_sys'", prefix); free (prefix); /* compiling SQL prepared statement */ ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement), &stmt, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("createTemporarySpatialRefSys: error %d \"%s\"\n", sqlite3_errcode (sqlite), sqlite3_errmsg (sqlite)); return 0; } sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ if (ret == SQLITE_ROW) already_defined = 1; } sqlite3_finalize (stmt); if (already_defined) return 1; /* creating the SPATIAL_REF_SYS table */ prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("CREATE TABLE \"%s\".spatial_ref_sys (\n" "srid INTEGER NOT NULL PRIMARY KEY,\n" "auth_name TEXT NOT NULL,\n" "auth_srid INTEGER NOT NULL,\n" "ref_sys_name TEXT NOT NULL DEFAULT 'Unknown',\n" "proj4text TEXT NOT NULL,\n" "srtext TEXT NOT NULL DEFAULT 'Undefined')", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free(sql_statement); if (ret != SQLITE_OK) goto error; prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("CREATE UNIQUE INDEX \"%s\".idx_spatial_ref_sys \n" "ON spatial_ref_sys (auth_srid, auth_name)", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; sql_statement = sqlite3_mprintf ("SAVEPOINT tmp_spatial_ref_sys"); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("INSERT INTO \"%s\".spatial_ref_sys " "(srid, auth_name, auth_srid, ref_sys_name, proj4text, srtext) " "SELECT srid, auth_name, auth_srid, ref_sys_name, proj4text, srtext " "FROM main.spatial_ref_sys", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; sql_statement = sqlite3_mprintf ("RELEASE SAVEPOINT tmp_spatial_ref_sys"); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; return 1; error: return 0; } SPATIALITE_PRIVATE int createTemporaryGeometryColumns (void *p_sqlite, const char *db_prefix) { sqlite3 *sqlite = (sqlite3 *) p_sqlite; char *sql; char *errMsg = NULL; int ret; char *prefix; /* creating the GEOMETRY_COLUMNS table */ prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TABLE IF NOT EXISTS \"%s\".geometry_columns (\n" "f_table_name TEXT NOT NULL,\n" "f_geometry_column TEXT NOT NULL,\n" "geometry_type INTEGER NOT NULL,\n" "coord_dimension INTEGER NOT NULL,\n" "srid INTEGER NOT NULL,\n" "spatial_index_enabled INTEGER NOT NULL,\n" "CONSTRAINT pk_geom_cols PRIMARY KEY " "(f_table_name, f_geometry_column),\n" "CONSTRAINT fk_gc_srs FOREIGN KEY " "(srid) REFERENCES spatial_ref_sys (srid),\n" "CONSTRAINT ck_gc_rtree CHECK " "(spatial_index_enabled IN (0,1)))", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } /* creating an INDEX corresponding to the SRID FK */ prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE INDEX IF NOT EXISTS \"%s\".idx_srid_geocols " "ON geometry_columns (srid)", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } /* creating the GEOMETRY_COLUMNS triggers */ prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_f_table_name_insert\n" "BEFORE INSERT ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: " "f_table_name value must not contain a single quote')\n" "WHERE NEW.f_table_name LIKE ('%%''%%');\n" "SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: " "f_table_name value must not contain a double quote')\n" "WHERE NEW.f_table_name LIKE ('%%\"%%');\n" "SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: \n" "f_table_name value must be lower case')\n" "WHERE NEW.f_table_name <> lower(NEW.f_table_name);\n" "END", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_f_table_name_update\n" "BEFORE UPDATE OF 'f_table_name' ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'update on geometry_columns violates constraint: " "f_table_name value must not contain a single quote')\n" "WHERE NEW.f_table_name LIKE ('%%''%%');\n" "SELECT RAISE(ABORT,'update on geometry_columns violates constraint: " "f_table_name value must not contain a double quote')\n" "WHERE NEW.f_table_name LIKE ('%%\"%%');\n" "SELECT RAISE(ABORT,'update on geometry_columns violates constraint: " "f_table_name value must be lower case')\n" "WHERE NEW.f_table_name <> lower(NEW.f_table_name);\n" "END", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_f_geometry_column_insert\n" "BEFORE INSERT ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: " "f_geometry_column value must not contain a single quote')\n" "WHERE NEW.f_geometry_column LIKE ('%%''%%');\n" "SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: \n" "f_geometry_column value must not contain a double quote')\n" "WHERE NEW.f_geometry_column LIKE ('%%\"%%');\n" "SELECT RAISE(ABORT,'insert on geometry_columns violates constraint: " "f_geometry_column value must be lower case')\n" "WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);\n" "END", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_f_geometry_column_update\n" "BEFORE UPDATE OF 'f_geometry_column' ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'update on geometry_columns violates constraint: " "f_geometry_column value must not contain a single quote')\n" "WHERE NEW.f_geometry_column LIKE ('%%''%%');\n" "SELECT RAISE(ABORT,'update on geometry_columns violates constraint: " "f_geometry_column value must not contain a double quote')\n" "WHERE NEW.f_geometry_column LIKE ('%%\"%%');\n" "SELECT RAISE(ABORT,'update on geometry_columns violates constraint: " "f_geometry_column value must be lower case')\n" "WHERE NEW.f_geometry_column <> lower(NEW.f_geometry_column);\n" "END", prefix); free(prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_geometry_type_insert\n" "BEFORE INSERT ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'geometry_type must be one of " "0,1,2,3,4,5,6,7," "1000,1001,1002,1003,1004,1005,1006,1007," "2000,2001,2002,2003,2004,2005,2006,2007," "3000,3001,3002,3003,3004,3005,3006,3007')\n" "WHERE NOT(NEW.geometry_type IN (0,1,2,3,4,5,6,7," "1000,1001,1002,1003,1004,1005,1006,1007," "2000,2001,2002,2003,2004,2005,2006,2007," "3000,3001,3002,3003,3004,3005,3006,3007));\n" "END", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_geometry_type_update\n" "BEFORE UPDATE OF 'geometry_type' ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'geometry_type must be one of " "0,1,2,3,4,5,6,7," "1000,1001,1002,1003,1004,1005,1006,1007," "2000,2001,2002,2003,2004,2005,2006,2007," "3000,3001,3002,3003,3004,3005,3006,3007')\n" "WHERE NOT(NEW.geometry_type IN (0,1,2,3,4,5,6,7," "1000,1001,1002,1003,1004,1005,1006,1007," "2000,2001,2002,2003,2004,2005,2006,2007," "3000,3001,3002,3003,3004,3005,3006,3007));\n" "END", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_coord_dimension_insert\n" "BEFORE INSERT ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'coord_dimension must be one of 2,3,4')\n" "WHERE NOT(NEW.coord_dimension IN (2,3,4));\n" "END", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("CREATE TRIGGER IF NOT EXISTS \"%s\".geometry_columns_coord_dimension_update\n" "BEFORE UPDATE OF 'coord_dimension' ON 'geometry_columns'\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT,'coord_dimension must be one of 2,3,4')\n" "WHERE NOT(NEW.coord_dimension IN (2,3,4));\n" "END", prefix); free (prefix); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } return 1; } SPATIALITE_PRIVATE int upgradeGeometryTriggers (void *p_sqlite) { /* upgrading all triggers for any Spatial Column */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; int ret; ................................................................................ &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; } /* deleting the old INSERT trigger SPATIAL_INDEX [if any] */ raw = sqlite3_mprintf ("gii_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS main.\"%s\"", quoted_trigger); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); ................................................................................ curr_idx = next_idx; } if (p_table) free (p_table); if (p_column) free (p_column); } SPATIALITE_PRIVATE void updateTemporaryGeometryTriggers (void *p_sqlite, const char *db_prefix, const char *table, const char *column) { /* updates triggers for some Spatial Column - only on Attached DB based on :memory: */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; int ret; int col_index; int index; int len; char *errMsg = NULL; char *sql_statement; char *raw; char *quoted_trigger; char *quoted_rtree; char *quoted_prefix; char *quoted_table; char *quoted_column; char *p_table = NULL; char *p_column = NULL; sqlite3_stmt *stmt; struct spatial_index_str *first_idx = NULL; struct spatial_index_str *last_idx = NULL; struct spatial_index_str *curr_idx; struct spatial_index_str *next_idx; if (!getRealSQLnamesTemporary (sqlite, db_prefix, table, column, &p_table, &p_column)) { spatialite_e ("updateTemporaryTableTriggers() error: not existing Table or Column\n"); return; } quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("SELECT spatial_index_enabled " "FROM \"%s\".geometry_columns WHERE Lower(f_table_name) = Lower(?) " "AND Lower(f_geometry_column) = Lower(?)", quoted_prefix); free (quoted_prefix); /* compiling SQL prepared statement */ ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement), &stmt, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("updateTemporaryTableTriggers: error %d \"%s\"\n", sqlite3_errcode (sqlite), sqlite3_errmsg (sqlite)); return; } sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); sqlite3_bind_text (stmt, 1, table, strlen (table), SQLITE_STATIC); sqlite3_bind_text (stmt, 2, column, strlen (column), SQLITE_STATIC); while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ if (ret == SQLITE_ROW) { col_index = sqlite3_column_int (stmt, 0); index = 0; if (col_index == 1) index = 1; /* deleting the old INSERT trigger TYPE [if any] */ raw = sqlite3_mprintf ("ggi_%s_%s", p_table, p_column); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* inserting the INSERT trigger TYPE */ raw = sqlite3_mprintf ("ggi_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_table = gaiaDoubleQuotedSql (p_table); quoted_column = gaiaDoubleQuotedSql (p_column); sql_statement = sqlite3_mprintf ("CREATE TRIGGER \"%s\".\"%s\" BEFORE INSERT ON \"%s\"\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ROLLBACK, '%q.%q violates Geometry constraint [geom-type or SRID not allowed]')\n" "WHERE (SELECT geometry_type FROM \"%s\".geometry_columns\n" "WHERE Lower(f_table_name) = Lower(%Q) AND " "Lower(f_geometry_column) = Lower(%Q)\n" "AND GeometryConstraints(NEW.\"%s\", geometry_type, srid) = 1) IS NULL;\nEND", quoted_prefix, quoted_trigger, quoted_table, p_table, p_column, db_prefix, p_table, p_column, quoted_column); free (quoted_prefix); free (quoted_trigger); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* deleting the old UPDATE trigger TYPE [if any] */ raw = sqlite3_mprintf ("ggu_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* inserting the new UPDATE trigger TYPE */ raw = sqlite3_mprintf ("ggu_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_table = gaiaDoubleQuotedSql (p_table); quoted_column = gaiaDoubleQuotedSql (p_column); sql_statement = sqlite3_mprintf ("CREATE TRIGGER \"%s\".\"%s\" BEFORE UPDATE OF \"%s\" ON \"%s\"\n" "FOR EACH ROW BEGIN\n" "SELECT RAISE(ROLLBACK, '%q.%q violates Geometry constraint [geom-type or SRID not allowed]')\n" "WHERE (SELECT geometry_type FROM \"%s\".geometry_columns\n" "WHERE Lower(f_table_name) = Lower(%Q) AND " "Lower(f_geometry_column) = Lower(%Q)\n" "AND GeometryConstraints(NEW.\"%s\", geometry_type, srid) = 1) IS NULL;\nEND", quoted_prefix, quoted_trigger, quoted_column, quoted_table, p_table, p_column, db_prefix, p_table, p_column, quoted_column); free (quoted_prefix); free (quoted_trigger); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* inserting SpatialIndex information into the linked list */ curr_idx = malloc (sizeof (struct spatial_index_str)); len = strlen (p_table); curr_idx->TableName = malloc (len + 1); strcpy (curr_idx->TableName, p_table); len = strlen (p_column); curr_idx->ColumnName = malloc (len + 1); strcpy (curr_idx->ColumnName, p_column); curr_idx->ValidRtree = (char) index; curr_idx->ValidCache = '\0'; curr_idx->Next = NULL; if (!first_idx) first_idx = curr_idx; if (last_idx) last_idx->Next = curr_idx; last_idx = curr_idx; /* deleting the old INSERT trigger SPATIAL_INDEX [if any] */ raw = sqlite3_mprintf ("gii_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* deleting the old UPDATE trigger SPATIAL_INDEX [if any] */ raw = sqlite3_mprintf ("giu_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* deleting the old DELETE trigger SPATIAL_INDEX [if any] */ raw = sqlite3_mprintf ("gid_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* deleting the old INSERT trigger MBR_CACHE [if any] */ raw = sqlite3_mprintf ("gci_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* deleting the old UPDATE trigger MBR_CACHE [if any] */ raw = sqlite3_mprintf ("gcu_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* deleting the old UPDATE trigger MBR_CACHE [if any] */ raw = sqlite3_mprintf ("gcd_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("DROP TRIGGER IF EXISTS \"%s\".\"%s\"", quoted_prefix, quoted_trigger); free (quoted_prefix); free (quoted_trigger); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; if (index) { /* inserting the new INSERT trigger RTree */ raw = sqlite3_mprintf ("gii_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); raw = sqlite3_mprintf ("idx_%s_%s", p_table, p_column); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_rtree = gaiaDoubleQuotedSql (raw); quoted_table = gaiaDoubleQuotedSql (p_table); quoted_column = gaiaDoubleQuotedSql (p_column); sql_statement = sqlite3_mprintf ("CREATE TRIGGER \"%s\".\"%s\" AFTER INSERT ON \"%s\"\n" "FOR EACH ROW BEGIN\n" "DELETE FROM \"%s\" WHERE pkid=NEW.ROWID;\n" "SELECT TemporaryRTreeAlign(%Q, %Q, NEW.ROWID, NEW.\"%s\");\nEND", quoted_prefix, quoted_trigger, quoted_table, quoted_rtree, db_prefix, raw, quoted_column); sqlite3_free (raw); free (quoted_prefix); free (quoted_trigger); free (quoted_rtree); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* inserting the new UPDATE trigger RTree */ raw = sqlite3_mprintf ("giu_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); raw = sqlite3_mprintf ("idx_%s_%s", p_table, p_column); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_rtree = gaiaDoubleQuotedSql (raw); quoted_table = gaiaDoubleQuotedSql (p_table); quoted_column = gaiaDoubleQuotedSql (p_column); sql_statement = sqlite3_mprintf ("CREATE TRIGGER \"%s\".\"%s\" AFTER UPDATE OF \"%s\" ON \"%s\"\n" "FOR EACH ROW BEGIN\n" "DELETE FROM \"%s\" WHERE pkid=NEW.ROWID;\n" "SELECT TemporaryRTreeAlign(%Q, %Q, NEW.ROWID, NEW.\"%s\");\nEND", quoted_prefix, quoted_trigger, quoted_column, quoted_table, quoted_rtree, db_prefix, raw, quoted_column); sqlite3_free (raw); free (quoted_prefix); free (quoted_trigger); free (quoted_rtree); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* inserting the new DELETE trigger RTree */ raw = sqlite3_mprintf ("gid_%s_%s", p_table, p_column); quoted_trigger = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); raw = sqlite3_mprintf ("idx_%s_%s", p_table, p_column); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_rtree = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); quoted_table = gaiaDoubleQuotedSql (p_table); quoted_column = gaiaDoubleQuotedSql (p_column); sql_statement = sqlite3_mprintf ("CREATE TRIGGER \"%s\".\"%s\" AFTER DELETE ON \"%s\"\n" "FOR EACH ROW BEGIN\n" "DELETE FROM \"%s\" WHERE pkid=OLD.ROWID;\nEND", quoted_prefix, quoted_trigger, quoted_table, quoted_rtree); free (quoted_prefix); free (quoted_trigger); free (quoted_rtree); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; } } } ret = sqlite3_finalize (stmt); /* now we'll adjust any related SpatialIndex as required */ curr_idx = first_idx; while (curr_idx) { if (curr_idx->ValidRtree) { /* building RTree SpatialIndex */ int status; raw = sqlite3_mprintf ("idx_%s_%s", curr_idx->TableName, curr_idx->ColumnName); quoted_rtree = gaiaDoubleQuotedSql (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sqlite3_free (raw); sql_statement = sqlite3_mprintf ("CREATE VIRTUAL TABLE \"%s\".\"%s\" " "USING rtree(pkid, xmin, xmax, ymin, ymax)", quoted_prefix, quoted_rtree); free (quoted_prefix); free (quoted_rtree); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; status = buildTemporarySpatialIndex (sqlite, db_prefix, (unsigned char *) (curr_idx->TableName), curr_idx->ColumnName); if (status == 0) ; else { if (status == -2) errMsg = sqlite3_mprintf ("TemporarySpatialIndex error: a physical column named ROWID shadows the real ROWID"); else errMsg = sqlite3_mprintf ("TemporarySpatialIndex error: unable to rebuild the T*Tree"); goto error; } } if (curr_idx->ValidCache) { /* building MbrCache SpatialIndex */ raw = sqlite3_mprintf ("cache_%s_%s", curr_idx->TableName, curr_idx->ColumnName); quoted_rtree = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_table = gaiaDoubleQuotedSql (curr_idx->TableName); quoted_column = gaiaDoubleQuotedSql (curr_idx->ColumnName); sql_statement = sqlite3_mprintf ("CREATE VIRTUAL TABLE \"%s\".\"%s\" " "USING MbrCache(\"%s\", \"%s\")", quoted_prefix, quoted_rtree, quoted_table, quoted_column); free (quoted_prefix); free (quoted_rtree); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; } curr_idx = curr_idx->Next; } goto index_cleanup; error: spatialite_e ("updateTemporaryTableTriggers: \"%s\"\n", errMsg); sqlite3_free (errMsg); index_cleanup: curr_idx = first_idx; while (curr_idx) { next_idx = curr_idx->Next; if (curr_idx->TableName) free (curr_idx->TableName); if (curr_idx->ColumnName) free (curr_idx->ColumnName); free (curr_idx); curr_idx = next_idx; } if (p_table) free (p_table); if (p_column) free (p_column); } SPATIALITE_PRIVATE void buildSpatialIndex (void *p_sqlite, const unsigned char *table, const char *column) { /* DEPRECATED - always use buildSpatialIndexEx as a safer replacement */ buildSpatialIndexEx (p_sqlite, table, column); ................................................................................ char **results; int rows; int columns; char *quoted_table = gaiaDoubleQuotedSql (table); sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", quoted_table); ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); sqlite3_free (sql); free (quoted_table); if (ret != SQLITE_OK) return 0; if (rows < 1) ; else { for (i = 1; i <= rows; i++) { name = results[(i * columns) + 1]; if (strcasecmp (name, "rowid") == 0) rowid = 1; type = results[(i * columns) + 2]; if (strcasecmp (type, "INTEGER") == 0) int_pk = 1; pk = results[(i * columns) + 5]; if (atoi (pk) != 0) pk_cols++; if (strcasecmp (name, "rowid") == 0 && atoi (pk) != 0) rowid_pk = 1; } } sqlite3_free_table (results); if (rowid == 0) return 1; if (rowid_pk == 1 && pk_cols == 1 && int_pk == 1) { /* OK, found: ROWID INTEGER PRIMARY KEY */ return 1; } return 0; } SPATIALITE_PRIVATE int validateTemporaryRowid (void *p_sqlite, const char *db_prefix, const char *table) { /* check for tables containing a physical column named ROWID */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; int rowid = 0; char *sql; int ret; const char *name; const char *type; const char *pk; int rowid_pk = 0; int int_pk = 0; int pk_cols = 0; int i; char **results; int rows; int columns; char *quoted_prefix; char *quoted_table; if (db_prefix == NULL) return 0; quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_table = gaiaDoubleQuotedSql (table); sql = sqlite3_mprintf ("PRAGMA \"%s\".table_info(\"%s\")", quoted_prefix, quoted_table); ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); sqlite3_free (sql); free (quoted_prefix); free (quoted_table); if (ret != SQLITE_OK) return 0; if (rows < 1) ; else { ................................................................................ { spatialite_e ("buildSpatialIndex error: \"%s\"\n", errMsg); sqlite3_free (errMsg); return -1; } return 0; } SPATIALITE_PRIVATE int buildTemporarySpatialIndex (void *p_sqlite, const char *db_prefix, const unsigned char *table, const char *column) { /* loading a SpatialIndex [RTree] */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; char *raw; char *quoted_prefix; char *quoted_rtree; char *quoted_table; char *quoted_column; char *sql_statement; char *errMsg = NULL; int ret; if (!validateTemporaryRowid (sqlite, db_prefix, (const char *) table)) { /* a physical column named "rowid" shadows the real ROWID */ spatialite_e ("buildTemporarySpatialIndex error: a physical column named ROWID shadows the real ROWID\n"); return -2; } raw = sqlite3_mprintf ("idx_%s_%s", table, column); quoted_rtree = gaiaDoubleQuotedSql (raw); sqlite3_free (raw); quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_table = gaiaDoubleQuotedSql ((const char *) table); quoted_column = gaiaDoubleQuotedSql (column); sql_statement = sqlite3_mprintf ("INSERT INTO \"%s\".\"%s\" " "(pkid, xmin, xmax, ymin, ymax) " "SELECT ROWID, MbrMinX(\"%s\"), MbrMaxX(\"%s\"), MbrMinY(\"%s\"), MbrMaxY(\"%s\") " "FROM \"%s\".\"%s\" WHERE MbrMinX(\"%s\") IS NOT NULL", quoted_prefix, quoted_rtree, quoted_column, quoted_column, quoted_column, quoted_column, quoted_prefix, quoted_table, quoted_column); free (quoted_prefix); free (quoted_rtree); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("buildTemporarySpatialIndex error: \"%s\"\n", errMsg); sqlite3_free (errMsg); return -1; } return 0; } SPATIALITE_PRIVATE int getRealSQLnames (void *p_sqlite, const char *table, const char *column, char **real_table, char **real_column) { /* attempting to retrieve the "real" table and column names (upper/lowercase) */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; ................................................................................ sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("real_names: error %d \"%s\"\n", sqlite3_errcode (sqlite), sqlite3_errmsg (sqlite)); free (p_table); return 0; } while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ if (ret == SQLITE_ROW) { name = (const char *) sqlite3_column_text (stmt, 1); len = sqlite3_column_bytes (stmt, 1); if (strcasecmp (name, column) == 0) { if (p_column) free (p_column); p_column = malloc (len + 1); strcpy (p_column, name); } } } sqlite3_finalize (stmt); if (p_column == NULL) { free (p_table); return 0; } *real_table = p_table; *real_column = p_column; return 1; } SPATIALITE_PRIVATE int getRealSQLnamesTemporary (void *p_sqlite, const char *db_prefix, const char *table, const char *column, char **real_table, char **real_column) { /* attempting to retrieve the "real" table and column names (upper/lowercase) */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; char *p_table = NULL; char *p_column = NULL; char *sql_statement; char *prefix; char *quoted; const char *name; int len; sqlite3_stmt *stmt; int ret; if (db_prefix == NULL) return 0; prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("SELECT name " "FROM \"%s\".sqlite_master WHERE type = 'table' " "AND Lower(name) = Lower(?)", prefix); free (prefix); /* compiling SQL prepared statement */ ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement), &stmt, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("real_names temporary: error %d \"%s\"\n", sqlite3_errcode (sqlite), sqlite3_errmsg (sqlite)); return 0; } sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); sqlite3_bind_text (stmt, 1, table, strlen (table), SQLITE_STATIC); while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ if (ret == SQLITE_ROW) { name = (const char *) sqlite3_column_text (stmt, 0); len = sqlite3_column_bytes (stmt, 0); if (p_table) free (p_table); p_table = malloc (len + 1); strcpy (p_table, name); } } sqlite3_finalize (stmt); if (p_table == NULL) return 0; prefix = gaiaDoubleQuotedSql (db_prefix); quoted = gaiaDoubleQuotedSql (p_table); sql_statement = sqlite3_mprintf ("PRAGMA \"%s\".table_info(\"%s\")", prefix, quoted); free (prefix); free (quoted); /* compiling SQL prepared statement */ ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement), &stmt, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("real_names temporary: error %d \"%s\"\n", sqlite3_errcode (sqlite), sqlite3_errmsg (sqlite)); free (p_table); return 0; } while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ |
Changes to src/spatialite/spatialite.c.
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 ... 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 .... 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 .... 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 .... 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 .... 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 ..... 40673 40674 40675 40676 40677 40678 40679 40680 40681 40682 40683 40684 40685 40686 40687 ..... 40700 40701 40702 40703 40704 40705 40706 40707 40708 40709 40710 40711 40712 40713 40714 ..... 40731 40732 40733 40734 40735 40736 40737 40738 40739 40740 40741 40742 40743 40744 40745 ..... 46745 46746 46747 46748 46749 46750 46751 46752 46753 46754 46755 46756 46757 46758 ..... 46893 46894 46895 46896 46897 46898 46899 46900 46901 46902 46903 46904 46905 46906 ..... 46941 46942 46943 46944 46945 46946 46947 46948 46949 46950 46951 46952 46953 46954 ..... 50986 50987 50988 50989 50990 50991 50992 50993 50994 50995 50996 50997 50998 50999 51000 51001 51002 51003 51004 51005 51006 51007 51008 51009 51010 ..... 51800 51801 51802 51803 51804 51805 51806 51807 51808 51809 51810 51811 51812 51813 51814 51815 |
/ or NULL if PROJ.4 is currently unsupported */ #ifndef OMIT_PROJ /* PROJ.4 version */ int len; const char *p_result; #ifdef PROJ_NEW /* supporting new PROJ.6 */ PJ_INFO info = proj_info(); p_result = info.release; #else /* supporting old PROJ.4 */ p_result = pj_get_release (); #endif GAIA_UNUSED (); /* LCOV_EXCL_LINE */ len = strlen (p_result); sqlite3_result_text (context, p_result, len, SQLITE_TRANSIENT); ................................................................................ GAIA_UNUSED (); /* LCOV_EXCL_LINE */ #ifndef OMIT_GEOS /* only if GEOS is enabled */ sqlite3_result_int (context, 1); #else sqlite3_result_int (context, 0); #endif } static void fnct_GeometryConstraints (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / GeometryConstraints(BLOBencoded geometry, geometry-type, srid) ................................................................................ free (table_name); if (ret != SQLITE_OK) sqlite3_result_int (context, 0); else sqlite3_result_int (context, 1); } } static void fnct_IsValidFont (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / IsValidFont(BLOBencoded font) / ................................................................................ without_rowid = 1; } sqlite3_free_table (results2); } sqlite3_free_table (results); return without_rowid; } static int checkDatabase (const sqlite3 * handle, const char *db_prefix) { /* testing if some ATTACHED-DB do really exist */ sqlite3 *sqlite = (sqlite3 *) handle; char *xdb_prefix; ................................................................................ break; }; sql_statement = sqlite3_mprintf ("Geometry [%s,%s,SRID=%d] successfully created", p_type, p_dims, (srid <= 0) ? -1 : srid); updateSpatiaLiteHistory (sqlite, table, column, sql_statement); sqlite3_free (sql_statement); sqlite3_free (p_table); return; error: sqlite3_result_int (context, 0); sqlite3_free (p_table); return; } ................................................................................ { if (is_without_rowid_table (sqlite, (const char *) table)) sqlite3_result_int (context, 1); else sqlite3_result_int (context, 0); } } static void fnct_CreateSpatialIndex (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / CreateSpatialIndex(table, column ) ................................................................................ update_vector_coverage_extent (sqlite, cache, coverage_name, transaction); sqlite3_result_int (context, ret); } static void fnct_RegisterMapConfiguration (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / RL2_RegisterMapConfiguration(BLOB style) / / inserts an RL2 Map Configuration / returns 1 on success / 0 on failure, -1 on invalid arguments ................................................................................ n_bytes = sqlite3_value_bytes (argv[0]); ret = register_map_configuration (sqlite, p_blob, n_bytes); sqlite3_result_int (context, ret); } static void fnct_UnRegisterMapConfiguration (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / UnRegisterMapConfiguration(Integer id ) / or / UnRegisterMapConfiguration(Text name ) / / removes a Map Configuration definition ................................................................................ } ret = unregister_map_configuration (sqlite, id, name); sqlite3_result_int (context, ret); } static void fnct_ReloadMapConfiguration (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / ReloadMapConfiguration(Integer id, BLOB style) / or / ReloadMapConfiguration(Text name, BLOB style) / / updates a Map Configuration definition ................................................................................ fnct_GeometryConstraints, 0, 0, 0); sqlite3_create_function_v2 (db, "GeometryConstraints", 4, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_GeometryConstraints, 0, 0, 0); sqlite3_create_function_v2 (db, "RTreeAlign", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RTreeAlign, 0, 0, 0); sqlite3_create_function_v2 (db, "IsValidFont", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsValidFont, 0, 0, 0); sqlite3_create_function_v2 (db, "CheckFontFaceName", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CheckFontFacename, 0, 0, 0); sqlite3_create_function_v2 (db, "GetFontFamily", 1, ................................................................................ fnct_AddGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "AddGeometryColumn", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AddGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "AddGeometryColumn", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AddGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "RecoverGeometryColumn", 4, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RecoverGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "RecoverGeometryColumn", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RecoverGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "UpgradeGeometryTriggers", 1, ................................................................................ fnct_CheckShadowedRowid, 0, 0, 0); sqlite3_create_function_v2 (db, "CheckWithoutRowid", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CheckWithoutRowid, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateSpatialIndex", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateSpatialIndex, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateMbrCache", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateMbrCache, 0, 0, 0); sqlite3_create_function_v2 (db, "DisableSpatialIndex", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_DisableSpatialIndex, 0, 0, 0); sqlite3_create_function_v2 (db, "RebuildGeometryTriggers", 2, ................................................................................ fnct_ReloadGroupStyle, 0, 0, 0); sqlite3_create_function_v2 (db, "SE_RegisterStyledGroupStyle", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RegisterStyledGroupStyle, 0, 0, 0); sqlite3_create_function_v2 (db, "SE_UnRegisterStyledGroupStyle", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_UnRegisterStyledGroupStyle, 0, 0, 0); sqlite3_create_function_v2 (db, "RL2_RegisterMapConfiguration", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RegisterMapConfiguration, 0, 0, 0); sqlite3_create_function_v2 (db, "RL2_UnRegisterMapConfiguration", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_UnRegisterMapConfiguration, 0, 0, 0); sqlite3_create_function_v2 (db, "RL2_ReloadMapConfiguration", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ReloadMapConfiguration, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateIsoMetadataTables", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateIsoMetadataTables, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateIsoMetadataTables", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateIsoMetadataTables, 0, 0, 0); sqlite3_create_function_v2 (db, "GetIsoMetadataId", 1, ................................................................................ } #ifndef OMIT_PROJ /* PROJ.4 version */ if (verbose) { const char *p_result = "unknown"; #ifdef PROJ_NEW /* supporting new PROJ.6 */ PJ_INFO info = proj_info(); p_result = info.release; #else /* supporting old PROJ.4 */ p_result = pj_get_release (); #endif spatialite_i ("PROJ version ........: %s\n", p_result); } #endif /* end PROJ */ |
| < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > > > > > > > > > > > > | | | | |
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 ... 870 871 872 873 874 875 876 877 878 879 880 881 882 883 .... 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 .... 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 .... 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 .... 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 ..... 41620 41621 41622 41623 41624 41625 41626 41627 41628 41629 41630 41631 41632 41633 41634 ..... 41647 41648 41649 41650 41651 41652 41653 41654 41655 41656 41657 41658 41659 41660 41661 ..... 41678 41679 41680 41681 41682 41683 41684 41685 41686 41687 41688 41689 41690 41691 41692 ..... 47692 47693 47694 47695 47696 47697 47698 47699 47700 47701 47702 47703 47704 47705 47706 47707 47708 ..... 47843 47844 47845 47846 47847 47848 47849 47850 47851 47852 47853 47854 47855 47856 47857 47858 47859 47860 47861 47862 47863 47864 47865 ..... 47900 47901 47902 47903 47904 47905 47906 47907 47908 47909 47910 47911 47912 47913 47914 47915 47916 ..... 51948 51949 51950 51951 51952 51953 51954 51955 51956 51957 51958 51959 51960 51961 51962 51963 51964 51965 51966 51967 51968 51969 51970 51971 51972 ..... 52762 52763 52764 52765 52766 52767 52768 52769 52770 52771 52772 52773 52774 52775 52776 52777 |
/ or NULL if PROJ.4 is currently unsupported */ #ifndef OMIT_PROJ /* PROJ.4 version */ int len; const char *p_result; #ifdef PROJ_NEW /* supporting new PROJ.6 */ PJ_INFO info = proj_info (); p_result = info.release; #else /* supporting old PROJ.4 */ p_result = pj_get_release (); #endif GAIA_UNUSED (); /* LCOV_EXCL_LINE */ len = strlen (p_result); sqlite3_result_text (context, p_result, len, SQLITE_TRANSIENT); ................................................................................ GAIA_UNUSED (); /* LCOV_EXCL_LINE */ #ifndef OMIT_GEOS /* only if GEOS is enabled */ sqlite3_result_int (context, 1); #else sqlite3_result_int (context, 0); #endif } static void fnct_GeometryConstraints (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / GeometryConstraints(BLOBencoded geometry, geometry-type, srid) ................................................................................ free (table_name); if (ret != SQLITE_OK) sqlite3_result_int (context, 0); else sqlite3_result_int (context, 1); } } static void fnct_TemporaryRTreeAlign (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / TemporaryRTreeAlign(db-prefix, RTree-table-name, PKID-value, BLOBencoded geometry) / / attempts to update the associated R*Tree, returning: / / -1 - if some invalid arg was passed / 1 - successful update / 0 - update failure / */ unsigned char *p_blob = NULL; int n_bytes = 0; sqlite3_int64 pkid; const char *db_prefix; const char *rtree_table; char *prefix; char *table_name; int len; char pkv[64]; gaiaGeomCollPtr geom = NULL; int ret; char *sql_statement; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) db_prefix = (const char *) sqlite3_value_text (argv[0]); else { sqlite3_result_int (context, -1); return; } if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) rtree_table = (const char *) sqlite3_value_text (argv[1]); else { sqlite3_result_int (context, -1); return; } if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) pkid = sqlite3_value_int64 (argv[2]); else { sqlite3_result_int (context, -1); return; } if (sqlite3_value_type (argv[3]) == SQLITE_BLOB || sqlite3_value_type (argv[3]) == SQLITE_NULL) ; else { sqlite3_result_int (context, -1); return; } if (sqlite3_value_type (argv[3]) == SQLITE_BLOB) { p_blob = (unsigned char *) sqlite3_value_blob (argv[3]); n_bytes = sqlite3_value_bytes (argv[3]); geom = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); } if (geom == NULL) { /* NULL geometry: nothing to do */ sqlite3_result_int (context, 1); } else { /* INSERTing into the R*Tree */ if (*(rtree_table + 0) == '"' && *(rtree_table + strlen (rtree_table) - 1) == '"') { /* earlier versions may pass an already quoted name */ char *dequoted_table_name; len = strlen (rtree_table); table_name = malloc (len + 1); strcpy (table_name, rtree_table); dequoted_table_name = gaiaDequotedSql (table_name); free (table_name); if (dequoted_table_name == NULL) { sqlite3_result_int (context, -1); return; } table_name = gaiaDoubleQuotedSql (dequoted_table_name); free (dequoted_table_name); } else table_name = gaiaDoubleQuotedSql (rtree_table); prefix = gaiaDoubleQuotedSql (db_prefix); sprintf (pkv, FRMT64, pkid); sql_statement = sqlite3_mprintf ("INSERT INTO \"%s\".\"%s\" (pkid, xmin, ymin, xmax, ymax) " "VALUES (%s, %1.12f, %1.12f, %1.12f, %1.12f)", prefix, table_name, pkv, geom->MinX, geom->MinY, geom->MaxX, geom->MaxY); free (prefix); gaiaFreeGeomColl (geom); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); free (table_name); if (ret != SQLITE_OK) sqlite3_result_int (context, 0); else sqlite3_result_int (context, 1); } } static void fnct_IsValidFont (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / IsValidFont(BLOBencoded font) / ................................................................................ without_rowid = 1; } sqlite3_free_table (results2); } sqlite3_free_table (results); return without_rowid; } static int is_without_rowid_table_attached (sqlite3 * sqlite, const char *db_prefix, const char *table) { /* internal utility functions; checks for WITHOUT ROWID tables */ char *sql; char *xprefix; char *xtable; int ret; int i; char **results; int rows; int columns; int j; char **results2; int rows2; int columns2; char *errMsg = NULL; int without_rowid = 0; if (db_prefix == NULL) return 1; xprefix = gaiaDoubleQuotedSql (db_prefix); xtable = gaiaDoubleQuotedSql (table); sql = sqlite3_mprintf ("PRAGMA \"%s\".index_list(\"%s\")", xprefix, xtable); free (xprefix); free (xtable); ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { sqlite3_free (errMsg); return 1; } xprefix = gaiaDoubleQuotedSql (db_prefix); for (i = 1; i <= rows; i++) { const char *index = results[(i * columns) + 1]; sql = sqlite3_mprintf ("SELECT count(*) FROM \"%s\".sqlite_master WHERE " "type = 'index' AND Lower(tbl_name) = Lower(%Q) " "AND Lower(name) = Lower(%Q)", table, index); ret = sqlite3_get_table (sqlite, sql, &results2, &rows2, &columns2, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { sqlite3_free (errMsg); return 1; } for (j = 1; j <= rows2; j++) { if (atoi (results2[(j * columns2) + 0]) == 0) without_rowid = 1; } sqlite3_free_table (results2); } free (xprefix); sqlite3_free_table (results); return without_rowid; } static int is_attached_memory (sqlite3 * sqlite, const char *db_prefix) { /* internal utility functions; checks if an Attached Database is based on :memory: */ const char *sql; int ret; int i; char **results; int rows; int columns; char *errMsg = NULL; int is_memory = 0; if (db_prefix == NULL) return 0; sql = "PRAGMA database_list"; ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, &errMsg); if (ret != SQLITE_OK) { sqlite3_free (errMsg); return 0; } for (i = 1; i <= rows; i++) { const char *name = results[(i * columns) + 1]; const char *file = results[(i * columns) + 2]; if (strcasecmp (name, db_prefix) == 0) { if (file == NULL || strlen (file) == 0) is_memory = 1; } } sqlite3_free_table (results); return is_memory; } static int checkDatabase (const sqlite3 * handle, const char *db_prefix) { /* testing if some ATTACHED-DB do really exist */ sqlite3 *sqlite = (sqlite3 *) handle; char *xdb_prefix; ................................................................................ break; }; sql_statement = sqlite3_mprintf ("Geometry [%s,%s,SRID=%d] successfully created", p_type, p_dims, (srid <= 0) ? -1 : srid); updateSpatiaLiteHistory (sqlite, table, column, sql_statement); sqlite3_free (sql_statement); sqlite3_free (p_table); return; error: sqlite3_result_int (context, 0); sqlite3_free (p_table); return; } static void fnct_AddTemporaryGeometryColumn (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / AddTemporaryGeometryColumn(db-prefix, table, column, srid, type [ , dimension [ , not-null ] ] ) / / creates a new COLUMN of given TYPE into TABLE / returns 1 on success / 0 on failure / / INTENDED ONLY FOR TEMPORARY ATTACHED DATABASES / */ const char *db_prefix; const char *table; const char *column; const unsigned char *type; const unsigned char *txt_dims; int xtype; int srid = -1; int srid_exists = -1; int dimension = 2; int dims = -1; int auto_dims = -1; char sql[1024]; char *sql2; int ret; int notNull = 0; sqlite3_stmt *stmt; char *p_table = NULL; char *quoted_prefix; char *quoted_table; char *quoted_column; const char *p_type = NULL; const char *p_dims = NULL; int n_type = 0; int n_dims = 0; char *sql_statement; sqlite3 *sqlite = sqlite3_context_db_handle (context); if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 1 [DB-prefix] is not of the String type\n"); sqlite3_result_int (context, 0); return; } db_prefix = (const char *) sqlite3_value_text (argv[0]); if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 2 [table_name] is not of the String type\n"); sqlite3_result_int (context, 0); return; } table = (const char *) sqlite3_value_text (argv[1]); if (sqlite3_value_type (argv[2]) != SQLITE_TEXT) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 3 [column_name] is not of the String type\n"); sqlite3_result_int (context, 0); return; } column = (const char *) sqlite3_value_text (argv[2]); if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 4 [SRID] is not of the Integer type\n"); sqlite3_result_int (context, 0); return; } srid = sqlite3_value_int (argv[3]); if (sqlite3_value_type (argv[4]) != SQLITE_TEXT) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 5 [geometry_type] is not of the String type\n"); sqlite3_result_int (context, 0); return; } type = sqlite3_value_text (argv[4]); if (argc > 5) { if (sqlite3_value_type (argv[5]) == SQLITE_INTEGER) { dimension = sqlite3_value_int (argv[5]); if (dimension == 2) dims = GAIA_XY; if (dimension == 3) dims = GAIA_XY_Z; if (dimension == 4) dims = GAIA_XY_Z_M; } else if (sqlite3_value_type (argv[5]) == SQLITE_TEXT) { txt_dims = sqlite3_value_text (argv[5]); if (strcasecmp ((char *) txt_dims, "XY") == 0) dims = GAIA_XY; if (strcasecmp ((char *) txt_dims, "XYZ") == 0) dims = GAIA_XY_Z; if (strcasecmp ((char *) txt_dims, "XYM") == 0) dims = GAIA_XY_M; if (strcasecmp ((char *) txt_dims, "XYZM") == 0) dims = GAIA_XY_Z_M; } else { spatialite_e ("AddTemporaryGeometryColumn() error: argument 6 [dimension] is not of the Integer or Text type\n"); sqlite3_result_int (context, 0); return; } } if (argc == 7) { /* optional NOT NULL arg */ if (sqlite3_value_type (argv[6]) != SQLITE_INTEGER) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 7 [not null] is not of the Integer type\n"); sqlite3_result_int (context, 0); return; } notNull = sqlite3_value_int (argv[5]); } /* checking if the Attached Database is actually based on :memory: */ if (!is_attached_memory (sqlite, db_prefix)) { spatialite_e ("AddTemporaryGeometryColumn() error: Database '%s' does not exists or is not a Temporary one\n", db_prefix); sqlite3_result_int (context, 0); return; } xtype = GAIA_UNKNOWN; if (strcasecmp ((char *) type, "POINT") == 0) { auto_dims = GAIA_XY; xtype = GAIA_POINT; } if (strcasecmp ((char *) type, "LINESTRING") == 0) { auto_dims = GAIA_XY; xtype = GAIA_LINESTRING; } if (strcasecmp ((char *) type, "POLYGON") == 0) { auto_dims = GAIA_XY; xtype = GAIA_POLYGON; } if (strcasecmp ((char *) type, "MULTIPOINT") == 0) { auto_dims = GAIA_XY; xtype = GAIA_MULTIPOINT; } if (strcasecmp ((char *) type, "MULTILINESTRING") == 0) { auto_dims = GAIA_XY; xtype = GAIA_MULTILINESTRING; } if (strcasecmp ((char *) type, "MULTIPOLYGON") == 0) { auto_dims = GAIA_XY; xtype = GAIA_MULTIPOLYGON; } if (strcasecmp ((char *) type, "GEOMETRYCOLLECTION") == 0) { auto_dims = GAIA_XY; xtype = GAIA_GEOMETRYCOLLECTION; } if (strcasecmp ((char *) type, "GEOMETRY") == 0) { auto_dims = GAIA_XY; xtype = -1; } if (strcasecmp ((char *) type, "POINTZ") == 0) { auto_dims = GAIA_XY_Z; xtype = GAIA_POINT; } if (strcasecmp ((char *) type, "LINESTRINGZ") == 0) { auto_dims = GAIA_XY_Z; xtype = GAIA_LINESTRING; } if (strcasecmp ((char *) type, "POLYGONZ") == 0) { auto_dims = GAIA_XY_Z; xtype = GAIA_POLYGON; } if (strcasecmp ((char *) type, "MULTIPOINTZ") == 0) { auto_dims = GAIA_XY_Z; xtype = GAIA_MULTIPOINT; } if (strcasecmp ((char *) type, "MULTILINESTRINGZ") == 0) { auto_dims = GAIA_XY_Z; xtype = GAIA_MULTILINESTRING; } if (strcasecmp ((char *) type, "MULTIPOLYGONZ") == 0) { auto_dims = GAIA_XY_Z; xtype = GAIA_MULTIPOLYGON; } if (strcasecmp ((char *) type, "GEOMETRYCOLLECTIONZ") == 0) { auto_dims = GAIA_XY_Z; xtype = GAIA_GEOMETRYCOLLECTION; } if (strcasecmp ((char *) type, "GEOMETRYZ") == 0) { auto_dims = GAIA_XY_Z; xtype = -1; } if (strcasecmp ((char *) type, "POINTM") == 0) { auto_dims = GAIA_XY_M; xtype = GAIA_POINT; } if (strcasecmp ((char *) type, "LINESTRINGM") == 0) { auto_dims = GAIA_XY_M; xtype = GAIA_LINESTRING; } if (strcasecmp ((char *) type, "POLYGONM") == 0) { auto_dims = GAIA_XY_M; xtype = GAIA_POLYGON; } if (strcasecmp ((char *) type, "MULTIPOINTM") == 0) { auto_dims = GAIA_XY_M; xtype = GAIA_MULTIPOINT; } if (strcasecmp ((char *) type, "MULTILINESTRINGM") == 0) { auto_dims = GAIA_XY_M; xtype = GAIA_MULTILINESTRING; } if (strcasecmp ((char *) type, "MULTIPOLYGONM") == 0) { auto_dims = GAIA_XY_M; xtype = GAIA_MULTIPOLYGON; } if (strcasecmp ((char *) type, "GEOMETRYCOLLECTIONM") == 0) { auto_dims = GAIA_XY_M; xtype = GAIA_GEOMETRYCOLLECTION; } if (strcasecmp ((char *) type, "GEOMETRYM") == 0) { auto_dims = GAIA_XY_M; xtype = -1; } if (strcasecmp ((char *) type, "POINTZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = GAIA_POINT; } if (strcasecmp ((char *) type, "LINESTRINGZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = GAIA_LINESTRING; } if (strcasecmp ((char *) type, "POLYGONZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = GAIA_POLYGON; } if (strcasecmp ((char *) type, "MULTIPOINTZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = GAIA_MULTIPOINT; } if (strcasecmp ((char *) type, "MULTILINESTRINGZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = GAIA_MULTILINESTRING; } if (strcasecmp ((char *) type, "MULTIPOLYGONZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = GAIA_MULTIPOLYGON; } if (strcasecmp ((char *) type, "GEOMETRYCOLLECTIONZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = GAIA_GEOMETRYCOLLECTION; } if (strcasecmp ((char *) type, "GEOMETRYZM") == 0) { auto_dims = GAIA_XY_Z_M; xtype = -1; } if (xtype == GAIA_UNKNOWN) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 5 [geometry_type] has an illegal value\n"); sqlite3_result_int (context, 0); return; } if (dims < 0) dims = auto_dims; if (dims == GAIA_XY || dims == GAIA_XY_Z || dims == GAIA_XY_M || dims == GAIA_XY_Z_M) ; else { spatialite_e ("AddTemporaryGeometryColumn() error: argument 6 [dimension] ILLEGAL VALUE\n"); sqlite3_result_int (context, 0); return; } if (auto_dims != GAIA_XY && dims != auto_dims) { spatialite_e ("AddTemporaryGeometryColumn() error: argument 6 [dimension] ILLEGAL VALUE\n"); sqlite3_result_int (context, 0); return; } /* checking if the table exists */ quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sql2 = sqlite3_mprintf ("SELECT name FROM \"%s\".sqlite_master WHERE type = 'table' AND Lower(name) = Lower(?)", quoted_prefix); free (quoted_prefix); ret = sqlite3_prepare_v2 (sqlite, sql2, strlen (sql2), &stmt, NULL); sqlite3_free (sql2); if (ret != SQLITE_OK) { spatialite_e ("AddTemporaryGeometryColumn: \"%s\"\n", sqlite3_errmsg (sqlite)); sqlite3_result_int (context, 0); return; } sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); sqlite3_bind_text (stmt, 1, table, strlen (table), SQLITE_STATIC); while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ if (ret == SQLITE_ROW) { if (p_table != NULL) sqlite3_free (p_table); p_table = sqlite3_mprintf ("%s", (const char *) sqlite3_column_text (stmt, 0)); } } sqlite3_finalize (stmt); if (!p_table) { spatialite_e ("AddTemporaryGeometryColumn() error: table '%s' does not exist\n", table); sqlite3_result_int (context, 0); return; } /* checking for WITHOUT ROWID */ if (is_without_rowid_table_attached (sqlite, db_prefix, table)) { spatialite_e ("AddTemporaryGeometryColumn() error: table '%s' is WITHOUT ROWID\n", table); sqlite3_result_int (context, 0); return; } /* trying to add the column */ switch (xtype) { case GAIA_POINT: p_type = "POINT"; break; case GAIA_LINESTRING: p_type = "LINESTRING"; break; case GAIA_POLYGON: p_type = "POLYGON"; break; case GAIA_MULTIPOINT: p_type = "MULTIPOINT"; break; case GAIA_MULTILINESTRING: p_type = "MULTILINESTRING"; break; case GAIA_MULTIPOLYGON: p_type = "MULTIPOLYGON"; break; case GAIA_GEOMETRYCOLLECTION: p_type = "GEOMETRYCOLLECTION"; break; case -1: p_type = "GEOMETRY"; break; }; quoted_prefix = gaiaDoubleQuotedSql (db_prefix); quoted_table = gaiaDoubleQuotedSql (p_table); quoted_column = gaiaDoubleQuotedSql (column); if (notNull) { /* adding a NOT NULL clause */ sql_statement = sqlite3_mprintf ("ALTER TABLE \"%s\".\"%s\" ADD COLUMN \"%s\" " "%s NOT NULL DEFAULT ''", quoted_prefix, quoted_table, quoted_column, p_type); } else sql_statement = sqlite3_mprintf ("ALTER TABLE \"%s\".\"%s\" ADD COLUMN \"%s\" %s ", quoted_prefix, quoted_table, quoted_column, p_type); free (quoted_prefix); free (quoted_table); free (quoted_column); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("AddTemporaryGeometryColumn: \"%s\"\n", sqlite3_errmsg (sqlite)); sqlite3_result_int (context, 0); sqlite3_free (p_table); return; } /* ok, inserting into geometry_columns [Spatial Metadata] */ switch (xtype) { case GAIA_POINT: if (dims == GAIA_XY_Z) n_type = 1001; else if (dims == GAIA_XY_M) n_type = 2001; else if (dims == GAIA_XY_Z_M) n_type = 3001; else n_type = 1; break; case GAIA_LINESTRING: if (dims == GAIA_XY_Z) n_type = 1002; else if (dims == GAIA_XY_M) n_type = 2002; else if (dims == GAIA_XY_Z_M) n_type = 3002; else n_type = 2; break; case GAIA_POLYGON: if (dims == GAIA_XY_Z) n_type = 1003; else if (dims == GAIA_XY_M) n_type = 2003; else if (dims == GAIA_XY_Z_M) n_type = 3003; else n_type = 3; break; case GAIA_MULTIPOINT: if (dims == GAIA_XY_Z) n_type = 1004; else if (dims == GAIA_XY_M) n_type = 2004; else if (dims == GAIA_XY_Z_M) n_type = 3004; else n_type = 4; break; case GAIA_MULTILINESTRING: if (dims == GAIA_XY_Z) n_type = 1005; else if (dims == GAIA_XY_M) n_type = 2005; else if (dims == GAIA_XY_Z_M) n_type = 3005; else n_type = 5; break; case GAIA_MULTIPOLYGON: if (dims == GAIA_XY_Z) n_type = 1006; else if (dims == GAIA_XY_M) n_type = 2006; else if (dims == GAIA_XY_Z_M) n_type = 3006; else n_type = 6; break; case GAIA_GEOMETRYCOLLECTION: if (dims == GAIA_XY_Z) n_type = 1007; else if (dims == GAIA_XY_M) n_type = 2007; else if (dims == GAIA_XY_Z_M) n_type = 3007; else n_type = 7; break; case -1: if (dims == GAIA_XY_Z) n_type = 1000; else if (dims == GAIA_XY_M) n_type = 2000; else if (dims == GAIA_XY_Z_M) n_type = 3000; else n_type = 0; break; }; switch (dims) { case GAIA_XY: n_dims = 2; break; case GAIA_XY_Z: case GAIA_XY_M: n_dims = 3; break; case GAIA_XY_Z_M: n_dims = 4; break; }; /* attempting to create spatial_ref_sys, just in case */ if (!createTemporarySpatialRefSys (sqlite, db_prefix)) { spatialite_e ("AddTemporaryGeometryColumn() error: unable to create \"spatial_ref_sys\" on Database '%s'\n", db_prefix); sqlite3_result_int (context, 0); return; } /* attempting to create geometry_columns, just in case */ if (!createTemporaryGeometryColumns (sqlite, db_prefix)) { spatialite_e ("AddTemporaryGeometryColumn() error: unable to create \"geometry_columns\" on Database '%s'\n", db_prefix); sqlite3_result_int (context, 0); return; } quoted_prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("INSERT INTO \"%s\".geometry_columns " "(f_table_name, f_geometry_column, geometry_type, coord_dimension, " "srid, spatial_index_enabled) VALUES (Lower(?), Lower(?), %d, %d, ?, 0)", quoted_prefix, n_type, n_dims); free (quoted_prefix); ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement), &stmt, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) { spatialite_e ("AddTemporaryGeometryColumn: \"%s\"\n", sqlite3_errmsg (sqlite)); sqlite3_result_int (context, 0); sqlite3_free (p_table); return; } sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); sqlite3_bind_text (stmt, 1, p_table, strlen (p_table), SQLITE_STATIC); sqlite3_bind_text (stmt, 2, column, strlen (column), SQLITE_STATIC); if (srid < 0) sqlite3_bind_int (stmt, 3, -1); else sqlite3_bind_int (stmt, 3, srid); ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) ; else { spatialite_e ("AddTemporaryGeometryColumn() error: \"%s\"\n", sqlite3_errmsg (sqlite)); sqlite3_finalize (stmt); goto error; } sqlite3_finalize (stmt); updateTemporaryGeometryTriggers (sqlite, db_prefix, table, column); sqlite3_result_int (context, 1); switch (xtype) { case GAIA_POINT: p_type = "POINT"; break; case GAIA_LINESTRING: p_type = "LINESTRING"; break; case GAIA_POLYGON: p_type = "POLYGON"; break; case GAIA_MULTIPOINT: p_type = "MULTIPOINT"; break; case GAIA_MULTILINESTRING: p_type = "MULTILINESTRING"; break; case GAIA_MULTIPOLYGON: p_type = "MULTIPOLYGON"; break; case GAIA_GEOMETRYCOLLECTION: p_type = "GEOMETRYCOLLECTION"; break; case -1: p_type = "GEOMETRY"; break; }; switch (dims) { case GAIA_XY: p_dims = "XY"; break; case GAIA_XY_Z: p_dims = "XYZ"; break; case GAIA_XY_M: p_dims = "XYM"; break; case GAIA_XY_Z_M: p_dims = "XYZM"; break; }; sqlite3_free (p_table); return; error: sqlite3_result_int (context, 0); sqlite3_free (p_table); return; } ................................................................................ { if (is_without_rowid_table (sqlite, (const char *) table)) sqlite3_result_int (context, 1); else sqlite3_result_int (context, 0); } } static void fnct_CreateTemporarySpatialIndex (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / CreateTemporarySpatialIndex(db_prefix, table, column ) / / creates a SpatialIndex based on Column and Table / returns 1 on success / 0 on failure */ const char *db_prefix; const char *table; const char *column; char *sql_statement; char sql[1024]; char *prefix; char *errMsg = NULL; int ret; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { spatialite_e ("CreateTemporarySpatialIndex() error: argument 1 [db-prefix] is not of the String type\n"); sqlite3_result_int (context, 0); return; } db_prefix = (const char *) sqlite3_value_text (argv[0]); if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) { spatialite_e ("CreateTemporarySpatialIndex() error: argument 2 [table_name] is not of the String type\n"); sqlite3_result_int (context, 0); return; } table = (const char *) sqlite3_value_text (argv[1]); if (sqlite3_value_type (argv[2]) != SQLITE_TEXT) { spatialite_e ("CreateTemporarySpatialIndex() error: argument 3 [column_name] is not of the String type\n"); sqlite3_result_int (context, 0); return; } column = (const char *) sqlite3_value_text (argv[2]); if (is_without_rowid_table_attached (sqlite, db_prefix, table)) { spatialite_e ("CreateTemporarySpatialIndex() error: table '%s' is WITHOUT ROWID\n", table); sqlite3_result_int (context, -1); return; } /* checking if the Attached Database is actually based on :memory: */ if (!is_attached_memory (sqlite, db_prefix)) { spatialite_e ("CreateTemporarySpatialIndex\n() error: Database '%s' does not exists or is not a Temporary one\n", db_prefix); sqlite3_result_int (context, 0); return; } if (!validateTemporaryRowid (sqlite, db_prefix, table)) { spatialite_e ("CreateTemporarySpatialIndex() error: a physical column named ROWID shadows the real ROWID\n"); sqlite3_result_int (context, -1); return; } prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = sqlite3_mprintf ("UPDATE \"%s\".geometry_columns SET spatial_index_enabled = 1 " "WHERE Upper(f_table_name) = Upper(%Q) AND " "Upper(f_geometry_column) = Upper(%Q) AND spatial_index_enabled = 0", prefix, table, column); free (prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; if (sqlite3_changes (sqlite) == 0) { spatialite_e ("CreateTemporarySpatialIndex() error: either \"%s\".\"%s\" isn't a Geometry column or a SpatialIndex is already defined\n", table, column); sqlite3_result_int (context, 0); return; } updateTemporaryGeometryTriggers (sqlite, db_prefix, table, column); sqlite3_result_int (context, 1); return; error: spatialite_e ("CreateTemporarySpatialIndex() error: \"%s\"\n", errMsg); sqlite3_free (errMsg); sqlite3_result_int (context, 0); return; } static void fnct_CreateSpatialIndex (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / CreateSpatialIndex(table, column ) ................................................................................ update_vector_coverage_extent (sqlite, cache, coverage_name, transaction); sqlite3_result_int (context, ret); } static void fnct_RegisterMapConfiguration (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / RL2_RegisterMapConfiguration(BLOB style) / / inserts an RL2 Map Configuration / returns 1 on success / 0 on failure, -1 on invalid arguments ................................................................................ n_bytes = sqlite3_value_bytes (argv[0]); ret = register_map_configuration (sqlite, p_blob, n_bytes); sqlite3_result_int (context, ret); } static void fnct_UnRegisterMapConfiguration (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / UnRegisterMapConfiguration(Integer id ) / or / UnRegisterMapConfiguration(Text name ) / / removes a Map Configuration definition ................................................................................ } ret = unregister_map_configuration (sqlite, id, name); sqlite3_result_int (context, ret); } static void fnct_ReloadMapConfiguration (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / ReloadMapConfiguration(Integer id, BLOB style) / or / ReloadMapConfiguration(Text name, BLOB style) / / updates a Map Configuration definition ................................................................................ fnct_GeometryConstraints, 0, 0, 0); sqlite3_create_function_v2 (db, "GeometryConstraints", 4, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_GeometryConstraints, 0, 0, 0); sqlite3_create_function_v2 (db, "RTreeAlign", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RTreeAlign, 0, 0, 0); sqlite3_create_function_v2 (db, "TemporaryRTreeAlign", 4, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_TemporaryRTreeAlign, 0, 0, 0); sqlite3_create_function_v2 (db, "IsValidFont", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsValidFont, 0, 0, 0); sqlite3_create_function_v2 (db, "CheckFontFaceName", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CheckFontFacename, 0, 0, 0); sqlite3_create_function_v2 (db, "GetFontFamily", 1, ................................................................................ fnct_AddGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "AddGeometryColumn", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AddGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "AddGeometryColumn", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AddGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "AddTemporaryGeometryColumn", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AddTemporaryGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "AddTemporaryGeometryColumn", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AddTemporaryGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "AddTemporaryGeometryColumn", 7, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AddTemporaryGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "RecoverGeometryColumn", 4, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RecoverGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "RecoverGeometryColumn", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RecoverGeometryColumn, 0, 0, 0); sqlite3_create_function_v2 (db, "UpgradeGeometryTriggers", 1, ................................................................................ fnct_CheckShadowedRowid, 0, 0, 0); sqlite3_create_function_v2 (db, "CheckWithoutRowid", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CheckWithoutRowid, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateSpatialIndex", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateSpatialIndex, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateTemporarySpatialIndex", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateTemporarySpatialIndex, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateMbrCache", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateMbrCache, 0, 0, 0); sqlite3_create_function_v2 (db, "DisableSpatialIndex", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_DisableSpatialIndex, 0, 0, 0); sqlite3_create_function_v2 (db, "RebuildGeometryTriggers", 2, ................................................................................ fnct_ReloadGroupStyle, 0, 0, 0); sqlite3_create_function_v2 (db, "SE_RegisterStyledGroupStyle", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RegisterStyledGroupStyle, 0, 0, 0); sqlite3_create_function_v2 (db, "SE_UnRegisterStyledGroupStyle", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_UnRegisterStyledGroupStyle, 0, 0, 0); sqlite3_create_function_v2 (db, "RL2_RegisterMapConfiguration", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_RegisterMapConfiguration, 0, 0, 0); sqlite3_create_function_v2 (db, "RL2_UnRegisterMapConfiguration", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_UnRegisterMapConfiguration, 0, 0, 0); sqlite3_create_function_v2 (db, "RL2_ReloadMapConfiguration", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ReloadMapConfiguration, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateIsoMetadataTables", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateIsoMetadataTables, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateIsoMetadataTables", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateIsoMetadataTables, 0, 0, 0); sqlite3_create_function_v2 (db, "GetIsoMetadataId", 1, ................................................................................ } #ifndef OMIT_PROJ /* PROJ.4 version */ if (verbose) { const char *p_result = "unknown"; #ifdef PROJ_NEW /* supporting new PROJ.6 */ PJ_INFO info = proj_info (); p_result = info.release; #else /* supporting old PROJ.4 */ p_result = pj_get_release (); #endif spatialite_i ("PROJ version ........: %s\n", p_result); } #endif /* end PROJ */ |
Changes to test/Makefile.am.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
check_PROGRAMS = check_endian \ check_version \ check_init \ check_init2 \ check_init_full \ check_geom_aux \ check_geometry_cols \ check_create \ check_bufovflw \ check_fdo1 \ check_fdo2 \ check_fdo3 \ check_fdo_bufovflw \ check_md5 \ |
> |
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
check_PROGRAMS = check_endian \
check_version \
check_init \
check_init2 \
check_init_full \
check_geom_aux \
check_geometry_cols \
check_tempgeom \
check_create \
check_bufovflw \
check_fdo1 \
check_fdo2 \
check_fdo3 \
check_fdo_bufovflw \
check_md5 \
|
Changes to test/Makefile.in.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ... 467 468 469 470 471 472 473 474 475 476 477 478 479 480 ... 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 ... 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 ... 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 .... 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 .... 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 .... 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 .... 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 .... 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 |
PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = check_endian$(EXEEXT) check_version$(EXEEXT) \ check_init$(EXEEXT) check_init2$(EXEEXT) \ check_init_full$(EXEEXT) check_geom_aux$(EXEEXT) \ check_geometry_cols$(EXEEXT) check_create$(EXEEXT) \ check_bufovflw$(EXEEXT) check_fdo1$(EXEEXT) \ check_fdo2$(EXEEXT) check_fdo3$(EXEEXT) \ check_fdo_bufovflw$(EXEEXT) check_md5$(EXEEXT) \ check_dbf_load$(EXEEXT) check_shp_load$(EXEEXT) \ check_shp_load_3d$(EXEEXT) shape_cp1252$(EXEEXT) \ shape_primitives$(EXEEXT) shape_utf8_1$(EXEEXT) \ shape_utf8_1ex$(EXEEXT) shape_utf8_2$(EXEEXT) \ shape_3d$(EXEEXT) check_clone_table$(EXEEXT) \ check_xls_load$(EXEEXT) check_math_funcs$(EXEEXT) \ ................................................................................ check_srid_fncts_LDADD = $(LDADD) check_stored_proc_SOURCES = check_stored_proc.c check_stored_proc_OBJECTS = check_stored_proc.$(OBJEXT) check_stored_proc_LDADD = $(LDADD) check_styling_SOURCES = check_styling.c check_styling_OBJECTS = check_styling.$(OBJEXT) check_styling_LDADD = $(LDADD) check_topology2d_SOURCES = check_topology2d.c check_topology2d_OBJECTS = check_topology2d.$(OBJEXT) check_topology2d_LDADD = $(LDADD) check_topology3d_SOURCES = check_topology3d.c check_topology3d_OBJECTS = check_topology3d.$(OBJEXT) check_topology3d_LDADD = $(LDADD) check_toponoface2d_SOURCES = check_toponoface2d.c ................................................................................ ./$(DEPDIR)/check_spatialindex.Po \ ./$(DEPDIR)/check_sql_stmt.Po \ ./$(DEPDIR)/check_sql_stmt_extension.Po \ ./$(DEPDIR)/check_sql_stmt_legacy.Po \ ./$(DEPDIR)/check_sql_stmt_tiny.Po \ ./$(DEPDIR)/check_srid_fncts.Po \ ./$(DEPDIR)/check_stored_proc.Po ./$(DEPDIR)/check_styling.Po \ ./$(DEPDIR)/check_topology2d.Po \ ./$(DEPDIR)/check_topology3d.Po \ ./$(DEPDIR)/check_toponoface2d.Po \ ./$(DEPDIR)/check_topoplus.Po ./$(DEPDIR)/check_toposnap.Po \ ./$(DEPDIR)/check_version.Po \ ./$(DEPDIR)/check_virtual_ovflw.Po \ ./$(DEPDIR)/check_virtualbbox.Po \ ./$(DEPDIR)/check_virtualelem.Po \ ................................................................................ check_md5.c check_metacatalog.c check_multithread.c \ check_network2d.c check_network3d.c check_network_log.c \ check_recover_geom.c check_relations_fncts.c check_sequence.c \ check_shp_load.c check_shp_load_3d.c check_spatialindex.c \ check_sql_stmt.c check_sql_stmt_extension.c \ check_sql_stmt_legacy.c check_sql_stmt_tiny.c \ check_srid_fncts.c check_stored_proc.c check_styling.c \ check_topology2d.c check_topology3d.c check_toponoface2d.c \ check_topoplus.c check_toposnap.c check_version.c \ check_virtual_ovflw.c check_virtualbbox.c check_virtualelem.c \ check_virtualknn.c check_virtualtable1.c check_virtualtable2.c \ check_virtualtable3.c check_virtualtable4.c \ check_virtualtable5.c check_virtualtable6.c \ check_virtualxpath.c check_wfsin.c check_wms.c \ check_xls_load.c geojson_test.c routing_test.c shape_3d.c \ shape_cp1252.c shape_primitives.c shape_utf8_1.c \ shape_utf8_1ex.c shape_utf8_2.c DIST_SOURCES = check_add_tile_triggers.c \ check_add_tile_triggers_bad_table_name.c check_bufovflw.c \ check_clone_table.c check_control_points.c check_create.c \ check_createBaseTables.c check_cutter.c check_dbf_load.c \ check_drop_rename.c check_dxf.c check_endian.c check_exif.c \ check_exif2.c check_extension.c check_extra_relations_fncts.c \ ................................................................................ check_md5.c check_metacatalog.c check_multithread.c \ check_network2d.c check_network3d.c check_network_log.c \ check_recover_geom.c check_relations_fncts.c check_sequence.c \ check_shp_load.c check_shp_load_3d.c check_spatialindex.c \ check_sql_stmt.c check_sql_stmt_extension.c \ check_sql_stmt_legacy.c check_sql_stmt_tiny.c \ check_srid_fncts.c check_stored_proc.c check_styling.c \ check_topology2d.c check_topology3d.c check_toponoface2d.c \ check_topoplus.c check_toposnap.c check_version.c \ check_virtual_ovflw.c check_virtualbbox.c check_virtualelem.c \ check_virtualknn.c check_virtualtable1.c check_virtualtable2.c \ check_virtualtable3.c check_virtualtable4.c \ check_virtualtable5.c check_virtualtable6.c \ check_virtualxpath.c check_wfsin.c check_wms.c \ check_xls_load.c geojson_test.c routing_test.c shape_3d.c \ shape_cp1252.c shape_primitives.c shape_utf8_1.c \ shape_utf8_1ex.c shape_utf8_2.c RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ ................................................................................ check_stored_proc$(EXEEXT): $(check_stored_proc_OBJECTS) $(check_stored_proc_DEPENDENCIES) $(EXTRA_check_stored_proc_DEPENDENCIES) @rm -f check_stored_proc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_stored_proc_OBJECTS) $(check_stored_proc_LDADD) $(LIBS) check_styling$(EXEEXT): $(check_styling_OBJECTS) $(check_styling_DEPENDENCIES) $(EXTRA_check_styling_DEPENDENCIES) @rm -f check_styling$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_styling_OBJECTS) $(check_styling_LDADD) $(LIBS) check_topology2d$(EXEEXT): $(check_topology2d_OBJECTS) $(check_topology2d_DEPENDENCIES) $(EXTRA_check_topology2d_DEPENDENCIES) @rm -f check_topology2d$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_topology2d_OBJECTS) $(check_topology2d_LDADD) $(LIBS) check_topology3d$(EXEEXT): $(check_topology3d_OBJECTS) $(check_topology3d_DEPENDENCIES) $(EXTRA_check_topology3d_DEPENDENCIES) @rm -f check_topology3d$(EXEEXT) ................................................................................ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt_extension.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt_legacy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt_tiny.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_srid_fncts.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_stored_proc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_styling.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topology2d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topology3d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_toponoface2d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topoplus.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_toposnap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_version.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_virtual_ovflw.Po@am__quote@ # am--include-marker ................................................................................ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) check_geometry_cols.log: check_geometry_cols$(EXEEXT) @p='check_geometry_cols$(EXEEXT)'; \ b='check_geometry_cols'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) check_create.log: check_create$(EXEEXT) @p='check_create$(EXEEXT)'; \ b='check_create'; \ ................................................................................ -rm -f ./$(DEPDIR)/check_sql_stmt.Po -rm -f ./$(DEPDIR)/check_sql_stmt_extension.Po -rm -f ./$(DEPDIR)/check_sql_stmt_legacy.Po -rm -f ./$(DEPDIR)/check_sql_stmt_tiny.Po -rm -f ./$(DEPDIR)/check_srid_fncts.Po -rm -f ./$(DEPDIR)/check_stored_proc.Po -rm -f ./$(DEPDIR)/check_styling.Po -rm -f ./$(DEPDIR)/check_topology2d.Po -rm -f ./$(DEPDIR)/check_topology3d.Po -rm -f ./$(DEPDIR)/check_toponoface2d.Po -rm -f ./$(DEPDIR)/check_topoplus.Po -rm -f ./$(DEPDIR)/check_toposnap.Po -rm -f ./$(DEPDIR)/check_version.Po -rm -f ./$(DEPDIR)/check_virtual_ovflw.Po ................................................................................ -rm -f ./$(DEPDIR)/check_sql_stmt.Po -rm -f ./$(DEPDIR)/check_sql_stmt_extension.Po -rm -f ./$(DEPDIR)/check_sql_stmt_legacy.Po -rm -f ./$(DEPDIR)/check_sql_stmt_tiny.Po -rm -f ./$(DEPDIR)/check_srid_fncts.Po -rm -f ./$(DEPDIR)/check_stored_proc.Po -rm -f ./$(DEPDIR)/check_styling.Po -rm -f ./$(DEPDIR)/check_topology2d.Po -rm -f ./$(DEPDIR)/check_topology3d.Po -rm -f ./$(DEPDIR)/check_toponoface2d.Po -rm -f ./$(DEPDIR)/check_topoplus.Po -rm -f ./$(DEPDIR)/check_toposnap.Po -rm -f ./$(DEPDIR)/check_version.Po -rm -f ./$(DEPDIR)/check_virtual_ovflw.Po |
| | | > > > | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > |
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ... 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 ... 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 ... 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 ... 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 .... 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 .... 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 .... 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 .... 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 .... 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 |
PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = check_endian$(EXEEXT) check_version$(EXEEXT) \ check_init$(EXEEXT) check_init2$(EXEEXT) \ check_init_full$(EXEEXT) check_geom_aux$(EXEEXT) \ check_geometry_cols$(EXEEXT) check_tempgeom$(EXEEXT) \ check_create$(EXEEXT) check_bufovflw$(EXEEXT) \ check_fdo1$(EXEEXT) check_fdo2$(EXEEXT) check_fdo3$(EXEEXT) \ check_fdo_bufovflw$(EXEEXT) check_md5$(EXEEXT) \ check_dbf_load$(EXEEXT) check_shp_load$(EXEEXT) \ check_shp_load_3d$(EXEEXT) shape_cp1252$(EXEEXT) \ shape_primitives$(EXEEXT) shape_utf8_1$(EXEEXT) \ shape_utf8_1ex$(EXEEXT) shape_utf8_2$(EXEEXT) \ shape_3d$(EXEEXT) check_clone_table$(EXEEXT) \ check_xls_load$(EXEEXT) check_math_funcs$(EXEEXT) \ ................................................................................ check_srid_fncts_LDADD = $(LDADD) check_stored_proc_SOURCES = check_stored_proc.c check_stored_proc_OBJECTS = check_stored_proc.$(OBJEXT) check_stored_proc_LDADD = $(LDADD) check_styling_SOURCES = check_styling.c check_styling_OBJECTS = check_styling.$(OBJEXT) check_styling_LDADD = $(LDADD) check_tempgeom_SOURCES = check_tempgeom.c check_tempgeom_OBJECTS = check_tempgeom.$(OBJEXT) check_tempgeom_LDADD = $(LDADD) check_topology2d_SOURCES = check_topology2d.c check_topology2d_OBJECTS = check_topology2d.$(OBJEXT) check_topology2d_LDADD = $(LDADD) check_topology3d_SOURCES = check_topology3d.c check_topology3d_OBJECTS = check_topology3d.$(OBJEXT) check_topology3d_LDADD = $(LDADD) check_toponoface2d_SOURCES = check_toponoface2d.c ................................................................................ ./$(DEPDIR)/check_spatialindex.Po \ ./$(DEPDIR)/check_sql_stmt.Po \ ./$(DEPDIR)/check_sql_stmt_extension.Po \ ./$(DEPDIR)/check_sql_stmt_legacy.Po \ ./$(DEPDIR)/check_sql_stmt_tiny.Po \ ./$(DEPDIR)/check_srid_fncts.Po \ ./$(DEPDIR)/check_stored_proc.Po ./$(DEPDIR)/check_styling.Po \ ./$(DEPDIR)/check_tempgeom.Po ./$(DEPDIR)/check_topology2d.Po \ ./$(DEPDIR)/check_topology3d.Po \ ./$(DEPDIR)/check_toponoface2d.Po \ ./$(DEPDIR)/check_topoplus.Po ./$(DEPDIR)/check_toposnap.Po \ ./$(DEPDIR)/check_version.Po \ ./$(DEPDIR)/check_virtual_ovflw.Po \ ./$(DEPDIR)/check_virtualbbox.Po \ ./$(DEPDIR)/check_virtualelem.Po \ ................................................................................ check_md5.c check_metacatalog.c check_multithread.c \ check_network2d.c check_network3d.c check_network_log.c \ check_recover_geom.c check_relations_fncts.c check_sequence.c \ check_shp_load.c check_shp_load_3d.c check_spatialindex.c \ check_sql_stmt.c check_sql_stmt_extension.c \ check_sql_stmt_legacy.c check_sql_stmt_tiny.c \ check_srid_fncts.c check_stored_proc.c check_styling.c \ check_tempgeom.c check_topology2d.c check_topology3d.c \ check_toponoface2d.c check_topoplus.c check_toposnap.c \ check_version.c check_virtual_ovflw.c check_virtualbbox.c \ check_virtualelem.c check_virtualknn.c check_virtualtable1.c \ check_virtualtable2.c check_virtualtable3.c \ check_virtualtable4.c check_virtualtable5.c \ check_virtualtable6.c check_virtualxpath.c check_wfsin.c \ check_wms.c check_xls_load.c geojson_test.c routing_test.c \ shape_3d.c shape_cp1252.c shape_primitives.c shape_utf8_1.c \ shape_utf8_1ex.c shape_utf8_2.c DIST_SOURCES = check_add_tile_triggers.c \ check_add_tile_triggers_bad_table_name.c check_bufovflw.c \ check_clone_table.c check_control_points.c check_create.c \ check_createBaseTables.c check_cutter.c check_dbf_load.c \ check_drop_rename.c check_dxf.c check_endian.c check_exif.c \ check_exif2.c check_extension.c check_extra_relations_fncts.c \ ................................................................................ check_md5.c check_metacatalog.c check_multithread.c \ check_network2d.c check_network3d.c check_network_log.c \ check_recover_geom.c check_relations_fncts.c check_sequence.c \ check_shp_load.c check_shp_load_3d.c check_spatialindex.c \ check_sql_stmt.c check_sql_stmt_extension.c \ check_sql_stmt_legacy.c check_sql_stmt_tiny.c \ check_srid_fncts.c check_stored_proc.c check_styling.c \ check_tempgeom.c check_topology2d.c check_topology3d.c \ check_toponoface2d.c check_topoplus.c check_toposnap.c \ check_version.c check_virtual_ovflw.c check_virtualbbox.c \ check_virtualelem.c check_virtualknn.c check_virtualtable1.c \ check_virtualtable2.c check_virtualtable3.c \ check_virtualtable4.c check_virtualtable5.c \ check_virtualtable6.c check_virtualxpath.c check_wfsin.c \ check_wms.c check_xls_load.c geojson_test.c routing_test.c \ shape_3d.c shape_cp1252.c shape_primitives.c shape_utf8_1.c \ shape_utf8_1ex.c shape_utf8_2.c RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ ................................................................................ check_stored_proc$(EXEEXT): $(check_stored_proc_OBJECTS) $(check_stored_proc_DEPENDENCIES) $(EXTRA_check_stored_proc_DEPENDENCIES) @rm -f check_stored_proc$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_stored_proc_OBJECTS) $(check_stored_proc_LDADD) $(LIBS) check_styling$(EXEEXT): $(check_styling_OBJECTS) $(check_styling_DEPENDENCIES) $(EXTRA_check_styling_DEPENDENCIES) @rm -f check_styling$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_styling_OBJECTS) $(check_styling_LDADD) $(LIBS) check_tempgeom$(EXEEXT): $(check_tempgeom_OBJECTS) $(check_tempgeom_DEPENDENCIES) $(EXTRA_check_tempgeom_DEPENDENCIES) @rm -f check_tempgeom$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_tempgeom_OBJECTS) $(check_tempgeom_LDADD) $(LIBS) check_topology2d$(EXEEXT): $(check_topology2d_OBJECTS) $(check_topology2d_DEPENDENCIES) $(EXTRA_check_topology2d_DEPENDENCIES) @rm -f check_topology2d$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_topology2d_OBJECTS) $(check_topology2d_LDADD) $(LIBS) check_topology3d$(EXEEXT): $(check_topology3d_OBJECTS) $(check_topology3d_DEPENDENCIES) $(EXTRA_check_topology3d_DEPENDENCIES) @rm -f check_topology3d$(EXEEXT) ................................................................................ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt_extension.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt_legacy.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt_tiny.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_srid_fncts.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_stored_proc.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_styling.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_tempgeom.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topology2d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topology3d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_toponoface2d.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topoplus.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_toposnap.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_version.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_virtual_ovflw.Po@am__quote@ # am--include-marker ................................................................................ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) check_geometry_cols.log: check_geometry_cols$(EXEEXT) @p='check_geometry_cols$(EXEEXT)'; \ b='check_geometry_cols'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) check_tempgeom.log: check_tempgeom$(EXEEXT) @p='check_tempgeom$(EXEEXT)'; \ b='check_tempgeom'; \ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) check_create.log: check_create$(EXEEXT) @p='check_create$(EXEEXT)'; \ b='check_create'; \ ................................................................................ -rm -f ./$(DEPDIR)/check_sql_stmt.Po -rm -f ./$(DEPDIR)/check_sql_stmt_extension.Po -rm -f ./$(DEPDIR)/check_sql_stmt_legacy.Po -rm -f ./$(DEPDIR)/check_sql_stmt_tiny.Po -rm -f ./$(DEPDIR)/check_srid_fncts.Po -rm -f ./$(DEPDIR)/check_stored_proc.Po -rm -f ./$(DEPDIR)/check_styling.Po -rm -f ./$(DEPDIR)/check_tempgeom.Po -rm -f ./$(DEPDIR)/check_topology2d.Po -rm -f ./$(DEPDIR)/check_topology3d.Po -rm -f ./$(DEPDIR)/check_toponoface2d.Po -rm -f ./$(DEPDIR)/check_topoplus.Po -rm -f ./$(DEPDIR)/check_toposnap.Po -rm -f ./$(DEPDIR)/check_version.Po -rm -f ./$(DEPDIR)/check_virtual_ovflw.Po ................................................................................ -rm -f ./$(DEPDIR)/check_sql_stmt.Po -rm -f ./$(DEPDIR)/check_sql_stmt_extension.Po -rm -f ./$(DEPDIR)/check_sql_stmt_legacy.Po -rm -f ./$(DEPDIR)/check_sql_stmt_tiny.Po -rm -f ./$(DEPDIR)/check_srid_fncts.Po -rm -f ./$(DEPDIR)/check_stored_proc.Po -rm -f ./$(DEPDIR)/check_styling.Po -rm -f ./$(DEPDIR)/check_tempgeom.Po -rm -f ./$(DEPDIR)/check_topology2d.Po -rm -f ./$(DEPDIR)/check_topology3d.Po -rm -f ./$(DEPDIR)/check_toponoface2d.Po -rm -f ./$(DEPDIR)/check_topoplus.Po -rm -f ./$(DEPDIR)/check_toposnap.Po -rm -f ./$(DEPDIR)/check_version.Po -rm -f ./$(DEPDIR)/check_virtual_ovflw.Po |
Added test/check_tempgeom.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
/* check_tempgeom.c -- SpatiaLite Test Case Author: Sandro Furieri <a.furieri@lqt.it> ------------------------------------------------------------------------------ Version: MPL 1.1/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is the SpatiaLite library The Initial Developer of the Original Code is Alessandro Furieri Portions created by the Initial Developer are Copyright (C) 2020 the Initial Developer. All Rights Reserved. Contributor(s): Alternatively, the contents of this file may be used under the terms of either the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the MPL, the GPL or the LGPL. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "sqlite3.h" #include "spatialite.h" static int sql_test (sqlite3 * handle, const char *sql) { /* executing an SQL test returning a value */ int retval = 0; char *err_msg = NULL; char **results; int rows; int columns; int ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "Error: %s\n", err_msg); sqlite3_free (err_msg); retval = -1; goto stop; } if ((rows != 1) || (columns != 1)) { fprintf (stderr, "Unexpected rows/columns: %i/%i.\n", rows, columns); retval = -2; goto stop; } retval = atoi (results[1]); stop: sqlite3_free_table (results); return retval; } int main (int argc, char *argv[]) { int retval = 0; int ret; sqlite3 *handle; const char *sql; sqlite3_stmt *stmt = NULL; char *err_msg = NULL; char **results; int rows; int columns; void *cache = spatialite_alloc_connection (); if (argc > 1 || argv[0] == NULL) argc = 1; /* silencing stupid compiler warnings */ ret = sqlite3_open_v2 (":memory:", &handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { fprintf (stderr, "cannot open in-memory db: %s\n", sqlite3_errmsg (handle)); sqlite3_close (handle); return -1; } spatialite_init_ex (handle, cache, 0); ret = sqlite3_exec (handle, "SELECT InitSpatialMetadataFull(1)", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "InitSpatialMetadataFull() error: %s\n", err_msg); sqlite3_free (err_msg); retval = -2; goto stop; } /* basic tests expecting SUCESS */ ret = sqlite3_exec (handle, "ATTACH DATABASE ':memory:' AS t", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "ATTACH DATABASE #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -3; goto stop; } ret = sqlite3_exec (handle, "CREATE TABLE t.point_test (id INTEGER PRIMARY KEY, name TEXT)", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "CREATE TABLE #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -4; goto stop; } ret = sqlite3_exec (handle, "SELECT AddTemporaryGeometryColumn('t', 'point_test', 'geom', 4326, 'POINT', 'XY')", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "AddTemporaryGeometryColumn #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -5; goto stop; } ret = sqlite3_exec (handle, "INSERT INTO t.point_test (id, name, geom) VALUES (NULL, 'one', MakePoint(11.50, 22.50, 4326))", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "INSERT INTO #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -6; goto stop; } ret = sqlite3_exec (handle, "INSERT INTO t.point_test (id, name, geom) VALUES (NULL, 'two', MakePoint(33.50, 44.50, 4326))", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "INSERT INTO #2 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -7; goto stop; } ret = sqlite3_exec (handle, "INSERT INTO t.point_test (id, name, geom) VALUES (NULL, 'three', MakePoint(55.50, 66.50, 4326))", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "INSERT INTO #3 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -8; goto stop; } ret = sqlite3_exec (handle, "SELECT CreateTemporarySpatialIndex('t', 'point_test', 'geom')", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "CreateTemporarySpatialIndex #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -9; goto stop; } ret = sqlite3_exec (handle, "INSERT INTO t.point_test (id, name, geom) VALUES (NULL, 'four', MakePoint(77.50, 88.50, 4326))", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "INSERT INTO #4 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -10; goto stop; } ret = sqlite3_exec (handle, "INSERT INTO t.point_test (id, name, geom) VALUES (NULL, 'five', MakePoint(99.0, -99.0, 4326))", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "INSERT INTO #5 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -11; goto stop; } ret = sqlite3_exec (handle, "UPDATE t.point_test SET geom = MakePoint(-33.50, -44.50, 4326) WHERE id = 2", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "UPDATE #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -12; goto stop; } ret = sqlite3_exec (handle, "DELETE FROM t.point_test WHERE id = 3", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "DELETE #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -13; goto stop; } /* checking the Spatial Index */ sql = "SELECT pkid, xmin, ymin FROM t.idx_point_test_geom ORDER BY pkid"; ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); if (ret != SQLITE_OK) { fprintf (stderr, "PREPARED STATEMENT #1 error: %s\n", sqlite3_errmsg (handle)); sqlite3_free (err_msg); retval = -14; goto stop; } while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; /* end of result set */ if (ret == SQLITE_ROW) { int id = sqlite3_column_int (stmt, 0); double x = sqlite3_column_double (stmt, 1); double y = sqlite3_column_double (stmt, 2); if (id >= 1 && id <= 5 && id != 3) { int err = 0; if (id == 1) { if (x != 11.50) err = 1; if (y != 22.50) err = 1; } if (id == 2) { if (x != -33.50) err = 1; if (y != -44.50) err = 1; } if (id == 4) { if (x != 77.50) err = 1; if (y != 88.50) err = 1; } if (id == 5) { if (x != 99.0) err = 1; if (y != -99.0) err = 1; } if (err) { fprintf (stderr, "SpatialIndex error: ID=%d unexpected X=%f Y=%f\n", id, x, y); sqlite3_free (err_msg); retval = -15; goto stop; } } else { fprintf (stderr, "SpatialIndex error: unexpected ID=%d\n", id); sqlite3_free (err_msg); retval = -16; goto stop; } } else { fprintf (stderr, "STEP #1 error: %s\n", err_msg); sqlite3_free (err_msg); retval = -17; goto stop; } } sqlite3_finalize (stmt); stmt = NULL; /* testing bad arguments: AddTemporaryGeometryColumn */ sql = "SELECT AddTemporaryGeometryColumn(NULL, 'table', 'geom', 3003, 'POLYGON', 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #1: %d\n", ret); retval = -18; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('t', NULL, 'geom', 3003, 'POLYGON', 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #2: %d\n", ret); retval = -19; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('t', 'table', NULL, 3003, 'POLYGON', 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #3: %d\n", ret); retval = -20; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('t', 'table', 'geom', NULL, 'POLYGON', 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #4: %d\n", ret); retval = -21; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('t', 'table', 'geom', 3003, NULL, 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #5: %d\n", ret); retval = -22; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('t', 'table', 'geom', 3003, 'POLYGON', NULL)"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #6: %d\n", ret); retval = -23; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('t', 'table', 'geom', 3003, 'POLYGON', 'XY', 'true')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #7: %d\n", ret); retval = -24; goto stop; } /* testing bad arguments: CreateTemporarySpatialIndex */ sql = "SELECT CreateTemporarySpatialIndex(NULL, 'table', 'geom')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result CreateTemporarySpatialIndex #1: %d\n", ret); retval = -25; goto stop; } sql = "SELECT CreateTemporarySpatialIndex('t', NULL, 'geom')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result CreateTemporarySpatialIndex #2: %d\n", ret); retval = -26; goto stop; } sql = "SELECT CreateTemporarySpatialIndex('t', 'table', NULL)"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result CreateTemporarySpatialIndex #3: %d\n", ret); retval = -27; goto stop; } /* testing invalid arguments: CreateTemporarySpatialIndex */ sql = "SELECT AddTemporaryGeometryColumn('a', 'table', 'geom', 3003, 'POLYGON', 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #8: %d\n", ret); retval = -28; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('t', 'table', 'geom', 123456, 'POLYGON', 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #9: %d\n", ret); retval = -29; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('a', 'table', 'geom', 3003, 71, 'XY')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #10: %d\n", ret); retval = -30; goto stop; } sql = "SELECT AddTemporaryGeometryColumn('a', 'table', 'geom', 3003, 'POLYGON', 17)"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result AddTemporaryGeometryColumn #11: %d\n", ret); retval = -31; goto stop; } /* testing invalid arguments: CreateTemporarySpatialIndex */ sql = "SELECT CreateTemporarySpatialIndex('a', 'table', 'geom')"; ret = sql_test (handle, sql); if (ret != -1) { fprintf (stderr, "Unexpected result CreateTemporarySpatialIndex #4: %d\n", ret); retval = -32; goto stop; } sql = "SELECT CreateTemporarySpatialIndex('t', 'table', 'geom2')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result CreateTemporarySpatialIndex #5: %d\n", ret); retval = -33; goto stop; } sql = "SELECT CreateTemporarySpatialIndex('t', 'table', 'geom')"; ret = sql_test (handle, sql); if (ret != 0) { fprintf (stderr, "Unexpected result CreateTemporarySpatialIndex #6: %d\n", ret); retval = -34; goto stop; } stop: if (stmt != NULL) sqlite3_finalize (stmt); ret = sqlite3_close (handle); if (ret != SQLITE_OK) { fprintf (stderr, "sqlite3_close() error: %s\n", sqlite3_errmsg (handle)); retval = -23; } spatialite_cleanup_ex (cache); spatialite_shutdown (); return retval; } |
Changes to test/sql_stmt_tests/Makefile.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
AS = as
AUTOCONF = autoconf
AUTOHEADER = autoheader
AUTOMAKE = automake-1.16
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2 -fprofile-arcs -ftest-coverage -g
CPP = gcc -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
|
| |
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
AS = as
AUTOCONF = autoconf
AUTOHEADER = autoheader
AUTOMAKE = automake-1.16
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -Wall -Wextra -Wunused -pedantic -g -O0 -fprofile-arcs -ftest-coverage -g
CPP = gcc -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
|