1 /*
2  spatialite.h -- Gaia spatial support for SQLite
3 
4  version 5.0, 2020 August 1
5 
6  Author: Sandro Furieri a.furieri@lqt.it
7 
8  ------------------------------------------------------------------------------
9 
10  Version: MPL 1.1/GPL 2.0/LGPL 2.1
11 
12  The contents of this file are subject to the Mozilla Public License Version
13  1.1 (the "License"); you may not use this file except in compliance with
14  the License. You may obtain a copy of the License at
15  http://www.mozilla.org/MPL/
16 
17 Software distributed under the License is distributed on an "AS IS" basis,
18 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19 for the specific language governing rights and limitations under the
20 License.
21 
22 The Original Code is the SpatiaLite library
23 
24 The Initial Developer of the Original Code is Alessandro Furieri
25 
26 Portions created by the Initial Developer are Copyright (C) 2008-2021
27 the Initial Developer. All Rights Reserved.
28 
29 Contributor(s):
30 
31 Alternatively, the contents of this file may be used under the terms of
32 either the GNU General Public License Version 2 or later (the "GPL"), or
33 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
34 in which case the provisions of the GPL or the LGPL are applicable instead
35 of those above. If you wish to allow use of your version of this file only
36 under the terms of either the GPL or the LGPL, and not to allow others to
37 use your version of this file under the terms of the MPL, indicate your
38 decision by deleting the provisions above and replace them with the notice
39 and other provisions required by the GPL or the LGPL. If you do not delete
40 the provisions above, a recipient may use your version of this file under
41 the terms of any one of the MPL, the GPL or the LGPL.
42 
43 */
44 
45 #include <time.h>
46 #include <stdarg.h>
47 
48 #include <zlib.h>
49 
50 #include "spatialite/gg_sequence.h"
51 #include "spatialite/sqlite.h"
52 
53 /**
54  \file spatialite_private.h
55 
56  SpatiaLite private header file
57  */
58 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59 #ifdef _WIN32
60 #ifdef DLL_EXPORT
61 #define SPATIALITE_PRIVATE
62 #else
63 #define SPATIALITE_PRIVATE
64 #endif
65 #else
66 #define SPATIALITE_PRIVATE __attribute__ ((visibility("hidden")))
67 #endif
68 #endif
69 
70 #ifndef _SPATIALITE_PRIVATE_H
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72 #define _SPATIALITE_PRIVATE_H
73 #endif
74 
75 #ifdef __cplusplus
76 extern "C"
77 {
78 #endif
79 
80 /** spatial_ref_sys_init2: will create the "spatial_ref_sys" table
81  and will populate this table with any supported EPSG SRID definition */
82 #define GAIA_EPSG_ANY -9999
83 /** spatial_ref_sys_init2: will create the "spatial_ref_sys" table
84  and will populate this table only inserting WGS84-related definitions */
85 #define GAIA_EPSG_WGS84_ONLY -9998
86 /** spatial_ref_sys_init2: will create the "spatial_ref_sys" table
87  but will avoid to insert any row at all */
88 #define GAIA_EPSG_NONE -9997
89 
90 #define SPATIALITE_STATISTICS_GENUINE	1
91 #define SPATIALITE_STATISTICS_VIEWS	2
92 #define SPATIALITE_STATISTICS_VIRTS	3
93 #define SPATIALITE_STATISTICS_LEGACY	4
94 
95 #define SPATIALITE_CACHE_MAGIC1	0xf8
96 #define SPATIALITE_CACHE_MAGIC2 0x8f
97 
98     struct vxpath_ns
99     {
100 	/* a Namespace definition */
101 	char *Prefix;
102 	char *Href;
103 	struct vxpath_ns *Next;
104     };
105 
106     struct vxpath_namespaces
107     {
108 	/* Namespace container */
109 	struct vxpath_ns *First;
110 	struct vxpath_ns *Last;
111     };
112 
113     struct splite_geos_cache_item
114     {
115 	unsigned char gaiaBlob[64];
116 	int gaiaBlobSize;
117 	uLong crc32;
118 	void *geosGeom;
119 	void *preparedGeosGeom;
120     };
121 
122     struct splite_xmlSchema_cache_item
123     {
124 	time_t timestamp;
125 	char *schemaURI;
126 	void *schemaDoc;
127 	void *parserCtxt;
128 	void *schema;
129     };
130 
131     struct splite_savepoint
132     {
133 	char *savepoint_name;
134 	struct splite_savepoint *prev;
135 	struct splite_savepoint *next;
136     };
137 
138     struct splite_vtable_extent
139     {
140 	char *table;
141 	double minx;
142 	double maxx;
143 	double miny;
144 	double maxy;
145 	int srid;
146 	struct splite_vtable_extent *prev;
147 	struct splite_vtable_extent *next;
148     };
149 
150     struct gaia_variant_value
151     {
152 	/* a struct/union intended to store a SQLite Variant Value */
153 	int dataType;		/* one of SQLITE_NULL, SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT or SQLITE_BLOB */
154 	sqlite3_int64 intValue;
155 	double dblValue;
156 	char *textValue;
157 	unsigned char *blobValue;
158 	int size;
159     };
160 
161 #define MAX_XMLSCHEMA_CACHE	16
162 
163     struct splite_internal_cache
164     {
165 	unsigned char magic1;
166 	int gpkg_mode;
167 	int gpkg_amphibious_mode;
168 	int decimal_precision;
169 	void *GEOS_handle;
170 	void *PROJ_handle;
171 	void *RTTOPO_handle;
172 	void *xmlParsingErrors;
173 	void *xmlSchemaValidationErrors;
174 	void *xmlXPathErrors;
175 	char *cutterMessage;
176 	char *storedProcError;
177 	char *createRoutingError;
178 	struct splite_geos_cache_item cacheItem1;
179 	struct splite_geos_cache_item cacheItem2;
180 	struct splite_xmlSchema_cache_item xmlSchemaCache[MAX_XMLSCHEMA_CACHE];
181 	int pool_index;
182 	void (*geos_warning) (const char *fmt, ...);
183 	void (*geos_error) (const char *fmt, ...);
184 	char *gaia_geos_error_msg;
185 	char *gaia_geos_warning_msg;
186 	char *gaia_geosaux_error_msg;
187 	char *gaia_rttopo_error_msg;
188 	char *gaia_rttopo_warning_msg;
189 	char *gaia_proj_error_msg;
190 	int silent_mode;
191 	void *firstTopology;
192 	void *lastTopology;
193 	void *firstNetwork;
194 	void *lastNetwork;
195 	unsigned int next_topo_savepoint;
196 	struct splite_savepoint *first_topo_svpt;
197 	struct splite_savepoint *last_topo_svpt;
198 	unsigned int next_network_savepoint;
199 	struct splite_savepoint *first_net_svpt;
200 	struct splite_savepoint *last_net_svpt;
201 	gaiaSequencePtr first_seq;
202 	gaiaSequencePtr last_seq;
203 	struct splite_vtable_extent *first_vtable_extent;
204 	struct splite_vtable_extent *last_vtable_extent;
205 	int ok_last_used_sequence;
206 	int last_used_sequence_val;
207 	char *SqlProcLogfile;
208 	int SqlProcLogfileAppend;
209 	FILE *SqlProcLog;
210 	int SqlProcContinue;
211 	struct gaia_variant_value *SqlProcRetValue;
212 	int tinyPointEnabled;
213 	unsigned char magic2;
214 	char *lastPostgreSqlError;
215 	int buffer_end_cap_style;
216 	int buffer_join_style;
217 	double buffer_mitre_limit;
218 	int buffer_quadrant_segments;
219 	int proj6_cached;
220 	void *proj6_cached_pj;
221 	char *proj6_cached_string_1;
222 	char *proj6_cached_string_2;
223 	void *proj6_cached_area;
224 	int is_pause_enabled;
225     };
226 
227     struct epsg_defs
228     {
229 	int srid;
230 	char *auth_name;
231 	int auth_srid;
232 	char *ref_sys_name;
233 	char *proj4text;
234 	char *srs_wkt;
235 	int is_geographic;
236 	int flipped_axes;
237 	char *spheroid;
238 	char *prime_meridian;
239 	char *datum;
240 	char *projection;
241 	char *unit;
242 	char *axis_1;
243 	char *orientation_1;
244 	char *axis_2;
245 	char *orientation_2;
246 	struct epsg_defs *next;
247     };
248 
249     struct gaia_control_points
250     {
251 	/* a struct to implement ATM_ControlPoints - aggregate function */
252 	int count;
253 	int allocation_incr;
254 	int allocated_items;
255 	int has3d;
256 	int tps;
257 	int order;
258 	/* point set A */
259 	double *x0;
260 	double *y0;
261 	double *z0;
262 	/* point set B */
263 	double *x1;
264 	double *y1;
265 	double *z1;
266 	/* affine transform coefficients */
267 	double a;
268 	double b;
269 	double c;
270 	double d;
271 	double e;
272 	double f;
273 	double g;
274 	double h;
275 	double i;
276 	double xoff;
277 	double yoff;
278 	double zoff;
279 	int affine_valid;
280     };
281 
282     SPATIALITE_PRIVATE void free_internal_cache (struct splite_internal_cache
283 						 *cache);
284 
285     SPATIALITE_PRIVATE void free_internal_cache_topologies (void *first);
286 
287     SPATIALITE_PRIVATE void free_internal_cache_networks (void *first);
288 
289     SPATIALITE_PRIVATE struct epsg_defs *add_epsg_def (int filter_srid,
290 						       struct epsg_defs
291 						       **first,
292 						       struct epsg_defs
293 						       **last, int srid,
294 						       const char *auth_name,
295 						       int auth_srid,
296 						       const char
297 						       *ref_sys_name);
298 
299     SPATIALITE_PRIVATE struct epsg_defs *add_epsg_def_ex (int filter_srid,
300 							  struct epsg_defs
301 							  **first,
302 							  struct epsg_defs
303 							  **last, int srid,
304 							  const char
305 							  *auth_name,
306 							  int auth_srid,
307 							  const char
308 							  *ref_sys_name,
309 							  int is_geographic,
310 							  int flipped_axes,
311 							  const char
312 							  *spheroid,
313 							  const char
314 							  *prime_meridian,
315 							  const char *datum,
316 							  const char
317 							  *projection,
318 							  const char *unit,
319 							  const char *axis_1,
320 							  const char
321 							  *orientation_1,
322 							  const char *axis_2,
323 							  const char
324 							  *orientation_2);
325 
326     SPATIALITE_PRIVATE void add_proj4text (struct epsg_defs *p, int count,
327 					   const char *text);
328 
329     SPATIALITE_PRIVATE void add_srs_wkt (struct epsg_defs *p, int count,
330 					 const char *text);
331 
332     SPATIALITE_PRIVATE void initialize_epsg (int filter,
333 					     struct epsg_defs **first,
334 					     struct epsg_defs **last);
335 
336     SPATIALITE_PRIVATE void free_epsg (struct epsg_defs *first);
337 
338     SPATIALITE_PRIVATE int exists_spatial_ref_sys (void *handle);
339 
340     SPATIALITE_PRIVATE int checkSpatialMetaData (const void *sqlite);
341 
342     SPATIALITE_PRIVATE int checkSpatialMetaData_ex (const void *sqlite,
343 						    const char *db_prefix);
344 
345     SPATIALITE_PRIVATE int delaunay_triangle_check (void *pg);
346 
347     SPATIALITE_PRIVATE void *voronoj_build (int pgs, void *first,
348 					    double extra_frame_size);
349 
350     SPATIALITE_PRIVATE void *voronoj_build_r (const void *p_cache, int pgs,
351 					      void *first,
352 					      double extra_frame_size);
353 
354     SPATIALITE_PRIVATE void *voronoj_export (void *voronoj, void *result,
355 					     int only_edges);
356 
357     SPATIALITE_PRIVATE void *voronoj_export_r (const void *p_cache,
358 					       void *voronoj, void *result,
359 					       int only_edges);
360 
361     SPATIALITE_PRIVATE void voronoj_free (void *voronoj);
362 
363     SPATIALITE_PRIVATE void *concave_hull_build (void *first,
364 						 int dimension_model,
365 						 double factor,
366 						 int allow_holes);
367 
368     SPATIALITE_PRIVATE void *concave_hull_build_r (const void *p_cache,
369 						   void *first,
370 						   int dimension_model,
371 						   double factor,
372 						   int allow_holes);
373 
374     SPATIALITE_PRIVATE int createAdvancedMetaData (void *sqlite);
375 
376     SPATIALITE_PRIVATE void updateSpatiaLiteHistory (void *sqlite,
377 						     const char *table,
378 						     const char *geom,
379 						     const char *operation);
380 
381     SPATIALITE_PRIVATE int createGeometryColumns (void *p_sqlite);
382 
383     SPATIALITE_PRIVATE int createTemporarySpatialRefSys (void *p_sqlite,
384 							 const char *db_prefix);
385 
386     SPATIALITE_PRIVATE int createTemporaryGeometryColumns (void *p_sqlite,
387 							   const char
388 							   *db_prefix);
389 
390     SPATIALITE_PRIVATE int check_layer_statistics (void *p_sqlite);
391 
392     SPATIALITE_PRIVATE int check_views_layer_statistics (void *p_sqlite);
393 
394     SPATIALITE_PRIVATE int check_virts_layer_statistics (void *p_sqlite);
395 
396     SPATIALITE_PRIVATE void updateGeometryTriggers (void *p_sqlite,
397 						    const char *table,
398 						    const char *column);
399 
400     SPATIALITE_PRIVATE void updateTemporaryGeometryTriggers (void *p_sqlite,
401 							     const char
402 							     *db_prefix,
403 							     const char *table,
404 							     const char
405 							     *column);
406 
407     SPATIALITE_PRIVATE int upgradeGeometryTriggers (void *p_sqlite);
408 
409     SPATIALITE_PRIVATE int getRealSQLnames (void *p_sqlite, const char *table,
410 					    const char *column,
411 					    char **real_table,
412 					    char **real_column);
413 
414     SPATIALITE_PRIVATE int getRealSQLnamesTemporary (void *p_sqlite,
415 						     const char *db_prefix,
416 						     const char *table,
417 						     const char *column,
418 						     char **real_table,
419 						     char **real_column);
420 
421     /* DEPRECATED - always use buildSpatialIndexEx */
422     SPATIALITE_PRIVATE void buildSpatialIndex (void *p_sqlite,
423 					       const unsigned char *table,
424 					       const char *column);
425 
426     SPATIALITE_PRIVATE int buildSpatialIndexEx (void *p_sqlite,
427 						const unsigned char *table,
428 						const char *column);
429 
430     SPATIALITE_PRIVATE int buildTemporarySpatialIndex (void *p_sqlite,
431 						       const char *db_prefix,
432 						       const unsigned char
433 						       *table,
434 						       const char *column);
435 
436     SPATIALITE_PRIVATE int validateRowid (void *p_sqlite, const char *table);
437 
438     SPATIALITE_PRIVATE int validateTemporaryRowid (void *p_sqlite,
439 						   const char *db_prefix,
440 						   const char *table);
441 
442     SPATIALITE_PRIVATE int doComputeFieldInfos (void *p_sqlite,
443 						const char *table,
444 						const char *column,
445 						int stat_type, void *p_lyr);
446 
447     SPATIALITE_PRIVATE void getProjParams (void *p_sqlite, int srid,
448 					   char **params);
449 
450     SPATIALITE_PRIVATE void getProjWkt (void *p_sqlite, int srid, char **wkt);
451 
452     SPATIALITE_PRIVATE void getProjAuthNameSrid (void *p_sqlite, int srid,
453 						 char **auth_name_srid);
454 
455     SPATIALITE_PRIVATE int getEllipsoidParams (void *p_sqlite, int srid,
456 					       double *a, double *b,
457 					       double *rf);
458 
459     SPATIALITE_PRIVATE void addVectorLayer (void *list,
460 					    const char *layer_type,
461 					    const char *table_name,
462 					    const char *geometry_column,
463 					    int geometry_type, int srid,
464 					    int spatial_index);
465 
466     SPATIALITE_PRIVATE void addVectorLayerExtent (void *list,
467 						  const char *table_name,
468 						  const char *geometry_column,
469 						  int count, double min_x,
470 						  double min_y, double max_x,
471 						  double max_y);
472 
473     SPATIALITE_PRIVATE void addLayerAttributeField (void *list,
474 						    const char *table_name,
475 						    const char
476 						    *geometry_column,
477 						    int ordinal,
478 						    const char *column_name,
479 						    int null_values,
480 						    int integer_values,
481 						    int double_values,
482 						    int text_values,
483 						    int blob_values,
484 						    int null_max_size,
485 						    int max_size,
486 						    int null_int_range,
487 						    void *integer_min,
488 						    void *integer_max,
489 						    int null_double_range,
490 						    double double_min,
491 						    double double_max);
492 
493     SPATIALITE_PRIVATE int createStylingTables (void *p_sqlite, int relaxed);
494     SPATIALITE_PRIVATE int createStylingTables_ex (void *p_sqlite,
495 						   int relaxed,
496 						   int transaction);
497 
498     SPATIALITE_PRIVATE int reCreateStylingTriggers (void *p_sqlite,
499 						    int relaxed,
500 						    int transaction);
501 
502     SPATIALITE_PRIVATE int register_external_graphic (void *p_sqlite,
503 						      const char *xlink_href,
504 						      const unsigned char
505 						      *p_blob, int n_bytes,
506 						      const char *title,
507 						      const char *abstract,
508 						      const char *file_name);
509 
510     SPATIALITE_PRIVATE int unregister_external_graphic (void *p_sqlite,
511 							const char *xlink_href);
512 
513     SPATIALITE_PRIVATE int register_vector_style (void *p_sqlite,
514 						  const unsigned char *p_blob,
515 						  int n_bytes);
516 
517     SPATIALITE_PRIVATE int unregister_vector_style (void *p_sqlite,
518 						    int style_id,
519 						    const char *style_name,
520 						    int remove_all);
521 
522     SPATIALITE_PRIVATE int reload_vector_style (void *p_sqlite, int style_id,
523 						const char *style_name,
524 						const unsigned char *p_blob,
525 						int n_bytes);
526 
527     /* DEPRECATED - always use register_vector_styled_layer_ex */
528     SPATIALITE_PRIVATE int register_vector_styled_layer (void *p_sqlite,
529 							 const char
530 							 *f_table_name,
531 							 const char
532 							 *f_geometry_column,
533 							 int style_id,
534 							 const unsigned char
535 							 *p_blob, int n_bytes);
536 
537     SPATIALITE_PRIVATE int register_vector_styled_layer_ex (void *p_sqlite,
538 							    const char
539 							    *coverage_name,
540 							    int style_id,
541 							    const char
542 							    *style_name);
543 
544     SPATIALITE_PRIVATE int unregister_vector_styled_layer (void *p_sqlite,
545 							   const char
546 							   *coverage_name,
547 							   int style_id,
548 							   const char
549 							   *style_name);
550 
551     SPATIALITE_PRIVATE int register_raster_style (void *p_sqlite,
552 						  const unsigned char *p_blob,
553 						  int n_bytes);
554 
555     SPATIALITE_PRIVATE int unregister_raster_style (void *p_sqlite,
556 						    int style_id,
557 						    const char *style_name,
558 						    int remove_all);
559 
560     SPATIALITE_PRIVATE int reload_raster_style (void *p_sqlite, int style_id,
561 						const char *style_name,
562 						const unsigned char *p_blob,
563 						int n_bytes);
564 
565     /* DEPRECATED - always use register_raster_styled_layer_ex */
566     SPATIALITE_PRIVATE int register_raster_styled_layer (void *p_sqlite,
567 							 const char
568 							 *coverage_name,
569 							 int style_id,
570 							 const unsigned char
571 							 *p_blob, int n_bytes);
572 
573     SPATIALITE_PRIVATE int register_raster_styled_layer_ex (void *p_sqlite,
574 							    const char
575 							    *coverage_name,
576 							    int style_id,
577 							    const char
578 							    *style_name);
579 
580     SPATIALITE_PRIVATE int unregister_raster_styled_layer (void *p_sqlite,
581 							   const char
582 							   *coverage_name,
583 							   int style_id,
584 							   const char
585 							   *style_name);
586 
587     SPATIALITE_PRIVATE int register_raster_coverage_srid (void *p_sqlite,
588 							  const char
589 							  *coverage_name,
590 							  int srid);
591 
592     SPATIALITE_PRIVATE int unregister_raster_coverage_srid (void *p_sqlite,
593 							    const char
594 							    *coverage_name,
595 							    int srid);
596 
597     SPATIALITE_PRIVATE int register_raster_coverage_keyword (void *p_sqlite,
598 							     const char
599 							     *coverage_name,
600 							     const char
601 							     *keyword);
602 
603     SPATIALITE_PRIVATE int unregister_raster_coverage_keyword (void *p_sqlite,
604 							       const char
605 							       *coverage_name,
606 							       const char
607 							       *keyword);
608 
609     SPATIALITE_PRIVATE int update_raster_coverage_extent (void *p_sqlite,
610 							  const void *cache,
611 							  const char
612 							  *coverage_name,
613 							  int transaction);
614 
615     SPATIALITE_PRIVATE int register_map_configuration (void *p_sqlite,
616 						       const unsigned char
617 						       *p_blob, int n_bytes);
618 
619     SPATIALITE_PRIVATE int unregister_map_configuration (void *p_sqlite,
620 							 int id,
621 							 const char *name);
622 
623     SPATIALITE_PRIVATE int reload_map_configuration (void *p_sqlite, int id,
624 						     const char *name,
625 						     const unsigned char
626 						     *p_blob, int n_bytes);
627 
628     SPATIALITE_PRIVATE int count_map_configurations (void *p_sqlite);
629 
630     SPATIALITE_PRIVATE char *get_map_configuration_name (void *p_sqlite,
631 							 int ind);
632 
633     SPATIALITE_PRIVATE char *get_map_configuration_title (void *p_sqlite,
634 							  int ind);
635 
636     SPATIALITE_PRIVATE char *get_map_configuration_abstract (void *p_sqlite,
637 							     int ind);
638 
639     SPATIALITE_PRIVATE int createIsoMetadataTables (void *p_sqlite,
640 						    int relaxed);
641 
642     SPATIALITE_PRIVATE int get_iso_metadata_id (void *p_sqlite,
643 						const char *fileIdentifier,
644 						void *p_id);
645 
646     SPATIALITE_PRIVATE int register_iso_metadata (void *p_sqlite,
647 						  const char *scope,
648 						  const unsigned char *p_blob,
649 						  int n_bytes, void *p_id,
650 						  const char *fileIdentifier);
651 
652     SPATIALITE_PRIVATE int createRasterCoveragesTable (void *p_sqlite);
653     SPATIALITE_PRIVATE int reCreateRasterCoveragesTriggers (void *p_sqlite);
654 
655     SPATIALITE_PRIVATE int checkPopulatedCoverage (void *p_sqlite,
656 						   const char *db_prefix,
657 						   const char *coverage_name);
658 
659     SPATIALITE_PRIVATE int createVectorCoveragesTable (void *p_sqlite);
660     SPATIALITE_PRIVATE int reCreateVectorCoveragesTriggers (void *p_sqlite);
661 
662     SPATIALITE_PRIVATE int register_vector_coverage (void *p_sqlite,
663 						     const char
664 						     *coverage_name,
665 						     const char *f_table_name,
666 						     const char
667 						     *f_geometry_column,
668 						     const char *title,
669 						     const char *abstract,
670 						     int is_queryable,
671 						     int is_editable);
672 
673     SPATIALITE_PRIVATE int register_spatial_view_coverage (void *p_sqlite,
674 							   const char
675 							   *coverage_name,
676 							   const char
677 							   *view_name,
678 							   const char
679 							   *view_geometry,
680 							   const char *title,
681 							   const char *abstract,
682 							   int is_queryable,
683 							   int is_editable);
684 
685     SPATIALITE_PRIVATE int register_virtual_table_coverage (void *p_sqlite,
686 							    const char
687 							    *coverage_name,
688 							    const char
689 							    *virt_name,
690 							    const char
691 							    *virt_geometry,
692 							    const char *title,
693 							    const char
694 							    *abstract,
695 							    int is_queryable);
696 
697     SPATIALITE_PRIVATE int register_topogeo_coverage (void *p_sqlite,
698 						      const char
699 						      *coverage_name,
700 						      const char *topogeo_name,
701 						      const char *title,
702 						      const char *abstract,
703 						      int is_queryable,
704 						      int is_editable);
705 
706     SPATIALITE_PRIVATE int register_toponet_coverage (void *p_sqlite,
707 						      const char
708 						      *coverage_name,
709 						      const char *toponet_name,
710 						      const char *title,
711 						      const char *abstract,
712 						      int is_queryable,
713 						      int is_editable);
714 
715     SPATIALITE_PRIVATE int unregister_vector_coverage (void *p_sqlite,
716 						       const char
717 						       *coverage_name);
718 
719     SPATIALITE_PRIVATE int set_vector_coverage_infos (void *p_sqlite,
720 						      const char
721 						      *coverage_name,
722 						      const char *title,
723 						      const char *abstract,
724 						      int is_queryable,
725 						      int is_editable);
726 
727     SPATIALITE_PRIVATE int set_vector_coverage_copyright (void *p_sqlite,
728 							  const char
729 							  *coverage_name,
730 							  const char *copyright,
731 							  const char *license);
732 
733     SPATIALITE_PRIVATE int register_vector_coverage_srid (void *p_sqlite,
734 							  const char
735 							  *coverage_name,
736 							  int srid);
737 
738     SPATIALITE_PRIVATE int unregister_vector_coverage_srid (void *p_sqlite,
739 							    const char
740 							    *coverage_name,
741 							    int srid);
742 
743     SPATIALITE_PRIVATE int register_vector_coverage_keyword (void *p_sqlite,
744 							     const char
745 							     *coverage_name,
746 							     const char
747 							     *keyword);
748 
749     SPATIALITE_PRIVATE int unregister_vector_coverage_keyword (void *p_sqlite,
750 							       const char
751 							       *coverage_name,
752 							       const char
753 							       *keyword);
754 
755     SPATIALITE_PRIVATE int update_vector_coverage_extent (void *p_sqlite,
756 							  const void *cache,
757 							  const char
758 							  *coverage_name,
759 							  int transaction);
760 
761     SPATIALITE_PRIVATE int createWMSTables (void *p_sqlite);
762 
763     SPATIALITE_PRIVATE int register_wms_getcapabilities (void *p_sqlite,
764 							 const char *url,
765 							 const char *title,
766 							 const char *abstract);
767 
768     SPATIALITE_PRIVATE int unregister_wms_getcapabilities (void *p_sqlite,
769 							   const char *url);
770 
771     SPATIALITE_PRIVATE int set_wms_getcapabilities_infos (void *p_sqlite,
772 							  const char *url,
773 							  const char *title,
774 							  const char *abstract);
775 
776     SPATIALITE_PRIVATE int register_wms_getmap (void *p_sqlite,
777 						const char *getcapabilities_url,
778 						const char *getmap_url,
779 						const char *layer_name,
780 						const char *title,
781 						const char *abstract,
782 						const char *version,
783 						const char *ref_sys,
784 						const char *image_format,
785 						const char *style,
786 						int transparent,
787 						int flip_axes,
788 						int tiled,
789 						int cached,
790 						int tile_width,
791 						int tile_height,
792 						const char *bgcolor,
793 						int is_queryable,
794 						const char *getfeatureinfo_url);
795 
796     SPATIALITE_PRIVATE int unregister_wms_getmap (void *p_sqlite,
797 						  const char *url,
798 						  const char *layer_name);
799 
800     SPATIALITE_PRIVATE int set_wms_getmap_infos (void *p_sqlite,
801 						 const char *url,
802 						 const char *layer_name,
803 						 const char *title,
804 						 const char *abstract);
805 
806     SPATIALITE_PRIVATE int set_wms_getmap_copyright (void *p_sqlite,
807 						     const char *url,
808 						     const char *layer_name,
809 						     const char *copyright,
810 						     const char *license);
811 
812     SPATIALITE_PRIVATE int set_wms_getmap_bgcolor (void *p_sqlite,
813 						   const char *url,
814 						   const char *layer_name,
815 						   const char *bgcolor);
816 
817     SPATIALITE_PRIVATE int set_wms_getmap_queryable (void *p_sqlite,
818 						     const char *url,
819 						     const char *layer_name,
820 						     int is_queryable,
821 						     const char
822 						     *getfeatureifo_url);
823 
824     SPATIALITE_PRIVATE int set_wms_getmap_options (void *p_sqlite,
825 						   const char *url,
826 						   const char *layer_name,
827 						   int transparent,
828 						   int flip_axes);
829 
830     SPATIALITE_PRIVATE int set_wms_getmap_tiled (void *p_sqlite,
831 						 const char *url,
832 						 const char *layer_name,
833 						 int tiled, int cached,
834 						 int tile_width,
835 						 int tile_height);
836 
837     SPATIALITE_PRIVATE int register_wms_setting (void *p_sqlite,
838 						 const char *url,
839 						 const char *layer_name,
840 						 const char *key,
841 						 const char *value,
842 						 int is_default);
843 
844     SPATIALITE_PRIVATE int unregister_wms_setting (void *p_sqlite,
845 						   const char *url,
846 						   const char *layer_name,
847 						   const char *key,
848 						   const char *value);
849 
850     SPATIALITE_PRIVATE int set_wms_default_setting (void *p_sqlite,
851 						    const char *url,
852 						    const char *layer_name,
853 						    const char *key,
854 						    const char *value);
855 
856     SPATIALITE_PRIVATE int register_wms_srs (void *p_sqlite,
857 					     const char *url,
858 					     const char *layer_name,
859 					     const char *ref_sys, double minx,
860 					     double miny, double maxx,
861 					     double maxy, int is_default);
862 
863     SPATIALITE_PRIVATE int unregister_wms_srs (void *p_sqlite,
864 					       const char *url,
865 					       const char *layer_name,
866 					       const char *ref_sys);
867 
868     SPATIALITE_PRIVATE int set_wms_default_srs (void *p_sqlite,
869 						const char *url,
870 						const char *layer_name,
871 						const char *ref_sys);
872 
873     SPATIALITE_PRIVATE char *wms_getmap_request_url (void *p_sqlite,
874 						     const char *getmap_url,
875 						     const char *layer_name,
876 						     int width, int height,
877 						     double minx, double miny,
878 						     double maxx, double maxy);
879 
880     SPATIALITE_PRIVATE char *wms_getfeatureinfo_request_url (void *p_sqlite,
881 							     const char
882 							     *getmap_url,
883 							     const char
884 							     *layer_name,
885 							     int width,
886 							     int height, int x,
887 							     int y, double minx,
888 							     double miny,
889 							     double maxx,
890 							     double maxy,
891 							     int feature_count);
892 
893     SPATIALITE_PRIVATE int register_data_license (void *p_sqlite,
894 						  const char *license_name,
895 						  const char *url);
896 
897     SPATIALITE_PRIVATE int unregister_data_license (void *p_sqlite,
898 						    const char *license_name);
899 
900     SPATIALITE_PRIVATE int rename_data_license (void *p_sqlite,
901 						const char *old_name,
902 						const char *new_name);
903 
904     SPATIALITE_PRIVATE int set_data_license_url (void *p_sqlite,
905 						 const char *license_name,
906 						 const char *url);
907 
908     SPATIALITE_PRIVATE const char *splite_rttopo_version (void);
909 
910     SPATIALITE_PRIVATE void splite_free_geos_cache_item (struct
911 							 splite_geos_cache_item
912 							 *p);
913 
914     SPATIALITE_PRIVATE void splite_free_geos_cache_item_r (const void
915 							   *p_cache,
916 							   struct
917 							   splite_geos_cache_item
918 							   *p);
919 
920     SPATIALITE_PRIVATE void splite_free_xml_schema_cache_item (struct
921 							       splite_xmlSchema_cache_item
922 							       *p);
923 
924     SPATIALITE_PRIVATE void vxpath_free_namespaces (struct vxpath_namespaces
925 						    *ns_list);
926 
927     SPATIALITE_PRIVATE struct vxpath_namespaces *vxpath_get_namespaces (void
928 									*p_xml_doc);
929 
930     SPATIALITE_PRIVATE int vxpath_eval_expr (const void *p_cache,
931 					     void *xml_doc,
932 					     const char *xpath_expr,
933 					     void *p_xpathCtx,
934 					     void *p_xpathObj);
935 
936     SPATIALITE_PRIVATE void *register_spatialite_sql_functions (void *db,
937 								const void
938 								*cache);
939 
940     SPATIALITE_PRIVATE void init_spatialite_virtualtables (void *p_db,
941 							   const void *p_cache);
942 
943     SPATIALITE_PRIVATE void spatialite_splash_screen (int verbose);
944 
945     SPATIALITE_PRIVATE void geos_error (const char *fmt, ...);
946 
947     SPATIALITE_PRIVATE void geos_warning (const char *fmt, ...);
948 
949     SPATIALITE_PRIVATE void splite_cache_semaphore_lock (void);
950 
951     SPATIALITE_PRIVATE void splite_cache_semaphore_unlock (void);
952 
953     SPATIALITE_PRIVATE const void *gaiaAuxClonerCreate (const void *sqlite,
954 							const char *db_prefix,
955 							const char *in_table,
956 							const char *out_table);
957 
958     SPATIALITE_PRIVATE const void *gaiaAuxClonerCreateEx (const void *sqlite,
959 							  const char
960 							  *db_prefix,
961 							  const char
962 							  *in_table,
963 							  const char
964 							  *out_table,
965 							  int create_only);
966 
967     SPATIALITE_PRIVATE void gaiaAuxClonerDestroy (const void *cloner);
968 
969     SPATIALITE_PRIVATE void gaiaAuxClonerAddOption (const void *cloner,
970 						    const char *option);
971 
972     SPATIALITE_PRIVATE int gaiaAuxClonerCheckValidTarget (const void *cloner);
973 
974     SPATIALITE_PRIVATE int gaiaAuxClonerExecute (const void *cloner);
975 
976     SPATIALITE_PRIVATE const void *gaiaElemGeomOptionsCreate ();
977 
978     SPATIALITE_PRIVATE void gaiaElemGeomOptionsAdd (const void *options,
979 						    const char *option);
980 
981     SPATIALITE_PRIVATE void gaiaElemGeomOptionsDestroy (const void *options);
982 
983     SPATIALITE_PRIVATE int gaia_matrix_to_arrays (const unsigned char *blob,
984 						  int blob_sz, double *E,
985 						  double *N, double *Z);
986 
987 /* Topology SQL functions */
988     SPATIALITE_PRIVATE void *fromRTGeom (const void *ctx, const void *rtgeom,
989 					 const int dimension_model,
990 					 const int declared_type);
991 
992     SPATIALITE_PRIVATE void *toRTGeom (const void *ctx, const void *gaia);
993 
994     SPATIALITE_PRIVATE void fnctaux_GetLastTopologyException (const void
995 							      *context,
996 							      int argc,
997 							      const void *argv);
998 
999     SPATIALITE_PRIVATE void fnctaux_CreateTopoTables (const void *context,
1000 						      int argc,
1001 						      const void *argv);
1002     SPATIALITE_PRIVATE void fnctaux_ReCreateTopoTriggers (const void *context,
1003 							  int argc,
1004 							  const void *argv);
1005 
1006     SPATIALITE_PRIVATE int do_create_topologies (void *sqlite_handle);
1007     SPATIALITE_PRIVATE void drop_topologies_triggers (void *sqlite_handle);
1008     SPATIALITE_PRIVATE int do_create_topologies_triggers (void *sqlite_handle);
1009 
1010     SPATIALITE_PRIVATE int do_create_networks (void *sqlite_handle);
1011     SPATIALITE_PRIVATE void drop_networks_triggers (void *sqlite_handle);
1012     SPATIALITE_PRIVATE int do_create_networks_triggers (void *sqlite_handle);
1013 
1014     SPATIALITE_PRIVATE void fnctaux_CreateTopology (const void *context,
1015 						    int argc, const void *argv);
1016 
1017     SPATIALITE_PRIVATE void fnctaux_DropTopology (const void *context,
1018 						  int argc, const void *argv);
1019 
1020     SPATIALITE_PRIVATE void fnctaux_AddIsoNode (const void *context, int argc,
1021 						const void *argv);
1022 
1023     SPATIALITE_PRIVATE void fnctaux_MoveIsoNode (const void *context,
1024 						 int argc, const void *argv);
1025 
1026     SPATIALITE_PRIVATE void fnctaux_RemIsoNode (const void *context,
1027 						int argc, const void *argv);
1028 
1029     SPATIALITE_PRIVATE void fnctaux_AddIsoEdge (const void *context, int argc,
1030 						const void *argv);
1031 
1032     SPATIALITE_PRIVATE void fnctaux_AddEdgeModFace (const void *context,
1033 						    int argc, const void *argv);
1034 
1035     SPATIALITE_PRIVATE void fnctaux_AddEdgeNewFaces (const void *context,
1036 						     int argc,
1037 						     const void *argv);
1038 
1039     SPATIALITE_PRIVATE void fnctaux_RemEdgeNewFace (const void *context,
1040 						    int argc, const void *argv);
1041 
1042     SPATIALITE_PRIVATE void fnctaux_RemEdgeModFace (const void *context,
1043 						    int argc, const void *argv);
1044 
1045     SPATIALITE_PRIVATE void fnctaux_ChangeEdgeGeom (const void *context,
1046 						    int argc, const void *argv);
1047 
1048     SPATIALITE_PRIVATE void fnctaux_RemIsoEdge (const void *context,
1049 						int argc, const void *argv);
1050 
1051     SPATIALITE_PRIVATE void fnctaux_AddIsoEdge (const void *context, int argc,
1052 						const void *argv);
1053 
1054     SPATIALITE_PRIVATE void fnctaux_ModEdgeSplit (const void *context,
1055 						  int argc, const void *argv);
1056 
1057     SPATIALITE_PRIVATE void fnctaux_NewEdgesSplit (const void *context,
1058 						   int argc, const void *argv);
1059 
1060     SPATIALITE_PRIVATE void fnctaux_ModEdgeHeal (const void *context,
1061 						 int argc, const void *argv);
1062 
1063     SPATIALITE_PRIVATE void fnctaux_NewEdgeHeal (const void *context,
1064 						 int argc, const void *argv);
1065 
1066     SPATIALITE_PRIVATE void fnctaux_GetFaceEdges (const void *context,
1067 						  int argc, const void *argv);
1068 
1069     SPATIALITE_PRIVATE void fnctaux_GetFaceGeometry (const void *context,
1070 						     int argc,
1071 						     const void *argv);
1072 
1073     SPATIALITE_PRIVATE void fnctaux_ValidateTopoGeo (const void *context,
1074 						     int argc,
1075 						     const void *argv);
1076 
1077     SPATIALITE_PRIVATE void fnctaux_CreateTopoGeo (const void *context,
1078 						   int argc, const void *argv);
1079 
1080     SPATIALITE_PRIVATE void fnctaux_GetNodeByPoint (const void *context,
1081 						    int argc, const void *argv);
1082 
1083     SPATIALITE_PRIVATE void fnctaux_GetEdgeByPoint (const void *context,
1084 						    int argc, const void *argv);
1085 
1086     SPATIALITE_PRIVATE void fnctaux_GetFaceByPoint (const void *context,
1087 						    int argc, const void *argv);
1088 
1089     SPATIALITE_PRIVATE void fnctaux_TopoGeo_AddPoint (const void *context,
1090 						      int argc,
1091 						      const void *argv);
1092 
1093     SPATIALITE_PRIVATE void fnctaux_TopoGeo_AddLineString (const void
1094 							   *context, int argc,
1095 							   const void *argv);
1096 
1097     SPATIALITE_PRIVATE void fnctaux_TopoGeo_AddLineStringNoFace (const void
1098 								 *context,
1099 								 int argc,
1100 								 const void
1101 								 *argv);
1102 
1103     SPATIALITE_PRIVATE void fnctaux_TopoGeo_Polygonize (const void *context,
1104 							int argc,
1105 							const void *argv);
1106 
1107     SPATIALITE_PRIVATE void fnctaux_TopoGeo_FromGeoTable (const void *context,
1108 							  int argc,
1109 							  const void *argv);
1110 
1111     SPATIALITE_PRIVATE void fnctaux_TopoGeo_FromGeoTableNoFace (const void
1112 								*context,
1113 								int argc,
1114 								const void
1115 								*argv);
1116 
1117     SPATIALITE_PRIVATE void fnctaux_TopoGeo_FromGeoTableExt (const void
1118 							     *context,
1119 							     int argc,
1120 							     const void *argv);
1121 
1122     SPATIALITE_PRIVATE void fnctaux_TopoGeo_FromGeoTableNoFaceExt (const void
1123 								   *context,
1124 								   int argc,
1125 								   const void
1126 								   *argv);
1127 
1128     SPATIALITE_PRIVATE void fnctaux_Polygonize (const void
1129 						*context, int argc,
1130 						const void *argv);
1131 
1132     SPATIALITE_PRIVATE void fnctaux_TopoGeo_TopoSnap (const void
1133 						      *context, int argc,
1134 						      const void *argv);
1135 
1136     SPATIALITE_PRIVATE void fnctaux_TopoGeo_SnappedGeoTable (const void
1137 							     *context,
1138 							     int argc,
1139 							     const void *argv);
1140 
1141     SPATIALITE_PRIVATE void fnctaux_TopoGeo_ToGeoTable (const void *context,
1142 							int argc,
1143 							const void *argv);
1144 
1145     SPATIALITE_PRIVATE void fnctaux_TopoGeo_PolyFacesList (const void *context,
1146 							   int argc,
1147 							   const void *argv);
1148 
1149     SPATIALITE_PRIVATE void fnctaux_TopoGeo_LineEdgesList (const void *context,
1150 							   int argc,
1151 							   const void *argv);
1152 
1153     SPATIALITE_PRIVATE void fnctaux_TopoGeo_ToGeoTableGeneralize (const void
1154 								  *context,
1155 								  int argc,
1156 								  const void
1157 								  *argv);
1158 
1159     SPATIALITE_PRIVATE void fnctaux_TopoGeo_RemoveSmallFaces (const void
1160 							      *context,
1161 							      int argc,
1162 							      const void *argv);
1163 
1164     SPATIALITE_PRIVATE void fnctaux_TopoGeo_RemoveDanglingEdges (const void
1165 								 *context,
1166 								 int argc,
1167 								 const void
1168 								 *argv);
1169 
1170     SPATIALITE_PRIVATE void fnctaux_TopoGeo_RemoveDanglingNodes (const void
1171 								 *context,
1172 								 int argc,
1173 								 const void
1174 								 *argv);
1175 
1176     SPATIALITE_PRIVATE void fnctaux_TopoGeo_NewEdgeHeal (const void *context,
1177 							 int argc,
1178 							 const void *argv);
1179 
1180     SPATIALITE_PRIVATE void fnctaux_TopoGeo_ModEdgeHeal (const void *context,
1181 							 int argc,
1182 							 const void *argv);
1183 
1184     SPATIALITE_PRIVATE void fnctaux_TopoGeo_NewEdgesSplit (const void *context,
1185 							   int argc,
1186 							   const void *argv);
1187 
1188     SPATIALITE_PRIVATE void fnctaux_TopoGeo_ModEdgeSplit (const void *context,
1189 							  int argc,
1190 							  const void *argv);
1191 
1192     SPATIALITE_PRIVATE void fnctaux_TopoGeo_CreateTopoLayer (const void
1193 							     *context,
1194 							     int argc,
1195 							     const void *argv);
1196 
1197     SPATIALITE_PRIVATE void fnctaux_TopoGeo_InitTopoLayer (const void
1198 							   *context, int argc,
1199 							   const void *argv);
1200 
1201     SPATIALITE_PRIVATE void fnctaux_TopoGeo_RemoveTopoLayer (const void
1202 							     *context,
1203 							     int argc,
1204 							     const void *argv);
1205 
1206     SPATIALITE_PRIVATE void fnctaux_TopoGeo_ExportTopoLayer (const void
1207 							     *context,
1208 							     int argc,
1209 							     const void *argv);
1210 
1211     SPATIALITE_PRIVATE void fnctaux_TopoGeo_InsertFeatureFromTopoLayer (const
1212 									void
1213 									*context,
1214 									int
1215 									argc,
1216 									const
1217 									void
1218 									*argv);
1219 
1220     SPATIALITE_PRIVATE void fnctaux_TopoGeo_Clone (const void *context,
1221 						   int argc, const void *argv);
1222 
1223     SPATIALITE_PRIVATE void fnctaux_TopoGeo_SubdivideLines (const void
1224 							    *context,
1225 							    int argc,
1226 							    const void *argv);
1227 
1228     SPATIALITE_PRIVATE void fnctaux_TopoGeo_DisambiguateSegmentEdges (const void
1229 								      *context,
1230 								      int argc,
1231 								      const void
1232 								      *argv);
1233 
1234     SPATIALITE_PRIVATE void fnctaux_TopoGeo_GetEdgeSeed (const void *context,
1235 							 int argc,
1236 							 const void *argv);
1237 
1238     SPATIALITE_PRIVATE void fnctaux_TopoGeo_GetFaceSeed (const void *context,
1239 							 int argc,
1240 							 const void *argv);
1241 
1242     SPATIALITE_PRIVATE void fnctaux_TopoGeo_UpdateSeeds (const void *context,
1243 							 int argc,
1244 							 const void *argv);
1245 
1246     SPATIALITE_PRIVATE void fnctaux_TopoGeo_SnapPointToSeed (const void
1247 							     *context,
1248 							     int argc,
1249 							     const void *argv);
1250 
1251     SPATIALITE_PRIVATE void fnctaux_TopoGeo_SnapLineToSeed (const void
1252 							    *context,
1253 							    int argc,
1254 							    const void *argv);
1255 
1256     SPATIALITE_PRIVATE void start_topo_savepoint (const void *handle,
1257 						  const void *cache);
1258 
1259     SPATIALITE_PRIVATE void release_topo_savepoint (const void *handle,
1260 						    const void *cache);
1261 
1262     SPATIALITE_PRIVATE void rollback_topo_savepoint (const void *handle,
1263 						     const void *cache);
1264 
1265     SPATIALITE_PRIVATE void add_vtable_extent (const char *table, double minx,
1266 					       double miny, double maxx,
1267 					       double maxy, int srid,
1268 					       const void *cache);
1269 
1270     SPATIALITE_PRIVATE void remove_vtable_extent (const char *table,
1271 						  const void *cache);
1272 
1273     SPATIALITE_PRIVATE int get_vtable_extent (const char *table, double *minx,
1274 					      double *miny, double *maxx,
1275 					      double *maxy, int *srid,
1276 					      const void *cache);
1277 
1278 /* Topology-Network SQL functions */
1279     SPATIALITE_PRIVATE void fnctaux_GetLastNetworkException (const void
1280 							     *context,
1281 							     int argc,
1282 							     const void *argv);
1283 
1284     SPATIALITE_PRIVATE void fnctaux_CreateNetwork (const void *context,
1285 						   int argc, const void *argv);
1286 
1287     SPATIALITE_PRIVATE void fnctaux_DropNetwork (const void *context,
1288 						 int argc, const void *argv);
1289 
1290     SPATIALITE_PRIVATE void fnctaux_AddIsoNetNode (const void *context,
1291 						   int argc, const void *argv);
1292 
1293     SPATIALITE_PRIVATE void fnctaux_MoveIsoNetNode (const void *context,
1294 						    int argc, const void *argv);
1295 
1296     SPATIALITE_PRIVATE void fnctaux_RemIsoNetNode (const void *context,
1297 						   int argc, const void *argv);
1298 
1299     SPATIALITE_PRIVATE void fnctaux_AddLink (const void *context, int argc,
1300 					     const void *argv);
1301 
1302     SPATIALITE_PRIVATE void fnctaux_ChangeLinkGeom (const void *context,
1303 						    int argc, const void *argv);
1304 
1305     SPATIALITE_PRIVATE void fnctaux_RemoveLink (const void *context, int argc,
1306 						const void *argv);
1307 
1308     SPATIALITE_PRIVATE void fnctaux_NewLogLinkSplit (const void *context,
1309 						     int argc,
1310 						     const void *argv);
1311 
1312     SPATIALITE_PRIVATE void fnctaux_ModLogLinkSplit (const void *context,
1313 						     int argc,
1314 						     const void *argv);
1315 
1316     SPATIALITE_PRIVATE void fnctaux_NewGeoLinkSplit (const void *context,
1317 						     int argc,
1318 						     const void *argv);
1319 
1320     SPATIALITE_PRIVATE void fnctaux_ModGeoLinkSplit (const void *context,
1321 						     int argc,
1322 						     const void *argv);
1323 
1324     SPATIALITE_PRIVATE void fnctaux_NewLinkHeal (const void *context,
1325 						 int argc, const void *argv);
1326 
1327     SPATIALITE_PRIVATE void fnctaux_ModLinkHeal (const void *context,
1328 						 int argc, const void *argv);
1329 
1330     SPATIALITE_PRIVATE void fnctaux_LogiNetFromTGeo (const void *context,
1331 						     int argc,
1332 						     const void *argv);
1333 
1334     SPATIALITE_PRIVATE void fnctaux_SpatNetFromTGeo (const void *context,
1335 						     int argc,
1336 						     const void *argv);
1337 
1338     SPATIALITE_PRIVATE void fnctaux_SpatNetFromGeom (const void *context,
1339 						     int argc,
1340 						     const void *argv);
1341 
1342     SPATIALITE_PRIVATE void fnctaux_ValidLogicalNet (const void *context,
1343 						     int argc,
1344 						     const void *argv);
1345 
1346     SPATIALITE_PRIVATE void fnctaux_ValidSpatialNet (const void *context,
1347 						     int argc,
1348 						     const void *argv);
1349 
1350     SPATIALITE_PRIVATE void fnctaux_GetNetNodeByPoint (const void *context,
1351 						       int argc,
1352 						       const void *argv);
1353 
1354     SPATIALITE_PRIVATE void fnctaux_GetLinkByPoint (const void *context,
1355 						    int argc, const void *argv);
1356 
1357     SPATIALITE_PRIVATE void fnctaux_TopoNet_FromGeoTable (const void *context,
1358 							  int argc,
1359 							  const void *argv);
1360 
1361     SPATIALITE_PRIVATE void fnctaux_TopoNet_ToGeoTable (const void *context,
1362 							int argc,
1363 							const void *argv);
1364 
1365     SPATIALITE_PRIVATE void fnctaux_TopoNet_ToGeoTableGeneralize (const void
1366 								  *context,
1367 								  int argc,
1368 								  const void
1369 								  *argv);
1370 
1371     SPATIALITE_PRIVATE void fnctaux_TopoNet_ToGeoTableGeneralize (const void
1372 								  *context,
1373 								  int argc,
1374 								  const void
1375 								  *argv);
1376 
1377     SPATIALITE_PRIVATE void fnctaux_TopoNet_Clone (const void *context,
1378 						   int argc, const void *argv);
1379 
1380     SPATIALITE_PRIVATE void fnctaux_TopoNet_GetLinkSeed (const void *context,
1381 							 int argc,
1382 							 const void *argv);
1383 
1384     SPATIALITE_PRIVATE void fnctaux_TopoNet_UpdateSeeds (const void *context,
1385 							 int argc,
1386 							 const void *argv);
1387 
1388     SPATIALITE_PRIVATE void fnctaux_TopoNet_DisambiguateSegmentLinks (const void
1389 								      *context,
1390 								      int argc,
1391 								      const void
1392 								      *argv);
1393 
1394     SPATIALITE_PRIVATE void fnctaux_TopoNet_LineLinksList (const void *context,
1395 							   int argc,
1396 							   const void *argv);
1397 
1398     SPATIALITE_PRIVATE void start_net_savepoint (const void *handle,
1399 						 const void *cache);
1400 
1401     SPATIALITE_PRIVATE void release_net_savepoint (const void *handle,
1402 						   const void *cache);
1403 
1404     SPATIALITE_PRIVATE void rollback_net_savepoint (const void *handle,
1405 						    const void *cache);
1406 
1407     SPATIALITE_PRIVATE int test_inconsistent_topology (const void *handle);
1408 
1409     SPATIALITE_PRIVATE char *url_toUtf8 (const char *url,
1410 					 const char *in_charset);
1411 
1412     SPATIALITE_PRIVATE char *url_fromUtf8 (const char *url,
1413 					   const char *out_charset);
1414 
1415     SPATIALITE_PRIVATE int gaia_check_reference_geo_table (const void *handle,
1416 							   const char
1417 							   *db_prefix,
1418 							   const char *table,
1419 							   const char *column,
1420 							   char **xtable,
1421 							   char **xcolumn,
1422 							   int *srid,
1423 							   int *family);
1424 
1425     SPATIALITE_PRIVATE int gaia_check_output_table (const void *handle,
1426 						    const char *table);
1427 
1428     SPATIALITE_PRIVATE int gaia_check_spatial_index (const void *handle,
1429 						     const char *db_prefix,
1430 						     const char *ref_table,
1431 						     const char *ref_column);
1432 
1433     SPATIALITE_PRIVATE int gaia_do_eval_disjoint (const void *handle,
1434 						  const char *matrix);
1435 
1436     SPATIALITE_PRIVATE int gaia_do_eval_overlaps (const void *handle,
1437 						  const char *matrix);
1438 
1439     SPATIALITE_PRIVATE int gaia_do_eval_covers (const void *handle,
1440 						const char *matrix);
1441 
1442     SPATIALITE_PRIVATE int gaia_do_eval_covered_by (const void *handle,
1443 						    const char *matrix);
1444 
1445     SPATIALITE_PRIVATE void gaia_do_check_direction (const void *x1,
1446 						     const void *x2,
1447 						     char *direction);
1448 
1449     SPATIALITE_PRIVATE int gaia_do_check_linestring (const void *geom);
1450 
1451     SPATIALITE_PRIVATE void spatialite_internal_init (void *db_handle,
1452 						      const void *ptr);
1453 
1454     SPATIALITE_PRIVATE void spatialite_internal_cleanup (const void *ptr);
1455 
1456     SPATIALITE_PRIVATE void gaia_sql_proc_set_error (const void *p_cache,
1457 						     const char *errmsg);
1458 
1459     SPATIALITE_PRIVATE struct gaia_variant_value *gaia_alloc_variant ();
1460 
1461     SPATIALITE_PRIVATE void gaia_free_variant (struct gaia_variant_value
1462 					       *variant);
1463 
1464     SPATIALITE_PRIVATE void gaia_set_variant_null (struct gaia_variant_value
1465 						   *variant);
1466 
1467     SPATIALITE_PRIVATE void gaia_set_variant_int64 (struct gaia_variant_value
1468 						    *variant,
1469 						    sqlite3_int64 value);
1470 
1471     SPATIALITE_PRIVATE void gaia_set_variant_double (struct gaia_variant_value
1472 						     *variant, double value);
1473 
1474     SPATIALITE_PRIVATE int gaia_set_variant_text (struct gaia_variant_value
1475 						  *variant, const char *value,
1476 						  int size);
1477 
1478     SPATIALITE_PRIVATE int gaia_set_variant_blob (struct gaia_variant_value
1479 						  *variant,
1480 						  const unsigned char *value,
1481 						  int size);
1482 
1483 #ifdef _WIN32
1484     SPATIALITE_PRIVATE void splite_pause_windows (void);
1485 #else
1486     SPATIALITE_PRIVATE void splite_pause_signal (void);
1487 #endif
1488 
1489     SPATIALITE_PRIVATE void finalize_topologies (const void *p_cache);
1490 
1491     SPATIALITE_PRIVATE int create_data_licenses (sqlite3 * sqlite);
1492 
1493     SPATIALITE_PRIVATE int create_geometry_columns_time (sqlite3 * sqlite);
1494 
1495     SPATIALITE_PRIVATE int create_spatial_ref_sys_aux (sqlite3 * handle);
1496 
1497     SPATIALITE_PRIVATE int create_raster_coverages (sqlite3 * sqlite);
1498 
1499     SPATIALITE_PRIVATE int create_vector_coverages (sqlite3 * sqlite);
1500 
1501     SPATIALITE_PRIVATE int create_wms_tables (sqlite3 * sqlite);
1502 
1503     SPATIALITE_PRIVATE int create_external_graphics (sqlite3 * sqlite);
1504 
1505     SPATIALITE_PRIVATE int create_fonts (sqlite3 * sqlite);
1506 
1507     SPATIALITE_PRIVATE int create_raster_styles (sqlite3 * sqlite, int relaxed);
1508 
1509     SPATIALITE_PRIVATE int create_raster_styled_layers (sqlite3 * sqlite);
1510 
1511     SPATIALITE_PRIVATE int create_vector_styles (sqlite3 * sqlite, int relaxed);
1512 
1513     SPATIALITE_PRIVATE int create_vector_styled_layers (sqlite3 * sqlite);
1514 
1515     SPATIALITE_PRIVATE int create_iso_metadata (sqlite3 * sqlite, int relaxed);
1516 
1517     SPATIALITE_PRIVATE int create_iso_metadata_reference (sqlite3 * sqlite);
1518 
1519     SPATIALITE_PRIVATE int create_iso_metadata_view (sqlite3 * sqlite);
1520 
1521     SPATIALITE_PRIVATE int create_rl2map_configurations (sqlite3 * sqlite,
1522 							 int relaxed);
1523 
1524     SPATIALITE_PRIVATE int create_rl2map_configurations_view (sqlite3 * sqlite);
1525 
1526     SPATIALITE_PRIVATE int create_external_graphics_view (sqlite3 * sqlite);
1527 
1528     SPATIALITE_PRIVATE int create_fonts_view (sqlite3 * sqlite);
1529 
1530     SPATIALITE_PRIVATE int create_raster_styled_layers_view (sqlite3 * sqlite);
1531 
1532     SPATIALITE_PRIVATE int create_raster_styles_view (sqlite3 * sqlite);
1533 
1534     SPATIALITE_PRIVATE int create_vector_styles_view (sqlite3 * sqlite);
1535 
1536     SPATIALITE_PRIVATE int create_vector_styled_layers_view (sqlite3 * sqlite);
1537 
1538     SPATIALITE_PRIVATE int createMissingSystemTables (sqlite3 * sqlite,
1539 						      const void *cache,
1540 						      int relaxed,
1541 						      int transaction,
1542 						      char **err_msg);
1543 
1544 #ifdef __cplusplus
1545 }
1546 #endif
1547 
1548 #endif				/* _SPATIALITE_PRIVATE_H */
1549