Index: Makefile.am ================================================================== --- Makefile.am +++ Makefile.am @@ -1,11 +1,13 @@ ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = dist-zip foreign EXTRA_DIST = makefile.vc nmake.opt \ + makefile64.vc nmake64.opt \ makefile_mod.vc nmake_mod.opt \ + makefile_mod64.vc nmake_mod64.opt \ Android_3.0.2.mk Android_4.3.0.mk \ spatialite-4.3.0.mk Android_4.4.0.mk spatialite-4.4.0.mk \ mainpage.doxy README.coverage spatialite-sql-latest.html \ config-msvc.h Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -366,11 +366,13 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = dist-zip foreign EXTRA_DIST = makefile.vc nmake.opt \ + makefile64.vc nmake64.opt \ makefile_mod.vc nmake_mod.opt \ + makefile_mod64.vc nmake_mod64.opt \ Android_3.0.2.mk Android_4.3.0.mk \ spatialite-4.3.0.mk Android_4.4.0.mk spatialite-4.4.0.mk \ mainpage.doxy README.coverage spatialite-sql-latest.html \ config-msvc.h Index: config-msvc.h ================================================================== --- config-msvc.h +++ config-msvc.h @@ -13,11 +13,11 @@ /* Should be defined in order to enable LIBXML2 support. */ #define ENABLE_LIBXML2 1 /* Should be defined in order to enable RTTOPO support. */ -#define ENABLE_RTTOPO 1 +/* #define ENABLE_RTTOPO */ /* Should be defined in order to enable GEOS_ADVANCED support. */ #define GEOS_ADVANCED 1 /* Should be defined in order to fully disable GEOS non-thread-safe API. */ @@ -191,20 +191,20 @@ /* Define to the full name of this package. */ #define PACKAGE_NAME "libspatialite" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libspatialite 4.4.0-RC1" +#define PACKAGE_STRING "libspatialite 5.0.0-devel" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "libspatialite" /* Define to the home page for this package. */ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "4.4.0-RC1" +#define PACKAGE_VERSION "5.0.0-devel1" /* Should be defined when linking liblwgeom from PostGIS 2.1 (or later). */ /* #undefine POSTGIS_2_1 */ /* Define to 1 if you have the ANSI C header files. */ @@ -218,11 +218,11 @@ /* Define to 1 if your declares `struct tm'. */ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ -#define VERSION "4.4.0-RC1" +#define VERSION "5.0.0-devel" /* Must be =64 in order to enable huge-file support. */ #define _FILE_OFFSET_BITS 64 /* Must be defined in order to enable huge-file support. */ Index: configure ================================================================== --- configure +++ configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libspatialite 4.4.0-RC1. +# Generated by GNU Autoconf 2.69 for libspatialite 5.0.0-devel. # # Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -588,12 +588,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libspatialite' PACKAGE_TARNAME='libspatialite' -PACKAGE_VERSION='4.4.0-RC1' -PACKAGE_STRING='libspatialite 4.4.0-RC1' +PACKAGE_VERSION='5.0.0-devel' +PACKAGE_STRING='libspatialite 5.0.0-devel' PACKAGE_BUGREPORT='a.furieri@lqt.it' PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ @@ -1367,11 +1367,11 @@ # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libspatialite 4.4.0-RC1 to adapt to many kinds of systems. +\`configure' configures libspatialite 5.0.0-devel to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. @@ -1437,11 +1437,11 @@ _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libspatialite 4.4.0-RC1:";; + short | recursive ) echo "Configuration of libspatialite 5.0.0-devel:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options @@ -1579,11 +1579,11 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libspatialite configure 4.4.0-RC1 +libspatialite configure 5.0.0-devel generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -2169,11 +2169,11 @@ } # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libspatialite $as_me 4.4.0-RC1, which was +It was created by libspatialite $as_me 5.0.0-devel, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF @@ -3040,11 +3040,11 @@ fi # Define the identity of the package. PACKAGE='libspatialite' - VERSION='4.4.0-RC1' + VERSION='5.0.0-devel' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF @@ -17412,11 +17412,11 @@ else as_fn_error $? "'libz' is required but it doesn't seem to be installed on this system." "$LINENO" 5 fi -ac_config_files="$ac_config_files Makefile src/Makefile src/headers/Makefile src/gaiaaux/Makefile src/gaiaexif/Makefile src/gaiageo/Makefile src/gaiageo/flex/Makefile src/gaiageo/lemon/Makefile src/gaiageo/lemon/lemon_src/Makefile src/geopackage/Makefile src/spatialite/Makefile src/shapefiles/Makefile src/dxf/Makefile src/md5/Makefile src/control_points/Makefile src/cutter/Makefile src/topology/Makefile src/srsinit/Makefile src/srsinit/epsg_update/Makefile src/connection_cache/Makefile src/connection_cache/generator/Makefile src/virtualtext/Makefile src/wfs/Makefile test/Makefile test/sql_stmt_tests/Makefile test/sql_stmt_geos_tests/Makefile test/sql_stmt_geosadvanced_tests/Makefile test/sql_stmt_geopackage_tests/Makefile test/sql_stmt_gpkg_epsg492_tests/Makefile test/sql_stmt_gpkg_epsg493_tests/Makefile test/sql_stmt_proj_tests/Makefile test/sql_stmt_proj492_tests/Makefile test/sql_stmt_proj493_tests/Makefile test/sql_stmt_mathsql_tests/Makefile test/sql_stmt_rtgeom_tests/Makefile test/sql_stmt_rttopo_tests/Makefile test/sql_stmt_libxml2_tests/Makefile test/sql_stmt_security_tests/Makefile test/sql_stmt_xmlsec_tests/Makefile test/sql_stmt_freexl_tests/Makefile test/sql_stmt_cache_tests/Makefile test/sql_stmt_gpkgcache_tests/Makefile test/sql_stmt_nocache_tests/Makefile test/sql_stmt_gpkgnocache_tests/Makefile test/sql_stmt_voronoj1_tests/Makefile test/sql_stmt_voronoj2_tests/Makefile test/sql_stmt_sequence_tests/Makefile examples/Makefile Doxyfile spatialite.pc" +ac_config_files="$ac_config_files Makefile src/Makefile src/headers/Makefile src/gaiaaux/Makefile src/gaiaexif/Makefile src/gaiageo/Makefile src/gaiageo/flex/Makefile src/gaiageo/lemon/Makefile src/gaiageo/lemon/lemon_src/Makefile src/geopackage/Makefile src/spatialite/Makefile src/shapefiles/Makefile src/dxf/Makefile src/md5/Makefile src/control_points/Makefile src/cutter/Makefile src/topology/Makefile src/srsinit/Makefile src/srsinit/epsg_update/Makefile src/stored_procedures/Makefile src/connection_cache/Makefile src/connection_cache/generator/Makefile src/virtualtext/Makefile src/wfs/Makefile test/Makefile test/sql_stmt_tests/Makefile test/sql_stmt_geos_tests/Makefile test/sql_stmt_geosadvanced_tests/Makefile test/sql_stmt_geopackage_tests/Makefile test/sql_stmt_gpkg_epsg492_tests/Makefile test/sql_stmt_gpkg_epsg493_tests/Makefile test/sql_stmt_proj_tests/Makefile test/sql_stmt_proj492_tests/Makefile test/sql_stmt_proj493_tests/Makefile test/sql_stmt_mathsql_tests/Makefile test/sql_stmt_rtgeom_tests/Makefile test/sql_stmt_rttopo_tests/Makefile test/sql_stmt_libxml2_tests/Makefile test/sql_stmt_security_tests/Makefile test/sql_stmt_xmlsec_tests/Makefile test/sql_stmt_freexl_tests/Makefile test/sql_stmt_cache_tests/Makefile test/sql_stmt_gpkgcache_tests/Makefile test/sql_stmt_nocache_tests/Makefile test/sql_stmt_gpkgnocache_tests/Makefile test/sql_stmt_voronoj1_tests/Makefile test/sql_stmt_voronoj2_tests/Makefile test/sql_stmt_sequence_tests/Makefile test/sql_stmt_routing_tests/Makefile test/sql_stmt_logfile_tests/Makefile test/sql_stmt_iconv_tests/Makefile test/sql_stmt_point_geom/Makefile test/sql_stmt_tiny_point/Makefile examples/Makefile Doxyfile spatialite.pc" # exporting the TARGET_CPU string splite_cpu=`$CC -dumpmachine` cat >>confdefs.h <<_ACEOF @@ -19406,11 +19406,11 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libspatialite $as_me 4.4.0-RC1, which was +This file was extended by libspatialite $as_me 5.0.0-devel, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS @@ -19472,11 +19472,11 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libspatialite config.status 4.4.0-RC1 +libspatialite config.status 5.0.0-devel configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation @@ -20002,10 +20002,11 @@ "src/control_points/Makefile") CONFIG_FILES="$CONFIG_FILES src/control_points/Makefile" ;; "src/cutter/Makefile") CONFIG_FILES="$CONFIG_FILES src/cutter/Makefile" ;; "src/topology/Makefile") CONFIG_FILES="$CONFIG_FILES src/topology/Makefile" ;; "src/srsinit/Makefile") CONFIG_FILES="$CONFIG_FILES src/srsinit/Makefile" ;; "src/srsinit/epsg_update/Makefile") CONFIG_FILES="$CONFIG_FILES src/srsinit/epsg_update/Makefile" ;; + "src/stored_procedures/Makefile") CONFIG_FILES="$CONFIG_FILES src/stored_procedures/Makefile" ;; "src/connection_cache/Makefile") CONFIG_FILES="$CONFIG_FILES src/connection_cache/Makefile" ;; "src/connection_cache/generator/Makefile") CONFIG_FILES="$CONFIG_FILES src/connection_cache/generator/Makefile" ;; "src/virtualtext/Makefile") CONFIG_FILES="$CONFIG_FILES src/virtualtext/Makefile" ;; "src/wfs/Makefile") CONFIG_FILES="$CONFIG_FILES src/wfs/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; @@ -20030,10 +20031,15 @@ "test/sql_stmt_nocache_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_nocache_tests/Makefile" ;; "test/sql_stmt_gpkgnocache_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_gpkgnocache_tests/Makefile" ;; "test/sql_stmt_voronoj1_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_voronoj1_tests/Makefile" ;; "test/sql_stmt_voronoj2_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_voronoj2_tests/Makefile" ;; "test/sql_stmt_sequence_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_sequence_tests/Makefile" ;; + "test/sql_stmt_routing_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_routing_tests/Makefile" ;; + "test/sql_stmt_logfile_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_logfile_tests/Makefile" ;; + "test/sql_stmt_iconv_tests/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_iconv_tests/Makefile" ;; + "test/sql_stmt_point_geom/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_point_geom/Makefile" ;; + "test/sql_stmt_tiny_point/Makefile") CONFIG_FILES="$CONFIG_FILES test/sql_stmt_tiny_point/Makefile" ;; "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "Doxyfile") CONFIG_FILES="$CONFIG_FILES Doxyfile" ;; "spatialite.pc") CONFIG_FILES="$CONFIG_FILES spatialite.pc" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -1,10 +1,10 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT(libspatialite, 4.4.0-RC1, a.furieri@lqt.it) +AC_INIT(libspatialite, 5.0.0-devel, a.furieri@lqt.it) AC_LANG(C) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign]) AM_MAINTAINER_MODE @@ -127,10 +127,11 @@ src/control_points/Makefile \ src/cutter/Makefile \ src/topology/Makefile \ src/srsinit/Makefile \ src/srsinit/epsg_update/Makefile \ + src/stored_procedures/Makefile \ src/connection_cache/Makefile \ src/connection_cache/generator/Makefile \ src/virtualtext/Makefile \ src/wfs/Makefile \ test/Makefile \ @@ -155,10 +156,15 @@ test/sql_stmt_nocache_tests/Makefile \ test/sql_stmt_gpkgnocache_tests/Makefile \ test/sql_stmt_voronoj1_tests/Makefile \ test/sql_stmt_voronoj2_tests/Makefile \ test/sql_stmt_sequence_tests/Makefile \ + test/sql_stmt_routing_tests/Makefile \ + test/sql_stmt_logfile_tests/Makefile \ + test/sql_stmt_iconv_tests/Makefile \ + test/sql_stmt_point_geom/Makefile \ + test/sql_stmt_tiny_point/Makefile \ examples/Makefile \ Doxyfile \ spatialite.pc]) # exporting the TARGET_CPU string Index: examples/demo1.c ================================================================== --- examples/demo1.c +++ examples/demo1.c @@ -89,11 +89,11 @@ of the program handling the connection - in multithreaded programs a connection can never be share by different threads; the internal-cache block must be allocated by the same thread holding the connection */ - + cache = spatialite_alloc_connection (); spatialite_init_ex (handle, cache, 0); /* showing the SQLite version */ @@ -285,12 +285,13 @@ if (geom_type == GAIA_LINESTRING || geom_type == GAIA_MULTILINESTRING) { #ifndef OMIT_GEOS /* GEOS is required */ - gaiaGeomCollLength (geom, - &measure); + gaiaGeomCollLength_r (cache, + geom, + &measure); printf (" length=%1.2f", measure); #else printf (" length=?? [no GEOS support available]"); @@ -360,11 +361,11 @@ { /* freeing each tablename */ free (p_geotables[i]); } free (p_geotables); - spatialite_shutdown(); + spatialite_shutdown (); return 0; abort: sqlite3_close (handle); @@ -379,8 +380,8 @@ /* freeing each tablename */ free (p_geotables[i]); } free (p_geotables); } - spatialite_shutdown(); + spatialite_shutdown (); return -1; } Index: examples/demo2.c ================================================================== --- examples/demo2.c +++ examples/demo2.c @@ -238,11 +238,11 @@ /* then we insert a POINT, directly passing its coordinates */ gaiaAddPointToGeomColl (geo_pt, 1.5, 2.75); /* now we'll print the main attributes for this geometry */ printf ("step#1: %s\t\tDimension=%d IsValid=%d\n", geom_type (gaiaGeometryType (geo_pt)), - gaiaDimension (geo_pt), gaiaIsValid (geo_pt)); + gaiaDimension (geo_pt), gaiaIsValid_r (cache, geo_pt)); geometry_printout (geo_pt); /* @@ -263,11 +263,11 @@ gaiaSetPoint (line->Coords, 4, 100.0, 100.0); printf ("\nstep#2: %s\tDimension=%d IsValid=%d\n", geom_type (gaiaGeometryType (geo_ln)), - gaiaDimension (geo_ln), gaiaIsValid (geo_ln)); + gaiaDimension (geo_ln), gaiaIsValid_r (cache, geo_ln)); geometry_printout (geo_ln); /* @@ -323,11 +323,11 @@ gaiaSetPoint (ring->Coords, 4, 30.0, 30.0); printf ("\nstep#3: %s\tDimension=%d IsValid=%d\n", geom_type (gaiaGeometryType (geo_pg)), - gaiaDimension (geo_pg), gaiaIsValid (geo_pg)); + gaiaDimension (geo_pg), gaiaIsValid_r (cache, geo_pg)); geometry_printout (geo_pg); /* @@ -341,11 +341,11 @@ gaiaAddPointToGeomColl (geo_mpt, 5.0, 15.0); gaiaAddPointToGeomColl (geo_mpt, 25.0, 5.0); gaiaAddPointToGeomColl (geo_mpt, 5.0, 25.0); printf ("\nstep#4: %s\tDimension=%d IsValid=%d\n", geom_type (gaiaGeometryType (geo_mpt)), - gaiaDimension (geo_mpt), gaiaIsValid (geo_mpt)); + gaiaDimension (geo_mpt), gaiaIsValid_r (cache, geo_mpt)); geometry_printout (geo_mpt); /* @@ -363,11 +363,11 @@ gaiaSetPoint (line->Coords, 0, 40.0, 50.0); gaiaSetPoint (line->Coords, 1, 50.0, 40.0); printf ("\nstep#5: %s\tDimension=%d IsValid=%d\n", geom_type (gaiaGeometryType (geo_mln)), - gaiaDimension (geo_mln), gaiaIsValid (geo_mln)); + gaiaDimension (geo_mln), gaiaIsValid_r (cache, geo_mln)); geometry_printout (geo_mln); /* @@ -393,11 +393,11 @@ gaiaSetPoint (ring->Coords, 3, 80.0, 90.0); gaiaSetPoint (ring->Coords, 4, 80.0, 80.0); printf ("\nstep#6: %s\tDimension=%d IsValid=%d\n", geom_type (gaiaGeometryType (geo_mpg)), - gaiaDimension (geo_mpg), gaiaIsValid (geo_mpg)); + gaiaDimension (geo_mpg), gaiaIsValid_r (cache, geo_mpg)); geometry_printout (geo_mpg); /* @@ -436,11 +436,11 @@ gaiaSetPoint (ring->Coords, 3, 180.0, 190.0); gaiaSetPoint (ring->Coords, 4, 180.0, 180.0); printf ("\nstep#7: %s\tDimension=%d IsValid=%d\n", geom_type (gaiaGeometryType (geo_coll)), - gaiaDimension (geo_coll), gaiaIsValid (geo_coll)); + gaiaDimension (geo_coll), gaiaIsValid_r (cache, geo_coll)); geometry_printout (geo_coll); @@ -540,8 +540,8 @@ gaiaFreeGeomColl (geo_mpg); if (geo_coll) gaiaFreeGeomColl (geo_coll); sqlite3_close (handle); spatialite_cleanup_ex (cache); - spatialite_shutdown(); + spatialite_shutdown (); return 0; } Index: makefile.vc ================================================================== --- makefile.vc +++ makefile.vc @@ -14,21 +14,21 @@ src\gaiageo\gg_transform.obj src\gaiageo\gg_vanuatu.obj \ src\gaiageo\gg_wkb.obj src\gaiageo\gg_wkt.obj \ src\gaiageo\gg_extras.obj src\gaiageo\gg_xml.obj \ src\gaiageo\gg_voronoj.obj src\gaiageo\gg_matrix.obj \ src\gaiageo\gg_relations_ext.obj src\gaiageo\gg_rttopo.obj \ - src/connection_cache/alloc_cache.obj \ + src/connection_cache/alloc_cache.obj src/connection_cache/gg_sequence.obj \ src\spatialite\mbrcache.obj src\shapefiles\shapefiles.obj \ src\spatialite\spatialite.obj src\spatialite\virtualdbf.obj \ src\spatialite\virtualfdo.obj src\spatialite\virtualnetwork.obj \ src\spatialite\virtualshape.obj src\spatialite\virtualspatialindex.obj \ src\spatialite\statistics.obj src\spatialite\metatables.obj \ src\spatialite\virtualXL.obj src\spatialite\extra_tables.obj \ src\spatialite\virtualxpath.obj src\spatialite\virtualbbox.obj \ src\spatialite\spatialite_init.obj src\spatialite\se_helpers.obj \ src\spatialite\srid_aux.obj src\spatialite\table_cloner.obj \ - src\spatialite\virtualelementary.obj \ + src\spatialite\virtualelementary.obj src\spatialite\virtualrouting.obj \ src\wfs\wfs_in.obj src\srsinit\srs_init.obj \ src\dxf\dxf_parser.obj src\dxf\dxf_loader.obj src\dxf\dxf_writer.obj \ src\dxf\dxf_load_distinct.obj src\dxf\dxf_load_mixed.obj \ src\shapefiles\validator.obj src\md5\md5.obj src\md5\gaia_md5.obj \ src\srsinit\epsg_inlined_00.obj src\srsinit\epsg_inlined_01.obj \ @@ -85,11 +85,11 @@ link /debug /dll /out:$(SPATIALITE_DLL) \ /implib:spatialite_i.lib $(LIBOBJ) \ C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \ C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \ C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \ - C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib + C:\OSGeo4W\lib\libxml2.lib if exist $(SPATIALITE_DLL).manifest mt -manifest \ $(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2 .c.obj: $(CC) $(CFLAGS) /c $*.c /Fo$@ @@ -97,13 +97,16 @@ clean: del *.dll del *.exp del *.manifest del *.lib + del src\connection_cache\*.obj + del src\cutter\*.obj del src\gaiaaux\*.obj del src\gaiaexif\*.obj del src\gaiageo\*.obj + del src\shapefiles\*.obj del src\spatialite\*.obj del src\srsinit\*.obj del src\versioninfo\*.obj del src\virtualtext\*.obj del src\wfs\*.obj ADDED makefile64.vc Index: makefile64.vc ================================================================== --- makefile64.vc +++ makefile64.vc @@ -0,0 +1,128 @@ +# $Id: $ +# +# NMAKE Makefile to build libspatialite on Windows +# +!INCLUDE nmake64.opt + +LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \ + src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \ + src\gaiageo\gg_endian.obj src\gaiageo\gg_ewkt.obj \ + src\gaiageo\gg_geodesic.obj src\gaiageo\gg_geoJSON.obj \ + src\gaiageo\gg_geometries.obj src\gaiageo\gg_geoscvt.obj \ + src\gaiageo\gg_gml.obj src\gaiageo\gg_kml.obj \ + src\gaiageo\gg_relations.obj src\gaiageo\gg_shape.obj \ + src\gaiageo\gg_transform.obj src\gaiageo\gg_vanuatu.obj \ + src\gaiageo\gg_wkb.obj src\gaiageo\gg_wkt.obj \ + src\gaiageo\gg_extras.obj src\gaiageo\gg_xml.obj \ + src\gaiageo\gg_voronoj.obj src\gaiageo\gg_matrix.obj \ + src\gaiageo\gg_relations_ext.obj src\gaiageo\gg_rttopo.obj \ + src/connection_cache/alloc_cache.obj src/connection_cache/gg_sequence.obj \ + src\spatialite\mbrcache.obj src\shapefiles\shapefiles.obj \ + src\spatialite\spatialite.obj src\spatialite\virtualdbf.obj \ + src\spatialite\virtualfdo.obj src\spatialite\virtualnetwork.obj \ + src\spatialite\virtualshape.obj src\spatialite\virtualspatialindex.obj \ + src\spatialite\statistics.obj src\spatialite\metatables.obj \ + src\spatialite\virtualXL.obj src\spatialite\extra_tables.obj \ + src\spatialite\virtualxpath.obj src\spatialite\virtualbbox.obj \ + src\spatialite\spatialite_init.obj src\spatialite\se_helpers.obj \ + src\spatialite\srid_aux.obj src\spatialite\table_cloner.obj \ + src\spatialite\virtualelementary.obj src\spatialite\virtualrouting.obj \ + src\wfs\wfs_in.obj src\srsinit\srs_init.obj \ + src\dxf\dxf_parser.obj src\dxf\dxf_loader.obj src\dxf\dxf_writer.obj \ + src\dxf\dxf_load_distinct.obj src\dxf\dxf_load_mixed.obj \ + src\shapefiles\validator.obj src\md5\md5.obj src\md5\gaia_md5.obj \ + src\srsinit\epsg_inlined_00.obj src\srsinit\epsg_inlined_01.obj \ + src\srsinit\epsg_inlined_02.obj src\srsinit\epsg_inlined_03.obj \ + src\srsinit\epsg_inlined_04.obj src\srsinit\epsg_inlined_05.obj \ + src\srsinit\epsg_inlined_06.obj src\srsinit\epsg_inlined_07.obj \ + src\srsinit\epsg_inlined_08.obj src\srsinit\epsg_inlined_09.obj \ + src\srsinit\epsg_inlined_10.obj src\srsinit\epsg_inlined_11.obj \ + src\srsinit\epsg_inlined_12.obj src\srsinit\epsg_inlined_13.obj \ + src\srsinit\epsg_inlined_14.obj src\srsinit\epsg_inlined_15.obj \ + src\srsinit\epsg_inlined_16.obj src\srsinit\epsg_inlined_17.obj \ + src\srsinit\epsg_inlined_18.obj src\srsinit\epsg_inlined_19.obj \ + src\srsinit\epsg_inlined_20.obj src\srsinit\epsg_inlined_21.obj \ + src\srsinit\epsg_inlined_22.obj src\srsinit\epsg_inlined_23.obj \ + src\srsinit\epsg_inlined_24.obj src\srsinit\epsg_inlined_25.obj \ + src\srsinit\epsg_inlined_26.obj src\srsinit\epsg_inlined_27.obj \ + src\srsinit\epsg_inlined_28.obj src\srsinit\epsg_inlined_29.obj \ + src\srsinit\epsg_inlined_30.obj src\srsinit\epsg_inlined_31.obj \ + src\srsinit\epsg_inlined_32.obj src\srsinit\epsg_inlined_33.obj \ + src\srsinit\epsg_inlined_34.obj src\srsinit\epsg_inlined_35.obj \ + src\srsinit\epsg_inlined_36.obj src\srsinit\epsg_inlined_37.obj \ + src\srsinit\epsg_inlined_38.obj src\srsinit\epsg_inlined_39.obj \ + src\srsinit\epsg_inlined_40.obj src\srsinit\epsg_inlined_41.obj \ + src\srsinit\epsg_inlined_42.obj src\srsinit\epsg_inlined_43.obj \ + src\srsinit\epsg_inlined_44.obj src\srsinit\epsg_inlined_45.obj \ + src\srsinit\epsg_inlined_46.obj src\srsinit\epsg_inlined_extra.obj \ + src\srsinit\epsg_inlined_prussian.obj \ + src\srsinit\epsg_inlined_wgs84_00.obj src\srsinit\epsg_inlined_wgs84_01.obj \ + src\versioninfo\version.obj src\virtualtext\virtualtext.obj \ + src\cutter\gaia_cutter.obj src\spatialite\virtualknn.obj \ + src\topology\gaia_auxnet.obj src\topology\gaia_topostmts.obj \ + src\topology\gaia_auxtopo.obj src\topology\lwn_network.obj \ + src\topology\gaia_netstmts.obj src\topology\net_callbacks.obj \ + src\topology\gaia_network.obj src\topology\topo_callbacks.obj \ + src\topology\gaia_topology.obj + +SPATIALITE_DLL = spatialite$(VERSION).dll + +CFLAGS = /nologo -I.\src\headers -I.\src\topology \ + -I. -IC:\OSGeo4W64\include -IC:\OSGeo4W64\include\libxml2 $(OPTFLAGS) + +default: all + +all: spatialite.lib spatialite_i.lib +#$(EXIF_LOADER_EXE) + +spatialite.lib: $(LIBOBJ) + if exist spatialite.lib del spatialite.lib + lib /out:spatialite.lib $(LIBOBJ) + +$(SPATIALITE_DLL): spatialite_i.lib + +spatialite_i.lib: $(LIBOBJ) + link /debug /dll /out:$(SPATIALITE_DLL) \ + /implib:spatialite_i.lib $(LIBOBJ) \ + C:\OSGeo4W64\lib\proj_i.lib C:\OSGeo4W64\lib\geos_c.lib \ + C:\OSGeo4w64\lib\freexl_i.lib C:\OSGeo4w64\lib\iconv.lib \ + C:\OSGeo4W64\lib\sqlite3_i.lib C:\OSGeo4W64\lib\zlib.lib \ + C:\OSGeo4W64\lib\libxml2.lib + if exist $(SPATIALITE_DLL).manifest mt -manifest \ + $(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2 + +.c.obj: + $(CC) $(CFLAGS) /c $*.c /Fo$@ + +clean: + del *.dll + del *.exp + del *.manifest + del *.lib + del src\connection_cache\*.obj + del src\cutter\*.obj + del src\gaiaaux\*.obj + del src\gaiaexif\*.obj + del src\gaiageo\*.obj + del src\shapefiles\*.obj + del src\spatialite\*.obj + del src\srsinit\*.obj + del src\versioninfo\*.obj + del src\virtualtext\*.obj + del src\wfs\*.obj + del src\dxf\*.obj + del src\md5\*.obj + del src\topology\*.obj + del *.pdb + +install: all + -mkdir $(INSTDIR) + -mkdir $(INSTDIR)\bin + -mkdir $(INSTDIR)\lib + -mkdir $(INSTDIR)\include + -mkdir $(INSTDIR)\include\spatialite + copy *.dll $(INSTDIR)\bin + copy *.lib $(INSTDIR)\lib + copy src\headers\spatialite.h $(INSTDIR)\include + copy src\headers\spatialite\*.h $(INSTDIR)\include\spatialite + Index: makefile_mod.vc ================================================================== --- makefile_mod.vc +++ makefile_mod.vc @@ -14,21 +14,21 @@ src\gaiageo\gg_transform.obj src\gaiageo\gg_vanuatu.obj \ src\gaiageo\gg_wkb.obj src\gaiageo\gg_wkt.obj \ src\gaiageo\gg_extras.obj src\gaiageo\gg_xml.obj \ src\gaiageo\gg_voronoj.obj src\gaiageo\gg_matrix.obj \ src\gaiageo\gg_relations_ext.obj src\gaiageo\gg_rttopo.obj \ - src/connection_cache/alloc_cache.obj \ + src/connection_cache/alloc_cache.obj src/connection_cache/gg_sequence.obj \ src\spatialite\mbrcache.obj src\shapefiles\shapefiles.obj \ src\spatialite\spatialite.obj src\spatialite\virtualdbf.obj \ src\spatialite\virtualfdo.obj src\spatialite\virtualnetwork.obj \ src\spatialite\virtualshape.obj src\spatialite\virtualspatialindex.obj \ src\spatialite\statistics.obj src\spatialite\metatables.obj \ src\spatialite\virtualXL.obj src\spatialite\extra_tables.obj \ src\spatialite\virtualxpath.obj src\spatialite\virtualbbox.obj \ src\spatialite\spatialite_init.obj src\spatialite\se_helpers.obj \ src\spatialite\srid_aux.obj src\spatialite\table_cloner.obj \ - src\spatialite\virtualelementary.obj \ + src\spatialite\virtualelementary.obj src\spatialite\virtualrouting.obj \ src\wfs\wfs_in.obj src\srsinit\srs_init.obj \ src\dxf\dxf_parser.obj src\dxf\dxf_loader.obj src\dxf\dxf_writer.obj \ src\dxf\dxf_load_distinct.obj src\dxf\dxf_load_mixed.obj \ src\shapefiles\validator.obj src\md5\md5.obj src\md5\gaia_md5.obj \ src\srsinit\epsg_inlined_00.obj src\srsinit\epsg_inlined_01.obj \ @@ -84,11 +84,11 @@ link /debug /dll /out:$(MOD_SPATIALITE_DLL) \ /implib:mod_spatialite_i.lib $(LIBOBJ) \ C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \ C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \ C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \ - C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib + C:\OSGeo4W\lib\libxml2.lib if exist $(MOD_SPATIALITE_DLL).manifest mt -manifest \ $(MOD_SPATIALITE_DLL).manifest -outputresource:$(MOD_SPATIALITE_DLL);2 .c.obj: $(CC) $(CFLAGS) /c $*.c /Fo$@ @@ -96,20 +96,24 @@ clean: del *.dll del *.exp del *.manifest del *.lib + del src\connection_cache\*.obj + del src\cutter\*.obj del src\gaiaaux\*.obj del src\gaiaexif\*.obj del src\gaiageo\*.obj + del src\shapefiles\*.obj del src\spatialite\*.obj del src\srsinit\*.obj del src\versioninfo\*.obj del src\virtualtext\*.obj del src\wfs\*.obj del src\dxf\*.obj del src\md5\*.obj + del src\topology\*.obj del *.pdb install: all -mkdir $(INSTDIR) -mkdir $(INSTDIR)\bin ADDED makefile_mod64.vc Index: makefile_mod64.vc ================================================================== --- makefile_mod64.vc +++ makefile_mod64.vc @@ -0,0 +1,127 @@ +# $Id: $ +# +# NMAKE Makefile to build libspatialite on Windows +# +!INCLUDE nmake_mod64.opt + +LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \ + src\gaiaexif\gaia_exif.obj src\gaiageo\gg_advanced.obj \ + src\gaiageo\gg_endian.obj src\gaiageo\gg_ewkt.obj \ + src\gaiageo\gg_geodesic.obj src\gaiageo\gg_geoJSON.obj \ + src\gaiageo\gg_geometries.obj src\gaiageo\gg_geoscvt.obj \ + src\gaiageo\gg_gml.obj src\gaiageo\gg_kml.obj \ + src\gaiageo\gg_relations.obj src\gaiageo\gg_shape.obj \ + src\gaiageo\gg_transform.obj src\gaiageo\gg_vanuatu.obj \ + src\gaiageo\gg_wkb.obj src\gaiageo\gg_wkt.obj \ + src\gaiageo\gg_extras.obj src\gaiageo\gg_xml.obj \ + src\gaiageo\gg_voronoj.obj src\gaiageo\gg_matrix.obj \ + src\gaiageo\gg_relations_ext.obj src\gaiageo\gg_rttopo.obj \ + src/connection_cache/alloc_cache.obj src/connection_cache/gg_sequence.obj \ + src\spatialite\mbrcache.obj src\shapefiles\shapefiles.obj \ + src\spatialite\spatialite.obj src\spatialite\virtualdbf.obj \ + src\spatialite\virtualfdo.obj src\spatialite\virtualnetwork.obj \ + src\spatialite\virtualshape.obj src\spatialite\virtualspatialindex.obj \ + src\spatialite\statistics.obj src\spatialite\metatables.obj \ + src\spatialite\virtualXL.obj src\spatialite\extra_tables.obj \ + src\spatialite\virtualxpath.obj src\spatialite\virtualbbox.obj \ + src\spatialite\spatialite_init.obj src\spatialite\se_helpers.obj \ + src\spatialite\srid_aux.obj src\spatialite\table_cloner.obj \ + src\spatialite\virtualelementary.obj src\spatialite\virtualrouting.obj \ + src\wfs\wfs_in.obj src\srsinit\srs_init.obj \ + src\dxf\dxf_parser.obj src\dxf\dxf_loader.obj src\dxf\dxf_writer.obj \ + src\dxf\dxf_load_distinct.obj src\dxf\dxf_load_mixed.obj \ + src\shapefiles\validator.obj src\md5\md5.obj src\md5\gaia_md5.obj \ + src\srsinit\epsg_inlined_00.obj src\srsinit\epsg_inlined_01.obj \ + src\srsinit\epsg_inlined_02.obj src\srsinit\epsg_inlined_03.obj \ + src\srsinit\epsg_inlined_04.obj src\srsinit\epsg_inlined_05.obj \ + src\srsinit\epsg_inlined_06.obj src\srsinit\epsg_inlined_07.obj \ + src\srsinit\epsg_inlined_08.obj src\srsinit\epsg_inlined_09.obj \ + src\srsinit\epsg_inlined_10.obj src\srsinit\epsg_inlined_11.obj \ + src\srsinit\epsg_inlined_12.obj src\srsinit\epsg_inlined_13.obj \ + src\srsinit\epsg_inlined_14.obj src\srsinit\epsg_inlined_15.obj \ + src\srsinit\epsg_inlined_16.obj src\srsinit\epsg_inlined_17.obj \ + src\srsinit\epsg_inlined_18.obj src\srsinit\epsg_inlined_19.obj \ + src\srsinit\epsg_inlined_20.obj src\srsinit\epsg_inlined_21.obj \ + src\srsinit\epsg_inlined_22.obj src\srsinit\epsg_inlined_23.obj \ + src\srsinit\epsg_inlined_24.obj src\srsinit\epsg_inlined_25.obj \ + src\srsinit\epsg_inlined_26.obj src\srsinit\epsg_inlined_27.obj \ + src\srsinit\epsg_inlined_28.obj src\srsinit\epsg_inlined_29.obj \ + src\srsinit\epsg_inlined_30.obj src\srsinit\epsg_inlined_31.obj \ + src\srsinit\epsg_inlined_32.obj src\srsinit\epsg_inlined_33.obj \ + src\srsinit\epsg_inlined_34.obj src\srsinit\epsg_inlined_35.obj \ + src\srsinit\epsg_inlined_36.obj src\srsinit\epsg_inlined_37.obj \ + src\srsinit\epsg_inlined_38.obj src\srsinit\epsg_inlined_39.obj \ + src\srsinit\epsg_inlined_40.obj src\srsinit\epsg_inlined_41.obj \ + src\srsinit\epsg_inlined_42.obj src\srsinit\epsg_inlined_43.obj \ + src\srsinit\epsg_inlined_44.obj src\srsinit\epsg_inlined_45.obj \ + src\srsinit\epsg_inlined_46.obj src\srsinit\epsg_inlined_extra.obj \ + src\srsinit\epsg_inlined_prussian.obj \ + src\srsinit\epsg_inlined_wgs84_00.obj src\srsinit\epsg_inlined_wgs84_01.obj \ + src\versioninfo\version.obj src\virtualtext\virtualtext.obj \ + src\cutter\gaia_cutter.obj src\spatialite\virtualknn.obj \ + src\topology\gaia_auxnet.obj src\topology\gaia_topostmts.obj \ + src\topology\gaia_auxtopo.obj src\topology\lwn_network.obj \ + src\topology\gaia_netstmts.obj src\topology\net_callbacks.obj \ + src\topology\gaia_network.obj src\topology\topo_callbacks.obj \ + src\topology\gaia_topology.obj +MOD_SPATIALITE_DLL = mod_spatialite$(VERSION).dll + +CFLAGS = /nologo -I.\src\headers -I.\src\topology \ + -I. -IC:\OSGeo4W64\include -IC:\OSGeo4W64\include\libxml2 $(OPTFLAGS) + +default: all + +all: mod_spatialite.lib mod_spatialite_i.lib +#$(EXIF_LOADER_EXE) + +mod_spatialite.lib: $(LIBOBJ) + if exist mod_spatialite.lib del mod_spatialite.lib + lib /out:mod_spatialite.lib $(LIBOBJ) + +$(MOD_SPATIALITE_DLL): mod_spatialite_i.lib + +mod_spatialite_i.lib: $(LIBOBJ) + link /debug /dll /out:$(MOD_SPATIALITE_DLL) \ + /implib:mod_spatialite_i.lib $(LIBOBJ) \ + C:\OSGeo4W64\lib\proj_i.lib C:\OSGeo4W64\lib\geos_c.lib \ + C:\OSGeo4w64\lib\freexl_i.lib C:\OSGeo4w64\lib\iconv.lib \ + C:\OSGeo4W64\lib\sqlite3_i.lib C:\OSGeo4W64\lib\zlib.lib \ + C:\OSGeo4W64\lib\libxml2.lib + if exist $(MOD_SPATIALITE_DLL).manifest mt -manifest \ + $(MOD_SPATIALITE_DLL).manifest -outputresource:$(MOD_SPATIALITE_DLL);2 + +.c.obj: + $(CC) $(CFLAGS) /c $*.c /Fo$@ + +clean: + del *.dll + del *.exp + del *.manifest + del *.lib + del src\connection_cache\*.obj + del src\cutter\*.obj + del src\gaiaaux\*.obj + del src\gaiaexif\*.obj + del src\gaiageo\*.obj + del src\shapefiles\*.obj + del src\spatialite\*.obj + del src\srsinit\*.obj + del src\versioninfo\*.obj + del src\virtualtext\*.obj + del src\wfs\*.obj + del src\dxf\*.obj + del src\md5\*.obj + del src\topology\*.obj + del *.pdb + +install: all + -mkdir $(INSTDIR) + -mkdir $(INSTDIR)\bin + -mkdir $(INSTDIR)\lib + -mkdir $(INSTDIR)\include + -mkdir $(INSTDIR)\include\spatialite + copy *.dll $(INSTDIR)\bin + copy *.lib $(INSTDIR)\lib + copy src\headers\spatialite.h $(INSTDIR)\include + copy src\headers\spatialite\*.h $(INSTDIR)\include\spatialite + ADDED nmake64.opt Index: nmake64.opt ================================================================== --- nmake64.opt +++ nmake64.opt @@ -0,0 +1,12 @@ +# Directory tree where SpatiaLite will be installed. +INSTDIR=C:\OSGeo4W64 + +# Uncomment the first for an optimized build, or the second for debug. +OPTFLAGS= /nologo /Ox /fp:precise /W4 /MD /D_CRT_SECURE_NO_WARNINGS \ + /DDLL_EXPORT /DYY_NO_UNISTD_H +#OPTFLAGS= /nologo /Zi /MD /Fdspatialite.pdb /DDLL_EXPORT + +# Set the version number for the DLL. Normally we leave this blank since +# we want software that is dynamically loading the DLL to have no problem +# with version numbers. +VERSION= ADDED nmake_mod64.opt Index: nmake_mod64.opt ================================================================== --- nmake_mod64.opt +++ nmake_mod64.opt @@ -0,0 +1,12 @@ +# Directory tree where SpatiaLite will be installed. +INSTDIR=C:\OSGeo4W64 + +# Uncomment the first for an optimized build, or the second for debug. +OPTFLAGS= /nologo /Ox /fp:precise /W4 /MD /D_CRT_SECURE_NO_WARNINGS \ + /DDLL_EXPORT /DLOADABLE_EXTENSION /DYY_NO_UNISTD_H +#OPTFLAGS= /nologo /Zi /MD /Fdmod_spatialite.pdb /DDLL_EXPORT + +# Set the version number for the DLL. Normally we leave this blank since +# we want software that is dynamically loading the DLL to have no problem +# with version numbers. +VERSION= Index: spatialite-sql-latest.html ================================================================== --- spatialite-sql-latest.html +++ spatialite-sql-latest.html @@ -7,11 +7,11 @@ h3 {color:blue;} b {color:brown;} i {color:navy;} -

SpatiaLite 4.4.0-RC1          SQL functions reference list

+

SpatiaLite 4.5.0-devel          SQL functions reference list

back @@ -93,57 +96,57 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -176,15 +179,27 @@ - - + + - - + + @@ -237,31 +252,42 @@ The spatialite_gui tool will honor this setting for all floating point values to be displayed on the screen. + + + + + + + + + - + + Will return NULL if the Sequence identified by seq_name has never been used before. + Will return NULL if sequence_nextval() has never been called before. + Will return value on success or NULL on failure. @@ -489,19 +515,29 @@ - + + + + + + + @@ -553,11 +589,11 @@ corresponding to a function invocation on NULL or not-BLOB argument.
TRUE if this BLOB object corresponds to a valid JP2 [Jpeg2000] image - + - + - + + + + + + + + + + + + @@ -1182,16 +1239,15 @@ ST_SRID( geom Geometry ) : Integer - + + Will return a new Geometry BLOB object, or NULL on invalid arguments or errors. @@ -1271,14 +1327,44 @@ Any Linestring or Ring will be in reverse order (first vertex will be the last one, and last vertex will be the first one). + + + + + + + + + + + All Polygons will be oriented accordingly to Counter-Clockwise Rule (all Exterior + Ring will be counter-clockwise oriented, and all Interior Rings will be clockwise oriented). + + + + + + + + + + @@ -1428,11 +1514,11 @@ - + @@ -1576,11 +1662,11 @@ + ST_SimplifyPreserveTopology( c Curve , tolerance Double precision ) : Curve - + @@ -1732,11 +1818,11 @@ - @@ -1892,32 +1978,40 @@ - - + + + + + - + - @@ -1956,10 +2050,47 @@ expressed in meters.
In this later case the optional arg use_spheroid can be used to select the distance algorithm to be used: is use_spheroid = 1 the slowest but most accurate geodesic distance will be evaluated: in any other case the simplest great circle distance will be used instead + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2163,10 +2294,47 @@ + + + + + + + + + + @@ -2250,26 +2418,10 @@ - - - - - - - - - - @@ -2396,11 +2548,11 @@ NULL is returned on failure. - + - + + + + + + g Integer , h Integer , i Integer , xoff Integer , yoff Integer , zoff Integer ] ) : AffineMatrix - - - - - @@ -2595,37 +2758,37 @@ - - - - - @@ -2672,13 +2835,13 @@
  • the input Geometries must be of the Point type and must have the same dimensions
  • if the points have XYZ or XYZM dimensions then 3D coeffs will be returned, otherwise 2D coeffs will be return.
  • the optional order argument can assume the following values:
    • 0: a set of 2D coeffs will be returned by applying the Thin Plate Spline method.
    • -
    • 1: (default setting) a set of 2D or 3D Polynomial coeffs of the 1st order will be returned.
    • -
    • 2: a set of 2D or 3D Polynomial coeffs of the 2nd order will be returned.
    • -
    • 3: a set of 2D or 3D Polynomial coeffs of the 3rd order will be returned.
    • +
    • 1: (default setting) a set of 2D or 3D Polynomial coeffs of the 1st order will be returned.
    • +
    • 2: a set of 2D or 3D Polynomial coeffs of the 2nd order will be returned.
    • +
    • 3: a set of 2D or 3D Polynomial coeffs of the 3rd order will be returned.

  • will return NULL on invalid arguments
    aggreagate function @@ -2727,10 +2890,26 @@
  • if the optional argument transaction is set to TRUE the whole operation will be handled as a single Transaction (faster): the default setting is transaction=FALSE (slower, but safer).
  • if the optional argument mode is not specified then any possible ESPG SRID definition will be inserted into the spatial_ref_sys table.
  • if the mode arg 'WGS84' (alias 'WGS84_ONLY') is specified, then only WGS84-related EPSG SRIDs will be inserted
  • if the mode arg 'NONE' (alias 'EMPTY') is specified, no EPSG SRID will be inserted at all
  • + + + + + - + + + + + + + + + + + + + + + + + + + + + @@ -3004,17 +3252,32 @@
  • coverage_name must identify an existing Vector Coverage.

  • the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments. - + + + + + + @@ -3021,11 +3284,11 @@ @@ -3081,11 +3344,11 @@ @@ -3109,11 +3372,11 @@
    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments. + SE_UnregisterVectorStyle( style_name Text [ , remove_all Integer ] ) : Integer + SE_ReloadVectorStyle( style_name Text , style BLOB ) : Integer + SE_UnregisterRasterStyle( style_name Text [ , remove_all Integer ] ) : Integer + SE_ReloadRasterStyle( style_name Text , style BLOB ) : Integer @@ -3408,11 +3671,11 @@
    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments. + SE_UnregisterGroupStyle( style_name Text [ , remove_all Integer ] ) : Integer + SE_ReloadGroupStyle( style_name Text , style BLOB ) : Integer - + +
    + The optional db_prefix argument specifies which one of the ATTACHED databases is intended to be checked; if unspecified or NULL then + the MAIN database will be assumed by default. - + + the return type is Integer [how many VirtualFDO tables have been created]
    + The optional db_prefix argument specifies which one of the ATTACHED databases is intended to be targeted; if unspecified or NULL then + the MAIN database will be assumed by default. - + + the return type is Integer [how many VirtualFDO tables have been destroyed]
    + the return type is Integer [how many VirtualFDO tables have been created]
    + The optional db_prefix argument specifies which one of the ATTACHED databases is intended to be targeted; if unspecified or NULL then + the MAIN database will be assumed by default. @@ -3585,29 +3859,38 @@ - + - + - + + the return type is Integer [how many VirtualGPKG tables have been created]
    + The optional db_prefix argument specifies which one of the ATTACHED databases is intended to be targeted; if unspecified or NULL then + the MAIN database will be assumed by default. - + + the return type is Integer [how many VirtualGPKG tables have been destroyed]
    + The optional db_prefix argument specifies which one of the ATTACHED databases is intended to be targeted; if unspecified or NULL then + the MAIN database will be assumed by default. - - + + + + + + + Will return 1 on success), 0 on failure, -1 on invalid args: an exception will be raised while passing a negative tolerance value. + TopoGeo_AddLineString( toponame Text , linestring Geometry , tolerance Double precision ) : Text + TopoGeo_AddLineStringNoFace( toponame Text , linestring Geometry , tolerance Double precision ) : Text - + + tolerance_snap Double precision , tolerance_removal Double precision , iterate Integer ) : Integer - + + + + + - + + + + + + + + + + @@ -4719,11 +5048,11 @@ - + @@ -4744,11 +5073,12 @@
  • netname: the individual unique name of this Topo-Net: all subordinated tables will use it as a prefix.
  • spatial: if set to TRUE this Topo-Net will be considered a Spatial-Network, otherwise a Logical-Network will be assumed (FALSE by default).
  • srid: the Spatial Reference System supporting this Topo-Net (-1 by default).
  • has_z: if set to TRUE this Topo-Net will support 3D - XYZ coordinates (FALSE by default).
  • allow_coincident: if set to FALSE all Node-on-Node, Link-on-Node or Node-on-Link conditions will raise an exception (TRUE by default).
  • - + + Will return 1 on success), 0 on failure, -1 on invalid arguments. + + + + + - + + + + + @@ -4949,11 +5305,11 @@ Will return 1 on success; an exception will be raised on failure. - + @@ -5017,10 +5373,20 @@ Will return 1 on success; 0 on failure; -1 on invalid arguments. + + + @@ -5039,11 +5405,11 @@
  • key = 'version' , value = ''1.1.0'
  • key = 'version' , value = ''1.1.1'
  • key = 'version' , value = ''1.3.0'
  • -
  • is_default (optional arg): if the corresponding value will become the standard setting for the corresponding WMS Layer (FALSE if undefined).
  • +
  • is_default (optional arg): if the corresponding value will become the standard setting for the corresponding WMS Layer (FALSE if undefined).

  • Will return 1 on success; 0 on failure; -1 on invalid arguments. + + + + + + + + + + + + + + + + @@ -5105,20 +5522,20 @@ transaction Integer ) : Integer
    CloneTable( db-prefix Text , input_table Text , output_table Text , transaction Integer , option_1 Text [ , ... , option_10 Text ] ) : Integer + out_pk Text , out_multi_id Text , transaction Boolean ) : Integer
    + ElementaryGeometries( in_table Text , geom_column Text , out_table Text , + out_pk Text , out_multi_id Text , transaction Boolean , + option_1 Text [ , ... , option_10 Text ] ) : Integer + NULL will be returned if no such message currently exists. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    SQL Version Info [and build options testing] functions

    Functionlibxml2_version( void ) : String returns the current LibXML2 version as a text string
    or NULL if LibXML2 is currently unsupported
    HasIconv HasIconv( void ) : BooleanTRUE if the underlaying library was built enabling ICONV
    TRUE if the underlying library was built enabling ICONV
    HasMathSQL HasMathSQL( void ) : BooleanTRUE if the underlaying library was built enabling MATHSQL
    TRUE if the underlying library was built enabling MATHSQL
    HasGeoCallbacks HasGeoCallbacks( void ) : BooleanTRUE if the underlaying library was built enabling GEOCALLBACKS
    TRUE if the underlying library was built enabling GEOCALLBACKS
    HasProj HasProj( void ) : BooleanTRUE if the underlaying library was built enabling PROJ
    TRUE if the underlying library was built enabling PROJ
    HasGeos HasGeos( void ) : BooleanTRUE if the underlaying library was built enabling GEOS
    TRUE if the underlying library was built enabling GEOS
    HasGeosAdvanced HasGeosAdvanced( void ) : BooleanTRUE if the underlaying library was built enabling GEOSADVANCED
    TRUE if the underlying library was built enabling GEOSADVANCED
    HasGeosTrunk HasGeosTrunk( void ) : BooleanTRUE if the underlaying library was built enabling GEOSTRUNK
    TRUE if the underlying library was built enabling GEOSTRUNK
    HasGeosReentrant HasGeosReentrant( void ) : BooleanTRUE if the underlaying library was built enabling GEOSREENTRANT
    TRUE if the underlying library was built enabling GEOSREENTRANT
    HasGeosOnlyReentrant HasGeosOnlyReentrant( void ) : BooleanTRUE if the underlaying library was built enabling GEOSONLYREENTRANT
    TRUE if the underlying library was built enabling GEOSONLYREENTRANT
    HasRtTopo HasRtTopo( void ) : BooleanTRUE if the underlaying library was built enabling RTTOPO
    TRUE if the underlying library was built enabling RTTOPO
    HasLibXML2 HasLibXML2( void ) : BooleanTRUE if the underlaying library was built enabling LibXML2
    TRUE if the underlying library was built enabling LibXML2
    HasEpsg HasEpsg( void ) : BooleanTRUE if the underlaying library was built enabling EPSG
    TRUE if the underlying library was built enabling EPSG
    HasFreeXL HasFreeXL( void ) : BooleanTRUE if the underlaying library was built enabling FREEXL
    TRUE if the underlying library was built enabling FREEXL
    HasGeoPackage HasGeoPackage( void ) : BooleanTRUE if the underlaying library was built enabling GeoPackage support (GPKG)
    TRUE if the underlying library was built enabling GeoPackage support (GPKG)
    HasGCP HasGCP( void ) : Boolean
    HasGroundControlPoints ( void ) : Boolean
    TRUE if the underlaying library was built enabling Ground Control Points support (GGP)
    TRUE if the underlying library was built enabling Ground Control Points support (GGP)
    HasTopology HasTopology( void ) : BooleanTRUE if the underlaying library was built enabling Topology support
    TRUE if the underlying library was built enabling Topology (RTTOPO) support

    Generic SQL functions

    Function Syntax Summary
    returns the MD5 checksum corresponding to the input value.
    Will return NULL for non-BLOB or non-TEXT input.
    MD5TotalChecksum MD5TotalChecksum( BLOB | TEXT ) : Text returns a cumulative MD5 checksum.
    aggregate function
    EncodeURLEncodeURL( TEXT ) : Textreturns the percent encoded URL corresponding to the input value.
    Will return NULL for invalid input.
    EncodeURL( url Text ) : Text
    + EncodeURL( url Text , charset Text ) : Text
    returns the percent encoded URL corresponding to the input value.
    Will return NULL for invalid input. +
      +
    • the input URL is always assumed to be an UTF-8 string.
    • +
    • the output URL will be converted into the charset encoding specified by the charset argument.
      + if not specified UTF-8 will be assumed by default.
    • +
    DecodeURLDecodeURL( TEXT ) : Textreturns a plain URL from its corresponding percent encoding.
    Will return NULL for invalid input.
    DecodeURL( url Text ) : Text
    + DecodeURL( url Text, charset Text ) : Text
    returns a plain URL from its corresponding percent encoding.
    Will return NULL for invalid input. +
      +
    • the output URL will be always returned as an UTF-8 string.
    • +
    • the input URL will be converted from the charset encoding specified by the charset argument.
      + if not specified UTF-8 will be assumed by default.
    • +
    DirNameFromPath DirNameFromPath( TEXT ) : Text returns the Directory Name from a relative or absolute Pathname.
    Will return NULL for invalid input of for any simple path lacking a Directory.
    FullFileNameFromPath FullFileNameFromPath( TEXT ) : Text
    GetDecimalPrecision GetDecimalPrecision( void ) : integer Returns the currently set decimal precision.
    A negative precision identifies the default setting.
    EnableTinyPointEnableTinyPoint( void ) : voidEnables the TinyPoint BLOB encoding for all Point-Geometries being created.
    + all connections initially start by disabling the TinyPoint BLOB encoding, that has always to be explicitly enabled whenever reguired.

    + Exception: if the environment variable SPATIALITE_TINYPOINT=1 is set, then all connections will initially start by enabling the TinyPoint BLOB encoding.
    DisableTinyPointDisableTinyPoint( void ) : voidDisables the TinyPoint BLOB encoding; all Point-Geometries will then be creted by applying the classic BLOB-Geometry encoding.
    IsTinyPointEnabledIsTinyPointEnabled( void ) : booleanReturns TRUE if the TinyPoint BLOB encoding is currently enabled, otherwise FALSE

    SQL functions manipolating Sequences

    Function Syntax Summary
    sequence_nextval sequence_nextval ( seq_name Text ) : Integeradvances to its next value the Sequence and then returns the value.
    - Will return NULL if any error occurred.
    advances to its next value the Sequence and then returns the value.
    + Will return NULL if any error occurred.
    sequence_currval sequence_currval ( seq_name Text ) : Integer returns the value most recently obtained by sequence_nextval() for the Sequence identified by seq_name
    - Will return NULL if the Sequence identified by seq_name has never been used before.
    sequence_lastval sequence_lastval ( void ) : Integer returns the value most recently obtained by sequence_nextval()
    - Will return NULL if sequence_nextval() has never been called before.
    sequence_setval sequence_setval ( seq_name Text , value Integer ) : Integer sets the current value for the Sequence identified by seq_name; if the Sequence doesn't yet exist it will be created on-the-fly.
    - Will return value on success or NULL on failure.

    SQL math functions

    Function Syntax Summary
    DD to DMS LongLatToDMS( longitude Double precision , latitude Double precision ) : String will return a DMS string (Degrees, Minutes and Seconds) starting from DD (Decimal Degrees) input coordinates
    NULL will be returned on invalid input.
    DMS to DDLongitudeFromDMS( dms_expression Sting ) : Double precision
    - LatitudeFromDMS( dms_expression Sting ) : Double precision
    LongitudeFromDMS( dms_expression String ) : Double precision
    + LatitudeFromDMS( dms_expression String ) : Double precision
    will return the DD coordinates from within a DMS expression
    NULL will be returned on invalid input.

    SQL utility functions for BLOB objects

    Function Syntax Summary
    IsGeometryBlobIsGeometryBlob( content BLOB ) : IntegerThe return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and –1 for UNKNOWN + corresponding to a function invocation on NULL or not-BLOB argument.
    + TRUE if this BLOB object corresponds to a valid BLOB-Geometry object.
    IsTinyPointBlobIsTinyPointBlob( content BLOB ) : IntegerThe return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and –1 for UNKNOWN + corresponding to a function invocation on NULL or not-BLOB argument.
    + TRUE if this BLOB object corresponds to a valid BLOB-TinyPoint object.
    IsZipBlob IsZipBlob( content BLOB ) : Integer The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and –1 for UNKNOWN corresponding to a function invocation on NULL or not-BLOB argument.
    TRUE if this BLOB object corresponds to a valid ZIP-compressed file
    GetMimeType GetMimeType( payload BLOB ) : String The return type is Text, and could be one of: image/gif, image/png, - image/jpeg, image/jp2, image/tiff, image/svg+xml, application/xml, + image/jpeg, image/jp2, image/tiff, image/svg+xml, application/xml, application/zip, application/pdf.
    NULL could be returned for an invalid argument or if no valid mime-type is detected.
    BlobFromFile BlobFromFile( filepath String ) : BLOB If filepath corresponds to some valid pathname, and the corresponding file @@ -653,11 +689,11 @@ will return a closed LINESTRING approximating the Circle defined by cx, cy and radius.
    The optional argument step if specified defines how many points will be interpolated on the circumference; a point will be set every step degrees.
    The implicit default setting corresponds to a point every 10 degrees.
    MakeEllipse MakeEllipse( cx Double precision , cy Double precision , - x_axis Double precision , y_axis Double precisin [ , SRID Integer [ , + x_axis Double precision , y_axis Double precision [ , SRID Integer [ , step Double precision ] ] ) : Geometry base will return a closed LINESTRING approximating the Ellipse defined by cx, cy and x_axis, y_axis.
    The optional argument step if specified defines how many points will be interpolated on the ellipse; a point will be set every step degrees.
    @@ -712,12 +748,12 @@
    will return a POLYGON approximating the Circular Stripe delimited by two arcs sharing the same Centre [cx, cy] but having different radii [radius_1, radius_2]; the arc's extremities will be defined by start, stop angles expressed in degrees.
    The optional argument step if specified defines how many points will be interpolated on the circumference; a point will be set every step degrees.
    The implicit default setting corresponds to a point every 10 degrees.
    SquareGridSquareGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origing PointGeometry ] ] ) : Geometry
    - ST_SquareGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origing PointGeometry ] ] ) : Geometry
    SquareGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origin PointGeometry ] ] ) : Geometry
    + ST_SquareGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origin PointGeometry ] ] ) : Geometry
    GEOS return a grid of square cells (having the edge length of size) precisely covering the input Geometry.
    The specific Type of returned Geometry is controlled by the mode attribute value:
      @@ -726,12 +762,12 @@
    • any negative value will cause a MultiPoint to be returned.
    If the optional origin argument (expected to be a Point) is not specified then the (0,0) grid origin will be assumed by default.
    NULL will be returned if any error is encountered.
    TriangularGridTriangularGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origing PointGeometry ] ] ) : Geometry
    - ST_TriangularGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origing PointGeometry ] ] ) : Geometry
    TriangularGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origin PointGeometry ] ] ) : Geometry
    + ST_TriangularGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origin PointGeometry ] ] ) : Geometry
    GEOS return a grid of triangular cells (having the edge length of size) precisely covering the input Geometry.
    The specific Type of returned Geometry is controlled by the mode attribute value:
      @@ -740,12 +776,12 @@
    • any negative value will cause a MultiPoint to be returned.
    If the optional origin argument (expected to be a Point) is not specified then the (0,0) grid origin will be assumed by default.
    NULL will be returned if any error is encountered.
    HexagonalGridHexagonalGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origing PointGeometry ] ] ) : Geometry
    - ST_HexagonalGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origing PointGeometry ] ] ) : Geometry
    HexagonalGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origin PointGeometry ] ] ) : Geometry
    + ST_HexagonalGrid( geom ArealGeometry , size Double precision [ , mode Integer , [ origin PointGeometry ] ] ) : Geometry
    GEOS return a grid of hexagonal cells (having the edge length of size) precisely covering the input Geometry.
    The specific Type of returned Geometry is controlled by the mode attribute value:
      @@ -1123,16 +1159,37 @@
      • 0 XY dimension
      • 1 XYZ dimension
      • 2 XYM dimension
      • 3 XYZM dimension
      • -
    GeomFromFGF GeomFromFGF( fgfGeometry Binary [ , SRID Integer] ) : Geometry base construct a geometric object given its FGF binary Representation
    AsTWKBAsTWKB( geom Geometry ) : TWKB-blob
    + AsTWKB( geom Geometry , precision_xy Integer) : TWKB-blob
    + AsTWKB( geom Geometry , precision_xy Integer , precision_z Integer ) : TWKB-blob
    + AsTWKB( geom Geometry , precision_xy Integer , precision_z Integer , precision_m Integer ) : TWKB-blob
    + AsTWKB( geom Geometry , precision_xy Integer , precision_z Integer , precision_m Integer , with_size Integer ) : TWKB-blob
    + AsTWKB( geom Geometry , precision_xy Integer , precision_z Integer , precision_m Integer , with_size Integer , with_bbox Integer ) : TWKB-blob
    RTTOPOreturns the TWKB [Tiny Well Known Binary] representation (PostGIS/Mapnik compatibility) +
      +
    • the optional arguments precision_xy, precision_z and precision_m are intended to specify how many decimal digist should be preserved + for the corresponding coordinate (less decimal digits = stronger compression). If not specified the default value is alwasy ZERO (no decimal digits at all).
    • +
    • the optional arguments with_size and with_bbox are of the Boolean type (TRUE or FALSE) and respectively control if the + TWKB geometry should include or not a size and/or a BBOX. If not specified the default value is always FALSE.
    • +
    GeomFromTWKBGeomFromTWKB( twkbGeometry BLOB [ , SRID Integer] ) : GeometryRTTOPOconstruct a geometric object given its TWKB Representation

    SQL functions on type Geometry

    Function Syntax OGC
    defined
    X base returns the Spatial Reference System ID for this geometric object
    SetSRIDSetSRID( geom Geometry , SRID Integer ) : IntegerSetSRID( geom Geometry , SRID Integer ) : Geometry base directly sets the Spatial Reference System ID for this geometric object [no reprojection is applied]
    - The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and –1 for UNKNOWN - corresponding to a function invocation on NULL arguments.
    IsEmpty IsEmpty( geom Geometry ) : Integer
    ST_IsEmpty( geom Geometry ) : Integer
    X base
    ForceLHR ST_ForceLHR( geom Geometry ) : Geometry baseJust an alias-name for ST_ForcePolygonCW().
    +
    Note: this function in Spatialite has a different interpretation then in PostGIS.
    +
    ForcePolygonCWST_ForcePolygonCW( geom Geometry ) : Geometrybasereturns a new Geometry [if a valid Geometry was supplied], or NULL in any other case.
    + All Polygons will be oriented accordingly to Clockwise Rule (all Exterior + Ring will be clockwise oriented, and all Interior Rings will be counter-clockwise oriented).
    ForcePolygonCCWST_ForcePolygonCCW( geom Geometry ) : Geometry base returns a new Geometry [if a valid Geometry was supplied], or NULL in any other case.
    - Any Polygon Ring will be oriented accordingly to Left Hand Rule (Exterior - Ring will be clockwise oriented, and Interior Rings will be counter-clockwise oriented).
    IsPolygonCWST_IsPolygonCW( geom Geometry ) : Booleanbasereturns TRUE (1) if all Polygons into the Geometry are oriented accordingly to Clockwise Rule (all Exterior + Ring must be clockwise oriented, and all Interior Rings must be counter-clockwise oriented).
    + returns FALSE (0) if not; returns -1 on invalid Geometries.
    + Note: a Geometry containing no Polygons will always return TRUE.
    IsPolygonCCWST_IsPolygonCCW( geom Geometry ) : Booleanbasereturns TRUE (1) if all Polygons into the Geometry are oriented accordingly to Counter-Clockwise Rule (all Exterior + Ring must be counter-clockwise oriented, and all Interior Rings must be clockwise oriented).
    + returns FALSE (0) if not: returns -1 on invalid Geometries.
    + Note: a Geometry containing no Polygons will always return TRUE.

    SQL functions attempting to repair malformed Geometries

    Function Syntax OGC
    defined
    returns a Geometry using the [XYZ] space dimension
    CastToXYM CastToXYM( geom Geometry ) : geom Geometry basereturns a Geometry using the [XYZM] space dimension
    returns a Geometry using the [XYM] space dimension
    CastToXYZM CastToXYZM( geom Geometry ) : geom Geometry base returns a Geometry using the [XYZM] space dimension
    GEOS return a geometric object representing a simplified version of c applying the Douglas-Peuker algorithm with given tolerance
    SimplifyPreserveTopology SimplifyPreserveTopology( c Curve , tolerance Double precision ) : Curve
    - ST_SimplifyPreserveTopology( c Curve , tolerance Double precision ) : Curve
    GEOS return a geometric object representing a simplified version of c applying the Douglas-Peuker algorithm with given tolerance and respecting topology
    @@ -1713,11 +1799,11 @@
    InteriorRingN InteriorRingN( polyg Polygon , n Integer ) : LineString
    ST_InteriorRingN( polyg Polygon , n Integer ) : LineString
    X basereturn the nth interiorRing. The order of Rings is not geometrically significant.
    return the nth (1-based) interiorRing. The order of Rings is not geometrically significant.

    SQL functions on type GeomCollection

    Function Syntax OGC
    defined
    GeometryN GeometryN( geom GeomCollection , n Integer ) : Geometry
    ST_GeometryN( geom GeomCollection , n Integer ) : Geometry
    X basereturn the nth geometric object in the collection. + return the nth (1-based) geometric object in the collection. The order of the elements in the collection is not geometrically significant.

    SQL functions that test approximate spatial relationships via MBRs

    Function Syntax GEOS The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and –1 for UNKNOWN corresponding to a function invocation on NULL arguments;
    convenience predicate: TRUE if g1 is completely covered by g2
    RelateRelate( geom1 Geometry , geom2 Geometry , patternMatrix String ) : Integer
    - ST_Relate( geom1 Geometry , geom2 Geometry , patternMatrix Text ) : Integer
    +
    Relate

    OGC canonical signature

    + Relate( geom1 Geometry , geom2 Geometry , patternMatrix String ) : Integer
    + ST_Relate( geom1 Geometry , geom2 Geometry , patternMatrix Text ) : Integer
    XGEOSFor more informations about patternMatrix interpretation please read: DE-9IM

    + The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, + and –1 for UNKNOWN corresponding to a function invocation on NULL arguments;
    + returns TRUE if the spatial relationship specified by the patternMatrix holds.

    non-canonical signature (PostGIS-like)

    Relate( geom1 Geometry , geom2 Geometry ) : Text
    ST_Relate( geom1 Geometry , geom2 Geometry ) : Text
    Relate( geom1 Geometry , geom2 Geometry , bnr Integer ) : Text
    ST_Relate( geom1 Geometry , geom2 Geometry , bnr Integer ) : Text
    X GEOS

    OGC canonical signature

    - The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, - and –1 for UNKNOWN corresponding to a function invocation on NULL arguments;
    - returns TRUE if the spatial relationship specified by the patternMatrix holds.
    -

    non-canonical signature

    - The return type is Text, this corresponding to the serialized representation of some [DE-9IM] intersection matrix.
    +
    The return type is Text, this corresponding to the serialized representation of some [DE-9IM] intersection matrix.
    The optional argument bnr determines the Boundary Node Rule to be appiled, and has the following interpretation:
    • 1: OGC/MOD2 (this is the default case, and will be always assumed for any unknown value)
    • 2: Endpoint
    • 3: Multivalent Endpoint
    • 4: Monovalent Endpoint
    • -

    + + A patternMatrix returned by this function is then expected to be evaluated later by ST_RelateMatch().
    + The main advantage in using this approach is that this way a comprehensive result (the patternMatrix itself) representing all possible intersection + modes between two geometries will be be computed just once by ST_Relate() and could then be more precisely qualified by repeatedly calling ST_RelateMatch(); + the first operation is computationally heavy but the second is really fast, so an overall performance boot is usually expected when more than a single + intersection mode have to be checked at the same time, as e.g. OVERLAPS OR TOUCHES OR INTERSECTS.
    Will return NULL on NULL or invalid geometries.
    RelateMatch ST_RelatedMatch( matrix Text , pattern Text ) : Integer
    +

    SQL functions supporting Linear Referencing

    FunctionSyntaxOGC
    defined
    required
    module
    Summary
    AddMeasureST_AddMeasure( geom Geometry , m_start Double precision , m_end Double precision ) : GeometrybaseReturn a derived Geometry with M-values linearly interpolated between the start and end points.
    + NULL will be returned if any error is encountered.
    + Please note: NULL will be returned if geom is not of the Linestring or MultiLinestring type.
    InterpolatePointST_InterpolatePoint( line Geometry , point Geometry ) : Double precisionGEOSInterpolates the M-value of a linear Geometry at the point closest to the given point.
    + NULL will be returned if any error is encountered.
    + Please note: NULL will be returned if the first geometry is not a Linestring supporting M-values, or if the second geometry is not a Point.
    LocateAlongMeasureST_Locate_Along_Measure( geom Geometry , m_value Double precision ) : Geometry
    + ST_LocateAlong( geom Geometry , m_value Double precision ) : Geometry
    baseReturn a derived geometry collection value with elements that match the specified measure.
    + NULL will be returned if any error is encountered (or when no element corresponding to the given measure is found).
    + Please note: NULL will be returned if geom doesn't contain M-dimension, or if geom contains a Polygon, or if geom is a GeometryCollection.
    LocateBetweenMeasuresST_Locate_Between_Measures( geom Geometry , m_start Double precision , m_end Double precision ) : Geometry
    + ST_LocateBetween( geom Geometry , m_start Double precision , m_end Double precision ) : Geometry
    baseReturn a derived geometry collection value with elements that match the specified range of measures.
    + NULL will be returned if any error is encountered (or when no element corresponding to the given range of measures is found).
    + Please note: NULL will be returned if geom doesn't contain M-dimension, or if geom contains a Polygon, or if geom is a GeometryCollection.

    SQL functions that implement spatial operators

    Function Syntax OGC
    defined
    required
    module
    GEOS Exactely the same as ST_Union, but applied to a single Geometry.
    (set union of elementary Geometries within a MULTI- or GEOMETRYCOLLECTION complex Geometry)
    NULL will be returned if any error is encountered
    DrapeLineST_DrapeLine( geom1 Geometry , geom2 Geometry ) : Geometry
    + ST_DrapeLine( geom1 Geometry , geom2 Geometry , tolerance Double ) : Geometry
    GEOSWill return a 3D Linestring by draping geom1 over geom2: +
      +
    • geom1 is expected to be a 2D Linestring (XY or XYM dimensions).
    • +
    • geom2 is expected to be a 3D Linestring (XYZ or XYZM dimensions).
    • +
    • both geom1 and geom2 must share the same SRID.
    • +
    • the option tolerance is the distance radius between corresponding 2D and 3d points.
      + By default a 0.0 tolerance is intended, thus implying an exact coincidence of X and Y coordinates.
    • +
    + Note: The returned Linestring will contain all Vertices defined by geom1 faithfully preserving their X and Y values; + Z and M values will be recovered from the corresponding 3D Vertex from geom2, or will be + possibily interpolated if no direct match exists.
    + If neither a direct match nor interpolation can be applied then Z and M will assume a conventional 0.0 value.
    + NULL will be returned on invalid arguments or if any error is encountered.
    DrapeLineExceptionsST_DrapeLineExceptions( geom1 Geometry , geom2 Geometry ) : Geometry
    + ST_DrapeLineExceptions( geom1 Geometry , geom2 Geometry , tolerance Double ) : Geometry
    + ST_DrapeLineExceptions( geom1 Geometry , geom2 Geometry , tolerance Double , interpolated Bool ) : Geometry
    GEOSWill return a 3D MultiPoint containing all undraped Vertices encountered when draping geom1 over geom2: +
      +
    • geom1, geom2 and tolerance exactly have the same interpretation as in ST_DrapeLine().
    • +
    • the option interpolated argument has the following interpreation: +
        +
      • if FALSE all 2D Vertices lacking a matching 3D Vertex will be inserted into the returned MultiPoint, even when Z and/or M values + have been succesfully interpolated.
      • +
      • if TRUE only 2D Vertices completely lacking Z and/or M values (defaulting to 0.0) will be inserted into the returned MultiPoint.
      • +
      • if not specified then TRUE is assumed by default.
      • +
      +
    • +
    + NULL will be returned on invalid arguments, or if any error is encountered or if there aren't undraped Vertices.
    DissolveSegments DissolveSegments( geom Geometry ) : Geometry
    ST_DissolveSegments( geom Geometry ) : Geometry
    base base Given any arbitrary GEOMETRY will return a derived MULTIPOLYGON geometry. Sub-geometries not being of the POLYGON type will be ignored.
    NULL will be returned if any error is encountered (or when no POLYGON is found).
    LocateAlongMeasureST_Locate_Along_Measure( geom Geometry , m_value Double precision ) : Geometry
    - ST_LocateAlong( geom Geometry , m_value Double precision ) : Geometry
    baseReturn a derived geometry collection value with elements that match the specified measure.
    - NULL will be returned if any error is encountered (or when no element corresponding to the given measure is found).
    - Please note: NULL will be returned if geom doesn't contain M-dimension, or if geom contains a Polygon, or if geom is a GeometryCollection.
    LocateBetweenMeasuresST_Locate_Between_Measures( geom Geometry , m_start Double precision , m_end Double precision ) : Geometry
    - ST_LocateBetween( geom Geometry , m_start Double precision , m_end Double precision ) : Geometry
    baseReturn a derived geometry collection value with elements that match the specified range of measures.
    - NULL will be returned if any error is encountered (or when no element corresponding to the given range of measures is found).
    - Please note: NULL will be returned if geom doesn't contain M-dimension, or if geom contains a Polygon, or if geom is a GeometryCollection.

    SQL functions that implement spatial operators
    [GEOS advanced features]

    Function Syntax OGC
    defined
    GeoHash GeoHash( geom Geometry [ , precision Integer ] ) : String
    ST_GeoHash( geom Geometry [ , precision Integer ] ) : String
    LRTTOPORTTOPO Return a GeoHash representation (geohash.org) of the geometry.
    A GeoHash encodes a point into a text form that is sortable and searchable based on prefixing.
    • If no precision is specficified ST_GeoHash returns a GeoHash based on full precision of the input geometry type.
      Points return a GeoHash with 20 characters of precision (about enough to hold the full double precision of the input).
    • @@ -2465,15 +2617,26 @@
    Syntax OGC
    defined
    required
    module
    Summary
    TransformTransform( geom Geometry , newSRID Integer ) : Geometry
    +
    Transform( geom Geometry , newSRID Integer ) : Geometry
    ST_Transform( geom Geometry , newSRID Integer ) : Geometry
    PROJ.4 return a geometric object obtained by reprojecting coordinates into the Reference System identified by newSRID
    TransformXYTransformXY( geom Geometry , newSRID Integer ) : Geometry
    + ST_TransformXY( geom Geometry , newSRID Integer ) : Geometry
    PROJ.4this is a special flavor of ST_Transform(); just X and Y coordinates will be transformed, + Z and M values (if eventually present) will be left untouched.
    +
    + Mainly intended as a workaround for (possibly) imprecise +towsg84 PROJ.4 definitions; should never be used as aST_Transform() + replacement without a very careful evaluation.
    +
    SridFromAuthCRS SridFromAuthCRS( auth_name String , auth_SRID Integer ) : Integer base return the internal SRID corresponding to auth_name and auth_SRID
    @@ -2542,11 +2705,11 @@
    Summary
    ATM_Create ATM_Create( void ) : AffineMatrix
    ATM_Create( a Integer , b Integer , d Integer , e Integer , xoff Integer , yoff Integer ] ) : AffineMatrix
    ATM_Create( a Integer , b Integer , c Integer , d Integer , e Integer , f Integer , - g Integer , h Integer , i Integer , xoff Integer , yoff Integer , zoff Integer ] ) : AffineMatrix
    base return a BLOB-encoded Affine Transformation matrix.
    • the first form (no arguments) will return an Identity matrix.
    • @@ -2556,37 +2719,37 @@
    ATM_CreateTranslate ATM_CreateTranslate( tx Double precision , ty Double precision ] ) : AffineMatrix
    ATM_CreateTranslate( tx Double precision , ty Double precision , tz Double precision ] ) : AffineMatrix
    basereturn a BLOB-encoded Affine Transformation matrix representing a 2D or 3D Translate transformation.
    +
    return a BLOB-encoded Affine Transformation matrix representing a 2D or 3D Translate transformation.
    will return NULL on invalid arguments.
    ATM_CreateScale ATM_CreateScale( sx Double precision , sy Double precision ] ) : AffineMatrix
    ATM_CreateScale( sx Double precision , sy Double precision , sz Double precision ] ) : AffineMatrix
    basereturn a BLOB-encoded Affine Transformation matrix representing a 2D or 3D Scale transformation.
    +
    return a BLOB-encoded Affine Transformation matrix representing a 2D or 3D Scale transformation.
    will return NULL on invalid arguments.
    ATM_CreateRotate ATM_CreateRotate( angleInDegrees Double precision ] ) : AffineMatrix
    ATM_CreateZRoll( angleInDegrees Double precision ] ) : AffineMatrix
    basereturn a BLOB-encoded Affine Transformation matrix representing a Rotate transformation (along the Z axis).
    +
    return a BLOB-encoded Affine Transformation matrix representing a Rotate transformation (along the Z axis).
    will return NULL on invalid argument.
    ATM_CreateXRoll ATM_CreateXRoll( angleInDegrees Double precision ] ) : AffineMatrix basereturn a BLOB-encoded Affine Transformation matrix representing a Rotate transformation (along the X axis).
    +
    return a BLOB-encoded Affine Transformation matrix representing a Rotate transformation (along the X axis).
    will return NULL on invalid argument.
    ATM_CreateYRoll ATM_CreateYRoll( angleInDegrees Double precision ] ) : AffineMatrix basereturn a BLOB-encoded Affine Transformation matrix representing a Rotate transformation (along the Y axis).
    +
    return a BLOB-encoded Affine Transformation matrix representing a Rotate transformation (along the Y axis).
    will return NULL on invalid argument.
    ATM_Multiply ATM_Multiply( matrixA AffineMatrix , matrixB AffineMatrix ) : AffineMatrix base
    ATM_Translate ATM_Translate( matrix AffineMatrix , tx Double precision , ty Double precision ] ) : AffineMatrix
    ATM_CreateTranslate( matrix AffineMatrix , tx Double precision , ty Double precision , tz Double precision ] ) : AffineMatrix
    basereturn a BLOB-encoded Affine Transformation matrix by chaining a further 2D or 3D Translate to a previous transformation matrix.
    +
    return a BLOB-encoded Affine Transformation matrix by chaining a further 2D or 3D Translate to a previous transformation matrix.
    will return NULL on invalid arguments.
    ATM_Scale ATM_Scale( matrix AffineMatrix , sx Double precision , sy Double precision ] ) : AffineMatrix
    ATM_Scale( matrix AffineMatrix , sx Double precision , sy Double precision , sz Double precision ] ) : AffineMatrix
    basereturn a BLOB-encoded Affine Transformation matrix by chaining a further 2D or 3D Scale to a previous transformation matrix.
    +
    return a BLOB-encoded Affine Transformation matrix by chaining a further 2D or 3D Scale to a previous transformation matrix.
    will return NULL on invalid arguments.
    ATM_Rotate ATM_Rotate( matrix AffineMatrix , angleInDegrees Double precision ] ) : AffineMatrix
    ATM_ZRoll( matrix AffineMatrix , angleInDegrees Double precision ] ) : AffineMatrix
    basereturn a BLOB-encoded Affine Transformation matrix by chaining a further Rotate (along the Z axis) to a previous transformation matrix.
    +
    return a BLOB-encoded Affine Transformation matrix by chaining a further Rotate (along the Z axis) to a previous transformation matrix.
    will return NULL on invalid argument.
    ATM_XRoll ATM_XRoll( matrix AffineMatrix , angleInDegrees Double precision ] ) : AffineMatrix basereturn a BLOB-encoded Affine Transformation matrix by chaining a further Rotate (along the X axis) to a previous transformation matrix.
    +
    return a BLOB-encoded Affine Transformation matrix by chaining a further Rotate (along the X axis) to a previous transformation matrix.
    will return NULL on invalid argument.
    ATM_YRoll ATM_YRoll( matrix AffineMatrix , angleInDegrees Double precision ] ) : AffineMatrix basereturn a BLOB-encoded Affine Transformation matrix by chaining a further Rotate (along the Y axis) to a previous transformation matrix.
    +
    return a BLOB-encoded Affine Transformation matrix by chaining a further Rotate (along the Y axis) to a previous transformation matrix.
    will return NULL on invalid argument.
    ATM_Determinant ATM_Determinant( matrix AffineMatrix ] ) : Double precision base
    GCP_IsValid
    InitSpatialMetaDataFullInitSpatialMetaDataFull( void ) : Integer
    + InitSpatialMetaDataFull( transaction Integer ) : Integer
    + InitSpatialMetaDataFull( mode String ) : Integer
    + InitSpatialMetaDataFull( transaction Integer , mode String ) : Integer
    baseThis one simply is a convenience function accepting the same arguments of InitSpatialMetaData() (with identical meaning).
    + The intended scope is to fully initialize all metadata tables required by libspatialite 4.5.0 (and following versions). + This function will internally call in a single pass: +
      +
    • InitSpatialMetaData()
    • +
    • CreateRasterCoveragesTable()
    • +
    • CreateVectorCoveragesTables()
    • +
    • CreateStylingTables()
    • +
    the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE
    InsertEpsgSrid InsertEpsgSrid( srid Integer ) : Integer base Attempts to insert into spatial_ref_sys the EPSG definition uniquely identified by srid
    @@ -2981,19 +3160,88 @@
    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    Please note: will implicitly invoke CreateRasterCoveragesTable() and CreateVectorCoveragesTables() so to create the corresponding tables if not already defined.
    SE_RegisterVectorCoverageSE_RegisterVectorCoverage( coverage_name String , f_table_name String , f_geometry_column Sting ) : Integer
    - SE_RegisterVectorCoverage( coverage_name String , f_table_name String , f_geometry_column Sting , title String , abstract String ) : Integer
    SE_RegisterVectorCoverage( coverage_name String , f_table_name String , f_geometry_column String ) : Integer
    + SE_RegisterVectorCoverage( coverage_name String , f_table_name String , f_geometry_column String , title String , abstract String ) : Integer
    + SE_RegisterVectorCoverage( coverage_name String , f_table_name String , f_geometry_column String , title String , abstract String , + is_queryable Boolen , is_editable Boolean ) : Integer
    libxml2 Creates a Vector Coverage based on an already existing Spatial Table.
    • coverage_name is the symbolic name uniquely identifying each Vector Coverage (Primary Key).
    • -
    • f_table_name and f_geometry_column are expected to match a corresponding entry in the geometry_columns table.
    • -
    • the optional arguments title and abstract could be eventually specified for better human readability.
    • +
    • f_table_name and f_geometry_column are expected to match the corresponding entries in the geometry_columns table.
    • +
    • the optional arguments title and abstract could be eventually be specified for better human readability.
    • +
    • if both optional arguments is_queryable and is_editable are left unspecified the Vector Coverage will then be neither queryable nor editable.
    • +

    +the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be + returned on invalid arguments.
    SE_RegisterSpatialViewCoverageSE_RegisterSpatialViewCoverage( coverage_name String , view_name String , view_geometry String ) : Integer
    + SE_RegisterSpatialViewCoverage( coverage_name String , view_name String , view_geometry String , title String , abstract String ) : Integer
    + SE_RegisterSpatialViewCoverage( coverage_name String , view_name String , view_geometry String , title String , abstract String , + is_queryable Boolen , is_editable Boolean ) : Integer
    libxml2Creates a Vector Coverage based on an already existing Spatial View. +
      +
    • coverage_name is the symbolic name uniquely identifying each Vector Coverage (Primary Key).
    • +
    • view_name and view_geometry are expected to match the corresponding entries in the views_geometry_columns table.
    • +
    • the optional arguments title and abstract could be eventually be specified for better human readability.
    • +
    • if both optional arguments is_queryable and is_editable are left unspecified the Vector Coverage will then be neither queryable nor editable.
    • +
    • Note: a Spatial View Coverage declared to be editable will not fully support editing operations if the underlying Spatial View is of the read-only type (read-only=1).
    • +

    +the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be + returned on invalid arguments.
    SE_RegisterVirtualShapeCoverageSE_RegisterVirtualShapeCoverage( coverage_name String , virt_name String , virt_geometry String ) : Integer
    + SE_RegisterVirtualShapeCoverage( coverage_name String , virt_name String , virt_geometry String , title String , abstract String ) : Integer
    + SE_RegisterVirtualShapeCoverage( coverage_name String , virt_name String , virt_geometry String , title String , abstract String , + is_queryable Boolen ) : Integer
    libxml2Creates a Vector Coverage based on an already existing VirtualShape Table. +
      +
    • coverage_name is the symbolic name uniquely identifying each Vector Coverage (Primary Key).
    • +
    • virt_name and virt_geometry are expected to match the corresponding entries in the virts_geometry_columns table.
    • +
    • the optional arguments title and abstract could be eventually be specified for better human readability.
    • +
    • if the optional argument is_queryable is left unspecified tjem the Vector Coverage will not be queryable.
    • +
    • Note: VirtualShape Coverages are always not editable.
    • +

    +the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be + returned on invalid arguments.
    SE_RegisterTopoGeoCoverageSE_RegisterTopoGeoCoverage( coverage_name String , topology_name String ) : Integer
    + SE_RegisterTopoGeoCoverage( coverage_name String , topology_name String , title String , abstract String ) : Integer
    + SE_RegisterTopoGeoCoverage( coverage_name String , topology_name String , title String , abstract String , + is_queryable Boolen , is_editable Boolean ) : Integer
    libxml2Creates a Vector Coverage based on an already existing Topology-Geometry. +
      +
    • coverage_name is the symbolic name uniquely identifying each Vector Coverage (Primary Key).
    • +
    • topogeo_name is expected to match the corresponding entries in the topologies table.
    • +
    • the optional arguments title and abstract could be eventually be specified for better human readability.
    • +
    • if both optional arguments is_queryable and is_editable are left unspecified the Vector Coverage will then be neither queryable nor editable.
    • +

    +the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be + returned on invalid arguments.
    SE_RegisterTopoNetCoverageSE_RegisterTopoNetCoverage( coverage_name String , network_name String ) : Integer
    + SE_RegisterTopoNetCoverage( coverage_name String , network_name String , title String , abstract String ) : Integer
    + SE_RegisterTopoNetCoverage( coverage_name String , network_name String , title String , abstract String , + is_queryable Boolen , is_editable Boolean ) : Integer
    libxml2Creates a Vector Coverage based on an already existing Topology-Network. +
      +
    • coverage_name is the symbolic name uniquely identifying each Vector Coverage (Primary Key).
    • +
    • toponet_name is expected to match the corresponding entries in the networks table.
    • +
    • the optional arguments title and abstract could be eventually be specified for better human readability.
    • +
    • if both optional arguments is_queryable and is_editable are left unspecified the Vector Coverage will then be neither queryable nor editable.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_UnregisterVectorCoverage SE_UnregisterVectorCoverage( coverage_name String ) : Integer
    SE_SetVectorCoverageInfosSE_SetVectorCoverageInfos( coverage_name String , title String , abstract String ) : IntegerSE_SetVectorCoverageInfos( coverage_name String , title String , abstract String ) : Integer
    + SE_SetVectorCoverageInfos( coverage_name String , title String , abstract String , is_queryable Boolen , is_editable Boolean ): Integer
    libxml2 Updates the descriptive infos associated to a Vector Coverage.
    • coverage_name must identify an existing Vector Coverage.
    • title and abstract represent the descriptive infos to be set.
    • +
    • the optional arguments is_queryable and is_editable can be explicitly set so to determine if the Vector Coverage is queryable and/or editable.
    • +

    +the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be + returned on invalid arguments.
    SE_SetVectorCoverageCopyrightSE_SetVectorCoverageCopyright( coverage_name String , copyright String ) : Integer
    + SE_SetVectorCoverageCopyright( coverage_name String , copyright String , license String ): Integer
    libxml2Updates Copyright and License infos associated to a Vector Coverage. +
      +
    • coverage_name must identify an existing Vector Coverage.
    • +
    • copyright identifies the Copyright holder; if NULL the current value will be preserved.
    • +
    • the optional argument license must reference one the Data Licenses registered into the data_licenses table, as e.g. CC0 1.0 or CC BY 4.0.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_RegisterVectorCoverageSrid SE_RegisterVectorCoverageSrid( coverage_name String , srid Integer ) : Integer libxml2 Adds an alternative SRID to an already defined Vector Coverage.
    • coverage_name must identify an existing Vector Coverage.
    • -
    • srid is expected to match a corresponding entry in the spatial_ref_sys table.
    • +
    • srid is expected to match the corresponding entries in the spatial_ref_sys table.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_UnregisterVectorCoverageSrid SE_UnregisterVectorCoverageSrid( coverage_name String , srid Integer ) : Integerlibxml2 Inserts (or updates) an External Graphic Resource.
    • xlink_href uniquely identifies each Resource (Primary Key).
    • resource is expected to be a BLOB containing an image/gif, image/png, image/jpeg or image/svg+xml payload.
    • -
    • the optional arguments title, abstract and file_name could be eventually specified for better human readability.
    • +
    • the optional arguments title, abstract and file_name could be eventually be specified for better human readability.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_UnregisterExternalGraphic SE_UnregisterExternalGraphic( xlink_href String ) : Integer
    SE_UnregisterVectorStyle SE_UnregisterVectorStyle( style_id Integer [ , remove_all Integer ] ) : Integer
    - SE_UnregisterVectorStyle( style_name Text [ , remove_all Integer ] ) : Integer
    libxml2 Removes an already registered Vector Style definition.
    • The Style to be removed could be referenced either by its unique Style Id or by its Style Name.
      @@ -3124,18 +3387,18 @@

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_ReloadVectorStyle SE_ReloadVectorStyle( style_id Integer , style BLOB ) : Integer
    - SE_ReloadVectorStyle( style_name Text , style BLOB ) : Integer
    libxml2 Updates an already existing Vector Style definition.
    • style is expected to be an XmlBLOB containing a valid SLD/SE Style of the Vector type.
      If CreatedStylingTables() was invoked without specifying the relaxed option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.
      - The updated Style will continue to be identified by its current unique Style ID but the Style Name will be automatically updated accordingly to SLD/SE XML.
    • + The updated Style will continue to be identified by its current unique Style ID but the Style Name will be automatically updated accordingly to SLD/SE XML.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_RegisterVectorStyledLayer SE_RegisterVectorStyledLayer( coverage_name String , style_id Integer ) : Integer
    @@ -3175,11 +3438,11 @@
    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_UnregisterRasterStyle SE_UnregisterRasterStyle( style_id Integer [ , remove_all Integer ] ) : Integer
    - SE_UnregisterRasterStyle( style_name Text [ , remove_all Integer ] ) : Integer
    libxml2 Removes an already registered Raster Style definition.
    • The Style to be removed could be referenced either by its unique Style Id or by its Style Name.
      @@ -3190,18 +3453,18 @@

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_ReloadRasterStyle SE_ReloadRasterStyle( style_id Integer , style BLOB ) : Integer
    - SE_ReloadRasterStyle( style_name Text , style BLOB ) : Integer
    libxml2 Updates an already existing Raster Style definition.
    • style is expected to be an XmlBLOB containing a valid SLD/SE Style of the Raster type.
      If CreatedStylingTables() was invoked without specifying the relaxed option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.
      - The updated Style will continue to be identified by its current unique Style ID but the Style Name will be automatically updated accordingly to SLD/SE XML.
    • < + The updated Style will continue to be identified by its current unique Style ID but the Style Name will be automatically updated accordingly to SLD/SE XML.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_RegisterRasterStyledLayer SE_RegisterRasterStyledLayer( coverage_name String , style_id Integer ) : Integer
    @@ -3234,11 +3497,11 @@
    libxml2 Adds an alternative SRID to an already defined Raster Coverage.
    • coverage_name must identify an existing Raster Coverage.
    • -
    • srid is expected to match a corresponding entry in the spatial_ref_sys table.
    • +
    • srid is expected to match the corresponding entries in the spatial_ref_sys table.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_UnregisterRasterCoverageSrid SE_UnregisterRasterCoverageSrid( coverage_name String , srid Integer ) : Integer
    SE_UnregisterGroupStyle SE_UnregisterGroupStyle( style_id Integer [ , remove_all Integer ] ) : Integer
    - SE_UnregisterGroupStyle( style_name Text [ , remove_all Integer ] ) : Integer
    libxml2 Removes an already registered Group Style definition.
    • The Style to be removed could be referenced either by its unique Style Id or by its Style Name.
      @@ -3423,18 +3686,18 @@

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_ReloadGroupStyle SE_ReloadGroupStyle( style_id Integer , style BLOB ) : Integer
    - SE_ReloadGroupStyle( style_name Text , style BLOB ) : Integer
    libxml2 Updates an already existing Group Style definition.
    • style is expected to be an XmlBLOB containing a valid SLD complex Style.
      If CreatedStylingTables() was invoked without specifying the relaxed option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.
      - The updated Style will continue to be identified by its current unique Style ID but the Style Name will be automatically updated accordingly to SLD/SE XML.
    • + The updated Style will continue to be identified by its current unique Style ID but the Style Name will be automatically updated accordingly to SLD/SE XML.

    the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    SE_RegisterStyledGroupStyle SE_RegisterStyledGroupStyle( group_name String , style_id Integer ) : Integer
    @@ -3510,34 +3773,45 @@
    Syntax OGC
    defined
    required
    module
    Summary
    CheckSpatialMetaDataCheckSpatialMetaData( void ) : IntegerCheckSpatialMetaData( void ) : Integer
    + CheckSpatialMetaData( db_prefix String ) : Integer
    base Checks the Spatial Metadata type, then returning:
      +
    • -1 - on invalid args or if no ATTACHED-DB identified by db_prefix exists.
    • 0 - if the geometry_columns or spatial_ref_sys table does not exists, or if their actual layout doesn't corresponds to any known implementation
    • 1 - if both tables exist, and their layout is the one previously used by SpatiaLite legacy (older versions including 3.1.0 any earlier)
    • 2 - if both tables exist, and their layout is the one used by FDO/OGR
    • 3 - if both tables exist, and their layout is the one currently used by SpatiaLite (4.0.0 or any subsequent version)
    • 4 - if the DB layout is the one defined by the OGC GPKG specification (GeoPackage)
    • -
    AutoFDOStartAutoFDOStart( void ) : IntegerAutoFDOStart( void ) : Integer
    + AutoFDOStart( db_prefix String ) : Integer
    base This function will inspect the Spatial Metadata, then automatically creating/refreshing a VirtualFDO wrapper for each FDO/OGR geometry table
    -the return type is Integer [how many VirtualFDO tables have been created]
    AutoFDOStopAutoFDOStop( void ) : IntegerAutoFDOStop( void ) : Integer
    + AutoFDOStop( db_prefix String ) : Integer
    base This function will inspect the Spatial Metadata, then automatically destroying any VirtualFDO wrapper found
    -the return type is Integer [how many VirtualFDO tables have been destroyed]
    InitFDOSpatialMetaData InitFDOSpatialMetaData( void ) : Integer base Creates the geometry_columns and spatial_ref_sys metadata tables
    @@ -3557,11 +3831,11 @@
  • 5 MULTILINESTRING
  • 6 MULTIPOLYGON
  • 7 GEOMETRYCOLLECTION
  • dimension may be 2, 3 or 4, accordingly to OGR/FDO specs
    geometry_format has to be one of the followings:
      -
    • 'WBT'
    • +
    • 'WKB'
    • 'WKT'
    • 'FGF'

    the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE
    RecoverFDOGeometryColumnSyntax OGC
    defined
    required
    module
    Summary
    CheckGeoPackageMetaDataCheckGeoPackageMetaData( void ) : IntegerCheckGeoPackageMetaData( void ) : Integer
    + CheckGeoPackageMetaData ( db_prefix String ) : Integer
    baseThis function will inspect the DB layout checking if it corresponds to the GPKG own style
    -the return type is Integer, with a return value of 1 for TRUE, 0 for FALSE
    This function will inspect the DB layout checking if it corresponds to the GPKG own style.
    + The optional db_prefix argument specifies which one of the ATTACHED databases is intended to be checked; if unspecified or NULL then + the MAIN database will be assumed by default.
    +the return type is Integer, with a return value of 1 for TRUE, 0 for FALSE and -1 on invalid args or if no ATTACHED-DB identified by db_prefix exists.
    AutoGPKGStartAutoGPKGStart( void ) : IntegerAutoGPKGStart( void ) : Integer
    + AutoGPKGStart( db_prefix String ) : Integer
    GeoPackage This function will inspect the DB layout, then automatically creating/refreshing a VirtualGPKG wrapper for each GPKG geometry table
    -the return type is Integer [how many VirtualGPKG tables have been created]
    AutoGPKGStopAutoGPKGStop( void ) : IntegerAutoGPKGStop( void ) : Integer
    + AutoGPKGStop( db_prefix String ) : Integer
    GeoPackage This function will inspect the DB layout, then automatically destroying any VirtualGPKG wrapper found
    -the return type is Integer [how many VirtualGPKG tables have been destroyed]
    gpkgCreateBaseTables gpkgCreateBaseTables( void ) : void GeoPackage This function will create base tables for an "empty" GeoPackage
    @@ -3675,11 +3958,11 @@
  • "x-webp" for WebP
  • These are the mime type for the image format (without the "image/" prefix).
    This function raises exception on error (e.g. wrong argument type).
    gpkgAddGeometryColumngpkgAddGeomtryColumn( table_name Sting, geometry_column_name String , geometry_type String , + gpkgAddGeomtryColumn( table_name String, geometry_column_name String , geometry_type String , with_z Integer , with_m Integer , srs_id Integer ) : void GeoPackage Adds a geometry column to the specified table:
      @@ -4172,14 +4455,20 @@
    Syntax ISO 13249-3
    defined
    required
    module
    Summary
    GetLastTopologyExceptionGetLastTopologyException( toponame Text ) : TextGetLastTopologyException( toponame Text ) : Text RTTOPO Will return the most recent exception raised by this Topo-Geo, or NULL if no exception is currently pending.
    CreateTopoTablesCreateTopoTables( ) : IntegerRTTOPOWill create both topologies and networks meta-tables.
    + Will return 1 on success) or 0 on failure (including already existing tables).
    InitTopoGeo ST_InitTopoGeo( toponame Text ) : Integer X RTTOPO This SQL function is explicitly required by ISO 13249-3, anyway it's simply implemented as an alias-name for CreateTopology ( toponame ).
    @@ -4196,11 +4485,11 @@
  • toponame: the individual unique name of this Topo-Geo: all subordinated tables will use it as a prefix.
  • srid: the Spatial Reference System supporting this Topo-Geo (-1 by default).
  • has_z: if set to TRUE this Topo-Geo will support 3D - XYZ coordinates (FALSE by default).
  • tolerence: the standard tolerance to be applied to this Topo-Geo. (0.0 by default, i.e. no tolerance at all).
  • - Will return 1 on success) or 0 on failure: an exception will be raised while passing a negative tolerance value.
    DropTopology DropTopology( toponame Text ) : Integer RTTOPO Completely removes a Topo-Geo (and all data it contains) from the DBMS: to be invoked very cautiously and only if you are absolutely sure of what you are doing.
    @@ -4351,45 +4640,45 @@
    Will attempt to add a Point (or even a MultiPoint) to an already existing Topology, possibly splitting existing Edges.
    • The optional argument tolerance if omitted will assume the corresponding value declared when creating the target Topology.

    Will return a comma separated list of all IDs of corresponding Nodes on success; an exception will be raised on failure.
    TopoGeo_AddLineString TopoGeo_AddLineString( toponame Text , linestring Geometry ) : Integer
    - TopoGeo_AddLineString( toponame Text , linestring Geometry , tolerance Double precision ) : Integer
    RTTOPO Will attempt to add a Linestring (or even a MultiLinestring) to an already existing Topology, possibly splitting existing Edges/Faces.
    • The optional argument tolerance if omitted will assume the corresponding value declared when creating the target Topology.

    Will return a comma separated list of all IDs of the corresponding Edges on success; an exception will be raised on failure.
    TopoGeo_AddLineStringNoFace TopoGeo_AddLineStringNoFace( toponame Text , linestring Geometry ) : Integer
    - TopoGeo_AddLineStringNoFace( toponame Text , linestring Geometry , tolerance Double precision ) : Integer
    RTTOPO Very similar to TopoGeo_AddLinestring except for a very critical difference. This function is strongly optimized for maximum speed, and will just update Nodes and Edges purposely ignoring Faces.
    Consequently it will always leave the target Topology in an inconsistent state; only after executing TopoGeo_Polygonize() all Faces will be properly restored and the target Topology will finally resume a consistent state.
    • The optional argument tolerance if omitted will assume the corresponding value declared when creating the target Topology.

    Will return a comma separated list of all IDs of the corresponding Edges on success; an exception will be raised on failure.
    TopoGeo_TopoSnapTopoGeo_TopoSnap( toponame Text , input Geometry , iterate Integer , remove_vertices Integer ) : Geometry
    - TopoGeo_TopoSnap( toponame Text , input Geometry , iterate Integer , remove_vertices Integer , toleranceDouble precision ) : Geometry
    TopoGeo_TopoSnap( toponame Text , input Geometry , iterate Integer ) : Geometry
    + TopoGeo_TopoSnap( toponame Text , input Geometry , tolerance_snap Double precision , tolerance_removal Double precision , iterate Integer ) : Geometry
    RTTOPO Will attempt to snap (i.e. renode) the input Geometry (any type) against the Topology identified by toponame.
      -
    • both arguments iterate and remove_vertices are intended to be Boolean (0 = FALSE, any other value = TRUE).
    • -
    • if argument iterate is set to TRUE the input Geometry will be iteratively processed until no more snaps are found.
    • -
    • if argument remove_vertices is set to TRUE any vertex falling within the tolerance radius will be removed.
    • -
    • The optional argument tolerance if omitted will assume the corresponding value declared when creating the target Topology.
    • +
    • the arguments iterate is intended to be Boolean (0 = FALSE, any other value = TRUE); + when set to TRUE the input Geometry will be iteratively processed until no more snaps are found.
    • +
    • The optional argument tolerance_snap if omitted will assume the corresponding value declared when creating the target Topology.
    • +
    • The optional argument tolerance_removal if omitted (or set to NULL) will suppress the removal phase.

    Will return a snapped Geometry on success; an exception will be raised on failure.
    TopoGeo_SnappedGeoTable TopoGeo_SnappedGeoTable( toponame Text , db-prefix Text , table-name Text , column-name Text , output-table Text , - iterate Integer , remove_vertices Integer ) : Integer
    + iterate Integer ) : Integer
    TopoGeo_SnappedGeoTable( toponame Text , db-prefix Text , table-name Text , column-name Text , output-table Text , - iterate Integer , remove_vertices Integer , tolerance Double precision ) : Integer
    RTTOPO Will attempt to create and populate an output-table by snapping against the Topology identified by toponame all Geometries from an input GeoTable identified by db-prefix, table-name and column-name.
      @@ -4397,20 +4686,19 @@
    • column-name too can be NULL, and in this case the name of the column containing Geometries will be automatically retrieved; if "db"."table" does not contains any Geometry column, or if it contains two or more Geometries an exception will be raised.
    • the input GeoTable must be properly registered and must match both SRID and dimensions declared by the target Topology.
    • this function accepts input Geometries of any class: Point, MultiPoint, Linestring, MultiLinestring, Polygon, MultiPolygon, GeometryCollection and Geometry.
    • -
    • arguments iterate and remove_vertices will be interpreted in the same way adopted by TopoGeo_TopoSnap().
    • -
    • The optional argument tolerance if omitted will assume the corresponding value declared when creating the target Topology.
    • +
    • argument iterate, tolerance_snap and tolerance_removal will be interpreted exactly in the same way adopted by TopoGeo_TopoSnap().

    Will return 1 on success; an exception will be raised on failure.
    TopoGeo_SubdivideLines TopoGeo_SubdivideLines( input Geometry , line_max_points Integer ) : MultiLinestring
    TopoGeo_SubdivideLines( input Geometry , line_max_points Integer , line_max_length Double precision ) : MultiLinestring
    RTTOPOWill attempt to split a Linestring (or even a MultiLinestring, Polygon or Multipolygon) into a collection + Will attempt to split a Linestring (or even a MultiLinestring) into a collection of shorter LineStrings fully respecting Topology consistency.
    • if argument line_max_points is set to a positive value (>= 2) then all input Linestrings will be split into many shorter lines having no more than the required number of points.
    • if argument line_max_length is set to a positive value, in units of the SRID, then a separate output line will be split every time @@ -4611,20 +4899,61 @@
    TopoGeo_SnapLineToSeed( line Geometry , toponame Text , distance Double ) : Geometry X RTTOPO Will possibly return a new Linestring precisely snapped to the nearset Edge TopoSeed within the given distance; if no such TopoSeed exists NULL will be returned.
    An exception will be raised on invalid arguments.
    TopoGeo_DisambiguateSegmentEdgesTopoGeo_DisambiguateSegmentEdges( toponame Text ) : IntegerXRTTOPOEnsures that all Edges on a Topology-Geometry will have not less than three vertices. +
      +
    • all Edges found already definining three or more vertices will be left untouched as they are.
    • +
    • all Edges found simply being a two-points segment will be changed by interpolating a third intermediate vertex.
    • +
    • this function is harmless (doesn't substantially alters the Topology in any way) and ensures that all Seeds will certainly be not ambiguous.
    • +
    + Will return the total number of changed Edges on success; an exception will be raised on failure.
    TopoGeo_UpdateSeeds TopoGeo_UpdateSeeds( toponame Text ) : Integer
    TopoGeo_UpdateSeeds( toponame Text , incremental-mode Integer ) : Integer
    X RTTOPOWill update all persistent Edge- and Face-Seeds so to correctly represent the current state of the underlaying Topology. + Will update all persistent Edge- and Face-Seeds so to correctly represent the current state of the underlying Topology.
    • if the optional argument incremental-mode is set to TRUE an incremental update (faster) will be applied, otherwise all persistent Seeds will be rebuilt from scratch (slower).

    + Will return 1 on success; an exception will be raised on failure.
    TopoGeo_PolyFacesListTopoGeo_PolyFacesList( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text ) : IntegerRTTOPOWill attempt to export into an output Table all relationships between the Faces of some Topology-Geometry and Polygons/Multipolygons found within a given + Reference-GeoTable. +
      +
    • db-prefix can be NULL, and in this case the reference GeoTable is expected to be located within the "MAIN" database.
    • +
    • ref-column-name too can be NULL, and in this case the name of the column containing Geometries will be automatically retrieved; + if "db"."table" does not contains any Geometry column, or if it contains two or more Geometries an exception will be raised.
    • +
    • the reference GeoTable must be properly registered and must match both SRID and dimensions declared by the target Topology.
    • +
    • this function accepts input Geometries only of the Polygon or MultiPolygon types.
    • +
    • the output Table will be always located on the "MAIN" DB and must not exists; it will be automatically created.
    • +

    + Will return 1 on success; an exception will be raised on failure.
    TopoGeo_LineEdgesListTopoGeo_LineEdgesList( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text ) : IntegerRTTOPOWill attempt to export into an output Table all relationships between the Edges of some Topology-Geometry and Linestrings/Multilinestrings found within a given + Reference-GeoTable. +
      +
    • db-prefix can be NULL, and in this case the reference GeoTable is expected to be located within the "MAIN" database.
    • +
    • ref-column-name too can be NULL, and in this case the name of the column containing Geometries will be automatically retrieved; + if "db"."table" does not contains any Geometry column, or if it contains two or more Geometries an exception will be raised.
    • +
    • the reference GeoTable must be properly registered and must match both SRID and dimensions declared by the target Topology.
    • +
    • this function accepts input Geometries only of the Linestring or MultiLinestring types.
    • +
    • the output Table will be always located on the "MAIN" DB and must not exists; it will be automatically created.
    • +

    Will return 1 on success; an exception will be raised on failure.
    TopoGeo_ToGeoTable TopoGeo_ToGeoTable( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text ) : Integer
    TopoGeo_ToGeoTable( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text , with-spatial-index Boolenan ) : Integer
    Syntax ISO 13249-3
    defined
    required
    module
    Summary
    GetLastNetworkExceptionGetLastNetworkException( netname Text ) : TextGetLastNetworkException( netname Text ) : Text RTTOPO Will return the most recent exception raised by this Topo-Net, or NULL if no exception is currently pending.
    InitTopoNet ST_InitTopoNet( netname Text ) : Integer
    DropNetwork DropNetwork( netname Text ) : Integer RTTOPO Completely removes a Topo-Net (and all data it contains) from the DBMS: to be invoked very cautiously and only if you are absolutely sure of what you are doing.
    @@ -4911,20 +5241,46 @@
    TopoNet_GetLinkSeed( netname Text , link-id Integer ) : Geometry RTTOPO Will return a Point Geometry uniquely identifying a Link (i.e. spatially intersecting the Link).
    Will return a Point on success; an exception will be raised on failure.
    TopoNet_DisambiguateSegmentLinksTopoNet_DisambiguateSegmentLinks( toponame Text ) : IntegerXRTTOPOEnsures that all Links on a Topology-Network will have not less than three vertices. +
      +
    • all Links found already definining three or more vertices will be left untouched as they are.
    • +
    • all Links found simply being a two-points segment will be changed by interpolating a third intermediate vertex.
    • +
    • this function is harmless (doesn't substantially alters the Network in any way) and ensures that all Seeds will certainly be not ambiguous.
    • +
    + Will return the total number of changed Links on success; an exception will be raised on failure.
    TopoNet_UpdateSeeds TopoNet_UpdateSeeds( netname Text ) : Integer
    TopoNet_UpdateSeeds( netname Text , incremental-mode Integer ) : Integer
    RTTOPOMWill update all persistent Link-Seeds so to correctly represent the current state of the underlaying Network. + Will update all persistent Link-Seeds so to correctly represent the current state of the underlying Network.
    • if the optional argument incremental-mode is set to TRUE an incremental update (faster) will be applied, otherwise all persistent Seeds will be rebuilt from scratch (slower).

    + Will return 1 on success; an exception will be raised on failure.
    TopoNet_LineLinksListTopoNet_LineLinksList( netname Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text ) : IntegerRTTOPOWill attempt to export into an output Table all relationships between the Links of some Topology-Network and Linestrings/Multilinestrings found within a given + Reference-GeoTable. +
      +
    • db-prefix can be NULL, and in this case the reference GeoTable is expected to be located within the "MAIN" database.
    • +
    • ref-column-name too can be NULL, and in this case the name of the column containing Geometries will be automatically retrieved; + if "db"."table" does not contains any Geometry column, or if it contains two or more Geometries an exception will be raised.
    • +
    • the reference GeoTable must be properly registered and must match both SRID and dimensions declared by the target Network.
    • +
    • this function accepts input Geometries only of the Linestring or MultiLinestring types.
    • +
    • the output Table will be always located on the "MAIN" DB and must not exists; it will be automatically created.
    • +

    Will return 1 on success; an exception will be raised on failure.
    TopoNet_ToGeoTable TopoNet_ToGeoTable( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text ) : Integer
    TopoNet_ToGeoTable( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text , with-spatial-index Boolean ) : Integer
    TopoNet_ToGeoTableGeneralize TopoNet_ToGeoTableGeneralize( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text , tolerance Double precision ) : Integer
    TopoNet_ToGeoTableGeneralize( toponame Text , db-prefix Text , ref-table-name Text , ref-column-name Text, out-table Text , tolerance Double precision , with-spatial-index Boolean ) : Integer
    LRTTOPORTTOPO Exactly the same as TopoNet_ToGeoTable() except in that all exported geometries will be simplified / generalized still maintaining full topological consistency.
    • tolerance represents the approximation radius required by the Douglas-Peuker simplification algorithm.

    Will return 1 on success; an exception will be raised on failure.
    WMS_SetGetMapInfos WMS_SetGetMapInfos( getmap_url Text , layer_name Text , title Text , abstract Text ) : Integer Sets or updates the Title and Abstract for the WMS Layer identified by getmap_url and layer_name.
    Will return 1 on success; 0 on failure; -1 on invalid arguments.
    WMS_SetGetMapCopyrightWMS_SetGetMapCopyright( getmap_url Text , layer_name String , copyright String ) : Integer
    + WMS_SetGetMapCopyright( getmap_url Text , layer_name String , copyright String , license String ): Integer
    Updates Copyright and License infos associated to a WMS Layer. +
      +
    • getmap_url and layer_name must identify an existing WMS Layer.
    • +
    • copyright identifies the Copyright holder; if NULL the current value will be preserved.
    • +
    • the optional argument license must reference one the Data Licenses registered into the data_licenses table, as e.g. CC0 1.0 or CC BY 4.0.
    • +

    + the return type is Integer, with a return value of 1 for TRUE (success) or 0 for FALSE (failure): -1 will be returned on invalid arguments.
    WMS_SetGetMapOptions WMS_SetGetMapOptions( getmap_url Text , layer_name Text , transparent Boolean , flip_axes Boolean )
    WMS_SetGetMapOptions( getmap_url Text , layer_name Text , is_tiled Boolean , cached Boolean , tile_width Integer , tile_height Integer) : Integer
    WMS_SetGetMapOptions( getmap_url Text , layer_name Text , is_queryable Boolean , getfeatureinfo_url Text ) : Integer
    WMS_SetGetMapOptions( getmap_url Text , layer_name Text , bgcolor Text ) : Integer
    WMS_UnRegisterSetting WMS_UnRegisterSetting( getmap_url Text , layer_name Text , key Text , value Text ) : Integer Unregisters an alternative setting from the corresponding WMS Layer.
    @@ -5059,11 +5425,11 @@ maxx Double , maxy Double , is_default Boolean ) : Integer
    Registers an alternative Reference System for the WMS Layer identified by getmap_url and layer_name
    • ref_sys: name of Reference System (e.g. 'EPSG:4326' or 'EPSG:32632').
    • minx, miny, maxx and maxy: the corresponding WMS Layer's Bounding Box (aka full extent).
    • -
    • is_default (optional arg): if the corresponding SRS will become the standard Reference System for the corresponding WMS Layer (FALSE if undefined).
    • +
    • is_default (optional arg): if the corresponding SRS will become the standard Reference System for the corresponding WMS Layer (FALSE if undefined).

    Will return 1 on success; 0 on failure; -1 on invalid arguments.
    WMS_UnRegisterRefSys WMS_UnRegisterRefSys( getmap_url Text , layer_name Text , ref_sys Text ) : Integer Unregisters an alternative Reference System from the corresponding WMS Layer.
    @@ -5094,10 +5460,61 @@
  • minx, miny, maxx and maxy: the Bounding Box coverred by the map image.
  • feature_count (optional arg): maximum number of features allowed (1 if unspecified).

  • Will return a request URL on success; NULL on failure or on invalid arguments.
    +

    SQL functions supporting Data Licenses

    FunctionSyntaxSummary
    RegisterDataLicenseRegisterDataLicense( license_name Text ) : Integer
    + RegisterDataLicense( license_name Text , url Text ) : Integer
    Registers a Data License. +
      +
    • license_name is expected to be a text string uniquely identifying a license/version.
      + Note: the following licenses are always self-defined when creating a new DB: +
        +
      • Undefined
      • +
      • Proprietary - Non Free
      • +
      • PD - Public Domain
      • +
      • CC0 1.0
      • +
      • CC BY 3.0
      • +
      • CC BY 4.0
      • +
      • CC BY-SA 3.0
      • +
      • CC BY-SA 4.0
      • +
      • CC BY-SA-NC 3.0
      • +
      • CC BY-SA-NC 4.0
      • +
      +
    • +
    • the optional argument url may eventually contain an URL pointing to the license's legal terms and conditions.
    • +

    + Will return 1 on success; 0 on failure; -1 on invalid arguments.
    UnRegisterDataLicenseUnRegisterDataLicense( license_name Text ) : IntegerUnregisters a Data License. +
      +
    • license_name is expected to match an already registered license/version.
    • +

    + Will return 1 on success; 0 on failure; -1 on invalid argument.
    RenameDataLicenseRenameDataLicense( old_name Text , new_name Text ) : IntegerRenames a Data License. +
      +
    • old_name is expected to match an already registered license/version.
    • +
    • new_name must not match any already registered license/version so to respect the unique constraint.
    • +

    + Will return 1 on success; 0 on failure; -1 on invalid arguments.
    SetDataLicenseUrlSetDataLicenseURL( license_name Text , url Text ) : IntegerSets or updates the URL corresponding to a Data License. +
      +
    • license_name is expected to match an already registered license/version.
    • +
    • url is expected to be an URL pointing to the license's legal terms and conditions.
    • +

    + Will return 1 on success; 0 on failure; -1 on invalid arguments.

    miscellaneous advanced SQL functions

    Function Syntax Summary
    CloneTable Will clone (i.e. create+copy) an origin table into a destination table: the origin could be eventually located into some attached DB, but the destination is always - assumed to be located into the primary DB.
      + assumed to be located into the primary DB.
      • Mandatory arguments:
        • db-prefix corresponding to the origin; the primary DB always corresponds to the main prefix.
        • input_table name of the origin table
        • output_table name of the destination table
        • transaction a boolean values stating if the whole operation has to be atomically confined within a monolithic SQL transaction
      • -
      • Optional arguments: a maximum of 10 further options could be eventually specified. Valid options are: +
      • Optional arguments: a maximum of 10 further options could be eventually be specified. Valid options are:
        • ::with-foreign-keys::
        • ::with-triggers::
        • ::resequence::
        • ::append::
        • @@ -5153,11 +5570,14 @@ Will return the total number of deleted rows.
          NULL will be returned on invalid arguments.
    ElementaryGeometries ElementaryGeometries( in_table Text , geom_column Text , out_table Text , out_pk Text , out_multi_id Text ) : Integer
    ElementaryGeometries( in_table Text , geom_column Text , out_table Text , - out_pk Text , out_multi_id Text , transaction Boolean ) : Integer
    Will create a new out_table directly corresponding to in_table. The output table will be arranged in such a way that each row will always contain an elementary Geometry; so each time that a MULTI-type Geometry is found in the input table it will be split into many distinct rows.
      @@ -5164,11 +5584,20 @@
    • out_pk is the name to be set for the output Primary Key, and out_multi_id is the name to be set for a second column within the output table where to store the a zero-based index from which Geometry the Element-Geometry comes from, that together with the original Primary Key can be identified.
      Note: both out_pk and out_multi_id must not exist in the given in_table table.
    • The optional argument transaction determines if an internal SQL Transaction should be automatically started or not (the default setting if not explicitly overridden is TRUE).
    • -

    + + Optional arguments: a maximum of 10 further options could be eventually be specified. Valid options are: +
      +
    • ::ignore::column_name
      + Note: the geom-column will never be ignored, even if explicitly requested to be.
    • +
    • ::cast2multi::
      + Will automatically apply a CastToMulti ( geom_column ) directive.
    • +
    • All references to mismatching options or not existinting columns will be silently discarded.
    • +
    +
    Will return the total number of rows inserted into the output table.
    NULL will be returned on invalid arguments.
    DropGeoTable DropGeoTable( table Text ) : Integer
    DropGeoTable( table Text , transaction Boolean ) : Integer
    DropGeoTable( db-prefix Text , table Text ) : Integer
    @@ -5232,11 +5661,11 @@
  • table name of the table to be exported.
  • geom_column name of the Geometry column.
  • filename absolute or relative path leading to the Shapefile (omitting any .shp, .shx or .dbf suffix).
  • charset the character encoding adopted by the DBF member, as e.g. UTF-8 or CP1252
  • the optional argument geom_type is useful when exporting unregistered Geometries, and - can be one between: POINT, LINESTRING, POLYGON or MULTUPOINT.
  • + can be one between: POINT, LINESTRING, POLYGON or MULTIPOINT.
  • colname_case (optional argument) can be one between:
    • LOWER or LOWERCASE: all column names will be converted to lowercase (default option).
    • UPPER or UPPERCASE: all column names will be converted to uppercase.
    • SAME or SAMECASE: all column names will be left as they are.
  • @@ -5445,32 +5874,252 @@ to trace back Input and Blade pairs giving birth to each single fragment.
    Any cut fragment stored into the Output dataset eventually falling outside any Blade will reference a conventional NULL Blade.
    • The Input dataset is always expected to declare a Primary Key and must declare a POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING or MULTIPOLYGON Geometry type.
      - It could be indifferently located on the MAIN database or on any other attached DB, and is fully identified by the input-db-prefix, + It can be located either in the MAIN database or in any other attached DB, and must be fully identified by the input-db-prefix, input-table and input-geometry arguments.
    • -
    • The Blade dataset is always expected to declare a Primary Key and must declare a POLYGON or MULTIPOLYGON Geometry type.
      - It could be indifferently located on the MAIN database or on any other attached DB, and is fully identified by the blade-db-prefix, +
    • The Blade dataset is always expected to be a POLYGON or MULTIPOLYGON, with a defined Primary Key.
      + It can be located either in the MAIN database or in any other attached DB, and is fully identified by the blade-db-prefix, blade-table and blade-geometry arguments.
      - Note: both the Input and Blade Geometries must share the same identical SRID value.
    • -
    • The Output dataset will be always located into the MAIN database.
      - The Output Geometry will always preserve the name and SRID declared by input-geom: the Geometry type will be always be one between + Note: both the Input and Blade Geometries must have the same identical SRID value.
    • +
    • The Output dataset will be always created in the MAIN database.
      + The Output Geometry will have the same name and SRID as the input-geom: the Geometry type will always be one of POINT, LINESTRING or POLYGON (all cut fragments will be stored as simple features on distinct rows).
      -
    • Both the input-db-prefix and blade-db-prefix arguments could be legitimately declared as NULL, and in this case the MAIN database will be always assumed.
    • -
    • and also the input-geom and blade-geom arguments could be legitimately declared as NULL.
      - In this case the appropriate Geometry column name will be implicitly determined, but only if the corresponding table declares just a single Geometry column, otherwise an exception will be raised.
    • -
    • The optional argument transaction determines if an internal SQL Transaction should be automatically started or not (the default setting if not explicitly overridden is FALSE).
    • +
    • Both the input-db-prefix and blade-db-prefix arguments could be set as NULL, where the MAIN database will then always be assumed.
    • +
    • also the input-geom and blade-geom arguments can be set as NULL.
      + In such a case the appropriate Geometry column name will be chosen when only one Geometry column is defined, otherwise an exception will be raised.
    • +
    • The optional argument transaction determines if an internal SQL Transaction should be automatically started or not (the default setting, if not explicitly overridden, is FALSE).
    • The optional argument ram-tmp-storage determines if the intermediate temporary tables internally used by this function should be created in RAM or not (the default setting if not explicitly overridden is FALSE).
    Will return -1 on invalid arguments, 0 on failure, 1 on full success and 2 on partial success (i.e.when the output table contains one or more invalid geometries).
    GetCutterMessage() GetCutterMessage( void ) : String Will return the most recent diagnostic message emitted by ST_Cutter().
    - NULL will be returned if no such message currently exists.
    GetShapefileExtent()GetShapefileExtent( virtual_table_name String ) : Geometryvirtual_table_name is expected to identify some Table of the VirtualSHP type.
    + An Envelope Geometry will be returned corresponding to the Shapefile's Full Extent; + NULL will be returned if any error occurs (invalid argument type or not existing VirtualTable).
    CreateRouting()CreateRouting( routing_data_table String , virtual_routing_table String , input_table String , from_column String , to_column String , + geom_column String , cost_column String ) : Boolean
    + CreateRouting( routing_data_table String , virtual_routing_table String , input_table String , from_column String , to_column String , + geom_column String , cost_column String , road_name_column String , a_star_enabled Boolean , bidirectional Boolean ) : Boolean
    + CreateRouting( routing_data_table String , virtual_routing_table String , input_table String , from_column String , to_column String , + geom_column String , cost_column String , road_name_column String , a_star_enabled Boolean , bidirectional Boolean , oneway_from String , + oneway_to String ) : Boolean
    + CreateRouting( routing_data_table String , virtual_routing_table String , input_table String , from_column String , to_column String , + geom_column String , cost_column String , road_name_column String , a_star_enabled Boolean , bidirectional Boolean , oneway_from String , + oneway_to String , overwrite Boolean ) : Boolean
    Will attempt to create a VirtualRouting Table (and the corresponding Routing Binary Data Table) starting from a topologically correct Road Network.
    +
      +
    • routing_data_table: name of the Routing Binary Data Table to be created.
    • +
    • virtual_routing_table: name of the VirtualRouting Table to be created.
    • +
    • input_table: name of the input Table containing the Road Network.
    • +
    • from_column: name of the input Table column containing FromNode values.
    • +
    • to_column: name of the input Table column containing ToNode values.
    • +
    • geom_column: name of the input Table column containing Geometries.
      + Could be eventually NULL for Networks just describing relations but lacking any Spatial representation.
    • +
    • cost_column: name of the input Table column containing Cost values.
      + Could be eventually NULL and in this case ST_Length(geom_column) will be assumed to be the Cost: in the case of Networks based on some Geographic Reference System + (long/lat, as e.g. SRID=4326) a precise measure of lengths expressed in meters will be computed by using geodesic formulas.
    • +
    • road_name_column: name of the input Table column containing Road Name values. Could be eventually NULL.
    • +
    • a_star_enabled: if the A* algorithm should be enabled or not (default: 1).
    • +
    • bidirectional: if arcs/links should be considered uni- or bi-directionals (default: 0).
    • +
    • oneway_from: name of the input Table column containing OneWay flags in the From-To direction. Could be eventually NULL.
    • +
    • oneway_to: name of the input Table column containing OneWay flags in the To-From direction. Could be eventually NULL.
    • +
    • overwrite: if set to TRUE already existing Routing Binary Data and/or VirtualRouting Tables will be silently overwritten (default: 0).
    • +

    + 1 (aka TRUE) will be returned on success, an exception will be raised on failure.
    CreateRoutingNodes()CreateRoutingNodes( db_prefix String , spatial_table String , geom_column String , node_from String , node_to String ) : BooleanWill attempt to add both node_from and nodes_to columns to the Spatial Table identified by db_prefix, spatial_table and geom_column. + These two columns will be populated by inserting appropriate Node-IDs (of the INTEGER type) fully respecting the topological consistency of the network.
    +
      +
    • db_prefix could be NULL, and in this case the MAIN DB is implicitly assumed.
    • +
    • also geom_column could be NULL, and in this case the name of the Geometry column will be automatically detected if the Spatial Table has just a single Geometry.
    • +
    • geom_column must contain Geometries of the LINESTRING type.
    • +
    • both node_from and node_to columns should not exist.
    • +

    + 1 (aka TRUE) will be returned on success, an exception will be raised on failure.
    CreateRouting_GetLastError()CreateRouting_GetLastError( void ) : StringWill return the most recent error message emitted by CreateRouting() or CreateRoutingNodes().
    + NULL will be returned if no such error message currently exists.
    IsLowASCII()IsLowASCII( text_string String ) : IntegerInspects an UTF-8 encoded text_string testing if it only contains ASCII 7-bit characters.
    + The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, + and -1 for UNKNOWN corresponding to a function invocation on invalid arguments.
    +

    SQL Procedures, Stored Procedures and Stored Variables related SQL functions

    FunctionSyntaxSummary
    SqlProc_GetLastErrorSqlProc_GetLastError( void ) : StringWill return the most recent error message returned by SQL Procedures and friends (if any).
    + NULL will be returned if there is no pending SQL Procedures error.
    SqlProc_SetLogfileSqlProc_SetLogfile( filepath String ) : Integer
    + SqlProc_SetLogfile( filepath String , append Boolean ) : Integer
    Will activate a SQL Logfile supporting all following calls to SqlProc_Execute() and StoredProc_Execute(). +
      +
    • The filepath argument is expected to be a valid relative or absolute pathname; it could be set to NULL so to disable SQL Logging.
    • +
    • The optional argument append if set to TRUE requires to open the Logfile for appending; if set to FALSE (default setting) the Logfile will be truncated.
    • +

    + 1 will be returned on success; an exception will be raised on invalid argument or if the SQL Logfile can't be succesfully opened.
    + Explicitly setting the environment variable SPATIALITE_SECURITY=relaxed is absolutely required in order to effectively enable this function.
    SqlProc_GetLogfileSqlProc_GetLogfile( void ) : StringWill return the pathname of the currently set SQL Logfile.
    + NULL will be returned if no SQL Logfile is currently set.
    SqlProc_FromTextSqlProc_FromText( sql_body String ) : BLOB
    + SqlProc_FromText( sql_body String, charset_encoding String ) : BLOB
    Will return a BLOB object of the Sql Procedure type encapsulating the given SQL Body.
    + If the optional second argument is explicitly specified the SQL Body will be automatically converted from the given charset encoding into UTF-8.
    + 1 will be returned on success; an exception will be raised on failure or invalid arguments.
    SqlProc_FromFileSqlProc_FromFile( filepath String ) : BLOB
    + SqlProc_FromFile( filepath String, charset_encoding String ) : BLOB
    Will return a BLOB object of the Sql Procedure type encapsulating the SQL Body loaded from the given filepath.
    + If the optional second argument is explicitly specified the SQL Body will be automatically converted from the given charset encoding into UTF-8.
    + 1 will be returned on success; an exception will be raised on failure or invalid arguments.
    + Explicitly setting the environment variable SPATIALITE_SECURITY=relaxed is absolutely required in order to effectively enable this function.
    SqlProc_IsValidSqlProc_IsValid( object BLOB ) : BooleanReturns TRUE if the passed BLOB is valid SQL Procedure object, otherwise FALSE.
    + An exception will be raised on invalid argument.
    SqlProc_NumVariablesSqlProc_NumVariables( object BLOB ) : IntegerReturns the total number of Variables declared by the given SQL Procedure object.
    + An exception will be raised on failure or invalid arguments.
    SqlProc_VariableNSqlProc_VariableN( object BLOB , index Integer ) : StringReturns the symbolic name of the Nth Variable declared by the given SQL Procedure object.
    + The first Variable always corresponds to index=0, and the last one to SqlProc_NumVariables() - 1.
    + An exception will be raised on failure or invalid arguments.
    SqlProc_AllVariablesSqlProc_AllVariables( object BLOB ) : StringReturns a space delimited list of all Variable symbolic names declared by the given SQL Procedure object.
    + An exception will be raised on failure or invalid argument.
    SqlProc_VarValueSqlProc_VarValue( var_name String , var_value NULL ) : String
    + SqlProc_VarValue( var_name String , var_value Integer ) : String
    + SqlProc_VarValue( var_name String , var_value Double ) : String
    + SqlProc_VarValue( var_name String , var_value Text ) : String
    + SqlProc_VarValue( var_name String , var_value BLOB ) : String
    Returns a properly formatted Variable with Value Text string.
    + An exception will be raised on failure or invalid argument.
    SqlProc_RawSQLSqlProc_RawSQL( object BLOB ) : StringReturns the raw SQL Body declared by the given SQL Procedure object.
    + An exception will be raised on failure or invalid argument.
    SqlProc_CookedSQLSqlProc_CookedSQL( object BLOB ) : String
    + SqlProc_CookedSQL( object BLOB , vararg String ) : String
    + SqlProc_CookedSQL( object BLOB , vararg1 String [ , ... ] , varargN String ) : String
    Returns the cooked SQL Body declared by the given SQL Procedure object after applying all Variable Values.
    + Note: this function accepts from 0 to 16 well-formed Variable with Value arguments; declaring twice or more the same Variable is considered to be a fatal error.
    + An exception will be raised on failure or invalid arguments.
    SqlProc_ExecuteSqlProc_Execute( object BLOB ) : Integer
    + SqlProc_Execute( object BLOB , vararg String ) : Integer
    + SqlProc_Execute( object BLOB , vararg1 String [ , ... ] , varargN String ) : Integer
    Executes the cooked SQL Body declared by the given SQL Procedure object after applying all Variable Values.
    + Note: this function accepts from 0 to 16 well-formed Variable with Value arguments; declaring twice or more the same Variable is considered to be a fatal error.
    + Will return 1 on success, an exception will be raised on failure or invalid arguments.
    SqlProc_ExitSqlProc_Exit( void ) : Integer
    + StoredProc_Exit( void ) : Integer
    + Will notify a pending EXIT request to SqlProc_Execute() or StoredProc_Execute(); + the internal execution loop will immediately stop and exit after completing the current SQL statement from the SQL Body.

    + Notes:
      +
    1. These functions are completely effectless outside the specific execution context of SqlProc_Execute() or StoredProc_Execute().
    2. +
    3. SqlProc_Exit() and StoredProc_Exit() are just alias names. +
    + Will return 1 on success, an exception will be raised on failure.
    StoredProc_CreateTablesStoredProc_CreateTables( void ) : BooleanReturns TRUE if the Stored Procedures and Variables tables have been succesfully created or if they already exist, otherwise FALSE.
    StoredProc_RegisterStoredProc_Register( name String , title String , object BLOB ) : BooleanRegisters a permanent Stored Procedure: +
      +
    • name is expected to uniquely identify the Stored Procedure.
    • +
    • title is expected to specify a short description of the Stored Procedure intended scopes.
    • +
    • object is expected to be a valid BLOB of the SQL Procedure type created by SqlProc_FromText() or SqlProc_FromFile().
    • +

    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    StoredProc_GetStoredProc_Get( name String ) : BLOBWill return a SQL Procedure BLOB object from a Stored Procedure. NULL will be returned if the Stored Procedure does not exists.
    + An exception will be raised on invalid arguments.
    StoredProc_DeleteStoredProc_Delete( name String ) : BooleanWill delete a Stored Procedure.
    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    StoredProc_UpdateTitleStoredProc_UpdateTitle( name String , title String ) : BooleanWill change the Title on the given Stored Procedure.
    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    StoredProc_UpdateSqlBodyStoredProc_UpdateSqlBody( name String , object BLOB ) : BooleanWill change the SQL Body on the given Stored Procedure.
    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    StoredProc_ExecuteStoredProc_Execute( name String ) : Integer
    + StoredProc_Execute( name String , vararg String ) : Integer
    + StoredProc_Execute( name String , vararg1 String [ , ... ] , varargN String ) : Integer
    Executes the given Stored Procedure after applying all Variable Values.
    + Note: this function accepts from 0 to 16 well-formed Variable with Value arguments; declaring twice or more the same Variable is considered to be a fatal error.
    + Will return 1 on success, an exception will be raised on failure or invalid arguments.
    StoredVar_RegisterStoredVar_Register( name String , title String , value NULL ) : Boolean
    + StoredVar_Register( name String , title String , value Integer ) : Boolean
    + StoredVar_Register( name String , title String , value Double ) : Boolean
    + StoredVar_Register( name String , title String , value Text ) : Boolean
    + StoredVar_Register( name String , title String , value BLOB ) : Boolean
    Registers a permanent Stored Variable: +
      +
    • name is expected to uniquely identify a Variable Name.
    • +
    • title is expected to specify a short description of the Stored Variable intended scopes.
    • +
    • value can be any data-type and will be automatically converted to its correspondined textual representation.
    • +

    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    StoredVar_GetStoredVar_Get( name String ) : BLOBWill return a Variable with Value string from a Stored Variable. NULL will be returned if the Stored Variable does not exists.
    + An exception will be raised on invalid arguments.
    StoredVar_GetValueStoredVar_GetValue( name String ) : BLOBWill return the undecorated Value string from a Stored Variable. NULL will be returned if the Stored Variable does not exists.
    + An exception will be raised on invalid arguments.
    StoredVar_DeleteStoredVar_Delete( name String ) : BooleanWill delete a Stored Variable.
    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    StoredVar_UpdateTitleStoredVar_UpdateTitle( name String , title String ) : BooleanWill change the Title on the given Stored Variable.
    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    StoredVar_UpdateValueStoredVar_UpdateValue( name String , var_value NULL ) : Boolean
    + StoredVar_UpdateValue( name String , var_value Integer ) : Boolean
    + StoredVar_UpdateValue( name String , var_value Double ) : Boolean
    + StoredVar_UpdateValue( name String , var_value Text ) : Boolean
    + StoredVar_UpdateValue( name String , var_value BLOB ) : Boolean
    Will change the Value on the given Stored Variable.
    + Returns TRUE on success, otherwise FALSE. An exception will be raised on invalid arguments.
    +
    back +
    Index: src/Makefile.am ================================================================== --- src/Makefile.am +++ src/Makefile.am @@ -13,13 +13,14 @@ wfs \ dxf \ md5 \ control_points \ cutter \ - topology + topology \ + stored_procedures -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers AM_CPPFLAGS += -I$(top_srcdir) if MODULE_ONLY lib_LTLIBRARIES = mod_spatialite.la @@ -39,10 +40,11 @@ ./md5/libmd5.la \ ./control_points/libcontrol_points.la \ ./cutter/libcutter.la \ ./topology/libtopology.la \ ./srsinit/libsrsinit.la \ + ./stored_procedures/libstored_procedures.la \ ./connection_cache/libconnection_cache.la \ ./virtualtext/libvirtualtext.la \ ./wfs/libwfs.la @LIBXML2_LIBS@ if MINGW @@ -70,15 +72,16 @@ ./md5/md5.la \ ./control_points/control_points.la \ ./cutter/cutter.la \ ./topology/topology.la \ ./srsinit/srsinit.la \ + ./stored_procedures/stored_procedures.la \ ./connection_cache/connection_cache.la \ ./virtualtext/virtualtext.la \ ./wfs/wfs.la @LIBXML2_LIBS@ -mod_spatialite_la_CPPFLAGS = @CFLAGS@ +mod_spatialite_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ mod_spatialite_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. mod_spatialite_la_CPPFLAGS += -DLOADABLE_EXTENSION mod_spatialite_la_LIBTOOLFLAGS = --tag=disable-static if MINGW Index: src/Makefile.in ================================================================== --- src/Makefile.in +++ src/Makefile.in @@ -141,10 +141,11 @@ ./gaiaexif/libgaiaexif.la ./gaiageo/libgaiageo.la \ ./geopackage/libgeopackage.la ./spatialite/libsplite.la \ ./shapefiles/libshapefiles.la ./dxf/libdxf.la ./md5/libmd5.la \ ./control_points/libcontrol_points.la ./cutter/libcutter.la \ ./topology/libtopology.la ./srsinit/libsrsinit.la \ + ./stored_procedures/libstored_procedures.la \ ./connection_cache/libconnection_cache.la \ ./virtualtext/libvirtualtext.la ./wfs/libwfs.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__dirstamp = $(am__leading_dot)dirstamp @@ -163,10 +164,11 @@ ./gaiaexif/gaiaexif.la ./gaiageo/gaiageo.la \ ./geopackage/geopackage.la ./spatialite/splite.la \ ./shapefiles/shapefiles.la ./dxf/dxf.la ./md5/md5.la \ ./control_points/control_points.la ./cutter/cutter.la \ ./topology/topology.la ./srsinit/srsinit.la \ + ./stored_procedures/stored_procedures.la \ ./connection_cache/connection_cache.la \ ./virtualtext/virtualtext.la ./wfs/wfs.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am_mod_spatialite_la_OBJECTS = \ @@ -426,22 +428,25 @@ wfs \ dxf \ md5 \ control_points \ cutter \ - topology + topology \ + stored_procedures -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I$(top_srcdir) +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers \ + -I$(top_srcdir) @MODULE_ONLY_FALSE@lib_LTLIBRARIES = libspatialite.la mod_spatialite.la @MODULE_ONLY_TRUE@lib_LTLIBRARIES = mod_spatialite.la libspatialite_la_SOURCES = versioninfo/version.c libspatialite_la_LIBADD = ./gaiaaux/libgaiaaux.la \ ./gaiaexif/libgaiaexif.la ./gaiageo/libgaiageo.la \ ./geopackage/libgeopackage.la ./spatialite/libsplite.la \ ./shapefiles/libshapefiles.la ./dxf/libdxf.la ./md5/libmd5.la \ ./control_points/libcontrol_points.la ./cutter/libcutter.la \ ./topology/libtopology.la ./srsinit/libsrsinit.la \ + ./stored_procedures/libstored_procedures.la \ ./connection_cache/libconnection_cache.la \ ./virtualtext/libvirtualtext.la ./wfs/libwfs.la @LIBXML2_LIBS@ \ $(am__append_1) $(am__append_2) $(am__append_3) @ANDROID_FALSE@@MINGW_FALSE@libspatialite_la_LDFLAGS = -version-info 8:1:1 @ANDROID_TRUE@@MINGW_FALSE@libspatialite_la_LDFLAGS = -version-info 8:1:1 @@ -450,15 +455,16 @@ mod_spatialite_la_LIBADD = ./gaiaaux/gaiaaux.la ./gaiaexif/gaiaexif.la \ ./gaiageo/gaiageo.la ./geopackage/geopackage.la \ ./spatialite/splite.la ./shapefiles/shapefiles.la ./dxf/dxf.la \ ./md5/md5.la ./control_points/control_points.la \ ./cutter/cutter.la ./topology/topology.la ./srsinit/srsinit.la \ + ./stored_procedures/stored_procedures.la \ ./connection_cache/connection_cache.la \ ./virtualtext/virtualtext.la ./wfs/wfs.la @LIBXML2_LIBS@ \ $(am__append_4) $(am__append_5) $(am__append_6) -mod_spatialite_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +mod_spatialite_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ \ + -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION mod_spatialite_la_LIBTOOLFLAGS = --tag=disable-static @ANDROID_FALSE@@MINGW_FALSE@mod_spatialite_la_LDFLAGS = -module -version-info 8:0:1 @ANDROID_TRUE@@MINGW_FALSE@mod_spatialite_la_LDFLAGS = -module -version-info 8:0:1 @MINGW_TRUE@mod_spatialite_la_LDFLAGS = -module -avoid-version -no-undefined MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/connection_cache/Makefile.am ================================================================== --- src/connection_cache/Makefile.am +++ src/connection_cache/Makefile.am @@ -1,22 +1,22 @@ SUBDIRS = generator -AM_CPPFLAGS = @CFLAGS@ @LIBXML2_CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_HEADERS = cache_aux_1.h cache_aux_2.h cache_aux_3.h noinst_LTLIBRARIES = libconnection_cache.la connection_cache.la libconnection_cache_la_SOURCES = alloc_cache.c gg_sequence.c connection_cache_la_SOURCES = alloc_cache.c gg_sequence.c -connection_cache_la_CPPFLAGS = @CFLAGS@ @LIBXML2_CFLAGS@ +connection_cache_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ connection_cache_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. connection_cache_la_CPPFLAGS += -DLOADABLE_EXTENSION connection_cache_la_LDFLAGS = -module connection_cache_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/connection_cache/Makefile.in ================================================================== --- src/connection_cache/Makefile.in +++ src/connection_cache/Makefile.in @@ -354,16 +354,17 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = generator -AM_CPPFLAGS = @CFLAGS@ @LIBXML2_CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ \ + -I$(top_srcdir)/src/headers noinst_HEADERS = cache_aux_1.h cache_aux_2.h cache_aux_3.h noinst_LTLIBRARIES = libconnection_cache.la connection_cache.la libconnection_cache_la_SOURCES = alloc_cache.c gg_sequence.c connection_cache_la_SOURCES = alloc_cache.c gg_sequence.c -connection_cache_la_CPPFLAGS = @CFLAGS@ @LIBXML2_CFLAGS@ \ +connection_cache_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ \ -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION connection_cache_la_LDFLAGS = -module connection_cache_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-recursive Index: src/connection_cache/alloc_cache.c ================================================================== --- src/connection_cache/alloc_cache.c +++ src/connection_cache/alloc_cache.c @@ -45,11 +45,11 @@ #include #include #include -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) #include #else #include #endif @@ -90,17 +90,21 @@ #ifndef GEOS_REENTRANT /* only when using the obsolete partially thread-safe mode */ #include "cache_aux_1.h" #endif /* end GEOS_REENTRANT */ +#ifdef _WIN32 +#define strcasecmp _stricmp +#endif /* not WIN32 */ + /* GLOBAL variables */ extern char *gaia_geos_error_msg; extern char *gaia_geos_warning_msg; /* GLOBAL semaphores */ int gaia_already_initialized = 0; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) static CRITICAL_SECTION gaia_cache_semaphore; #else static pthread_mutex_t gaia_cache_semaphore = PTHREAD_MUTEX_INITIALIZER; #endif @@ -345,10 +349,11 @@ init_splite_internal_cache (struct splite_internal_cache *cache) { /* common initialization of the internal cache */ gaiaOutBufferPtr out; int i; + const char *tinyPoint; struct splite_geos_cache_item *p; struct splite_xmlSchema_cache_item *p_xmlSchema; if (cache == NULL) return; @@ -359,17 +364,28 @@ cache->decimal_precision = -1; cache->GEOS_handle = NULL; cache->PROJ_handle = NULL; cache->RTTOPO_handle = NULL; cache->cutterMessage = NULL; + cache->storedProcError = NULL; + cache->createRoutingError = NULL; + cache->SqlProcLogfile = NULL; + cache->SqlProcLog = NULL; + cache->SqlProcContinue = 1; cache->pool_index = -1; cache->gaia_geos_error_msg = NULL; cache->gaia_geos_warning_msg = NULL; cache->gaia_geosaux_error_msg = NULL; cache->gaia_rttopo_error_msg = NULL; cache->gaia_rttopo_warning_msg = NULL; cache->silent_mode = 0; + cache->tinyPointEnabled = 0; + tinyPoint = getenv ("SPATIALITE_TINYPOINT"); + if (tinyPoint == NULL) + ; + else if (atoi (tinyPoint) != 0) + cache->tinyPointEnabled = 1; /* initializing an empty linked list of Topologies */ cache->firstTopology = NULL; cache->lastTopology = NULL; cache->next_topo_savepoint = 0; cache->first_topo_svpt = NULL; @@ -382,10 +398,13 @@ /* initializing Sequences */ cache->first_seq = NULL; cache->last_seq = NULL; cache->ok_last_used_sequence = 0; cache->last_used_sequence_val = 0; +/* initializing SHP BBOXes */ + cache->first_shp_extent = NULL; + cache->last_shp_extent = NULL; /* initializing the XML error buffers */ out = malloc (sizeof (gaiaOutBuffer)); gaiaOutBufferInitialize (out); cache->xmlParsingErrors = out; out = malloc (sizeof (gaiaOutBuffer)); @@ -575,10 +594,107 @@ free (pS->seq_name); free (pS); pS = pSn; } } + +static void +free_shp_extents (struct splite_internal_cache *cache) +{ +/* freeing all SHP BBOXes */ + struct splite_shp_extent *pS; + struct splite_shp_extent *pSn; + + pS = cache->first_shp_extent; + while (pS != NULL) + { + pSn = pS->next; + if (pS->table != NULL) + free (pS->table); + free (pS); + pS = pSn; + } +} + +SPATIALITE_PRIVATE void +add_shp_extent (const char *table, double minx, + double miny, double maxx, + double maxy, int srid, const void *p_cache) +{ +/* adding a Shapefile Full Extent */ + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + struct splite_shp_extent *shp = malloc (sizeof (struct splite_shp_extent)); + int len = strlen (table); + shp->table = malloc (len + 1); + strcpy (shp->table, table); + shp->minx = minx; + shp->miny = miny; + shp->maxx = maxx; + shp->maxy = maxy; + shp->srid = srid; + shp->prev = cache->last_shp_extent; + shp->next = NULL; + if (cache->first_shp_extent == NULL) + cache->first_shp_extent = shp; + if (cache->last_shp_extent != NULL) + cache->last_shp_extent->next = shp; + cache->last_shp_extent = shp; +} + +SPATIALITE_PRIVATE void +remove_shp_extent (const char *table, const void *p_cache) +{ +/* adding a Shapefile Full Extent */ + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + struct splite_shp_extent *shp_n; + struct splite_shp_extent *shp = cache->first_shp_extent; + while (shp != NULL) + { + shp_n = shp->next; + if (strcasecmp (shp->table, table) == 0) + { + if (shp->table != NULL) + free (shp->table); + if (shp->next != NULL) + shp->next->prev = shp->prev; + if (shp->prev != NULL) + shp->prev->next = shp->next; + if (cache->first_shp_extent == shp) + cache->first_shp_extent = shp->next; + if (cache->last_shp_extent == shp) + cache->last_shp_extent = shp->prev; + free (shp); + } + shp = shp_n; + } +} + +SPATIALITE_PRIVATE int +get_shp_extent (const char *table, double *minx, double *miny, double *maxx, + double *maxy, int *srid, const void *p_cache) +{ +/* retrieving a Shapefile Full Extent */ + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + struct splite_shp_extent *shp = cache->first_shp_extent; + while (shp != NULL) + { + if (strcasecmp (shp->table, table) == 0) + { + *minx = shp->minx; + *miny = shp->miny; + *maxx = shp->maxx; + *maxy = shp->maxy; + *srid = shp->srid; + return 1; + } + shp = shp->next; + } + return 0; +} SPATIALITE_PRIVATE void free_internal_cache (struct splite_internal_cache *cache) { /* freeing an internal cache */ @@ -653,11 +769,24 @@ #endif if (cache->cutterMessage != NULL) sqlite3_free (cache->cutterMessage); cache->cutterMessage = NULL; + if (cache->createRoutingError != NULL) + free (cache->createRoutingError); + cache->createRoutingError = NULL; + if (cache->storedProcError != NULL) + free (cache->storedProcError); + cache->storedProcError = NULL; + if (cache->SqlProcLogfile != NULL) + free (cache->SqlProcLogfile); + cache->SqlProcLogfile = NULL; + if (cache->SqlProcLog != NULL) + fclose (cache->SqlProcLog); + cache->SqlProcLog = NULL; free_sequences (cache); + free_shp_extents (cache); spatialite_finalize_topologies (cache); #ifdef ENABLE_RTTOPO if (cache->RTTOPO_handle != NULL) @@ -961,21 +1090,21 @@ } SPATIALITE_PRIVATE void splite_cache_semaphore_lock (void) { -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) EnterCriticalSection (&gaia_cache_semaphore); #else pthread_mutex_lock (&gaia_cache_semaphore); #endif } SPATIALITE_PRIVATE void splite_cache_semaphore_unlock (void) { -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) LeaveCriticalSection (&gaia_cache_semaphore); #else pthread_mutex_trylock (&gaia_cache_semaphore); pthread_mutex_unlock (&gaia_cache_semaphore); #endif @@ -986,11 +1115,11 @@ { /* initializes the library */ if (gaia_already_initialized) return; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) InitializeCriticalSection (&gaia_cache_semaphore); #endif #ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ xmlInitParser (); @@ -1007,11 +1136,11 @@ int i; #endif if (!gaia_already_initialized) return; -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__MINGW32__) DeleteCriticalSection (&gaia_cache_semaphore); #endif #ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ xmlCleanupParser (); Index: src/connection_cache/gg_sequence.c ================================================================== --- src/connection_cache/gg_sequence.c +++ src/connection_cache/gg_sequence.c @@ -51,10 +51,14 @@ #include "config.h" #endif #include +#ifdef _WIN32 +#define strcasecmp _stricmp +#endif /* not WIN32 */ + GAIASEQ_DECLARE gaiaSequencePtr gaiaCreateSequence (const void *p_cache, const char *seq_name) { /* creating a new Sequence or retrieving an already existing Sequence */ struct splite_internal_cache *cache = Index: src/control_points/Makefile.am ================================================================== --- src/control_points/Makefile.am +++ src/control_points/Makefile.am @@ -1,7 +1,7 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers -I. EXTRA_DIST = COPYING noinst_HEADERS = grass_crs.h @@ -11,12 +11,12 @@ grass_georef.c grass_georef_tps.c control_points_la_SOURCES = gaia_control_points.c grass_crs3d.c \ grass_georef.c grass_georef_tps.c -control_points_la_CPPFLAGS = @CFLAGS@ +control_points_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ control_points_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. control_points_la_CPPFLAGS += -DLOADABLE_EXTENSION control_points_la_LDFLAGS = -module control_points_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/control_points/Makefile.in ================================================================== --- src/control_points/Makefile.in +++ src/control_points/Makefile.in @@ -314,22 +314,22 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers -I. EXTRA_DIST = COPYING noinst_HEADERS = grass_crs.h noinst_LTLIBRARIES = libcontrol_points.la control_points.la libcontrol_points_la_SOURCES = gaia_control_points.c grass_crs3d.c \ grass_georef.c grass_georef_tps.c control_points_la_SOURCES = gaia_control_points.c grass_crs3d.c \ grass_georef.c grass_georef_tps.c -control_points_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +control_points_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ \ + -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION control_points_la_LDFLAGS = -module control_points_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/cutter/Makefile.am ================================================================== --- src/cutter/Makefile.am +++ src/cutter/Makefile.am @@ -1,17 +1,17 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers -I. noinst_LTLIBRARIES = libcutter.la cutter.la libcutter_la_SOURCES = gaia_cutter.c cutter_la_SOURCES = gaia_cutter.c -cutter_la_CPPFLAGS = @CFLAGS@ +cutter_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ cutter_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. cutter_la_CPPFLAGS += -DLOADABLE_EXTENSION cutter_la_LDFLAGS = -module cutter_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/cutter/Makefile.in ================================================================== --- src/cutter/Makefile.in +++ src/cutter/Makefile.in @@ -304,16 +304,16 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers -I. noinst_LTLIBRARIES = libcutter.la cutter.la libcutter_la_SOURCES = gaia_cutter.c cutter_la_SOURCES = gaia_cutter.c -cutter_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +cutter_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers \ + -I. -DLOADABLE_EXTENSION cutter_la_LDFLAGS = -module cutter_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/cutter/gaia_cutter.c ================================================================== --- src/cutter/gaia_cutter.c +++ src/cutter/gaia_cutter.c @@ -2158,16 +2158,18 @@ gaiaLinestringPtr ln; gaiaPolygonPtr pg; unsigned char *blob; int size; int gpkg_mode = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_mode = pcache->gpkg_mode; + tiny_point = pcache->tinyPointEnabled; } sqlite3_reset (stmt_out); sqlite3_clear_bindings (stmt_out); col = tbl->first; @@ -2266,11 +2268,11 @@ if (geom == NULL) { do_update_message (message, "UNEXPECTED NULL OUTPUT GEOMETRY"); return 0; } - gaiaToSpatiaLiteBlobWkbEx (geom, &blob, &size, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &blob, &size, gpkg_mode, tiny_point); if (blob == NULL) { do_update_message (message, "UNEXPECTED NULL OUTPUT BLOB GEOMETRY"); gaiaFreeGeomColl (geom); return 0; @@ -2833,17 +2835,19 @@ int icol = 1; int n_geom = 0; unsigned char *blob; int size; int gpkg_mode = 0; + int tiny_point = 0; gaiaGeomCollPtr g; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_mode = pcache->gpkg_mode; + tiny_point = pcache->tinyPointEnabled; } if (ngeom < 0) n_geom = 0; else @@ -2936,11 +2940,11 @@ } /* binding Nodes */ sqlite3_bind_null (stmt_out, icol); icol++; /* binding Geometry */ - gaiaToSpatiaLiteBlobWkbEx (g, &blob, &size, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (g, &blob, &size, gpkg_mode, tiny_point); if (blob == NULL) { do_update_message (message, "UNEXPECTED NULL TEMPORARY LINESTRING BLOB GEOMETRY"); gaiaFreeGeomColl (geom); @@ -2980,16 +2984,18 @@ int icol2 = 0; int icol = 1; unsigned char *blob; int size; int gpkg_mode = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_mode = pcache->gpkg_mode; + tiny_point = pcache->tinyPointEnabled; } sqlite3_reset (stmt_out); sqlite3_clear_bindings (stmt_out); col = tbl->first; @@ -3063,11 +3069,11 @@ icol++; } col = col->next; } /* binding Nodes */ - gaiaToSpatiaLiteBlobWkbEx (nodes, &blob, &size, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (nodes, &blob, &size, gpkg_mode, tiny_point); if (blob == NULL) { do_update_message (message, "UNEXPECTED NULL TEMPORARY LINESTRING NODES BLOB GEOMETRY"); return 0; @@ -3099,25 +3105,29 @@ int input_blob_sz; unsigned char *blade_blob = NULL; int blade_blob_sz; int gpkg_mode = 0; int gpkg_amphibious = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_mode = pcache->gpkg_mode; gpkg_amphibious = pcache->gpkg_amphibious_mode; + tiny_point = pcache->tinyPointEnabled; } sqlite3_reset (stmt_nodes); sqlite3_clear_bindings (stmt_nodes); input_g = do_prepare_linestring (input_ln, srid); - gaiaToSpatiaLiteBlobWkbEx (input_g, &input_blob, &input_blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (input_g, &input_blob, &input_blob_sz, gpkg_mode, + tiny_point); gaiaFreeGeomColl (input_g); - gaiaToSpatiaLiteBlobWkbEx (blade_g, &blade_blob, &blade_blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (blade_g, &blade_blob, &blade_blob_sz, gpkg_mode, + tiny_point); sqlite3_bind_blob (stmt_nodes, 1, input_blob, input_blob_sz, free); sqlite3_bind_blob (stmt_nodes, 2, blade_blob, blade_blob_sz, free); while (1) { @@ -3665,17 +3675,19 @@ struct multivar *var; int icol = 1; gaiaGeomCollPtr blade_g; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_amphibious = pcache->gpkg_amphibious_mode; gpkg_mode = pcache->gpkg_mode; + tiny_point = pcache->tinyPointEnabled; } blade_g = gaiaFromSpatiaLiteBlobWkbEx (blade_blob, blade_blob_sz, gpkg_mode, gpkg_amphibious); @@ -3732,12 +3744,12 @@ gpkg_amphibious); result = gaiaGeometryIntersection_r (cache, input_g, blade_g); if (result != NULL) { - gaiaToSpatiaLiteBlobWkbEx (result, &blob, &blob_sz, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &blob, &blob_sz, + gpkg_mode, tiny_point); gaiaFreeGeomColl (result); } gaiaFreeGeomColl (input_g); } if (blob != NULL) @@ -4107,17 +4119,19 @@ int icol = 1; int n_geom = 0; unsigned char *blob; int size; int gpkg_mode = 0; + int tiny_point = 0; gaiaGeomCollPtr g; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_mode = pcache->gpkg_mode; + tiny_point = pcache->tinyPointEnabled; } if (ngeom < 0) n_geom = 0; else @@ -4207,11 +4221,11 @@ icol++; } col = col->next; } /* binding Geometry */ - gaiaToSpatiaLiteBlobWkbEx (g, &blob, &size, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (g, &blob, &size, gpkg_mode, tiny_point); if (blob == NULL) { do_update_message (message, "UNEXPECTED NULL TEMPORARY POLYGON BLOB GEOMETRY"); gaiaFreeGeomColl (geom); @@ -4358,10 +4372,11 @@ struct output_column *col; int comma = 0; int cast2d = 0; int cast3d = 0; int gpkg_mode = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; @@ -4767,12 +4782,13 @@ { unsigned char *pg_blob; int pg_blob_sz; gaiaGeomCollPtr pg_geom = do_prepare_polygon (pg, input_g->Srid); - gaiaToSpatiaLiteBlobWkbEx (pg_geom, &pg_blob, &pg_blob_sz, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (pg_geom, &pg_blob, + &pg_blob_sz, gpkg_mode, + tiny_point); n_geom++; if (gaiaGeomCollPreparedIntersects (cache, pg_geom, pg_blob, pg_blob_sz, blade_g, blade_blob, blade_blob_sz)) { @@ -4861,17 +4877,19 @@ struct multivar *var; int icol = 1; gaiaGeomCollPtr blade_g; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_amphibious = pcache->gpkg_amphibious_mode; gpkg_mode = pcache->gpkg_mode; + tiny_point = pcache->tinyPointEnabled; } blade_g = gaiaFromSpatiaLiteBlobWkbEx (blade_blob, blade_blob_sz, gpkg_mode, gpkg_amphibious); @@ -4928,12 +4946,12 @@ gpkg_amphibious); result = gaiaGeometryIntersection_r (cache, input_g, blade_g); if (result != NULL) { - gaiaToSpatiaLiteBlobWkbEx (result, &blob, &blob_sz, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &blob, &blob_sz, + gpkg_mode, tiny_point); gaiaFreeGeomColl (result); } gaiaFreeGeomColl (input_g); } if (blob != NULL) @@ -5293,25 +5311,29 @@ int input_blob_sz; unsigned char *union_blob = NULL; int union_blob_sz; int gpkg_mode = 0; int gpkg_amphibious = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_mode = pcache->gpkg_mode; gpkg_amphibious = pcache->gpkg_amphibious_mode; + tiny_point = pcache->tinyPointEnabled; } sqlite3_reset (stmt_diff); sqlite3_clear_bindings (stmt_diff); input_g = do_prepare_polygon (input_pg, srid); - gaiaToSpatiaLiteBlobWkbEx (input_g, &input_blob, &input_blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (input_g, &input_blob, &input_blob_sz, gpkg_mode, + tiny_point); gaiaFreeGeomColl (input_g); - gaiaToSpatiaLiteBlobWkbEx (union_g, &union_blob, &union_blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (union_g, &union_blob, &union_blob_sz, gpkg_mode, + tiny_point); sqlite3_bind_blob (stmt_diff, 1, input_blob, input_blob_sz, SQLITE_STATIC); sqlite3_bind_blob (stmt_diff, 2, union_blob, union_blob_sz, SQLITE_STATIC); sqlite3_bind_blob (stmt_diff, 3, union_blob, union_blob_sz, SQLITE_STATIC); while (1) @@ -6042,25 +6064,29 @@ int input_blob_sz; unsigned char *union_blob = NULL; int union_blob_sz; int gpkg_mode = 0; int gpkg_amphibious = 0; + int tiny_point = 0; if (cache != NULL) { struct splite_internal_cache *pcache = (struct splite_internal_cache *) cache; gpkg_mode = pcache->gpkg_mode; gpkg_amphibious = pcache->gpkg_amphibious_mode; + tiny_point = pcache->tinyPointEnabled; } sqlite3_reset (stmt_diff); sqlite3_clear_bindings (stmt_diff); input_g = do_prepare_linestring (input_ln, srid); - gaiaToSpatiaLiteBlobWkbEx (input_g, &input_blob, &input_blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (input_g, &input_blob, &input_blob_sz, gpkg_mode, + tiny_point); gaiaFreeGeomColl (input_g); - gaiaToSpatiaLiteBlobWkbEx (union_g, &union_blob, &union_blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (union_g, &union_blob, &union_blob_sz, gpkg_mode, + tiny_point); sqlite3_bind_blob (stmt_diff, 1, input_blob, input_blob_sz, SQLITE_STATIC); sqlite3_bind_blob (stmt_diff, 2, union_blob, union_blob_sz, SQLITE_STATIC); sqlite3_bind_blob (stmt_diff, 3, union_blob, union_blob_sz, SQLITE_STATIC); while (1) Index: src/dxf/Makefile.am ================================================================== --- src/dxf/Makefile.am +++ src/dxf/Makefile.am @@ -1,7 +1,7 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers -I. noinst_HEADERS = dxf_private.h noinst_LTLIBRARIES = libdxf.la dxf.la @@ -11,12 +11,12 @@ libdxf_la_SOURCES = $(DXF_COMMON_SOURCES) dxf_la_SOURCES = $(DXF_COMMON_SOURCES) -dxf_la_CPPFLAGS = @CFLAGS@ +dxf_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ dxf_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. dxf_la_CPPFLAGS += -DLOADABLE_EXTENSION dxf_la_LDFLAGS = -module dxf_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/dxf/Makefile.in ================================================================== --- src/dxf/Makefile.in +++ src/dxf/Makefile.in @@ -312,20 +312,20 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers -I. noinst_HEADERS = dxf_private.h noinst_LTLIBRARIES = libdxf.la dxf.la DXF_COMMON_SOURCES = dxf_parser.c dxf_loader.c \ dxf_load_distinct.c dxf_load_mixed.c \ dxf_writer.c libdxf_la_SOURCES = $(DXF_COMMON_SOURCES) dxf_la_SOURCES = $(DXF_COMMON_SOURCES) -dxf_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ +dxf_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers -I. \ -DLOADABLE_EXTENSION dxf_la_LDFLAGS = -module dxf_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/gaiaaux/Makefile.am ================================================================== --- src/gaiaaux/Makefile.am +++ src/gaiaaux/Makefile.am @@ -1,7 +1,7 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgaiaaux.la gaiaaux.la GAIAAUX_COMMON_SOURCES = gg_sqlaux.c gg_utf8.c @@ -8,12 +8,12 @@ libgaiaaux_la_SOURCES = $(GAIAAUX_COMMON_SOURCES) gaiaaux_la_SOURCES = $(GAIAAUX_COMMON_SOURCES) -gaiaaux_la_CPPFLAGS = @CFLAGS@ +gaiaaux_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ gaiaaux_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. gaiaaux_la_CPPFLAGS += -DLOADABLE_EXTENSION gaiaaux_la_LDFLAGS = -module gaiaaux_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/gaiaaux/Makefile.in ================================================================== --- src/gaiaaux/Makefile.in +++ src/gaiaaux/Makefile.in @@ -306,17 +306,17 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgaiaaux.la gaiaaux.la GAIAAUX_COMMON_SOURCES = gg_sqlaux.c gg_utf8.c libgaiaaux_la_SOURCES = $(GAIAAUX_COMMON_SOURCES) gaiaaux_la_SOURCES = $(GAIAAUX_COMMON_SOURCES) -gaiaaux_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +gaiaaux_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers \ + -I. -DLOADABLE_EXTENSION gaiaaux_la_LDFLAGS = -module gaiaaux_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/gaiaaux/gg_sqlaux.c ================================================================== --- src/gaiaaux/gg_sqlaux.c +++ src/gaiaaux/gg_sqlaux.c @@ -1197,10 +1197,12 @@ dms = malloc (len + 1); strcpy (dms, dms0); sqlite3_free (dms0); return dms; } + +#if OMIT_ICONV == 0 /* ICONV is absolutely required */ /********************************************************************* / / DISCLAIMER / @@ -1218,41 +1220,46 @@ static char hex[] = "0123456789abcdef"; return hex[code & 15]; } GAIAAUX_DECLARE char * -gaiaEncodeURL (const char *url) +gaiaEncodeURL (const char *url, const char *out_charset) { /* encoding some URL */ char *encoded = NULL; - const char *in = url; + const char *in; + char *utf8_url = NULL; char *out; int len; if (url == NULL) return NULL; + + utf8_url = url_fromUtf8 (url, out_charset); + if (utf8_url == NULL) + return NULL; len = strlen (url); if (len == 0) return NULL; + in = utf8_url; encoded = malloc ((len * 3) + 1); out = encoded; while (*in != '\0') { if (isalnum (*in) || *in == '-' || *in == '_' || *in == '.' || *in == '~') *out++ = *in; - else if (*in == ' ') - *out++ = '+'; else { *out++ = '%'; *out++ = url_to_hex (*in >> 4); *out++ = url_to_hex (*in & 15); } in++; } *out = '\0'; + free (utf8_url); return encoded; } static char url_from_hex (char ch) @@ -1259,14 +1266,15 @@ { return isdigit (ch) ? ch - '0' : (char) (tolower (ch) - 'a' + 10); } GAIAAUX_DECLARE char * -gaiaDecodeURL (const char *encoded) +gaiaDecodeURL (const char *encoded, const char *in_charset) { /* decoding some URL */ char *url = NULL; + char *utf8_url = NULL; const char *in = encoded; char *out; int len; if (encoded == NULL) return NULL; @@ -1293,12 +1301,16 @@ else *out++ = *in; in++; } *out = '\0'; - return url; + utf8_url = url_toUtf8 (url, in_charset); + free (url); + return utf8_url; } + +#endif /* ICONV enabled/disabled */ GAIAAUX_DECLARE char * gaiaDirNameFromPath (const char *path) { /* extracting the DirName (if any) from a Path */ Index: src/gaiaaux/gg_utf8.c ================================================================== --- src/gaiaaux/gg_utf8.c +++ src/gaiaaux/gg_utf8.c @@ -78,10 +78,11 @@ #endif #endif #include #include +#include GAIAAUX_DECLARE const char * gaiaGetLocaleCharset () { /* identifies the locale charset */ @@ -194,7 +195,85 @@ return NULL; } utf8buf[maxlen - utf8len] = '\0'; return utf8buf; } + +SPATIALITE_PRIVATE char * +url_toUtf8 (const char *url, const char *in_charset) +{ +/* converting an URL to UTF-8 */ + iconv_t cvt; + size_t len; + size_t utf8len; + int maxlen; + char *utf8buf; + char *pUtf8buf; +#if !defined(__MINGW32__) && defined(_WIN32) + const char *pBuf = url; +#else /* not WIN32 */ + char *pBuf = (char *)url; +#endif + + if (url == NULL || in_charset == NULL) + return NULL; + cvt = iconv_open ("UTF-8", in_charset); + if (cvt == (iconv_t) (-1)) + goto unsupported; + len = strlen (url); + maxlen = len * 4; + utf8len = maxlen; + utf8buf = malloc (maxlen); + pUtf8buf = utf8buf; + if (iconv (cvt, &pBuf, &len, &pUtf8buf, &utf8len) == (size_t) (-1)) + goto error; + utf8buf[maxlen - utf8len] = '\0'; + iconv_close (cvt); + return utf8buf; + + error: + iconv_close (cvt); + free (utf8buf); + unsupported: + return NULL; +} + +SPATIALITE_PRIVATE char * +url_fromUtf8 (const char *url, const char *out_charset) +{ +/* converting an URL from UTF-8 */ + iconv_t cvt; + size_t len; + size_t utf8len; + int maxlen; + char *utf8buf; + char *pUtf8buf; +#if !defined(__MINGW32__) && defined(_WIN32) + const char *pBuf = url; +#else /* not WIN32 */ + char *pBuf = (char *)url; +#endif + + if (url == NULL || out_charset == NULL) + return NULL; + cvt = iconv_open (out_charset, "UTF-8"); + if (cvt == (iconv_t) (-1)) + goto unsupported; + len = strlen (url); + maxlen = len * 4; + utf8len = maxlen; + utf8buf = malloc (maxlen); + pUtf8buf = utf8buf; + if (iconv (cvt, &pBuf, &len, &pUtf8buf, &utf8len) == (size_t) (-1)) + goto error; + utf8buf[maxlen - utf8len] = '\0'; + iconv_close (cvt); + return utf8buf; + + error: + iconv_close (cvt); + free (utf8buf); + unsupported: + return NULL; +} #endif /* ICONV enabled/disabled */ Index: src/gaiaexif/Makefile.am ================================================================== --- src/gaiaexif/Makefile.am +++ src/gaiaexif/Makefile.am @@ -1,17 +1,17 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgaiaexif.la gaiaexif.la libgaiaexif_la_SOURCES = gaia_exif.c gaiaexif_la_SOURCES = gaia_exif.c -gaiaexif_la_CPPFLAGS = @CFLAGS@ +gaiaexif_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ gaiaexif_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. gaiaexif_la_CPPFLAGS += -DLOADABLE_EXTENSION gaiaexif_la_LDFLAGS = -module gaiaexif_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/gaiaexif/Makefile.in ================================================================== --- src/gaiaexif/Makefile.in +++ src/gaiaexif/Makefile.in @@ -305,16 +305,16 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgaiaexif.la gaiaexif.la libgaiaexif_la_SOURCES = gaia_exif.c gaiaexif_la_SOURCES = gaia_exif.c -gaiaexif_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +gaiaexif_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers \ + -I. -DLOADABLE_EXTENSION gaiaexif_la_LDFLAGS = -module gaiaexif_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/gaiaexif/gaia_exif.c ================================================================== --- src/gaiaexif/gaia_exif.c +++ src/gaiaexif/gaia_exif.c @@ -2360,10 +2360,11 @@ /* returns the BLOB content type */ int jpeg = 0; int exif = 0; int exif_gps = 0; int geom = 1; + int tiny_point = 1; gaiaExifTagListPtr exif_list; gaiaExifTagPtr pT; unsigned char jpeg1_signature[2]; unsigned char jpeg2_signature[2]; unsigned char jpeg3_signature[4]; @@ -2536,23 +2537,49 @@ if (size < 45) geom = 0; else { if (*(blob + 0) != GAIA_MARK_START) + geom = 0; + if (*(blob + 1) == GAIA_LITTLE_ENDIAN + || *(blob + 1) == GAIA_BIG_ENDIAN) + ; + else geom = 0; if (*(blob + (size - 1)) != GAIA_MARK_END) geom = 0; if (*(blob + 38) != GAIA_MARK_MBR) - geom = 0; - if (*(blob + 1) == 0 || *(blob + 1) == 1) - ; - else geom = 0; } if (geom) return GAIA_GEOMETRY_BLOB; +/* testing for TinyPoint */ + if (size < 24) + tiny_point = 0; + else + { + if (*(blob + 0) != GAIA_MARK_START) + tiny_point = 0; + if (*(blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN + || *(blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + ; + else + tiny_point = 0; + if (*(blob + 6) == GAIA_TINYPOINT_XY + || *(blob + 6) == GAIA_TINYPOINT_XYZ + || *(blob + 6) == GAIA_TINYPOINT_XYM + || *(blob + 6) == GAIA_TINYPOINT_XYZM) + ; + else + tiny_point = 0; + if (*(blob + (size - 1)) != GAIA_MARK_END) + tiny_point = 0; + } + if (tiny_point) + return GAIA_TINYPOINT_BLOB; + #ifdef ENABLE_LIBXML2 /* LIBXML2 enabled: supporting XML documents */ if (gaiaIsValidXmlBlob (blob, size)) return GAIA_XML_BLOB; Index: src/gaiageo/Makefile.am ================================================================== --- src/gaiageo/Makefile.am +++ src/gaiageo/Makefile.am @@ -1,9 +1,9 @@ SUBDIRS = flex lemon -AM_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgaiageo.la gaiageo.la GAIAGEO_COMMON_SOURCES = gg_advanced.c \ @@ -30,11 +30,11 @@ libgaiageo_la_SOURCES = $(GAIAGEO_COMMON_SOURCES) gaiageo_la_SOURCES = $(GAIAGEO_COMMON_SOURCES) -gaiageo_la_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ +gaiageo_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ gaiageo_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. gaiageo_la_CPPFLAGS += -DLOADABLE_EXTENSION gaiageo_la_LDFLAGS = -module gaiageo_la_LIBTOOLFLAGS = --tag=disable-static Index: src/gaiageo/Makefile.in ================================================================== --- src/gaiageo/Makefile.in +++ src/gaiageo/Makefile.in @@ -364,11 +364,11 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = flex lemon -AM_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ \ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ \ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgaiageo.la gaiageo.la GAIAGEO_COMMON_SOURCES = gg_advanced.c \ gg_endian.c \ gg_geodesic.c \ @@ -391,12 +391,13 @@ gg_xml.c \ gg_matrix.c libgaiageo_la_SOURCES = $(GAIAGEO_COMMON_SOURCES) gaiageo_la_SOURCES = $(GAIAGEO_COMMON_SOURCES) -gaiageo_la_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ \ - -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION +gaiageo_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ \ + @LIBXML2_CFLAGS@ -I$(top_srcdir)/src/headers -I. \ + -DLOADABLE_EXTENSION gaiageo_la_LDFLAGS = -module gaiageo_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda EXTRA_DIST = Ewkt.h Ewkt.c lex.Ewkt.c \ geoJSON.h geoJSON.c lex.GeoJson.c \ Index: src/gaiageo/gg_advanced.c ================================================================== --- src/gaiageo/gg_advanced.c +++ src/gaiageo/gg_advanced.c @@ -46,20 +46,24 @@ #include #include #include #include #include +#include #if defined(_WIN32) && !defined(__MINGW32__) #include "config-msvc.h" #else #include "config.h" #endif #include +#include +#include #include +#include GAIAGEO_DECLARE double gaiaMeasureLength (int dims, double *coords, int vert) { /* computes the total length */ @@ -3022,5 +3026,1100 @@ result->DeclaredType = GAIA_POLYGON; else result->DeclaredType = GAIA_MULTIPOLYGON; return result; } + +SPATIALITE_PRIVATE int +gaia_do_check_linestring (const void *g) +{ +/* testing if the Geometry is a simple Linestring */ + gaiaGeomCollPtr geom = (gaiaGeomCollPtr) g; + gaiaPointPtr pt; + gaiaLinestringPtr ln; + gaiaPolygonPtr pg; + int pts = 0; + int lns = 0; + int pgs = 0; + pt = geom->FirstPoint; + while (pt != NULL) + { + /* counting how many Points are there */ + pts++; + pt = pt->Next; + } + ln = geom->FirstLinestring; + while (ln != NULL) + { + /* counting how many Linestrings are there */ + lns++; + ln = ln->Next; + } + pg = geom->FirstPolygon; + while (pg != NULL) + { + /* counting how many Polygons are there */ + pgs++; + pg = pg->Next; + } + if (pts == 0 && lns == 1 && pgs == 0) + return 1; + return 0; +} + +static int +do_create_points (sqlite3 * mem_db, const char *table) +{ +/* creating a table for storing Points */ + int ret; + char *sql; + char *err_msg = NULL; + +/* creating the main table */ + if (strcmp (table, "points1") == 0) + sql = sqlite3_mprintf ("CREATE TABLE %s " + "(id INTEGER PRIMARY KEY AUTOINCREMENT, " + "geom BLOB NOT NULL, " + "needs_interpolation INTEGER NOT NULL)", table); + else + sql = sqlite3_mprintf ("CREATE TABLE %s " + "(id INTEGER PRIMARY KEY AUTOINCREMENT, " + "geom BLOB NOT NULL)", table); + ret = sqlite3_exec (mem_db, sql, NULL, NULL, &err_msg); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + spatialite_e ("gaiaDrapeLine: CREATE TABLE \"%s\" error: %s\n", + table, err_msg); + sqlite3_free (err_msg); + return 0; + } + + if (strcmp (table, "points1") == 0) + return 1; + +/* creating the companion R*Tree table */ + sql = sqlite3_mprintf ("CREATE VIRTUAL TABLE rtree_%s " + "USING rtree(pkid, xmin, xmax, ymin, ymax)", table); + ret = sqlite3_exec (mem_db, sql, NULL, NULL, &err_msg); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + spatialite_e ("gaiaDrapeLine: CREATE TABLE \"rtree_%s\" error: %s\n", + table, err_msg); + sqlite3_free (err_msg); + return 0; + } + + return 1; +} + +static int +do_insert_point (sqlite3 * mem_db, sqlite3_stmt * stmt_pts, + sqlite3_stmt * stmt_rtree_pts, double x, + double y, double z, double m) +{ +/* inserting into the Points2 helper table */ + int ret; + sqlite3_int64 rowid; + + sqlite3_reset (stmt_pts); + sqlite3_clear_bindings (stmt_pts); + sqlite3_bind_double (stmt_pts, 1, x); + sqlite3_bind_double (stmt_pts, 2, y); + sqlite3_bind_double (stmt_pts, 3, z); + sqlite3_bind_double (stmt_pts, 4, m); + ret = sqlite3_step (stmt_pts); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + rowid = sqlite3_last_insert_rowid (mem_db); + else + { + spatialite_e ("INSERT INTO \"Points\" error: \"%s\"\n", + sqlite3_errmsg (mem_db)); + goto error; + } + +/* inserting into the companion R*Tree */ + sqlite3_reset (stmt_rtree_pts); + sqlite3_clear_bindings (stmt_rtree_pts); + sqlite3_bind_int64 (stmt_rtree_pts, 1, rowid); + sqlite3_bind_double (stmt_rtree_pts, 2, x); + sqlite3_bind_double (stmt_rtree_pts, 3, x); + sqlite3_bind_double (stmt_rtree_pts, 4, y); + sqlite3_bind_double (stmt_rtree_pts, 5, y); + ret = sqlite3_step (stmt_rtree_pts); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("INSERT INTO \"RTree_Points\" error: \"%s\"\n", + sqlite3_errmsg (mem_db)); + goto error; + } + + return 1; + + error: + return 0; +} + +static int +do_populate_points2 (sqlite3 * mem_db, gaiaGeomCollPtr geom) +{ +/* populating Points-2 */ + int ret; + const char *sql; + int iv; + gaiaLinestringPtr ln; + sqlite3_stmt *stmt_pts = NULL; + sqlite3_stmt *stmt_rtree_pts = NULL; + double ox; + double oy; + double oz; + double om; + double fx; + double fy; + double fz; + double fm; + +/* creating an SQL statement for inserting rows into the Points2 table */ + sql = "INSERT INTO points2 (id, geom) VALUES " + "(NULL, MakePointZM(?, ?, ?, ?))"; + ret = sqlite3_prepare_v2 (mem_db, sql, strlen (sql), &stmt_pts, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("INSERT INTO Points2: error %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + +/* creating an SQL statement for inserting rows into the R*TREE table */ + sql = "INSERT INTO rtree_points2 (pkid, xmin, xmax, ymin, ymax) " + "VALUES (?, ?, ?, ?, ?)"; + ret = sqlite3_prepare_v2 (mem_db, sql, strlen (sql), &stmt_rtree_pts, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("INSERT INTO RTree_Points2: error %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + +/* starting a Transaction */ + sql = "BEGIN"; + ret = sqlite3_exec (mem_db, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("BEGIN: error: %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + + ln = geom->FirstLinestring; + for (iv = 0; iv < ln->Points; iv++) + { + /* processing all Vertices from the input Linestring */ + double x; + double y; + double z = 0.0; + double m = 0.0; + int repeated; + if (ln->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln->Coords, iv, &x, &y, &z); + } + else if (ln->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln->Coords, iv, &x, &y, &m); + } + else if (ln->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln->Coords, iv, &x, &y, &z, &m); + } + else + { + gaiaGetPoint (ln->Coords, iv, &x, &y); + } + repeated = 0; + if (iv != 0) + { + /* checking for repeated points */ + if (x == ox && y == oy && z == oz && m == om) + repeated = 1; + } + if (iv == ln->Points - 1) + { + /* checkink for a closed Linestring */ + if (x == fx && y == fy && z == fz && m == fm) + repeated = 1; + } + if (!repeated) + { + /* inserting a Point */ + if (!do_insert_point + (mem_db, stmt_pts, stmt_rtree_pts, x, y, z, m)) + goto error; + } + /* saving the current coords */ + ox = x; + oy = y; + oz = z; + om = m; + if (iv == 0) + { + /* saving the Start Point coords */ + fx = x; + fy = y; + fz = z; + fm = m; + } + } + +/* committing the pending Transaction */ + sql = "COMMIT"; + ret = sqlite3_exec (mem_db, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("COMMIT: error: %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + + sqlite3_finalize (stmt_pts); + sqlite3_finalize (stmt_rtree_pts); + return 1; + + error: + if (stmt_pts != NULL) + sqlite3_finalize (stmt_pts); + if (stmt_rtree_pts != NULL) + sqlite3_finalize (stmt_rtree_pts); + return 0; +} + +static int +do_insert_draped_point (sqlite3 * mem_db, sqlite3_stmt * stmt_pts, + int needs_interpolation, gaiaGeomCollPtr geom) +{ +/* inserting into the Points helper table */ + int ret; + gaiaPointPtr pt = geom->FirstPoint; + + if (pt == NULL) + return 0; + + sqlite3_reset (stmt_pts); + sqlite3_clear_bindings (stmt_pts); + sqlite3_bind_double (stmt_pts, 1, pt->X); + sqlite3_bind_double (stmt_pts, 2, pt->Y); + sqlite3_bind_double (stmt_pts, 3, pt->Z); + sqlite3_bind_double (stmt_pts, 4, pt->M); + sqlite3_bind_int (stmt_pts, 5, needs_interpolation); + ret = sqlite3_step (stmt_pts); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + return 1; + + spatialite_e ("INSERT INTO \"Points1\" error: \"%s\"\n", + sqlite3_errmsg (mem_db)); + return 0; +} + +static gaiaGeomCollPtr +do_point_drape_coords (int srid, double x, double y, gaiaGeomCollPtr geom_3d) +{ +/* draping a Point */ + gaiaPointPtr pt_3d = geom_3d->FirstPoint; + gaiaGeomCollPtr geom = gaiaAllocGeomCollXYZM (); + geom->Srid = srid; + gaiaAddPointToGeomCollXYZM (geom, x, y, pt_3d->Z, pt_3d->M); + return geom; +} + +static gaiaGeomCollPtr +do_point_same_coords (int srid, double x, double y, double z, double m) +{ +/* creating a Point (unchanged coords) */ + gaiaGeomCollPtr geom; + geom = gaiaAllocGeomCollXYZM (); + geom->Srid = srid; + gaiaAddPointToGeomCollXYZM (geom, x, y, z, m); + return geom; +} + +static int +do_drape_vertex (sqlite3 * mem_db, sqlite3_stmt * stmt, + sqlite3_stmt * stmt_pts, int srid, double tolerance, + double x, double y, double z, double m) +{ +/* draping the segment */ + double minx = x; + double miny = y; + double maxx = x; + double maxy = y; + int ret; + int count = 0; + gaiaGeomCollPtr g2; + +/* preparing an extendend BBOX */ + minx = x - (tolerance * 2.0); + miny = y - (tolerance * 2.0); + maxx = x + (tolerance * 2.0); + maxy = y + (tolerance * 2.0); + +/* querying Points-2 by distance from Segment */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, minx); /* R*Tree BBOX */ + sqlite3_bind_double (stmt, 2, miny); + sqlite3_bind_double (stmt, 3, maxx); + sqlite3_bind_double (stmt, 4, maxy); + sqlite3_bind_double (stmt, 5, x); /* point (distance) */ + sqlite3_bind_double (stmt, 6, y); + sqlite3_bind_double (stmt, 7, tolerance); + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + gaiaGeomCollPtr g2 = NULL; + gaiaGeomCollPtr geom = NULL; + if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) + { + unsigned char *p_blob = + (unsigned char *) sqlite3_column_blob (stmt, 0); + int n_bytes = sqlite3_column_bytes (stmt, 0); + geom = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); + } + if (geom != NULL) + { + /* found a valid Point */ + g2 = do_point_drape_coords (srid, x, y, geom); + gaiaFreeGeomColl (geom); + if (!do_insert_draped_point (mem_db, stmt_pts, 0, g2)) + goto error; + gaiaFreeGeomColl (g2); + count++; + } + } + } + if (count == 0) + { + /* not found - inserting the Point itself */ + g2 = do_point_same_coords (srid, x, y, z, m); + if (!do_insert_draped_point (mem_db, stmt_pts, 1, g2)) + goto error; + gaiaFreeGeomColl (g2); + } + return 1; + + error: + return 0; +} + +static int +do_drape_line (sqlite3 * mem_db, gaiaGeomCollPtr geom, double tolerance) +{ +/* draping the line */ + int ret; + sqlite3_stmt *stmt = NULL; + sqlite3_stmt *stmt_pts = NULL; + const char *sql; + gaiaLinestringPtr ln; + int iv; + +/* creating an SQL statement for querying Points-2 */ + sql = "SELECT geom FROM points2 " + "WHERE ROWID IN (SELECT pkid FROM rtree_points2 WHERE " + "MbrIntersects(geom, BuildMbr(?, ?, ?, ?)) = 1) " + "AND ST_Distance(geom, MakePoint(?, ?)) <= ? " "ORDER BY id"; + ret = sqlite3_prepare_v2 (mem_db, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("SELECT Points2: error %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + +/* creating an SQL statement for inserting rows into the Points-1 table */ + sql = "INSERT INTO points1 (id, geom, needs_interpolation) VALUES " + "(NULL, MakePointZM(?, ?, ?, ?), ?)"; + ret = sqlite3_prepare_v2 (mem_db, sql, strlen (sql), &stmt_pts, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("INSERT INTO Points1: error %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + +/* starting a Transaction */ + sql = "BEGIN"; + ret = sqlite3_exec (mem_db, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("BEGIN: error: %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + + ln = geom->FirstLinestring; + for (iv = 0; iv < ln->Points; iv++) + { + /* processing all Vertices from the input Linestring */ + double x; + double y; + double z = 0.0; + double m = 0.0; + if (ln->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln->Coords, iv, &x, &y, &z); + } + else if (ln->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln->Coords, iv, &x, &y, &m); + } + else if (ln->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln->Coords, iv, &x, &y, &z, &m); + } + else + { + gaiaGetPoint (ln->Coords, iv, &x, &y); + } + /* processing a Vertex */ + if (!do_drape_vertex + (mem_db, stmt, stmt_pts, geom->Srid, tolerance, x, y, z, m)) + goto error; + } + +/* committing the pending Transaction */ + sql = "COMMIT"; + ret = sqlite3_exec (mem_db, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("COMMIT: error: %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto error; + } + + sqlite3_finalize (stmt); + sqlite3_finalize (stmt_pts); + return 1; + + error: + if (stmt != NULL) + sqlite3_finalize (stmt); + if (stmt_pts != NULL) + sqlite3_finalize (stmt_pts); + return 0; +} + +static int +get_prev_coords (int index, gaiaDynamicLinePtr dyn, double *z, double *m, + double *dist) +{ +/* retrieving the previous Point */ + double ox; + double oy; + double x; + double y; + double zz; + double mm; + int ok = 0; + int count = 0; + gaiaPointPtr pt = dyn->First; + while (pt != NULL) + { + if (index - 1 == count) + { + /* this is the previous point */ + ox = pt->X; + oy = pt->Y; + zz = pt->Z; + mm = pt->M; + ok = 1; + } + if (index == count) + { + /* this is the current point */ + x = pt->X; + y = pt->Y; + if (ok) + { + *z = zz; + *m = mm; + *dist = + sqrt (((ox - x) * (ox - x)) + ((oy - y) * (oy - y))); + return 1; + } + return 0; + } + count++; + pt = pt->Next; + } + return 0; +} + +static int +get_next_coords (int index, gaiaDynamicLinePtr dyn, const char *interpolate, + double *z, double *m, double *dist) +{ +/* retrieving the next Point */ + double ox; + double oy; + double x; + double y; + double d = 0.0; + int ok = 0; + int count = 0; + gaiaPointPtr pt = dyn->First; + while (pt != NULL) + { + if (index == count) + { + /* this is the current Point */ + ox = pt->X; + oy = pt->Y; + ok = 1; + } + if (index < count) + { + /* this is a following Point */ + if (!ok) + return 0; + x = pt->X; + y = pt->Y; + d += sqrt (((ox - x) * (ox - x)) + ((oy - y) * (oy - y))); + if (*(interpolate + count) == 'N') + { + /* found a valid Point */ + *z = pt->Z; + *m = pt->M; + *dist = d; + return 1; + } + } + count++; + pt = pt->Next; + } + return 0; +} + +static int +do_update_coords (int index, gaiaDynamicLinePtr dyn, double z, double m) +{ +/* updating the coords */ + int count = 0; + gaiaPointPtr pt = dyn->First; + while (pt != NULL) + { + if (index == count) + { + pt->Z = z; + pt->M = m; + return 1; + } + count++; + pt = pt->Next; + } + return 0; +} + +static void +do_interpolate_coords (int index, gaiaDynamicLinePtr dyn, char *interpolate) +{ +/* attempting to interpolate coords */ + double pz; + double pm; + double nz; + double nm; + double z; + double m; + double pdist; + double ndist; + double perc; + if (!get_prev_coords (index, dyn, &pz, &pm, &pdist)) + return; + if (!get_next_coords (index, dyn, interpolate, &nz, &nm, &ndist)) + return; + perc = pdist / (pdist + ndist); + z = pz + ((nz - pz) * perc); + m = pm + ((nm - pm) * perc); + if (do_update_coords (index, dyn, z, m)) + *(interpolate+index) = 'I'; +} + +static gaiaGeomCollPtr +do_reassemble_line (sqlite3 * mem_db, int dims, int srid) +{ +/* reassembling the Linestring to be returned */ + gaiaGeomCollPtr geom = NULL; + gaiaPointPtr pt; + gaiaLinestringPtr ln; + gaiaDynamicLinePtr dyn = gaiaAllocDynamicLine (); + const char *sql; + int ret; + sqlite3_stmt *stmt = NULL; + int count = 0; + int needs_interpolation = 0; + +/* creating an SQL statement for querying Points-1 */ + sql = "SELECT geom, needs_interpolation FROM points1 ORDER BY id"; + ret = sqlite3_prepare_v2 (mem_db, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("SELECT Points1: error %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto end; + } + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + gaiaGeomCollPtr g = NULL; + if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) + { + unsigned char *p_blob = + (unsigned char *) sqlite3_column_blob (stmt, 0); + int n_bytes = sqlite3_column_bytes (stmt, 0); + g = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); + } + if (g != NULL) + { + /* found a valid Point */ + pt = g->FirstPoint; + if (dims == GAIA_XY_Z_M) + gaiaAppendPointZMToDynamicLine (dyn, pt->X, pt->Y, + pt->Z, pt->M); + else if (dims == GAIA_XY_Z) + gaiaAppendPointZToDynamicLine (dyn, pt->X, pt->Y, + pt->Z); + else if (dims == GAIA_XY_M) + gaiaAppendPointMToDynamicLine (dyn, pt->X, pt->Y, + pt->M); + else + gaiaAppendPointToDynamicLine (dyn, pt->X, pt->Y); + gaiaFreeGeomColl (g); + } + if (sqlite3_column_int (stmt, 1) == 1) + needs_interpolation = 1; + } + } + + pt = dyn->First; + while (pt) + { + /* counting how many points are there */ + count++; + pt = pt->Next; + } + if (count < 2) + goto end; + + if (needs_interpolation) + { + /* attempting to interpolate missing coords */ + int i; + int max = count; + char *interpolate = malloc (max + 1); + memset (interpolate, '\0', max + 1); + sqlite3_reset (stmt); /* rewinding the resultset */ + count = 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) + { + if (sqlite3_column_int (stmt, 1) == 0) + *(interpolate + count) = 'N'; + else + *(interpolate + count) = 'Y'; + count++; + } + } + for (i = 0; i < max; i++) + { + if (*(interpolate + i) == 'Y') + do_interpolate_coords (i, dyn, interpolate); + } + free (interpolate); + } + + sqlite3_finalize (stmt); + stmt = NULL; + +/* creating the final Linestring */ + if (dims == GAIA_XY_Z_M) + geom = gaiaAllocGeomCollXYZM (); + else if (dims == GAIA_XY_Z) + geom = gaiaAllocGeomCollXYZ (); + else if (dims == GAIA_XY_M) + geom = gaiaAllocGeomCollXYM (); + else + geom = gaiaAllocGeomColl (); + geom->Srid = srid; + + ln = gaiaAddLinestringToGeomColl (geom, count); + count = 0; + pt = dyn->First; + while (pt != NULL) + { + if (dims == GAIA_XY_Z_M) + { + gaiaSetPointXYZM (ln->Coords, count, pt->X, pt->Y, + pt->Z, pt->M); + } + else if (dims == GAIA_XY_Z) + { + gaiaSetPointXYZ (ln->Coords, count, pt->X, pt->Y, pt->Z); + } + else if (dims == GAIA_XY_M) + { + gaiaSetPointXYM (ln->Coords, count, pt->X, pt->Y, pt->M); + } + else + { + gaiaSetPoint (ln->Coords, count, pt->X, pt->Y); + } + count++; + pt = pt->Next; + } + + end: + gaiaFreeDynamicLine (dyn); + if (stmt != NULL) + sqlite3_finalize (stmt); + return geom; +} + +static gaiaGeomCollPtr +do_reassemble_multi_point (sqlite3 * mem_db, int dims, int srid, + int interpolated) +{ +/* reassembling the MultiPoint to be returned */ + gaiaGeomCollPtr geom = NULL; + gaiaPointPtr pt; + gaiaDynamicLinePtr dyn = gaiaAllocDynamicLine (); + const char *sql; + int ret; + sqlite3_stmt *stmt = NULL; + int count = 0; + int needs_interpolation = 0; + char *interpolate = NULL; + +/* creating an SQL statement for querying Points-1 */ + sql = "SELECT geom, needs_interpolation FROM points1 ORDER BY id"; + ret = sqlite3_prepare_v2 (mem_db, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("SELECT Points1: error %d \"%s\"\n", + sqlite3_errcode (mem_db), sqlite3_errmsg (mem_db)); + goto end; + } + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + gaiaGeomCollPtr g = NULL; + if (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) + { + unsigned char *p_blob = + (unsigned char *) sqlite3_column_blob (stmt, 0); + int n_bytes = sqlite3_column_bytes (stmt, 0); + g = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); + } + if (g != NULL) + { + /* found a valid Point */ + pt = g->FirstPoint; + if (dims == GAIA_XY_Z_M) + gaiaAppendPointZMToDynamicLine (dyn, pt->X, pt->Y, + pt->Z, pt->M); + else if (dims == GAIA_XY_Z) + gaiaAppendPointZToDynamicLine (dyn, pt->X, pt->Y, + pt->Z); + else if (dims == GAIA_XY_M) + gaiaAppendPointMToDynamicLine (dyn, pt->X, pt->Y, + pt->M); + else + gaiaAppendPointToDynamicLine (dyn, pt->X, pt->Y); + gaiaFreeGeomColl (g); + } + if (sqlite3_column_int (stmt, 1) == 1) + needs_interpolation = 1; + } + } + + pt = dyn->First; + while (pt) + { + /* counting how many points are there */ + count++; + pt = pt->Next; + } + if (count < 2) + goto end; + + if (needs_interpolation) + { + /* attempting to interpolate missing coords */ + int i; + int max = count; + interpolate = malloc (max + 1); + memset (interpolate, '\0', max + 1); + sqlite3_reset (stmt); /* rewinding the resultset */ + count = 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) + { + if (sqlite3_column_int (stmt, 1) == 0) + *(interpolate + count) = 'N'; + else + *(interpolate + count) = 'Y'; + count++; + } + } + for (i = 0; i < max; i++) + { + if (*(interpolate + i) == 'Y') + do_interpolate_coords (i, dyn, interpolate); + } + } + + sqlite3_finalize (stmt); + stmt = NULL; + +/* creating the final MultiPoint */ + if (dims == GAIA_XY_Z_M) + geom = gaiaAllocGeomCollXYZM (); + else if (dims == GAIA_XY_Z) + geom = gaiaAllocGeomCollXYZ (); + else if (dims == GAIA_XY_M) + geom = gaiaAllocGeomCollXYM (); + else + geom = gaiaAllocGeomColl (); + geom->Srid = srid; + geom->DeclaredType = GAIA_MULTIPOINT; + + pt = dyn->First; + count = 0; + while (pt != NULL) + { + int ok = 0; + if (*(interpolate + count) == 'Y') + ok = 1; + if (!interpolated && *(interpolate + count) == 'I') + ok = 1; + if (ok) + { + if (dims == GAIA_XY_Z_M) + gaiaAddPointToGeomCollXYZM (geom, pt->X, pt->Y, pt->Z, + pt->M); + else if (dims == GAIA_XY_Z) + gaiaAddPointToGeomCollXYZ (geom, pt->X, pt->Y, pt->Z); + else if (dims == GAIA_XY_M) + gaiaAddPointToGeomCollXYM (geom, pt->X, pt->Y, pt->M); + else + gaiaAddPointToGeomColl (geom, pt->X, pt->Y); + } + count++; + pt = pt->Next; + } + + end: + if (interpolate != NULL) + free (interpolate); + gaiaFreeDynamicLine (dyn); + if (stmt != NULL) + sqlite3_finalize (stmt); + return geom; +} + +GAIAGEO_DECLARE gaiaGeomCollPtr +gaiaDrapeLine (sqlite3 * db_handle, gaiaGeomCollPtr geom1, + gaiaGeomCollPtr geom2, double tolerance) +{ +/* will return a 3D Linestring by draping line-1 (2D) over line-2 (3D) */ + int ret; + sqlite3 *mem_db = NULL; + void *cache; + char *sql; + char *err_msg = NULL; + gaiaGeomCollPtr geom3 = NULL; + +/* arguments validation */ + if (db_handle == NULL) + return NULL; + if (geom1 == NULL || geom2 == NULL) + return NULL; + if (tolerance < 0.0) + return NULL; + if (geom1->Srid != geom2->Srid) + return NULL; + if (geom1->DimensionModel != GAIA_XY) + return NULL; + if (geom2->DimensionModel != GAIA_XY_Z) + return NULL; + if (!gaia_do_check_linestring (geom1)) + return NULL; + if (!gaia_do_check_linestring (geom2)) + return NULL; + +/* creating a Temporary MemoryDB */ + ret = + sqlite3_open_v2 (":memory:", &mem_db, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("gaiaDrapeLine: sqlite3_open_v2 error: %s\n", + sqlite3_errmsg (mem_db)); + sqlite3_close (mem_db); + return NULL; + } + cache = spatialite_alloc_connection (); + spatialite_internal_init (mem_db, cache); + +/* initializing a minimal SpatiaLite DB */ + sql = "SELECT InitSpatialMetadata(1, 'NONE')"; + ret = sqlite3_exec (mem_db, sql, NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + spatialite_e ("gaiaDrapeLine: InitSpatialMetadata() error: %s\n", + err_msg); + sqlite3_free (err_msg); + goto end; + } + +/* creating the helper tables on the Temporary MemoryDB */ + if (!do_create_points (mem_db, "points1")) + goto end; + if (!do_create_points (mem_db, "points2")) + goto end; + +/* populating the Points-2 helper table */ + if (!do_populate_points2 (mem_db, geom2)) + goto end; + +/* draping the first line over Points-2 */ + if (!do_drape_line (mem_db, geom1, tolerance)) + goto end; + +/* building the final linestring to be returned */ + geom3 = do_reassemble_line (mem_db, geom2->DimensionModel, geom2->Srid); + + end: +/* releasing the Temporary MemoryDB */ + ret = sqlite3_close (mem_db); + if (ret != SQLITE_OK) + spatialite_e ("gaiaDrapeLine: sqlite3_close() error: %s\n", + sqlite3_errmsg (mem_db)); + spatialite_internal_cleanup (cache); + + return geom3; +} + +GAIAGEO_DECLARE gaiaGeomCollPtr +gaiaDrapeLineExceptions (sqlite3 * db_handle, gaiaGeomCollPtr geom1, + gaiaGeomCollPtr geom2, double tolerance, + int interpolated) +{ +/* + * will return a 3D MultiPoint containing all Vertices from geom1 + * not being correctly draped over geom2 +*/ + int ret; + sqlite3 *mem_db = NULL; + void *cache; + char *sql; + char *err_msg = NULL; + gaiaGeomCollPtr geom3 = NULL; + +/* arguments validation */ + if (db_handle == NULL) + return NULL; + if (geom1 == NULL || geom2 == NULL) + return NULL; + if (tolerance < 0.0) + return NULL; + if (geom1->Srid != geom2->Srid) + return NULL; + if (geom1->DimensionModel != GAIA_XY) + return NULL; + if (geom2->DimensionModel != GAIA_XY_Z) + return NULL; + if (!gaia_do_check_linestring (geom1)) + return NULL; + if (!gaia_do_check_linestring (geom2)) + return NULL; + +/* creating a Temporary MemoryDB */ + ret = + sqlite3_open_v2 (":memory:", &mem_db, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("gaiaDrapeLine: sqlite3_open_v2 error: %s\n", + sqlite3_errmsg (mem_db)); + sqlite3_close (mem_db); + return NULL; + } + cache = spatialite_alloc_connection (); + spatialite_internal_init (mem_db, cache); + +/* initializing a minimal SpatiaLite DB */ + sql = "SELECT InitSpatialMetadata(1, 'NONE')"; + ret = sqlite3_exec (mem_db, sql, NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + spatialite_e + ("gaiaDrapeLineExceptions: InitSpatialMetadata() error: %s\n", + err_msg); + sqlite3_free (err_msg); + goto end; + } + +/* creating the helper tables on the Temporary MemoryDB */ + if (!do_create_points (mem_db, "points1")) + goto end; + if (!do_create_points (mem_db, "points2")) + goto end; + +/* populating the Points-2 helper table */ + if (!do_populate_points2 (mem_db, geom2)) + goto end; + +/* draping the first line over Points-2 */ + if (!do_drape_line (mem_db, geom1, tolerance)) + goto end; + +/* building the final MultiPoint to be returned */ + geom3 = + do_reassemble_multi_point (mem_db, geom2->DimensionModel, geom2->Srid, + interpolated); + + end: +/* releasing the Temporary MemoryDB */ + ret = sqlite3_close (mem_db); + if (ret != SQLITE_OK) + spatialite_e ("gaiaDrapeLineExceptions: sqlite3_close() error: %s\n", + sqlite3_errmsg (mem_db)); + spatialite_internal_cleanup (cache); + + return geom3; +} Index: src/gaiageo/gg_geometries.c ================================================================== --- src/gaiageo/gg_geometries.c +++ src/gaiageo/gg_geometries.c @@ -798,11 +798,12 @@ gaiaPolygonPtr new_polyg; gaiaRingPtr i_ring; gaiaRingPtr o_ring; if (!polyg) return NULL; - if (mode == GAIA_REVERSE_ORDER || mode == GAIA_LHR_ORDER) + if (mode == GAIA_REVERSE_ORDER || mode == GAIA_CW_ORDER + || mode == GAIA_CCW_ORDER) ; else return gaiaClonePolygon (polyg); i_ring = polyg->Exterior; @@ -819,14 +820,26 @@ if (mode == GAIA_REVERSE_ORDER) gaiaCopyRingCoordsReverse (o_ring, i_ring); else { gaiaClockwise (i_ring); - if (i_ring->Clockwise) - gaiaCopyRingCoords (o_ring, i_ring); + if (mode == GAIA_CCW_ORDER) + { + /* returning a Counter-Clockwise Polygon */ + if (i_ring->Clockwise) + gaiaCopyRingCoordsReverse (o_ring, i_ring); + else + gaiaCopyRingCoords (o_ring, i_ring); + } else - gaiaCopyRingCoordsReverse (o_ring, i_ring); + { + /* returning a Clockwise Polygon */ + if (i_ring->Clockwise) + gaiaCopyRingCoords (o_ring, i_ring); + else + gaiaCopyRingCoordsReverse (o_ring, i_ring); + } } for (ib = 0; ib < new_polyg->NumInteriors; ib++) { /* copying each INTERIOR RING [if any] */ i_ring = polyg->Interiors + ib; @@ -833,19 +846,93 @@ o_ring = gaiaAddInteriorRing (new_polyg, ib, i_ring->Points); if (mode == GAIA_REVERSE_ORDER) gaiaCopyRingCoordsReverse (o_ring, i_ring); else { - gaiaClockwise (i_ring); - if (i_ring->Clockwise) - gaiaCopyRingCoordsReverse (o_ring, i_ring); + if (mode == GAIA_CCW_ORDER) + { + /* returning a Counter-Clockwise Polygon */ + if (i_ring->Clockwise) + gaiaCopyRingCoords (o_ring, i_ring); + else + gaiaCopyRingCoordsReverse (o_ring, i_ring); + } else - gaiaCopyRingCoords (o_ring, i_ring); + { + /* returning a Clockwise Polygon */ + gaiaClockwise (i_ring); + if (i_ring->Clockwise) + gaiaCopyRingCoordsReverse (o_ring, i_ring); + else + gaiaCopyRingCoords (o_ring, i_ring); + } } } return new_polyg; } + +GAIAGEO_DECLARE int +gaiaCheckClockwise (gaiaGeomCollPtr geom) +{ +/* checking for a Clockwise Geometry */ + int retval = 1; + gaiaPolygonPtr polyg; + int ib; + gaiaRingPtr i_ring; + if (!geom) + return 1; + + polyg = geom->FirstPolygon; + while (polyg != NULL) + { + i_ring = polyg->Exterior; + gaiaClockwise (i_ring); + if (i_ring->Clockwise == 0) + retval = 0; + for (ib = 0; ib < polyg->NumInteriors; ib++) + { + /* checking each INTERIOR RING [if any] */ + i_ring = polyg->Interiors + ib; + gaiaClockwise (i_ring); + if (i_ring->Clockwise) + retval = 0; + } + polyg = polyg->Next; + } + return retval; +} + +GAIAGEO_DECLARE int +gaiaCheckCounterClockwise (gaiaGeomCollPtr geom) +{ +/* checking for a CounterClockwise Geometry */ + int retval = 1; + gaiaPolygonPtr polyg; + int ib; + gaiaRingPtr i_ring; + if (!geom) + return 1; + + polyg = geom->FirstPolygon; + while (polyg != NULL) + { + i_ring = polyg->Exterior; + gaiaClockwise (i_ring); + if (i_ring->Clockwise) + retval = 0; + for (ib = 0; ib < polyg->NumInteriors; ib++) + { + /* checking each INTERIOR RING [if any] */ + i_ring = polyg->Interiors + ib; + gaiaClockwise (i_ring); + if (i_ring->Clockwise == 0) + retval = 0; + } + polyg = polyg->Next; + } + return retval; +} GAIAGEO_DECLARE gaiaPolygonPtr gaiaAllocPolygon (int vert, int excl) { /* POLYGON object constructor */ @@ -1105,11 +1192,12 @@ gaiaGeomCollPtr new_geom; gaiaRingPtr i_ring; gaiaRingPtr o_ring; if (!geom) return NULL; - if (mode == GAIA_REVERSE_ORDER || mode == GAIA_LHR_ORDER) + if (mode == GAIA_REVERSE_ORDER || mode == GAIA_CW_ORDER + || mode == GAIA_CCW_ORDER) ; else return gaiaCloneGeomColl (geom); if (geom->DimensionModel == GAIA_XY_Z) @@ -1163,14 +1251,26 @@ if (mode == GAIA_REVERSE_ORDER) gaiaCopyRingCoordsReverse (o_ring, i_ring); else { gaiaClockwise (i_ring); - if (i_ring->Clockwise) - gaiaCopyRingCoords (o_ring, i_ring); + if (mode == GAIA_CCW_ORDER) + { + /* Counter-Clockwise Polygon */ + if (i_ring->Clockwise) + gaiaCopyRingCoordsReverse (o_ring, i_ring); + else + gaiaCopyRingCoords (o_ring, i_ring); + } else - gaiaCopyRingCoordsReverse (o_ring, i_ring); + { + /* Clockwise Polygon */ + if (i_ring->Clockwise) + gaiaCopyRingCoords (o_ring, i_ring); + else + gaiaCopyRingCoordsReverse (o_ring, i_ring); + } } for (ib = 0; ib < new_polyg->NumInteriors; ib++) { /* copying each INTERIOR RING [if any] */ i_ring = polyg->Interiors + ib; @@ -1178,14 +1278,26 @@ if (mode == GAIA_REVERSE_ORDER) gaiaCopyRingCoordsReverse (o_ring, i_ring); else { gaiaClockwise (i_ring); - if (i_ring->Clockwise) - gaiaCopyRingCoordsReverse (o_ring, i_ring); + if (mode == GAIA_CCW_ORDER) + { + /* Counter-Clockwise Polygon */ + if (i_ring->Clockwise) + gaiaCopyRingCoords (o_ring, i_ring); + else + gaiaCopyRingCoordsReverse (o_ring, i_ring); + } else - gaiaCopyRingCoords (o_ring, i_ring); + { + /* Clockwise Polygon */ + if (i_ring->Clockwise) + gaiaCopyRingCoordsReverse (o_ring, i_ring); + else + gaiaCopyRingCoords (o_ring, i_ring); + } } } polyg = polyg->Next; } return new_geom; @@ -4132,10 +4244,267 @@ else return 0; /* unknown encoding; neither little-endian nor big-endian */ *maxy = gaiaImport64 (blob + 30, little_endian, endian_arch); return 1; } + +GAIAGEO_DECLARE gaiaGeomCollPtr +gaiaAddMeasure (gaiaGeomCollPtr geom, double m_start, double m_end) +{ +/* linearly interpolates M-values between the start and end points. */ + double total_length; + double progressive_length; + gaiaGeomCollPtr geo2; + gaiaLinestringPtr pL; + gaiaLinestringPtr pL2; + int iv; + double x; + double y; + double z; + double m; + double x0; + double y0; + double mm; + double percent; + double interval = m_end - m_start; + + if (!geom) + return NULL; +/* only Linestring or MultiLinestrings are accepted */ + if (geom->FirstPoint != NULL) + return NULL; + if (geom->FirstPolygon != NULL) + return NULL; + if (geom->FirstLinestring == NULL) + return NULL; + +/* computing the total length */ + total_length = 0.0; + pL = geom->FirstLinestring; + while (pL != NULL) + { + for (iv = 0; iv < pL->Points; iv++) + { + z = 0.0; + m = 0.0; + if (pL->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (pL->Coords, iv, &x, &y, &z); + } + else if (pL->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (pL->Coords, iv, &x, &y, &m); + } + else if (pL->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (pL->Coords, iv, &x, &y, &z, &m); + } + else + { + gaiaGetPoint (pL->Coords, iv, &x, &y); + } + + if (iv != 0) + total_length += + sqrt (((x0 - x) * (x0 - x)) + ((y0 - y) * (y0 - y))); + x0 = x; + y0 = y; + } + pL = pL->Next; + } + +/* creating the output geometry */ + progressive_length = 0.0; + if (geom->DimensionModel == GAIA_XY_Z) + geo2 = gaiaAllocGeomCollXYZM (); + else if (geom->DimensionModel == GAIA_XY_M) + geo2 = gaiaAllocGeomCollXYM (); + else if (geom->DimensionModel == GAIA_XY_Z_M) + geo2 = gaiaAllocGeomCollXYZM (); + else + geo2 = gaiaAllocGeomCollXYM (); + geo2->Srid = geom->Srid; + pL = geom->FirstLinestring; + while (pL != NULL) + { + pL2 = gaiaAddLinestringToGeomColl (geo2, pL->Points); + for (iv = 0; iv < pL->Points; iv++) + { + z = 0.0; + m = 0.0; + if (pL->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (pL->Coords, iv, &x, &y, &z); + } + else if (pL->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (pL->Coords, iv, &x, &y, &m); + } + else if (pL->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (pL->Coords, iv, &x, &y, &z, &m); + } + else + { + gaiaGetPoint (pL->Coords, iv, &x, &y); + } + + if (iv != 0) + progressive_length += + sqrt (((x0 - x) * (x0 - x)) + ((y0 - y) * (y0 - y))); + x0 = x; + y0 = y; + + /* linealy interpolating M-values */ + percent = progressive_length / total_length; + mm = m_start + (interval * percent); + if (pL2->DimensionModel == GAIA_XY_M) + { + gaiaSetPointXYM (pL2->Coords, iv, x, y, mm); + } + else + { + gaiaSetPointXYZM (pL2->Coords, iv, x, y, z, mm); + } + } + pL = pL->Next; + } + + return geo2; +} + +GAIAGEO_DECLARE int +gaiaInterpolatePoint (const void *p_cache, gaiaGeomCollPtr line, + gaiaGeomCollPtr point, double *m_value) +{ +/* Will interpolate the M-value for a LinestringM at the point closest to the given Point */ + gaiaLinestringPtr pL; + int iv; + double x; + double y; + double m; + double z; + double fraction; + double x0; + double y0; + double m0; + double progressive_length; + double pl0; + + if (!line) + return 0; + if (!point) + return 0; +/* only a Linestring M is accepted as the first geom */ + if (line->FirstPoint != NULL) + return 0; + if (line->FirstPolygon != NULL) + return 0; + if (line->FirstLinestring == NULL) + return 0; + if (line->FirstLinestring != line->LastLinestring) + return 0; + if (line->DimensionModel == GAIA_XY_M + || line->DimensionModel == GAIA_XY_Z_M) + ; + else + return 0; +/* only a Point is accepted as the second geom */ + if (point->FirstPolygon != NULL) + return 0; + if (point->FirstLinestring != NULL) + return 0; + if (point->FirstPoint == NULL) + return 0; + if (point->FirstPoint != point->LastPoint) + return 0; + +#ifndef OMIT_GEOS /* only if GEOS is supported */ + +/* locating the Point along the Line */ + if (p_cache != NULL) + fraction = gaiaLineLocatePoint_r (p_cache, line, point); + else + fraction = gaiaLineLocatePoint (line, point); + + pL = line->FirstLinestring; + if (fraction <= 0.0) + { + /* special case: assuming the start point */ + z = 0.0; + if (pL->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (pL->Coords, 0, &x, &y, &m); + } + else + { + gaiaGetPointXYZM (pL->Coords, 0, &x, &y, &z, &m); + } + *m_value = m; + return 1; + } + if (fraction >= 1.0) + { + /* special case: assuming the end point */ + z = 0.0; + iv = pL->Points - 1; + if (pL->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (pL->Coords, iv, &x, &y, &m); + } + else + { + gaiaGetPointXYZM (pL->Coords, iv, &x, &y, &z, &m); + } + *m_value = m; + return 1; + } + +/* computing the progressive length */ + progressive_length = 0.0; + for (iv = 0; iv < pL->Points; iv++) + { + z = 0.0; + if (pL->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (pL->Coords, iv, &x, &y, &m); + } + else + { + gaiaGetPointXYZM (pL->Coords, iv, &x, &y, &z, &m); + } + + if (iv != 0) + { + progressive_length += + sqrt (((x0 - x) * (x0 - x)) + ((y0 - y) * (y0 - y))); + if (progressive_length == fraction) + { + /* special case: exactly intercepting a vertex */ + *m_value = m; + return 1; + } + if (progressive_length > fraction) + { + /* interpolating the M-Value */ + double interval = m - m0; + double diff = fraction - pl0; + *m_value = m0 + (interval * diff); + break; + } + } + x0 = x; + y0 = y; + m0 = m; + pl0 = progressive_length; + } + return 1; + +#else + return 0; +#endif /* end GEOS conditional */ +} GAIAGEO_DECLARE gaiaGeomCollPtr gaiaLocateBetweenMeasures (gaiaGeomCollPtr geom, double m_start, double m_end) { /* extracts points/linestrings accordingly to a range of measures */ Index: src/gaiageo/gg_relations.c ================================================================== --- src/gaiageo/gg_relations.c +++ src/gaiageo/gg_relations.c @@ -376,34 +376,212 @@ a valid signature */ if (memcmp (blob, p->gaiaBlob, 46) == 0) return 1; return 0; } + +static int +sniffTinyPointBlob (const unsigned char *blob, const int size) +{ +/* sniffing for a possible TinyPoint BLOB */ + if (size == 24 || size == 32 || size == 40) + ; + else + return 0; + if (*(blob + 0) != GAIA_MARK_START) + return 0; + if (*(blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN + || *(blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + ; + else + return 0; + if (*(blob + (size - 1)) != GAIA_MARK_END) + return 0; + return 1; +} + +static void +tinyPoint2Geom (const unsigned char *tiny, unsigned char **geom, int *geom_sz) +{ +/* quickly converting from BLOB-TinyPoint to BLOB-Geometry */ + int little_endian; + int endian_arch = gaiaEndianArch (); + int srid; + int type; + double x; + double y; + double z; + double m; + unsigned char *blob; + int blob_sz; + +/* parsing the BLOB-TinyPoint */ + if (*(tiny + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN) + little_endian = 1; + else + little_endian = 0; + srid = gaiaImport32 (tiny + 2, little_endian, endian_arch); + if (*(tiny + 6) == GAIA_TINYPOINT_XYZ) + type = GAIA_POINTZ; + else if (*(tiny + 6) == GAIA_TINYPOINT_XYM) + type = GAIA_POINTM; + else if (*(tiny + 6) == GAIA_TINYPOINT_XYZM) + type = GAIA_POINTZM; + else + type = GAIA_POINT; + x = gaiaImport64 (tiny + 7, little_endian, endian_arch); + y = gaiaImport64 (tiny + 15, little_endian, endian_arch); + if (type == GAIA_POINTZ) + z = gaiaImport64 (tiny + 23, little_endian, endian_arch); + if (type == GAIA_POINTM) + m = gaiaImport64 (tiny + 23, little_endian, endian_arch); + if (type == GAIA_POINTZM) + { + z = gaiaImport64 (tiny + 23, little_endian, endian_arch); + m = gaiaImport64 (tiny + 31, little_endian, endian_arch); + } + +/* allocating and initializing the BLOB-Geometry */ + switch (type) + { + case GAIA_POINT: + blob_sz = 60; + break; + case GAIA_POINTZ: + case GAIA_POINTM: + blob_sz = 68; + break; + case GAIA_POINTZM: + blob_sz = 76; + break; + }; + blob = malloc (blob_sz); + + *geom = blob; + *geom_sz = blob_sz; + switch (type) + { + case GAIA_POINT: + *blob = GAIA_MARK_START; /* START signature */ + *(blob + 1) = GAIA_LITTLE_ENDIAN; /* byte ordering */ + gaiaExport32 (blob + 2, srid, 1, endian_arch); /* the SRID */ + gaiaExport64 (blob + 6, x, 1, endian_arch); /* MBR - minimum X */ + gaiaExport64 (blob + 14, y, 1, endian_arch); /* MBR - minimum Y */ + gaiaExport64 (blob + 22, x, 1, endian_arch); /* MBR - maximum X */ + gaiaExport64 (blob + 30, y, 1, endian_arch); /* MBR - maximum Y */ + *(blob + 38) = GAIA_MARK_MBR; /* MBR signature */ + gaiaExport32 (blob + 39, GAIA_POINT, 1, endian_arch); /* class POINT */ + gaiaExport64 (blob + 43, x, 1, endian_arch); /* X */ + gaiaExport64 (blob + 51, y, 1, endian_arch); /* Y */ + *(blob + 59) = GAIA_MARK_END; /* END signature */ + break; + case GAIA_POINTZ: + *blob = GAIA_MARK_START; /* START signature */ + *(blob + 1) = GAIA_LITTLE_ENDIAN; /* byte ordering */ + gaiaExport32 (blob + 2, srid, 1, endian_arch); /* the SRID */ + gaiaExport64 (blob + 6, x, 1, endian_arch); /* MBR - minimum X */ + gaiaExport64 (blob + 14, y, 1, endian_arch); /* MBR - minimum Y */ + gaiaExport64 (blob + 22, x, 1, endian_arch); /* MBR - maximum X */ + gaiaExport64 (blob + 30, y, 1, endian_arch); /* MBR - maximum Y */ + *(blob + 38) = GAIA_MARK_MBR; /* MBR signature */ + gaiaExport32 (blob + 39, GAIA_POINTZ, 1, endian_arch); /* class POINT XYZ */ + gaiaExport64 (blob + 43, x, 1, endian_arch); /* X */ + gaiaExport64 (blob + 51, y, 1, endian_arch); /* Y */ + gaiaExport64 (blob + 59, z, 1, endian_arch); /* Z */ + *(blob + 67) = GAIA_MARK_END; /* END signature */ + break; + case GAIA_POINTM: + *blob = GAIA_MARK_START; /* START signature */ + *(blob + 1) = GAIA_LITTLE_ENDIAN; /* byte ordering */ + gaiaExport32 (blob + 2, srid, 1, endian_arch); /* the SRID */ + gaiaExport64 (blob + 6, x, 1, endian_arch); /* MBR - minimum X */ + gaiaExport64 (blob + 14, y, 1, endian_arch); /* MBR - minimum Y */ + gaiaExport64 (blob + 22, x, 1, endian_arch); /* MBR - maximum X */ + gaiaExport64 (blob + 30, y, 1, endian_arch); /* MBR - maximum Y */ + *(blob + 38) = GAIA_MARK_MBR; /* MBR signature */ + gaiaExport32 (blob + 39, GAIA_POINTM, 1, endian_arch); /* class POINT XYM */ + gaiaExport64 (blob + 43, x, 1, endian_arch); /* X */ + gaiaExport64 (blob + 51, y, 1, endian_arch); /* Y */ + gaiaExport64 (blob + 59, m, 1, endian_arch); /* M */ + *(blob + 67) = GAIA_MARK_END; /* END signature */ + break; + case GAIA_POINTZM: + *blob = GAIA_MARK_START; /* START signature */ + *(blob + 1) = GAIA_LITTLE_ENDIAN; /* byte ordering */ + gaiaExport32 (blob + 2, srid, 1, endian_arch); /* the SRID */ + gaiaExport64 (blob + 6, x, 1, endian_arch); /* MBR - minimum X */ + gaiaExport64 (blob + 14, y, 1, endian_arch); /* MBR - minimum Y */ + gaiaExport64 (blob + 22, x, 1, endian_arch); /* MBR - maximum X */ + gaiaExport64 (blob + 30, y, 1, endian_arch); /* MBR - maximum Y */ + *(blob + 38) = GAIA_MARK_MBR; /* MBR signature */ + gaiaExport32 (blob + 39, GAIA_POINTZM, 1, endian_arch); /* class POINT XYZM */ + gaiaExport64 (blob + 43, x, 1, endian_arch); /* X */ + gaiaExport64 (blob + 51, y, 1, endian_arch); /* Y */ + gaiaExport64 (blob + 59, z, 1, endian_arch); /* M */ + gaiaExport64 (blob + 67, m, 1, endian_arch); /* Z */ + *(blob + 75) = GAIA_MARK_END; /* END signature */ + break; + }; +} static int evalGeosCache (struct splite_internal_cache *cache, gaiaGeomCollPtr geom1, - unsigned char *blob1, int size1, gaiaGeomCollPtr geom2, - unsigned char *blob2, int size2, GEOSPreparedGeometry ** gPrep, + const unsigned char *blob1, const int size1, + gaiaGeomCollPtr geom2, const unsigned char *blob2, + const int size2, GEOSPreparedGeometry ** gPrep, gaiaGeomCollPtr * geom) { /* handling the internal GEOS cache */ struct splite_geos_cache_item *p1 = &(cache->cacheItem1); struct splite_geos_cache_item *p2 = &(cache->cacheItem2); - uLong crc1 = crc32 (0L, blob1, size1); - uLong crc2 = crc32 (0L, blob2, size2); - GEOSContextHandle_t handle = NULL; - if (cache == NULL) - return 0; - if (cache->magic1 != SPATIALITE_CACHE_MAGIC1 - || cache->magic2 != SPATIALITE_CACHE_MAGIC2) - return 0; - handle = cache->GEOS_handle; - if (handle == NULL) - return 0; + uLong crc1; + uLong crc2; + unsigned char *tiny1 = NULL; + unsigned char *tiny2 = NULL; + unsigned char *p_blob1; + unsigned char *p_blob2; + int sz1; + int sz2; + int tiny_sz; + int retcode; + GEOSContextHandle_t handle = NULL; + if (cache == NULL) + return 0; + if (cache->magic1 != SPATIALITE_CACHE_MAGIC1 + || cache->magic2 != SPATIALITE_CACHE_MAGIC2) + return 0; + handle = cache->GEOS_handle; + if (handle == NULL) + return 0; + + if (sniffTinyPointBlob (blob1, size1)) + { + tinyPoint2Geom (blob1, &tiny1, &tiny_sz); + p_blob1 = tiny1; + sz1 = tiny_sz; + } + else + { + p_blob1 = (unsigned char *) blob1; + sz1 = size1; + } + if (sniffTinyPointBlob (blob2, size2)) + { + tinyPoint2Geom (blob2, &tiny2, &tiny_sz); + p_blob2 = tiny2; + sz2 = tiny_sz; + } + else + { + p_blob2 = (unsigned char *) blob2; + sz2 = size2; + } + crc1 = crc32 (0L, p_blob1, sz1); + crc2 = crc32 (0L, p_blob2, sz2); /* checking the first cache item */ - if (evalGeosCacheItem (blob1, size1, crc1, p1)) + if (evalGeosCacheItem (p_blob1, sz1, crc1, p1)) { /* found a matching item */ if (p1->preparedGeosGeom == NULL) { /* preparing the GeosGeometries */ @@ -423,17 +601,19 @@ if (p1->preparedGeosGeom) { /* returning the corresponding GeosPreparedGeometry */ *gPrep = p1->preparedGeosGeom; *geom = geom2; - return 1; + retcode = 1; + goto end; } - return 0; + retcode = 0; + goto end; } /* checking the second cache item */ - if (evalGeosCacheItem (blob2, size2, crc2, p2)) + if (evalGeosCacheItem (p_blob2, sz2, crc2, p2)) { /* found a matching item */ if (p2->preparedGeosGeom == NULL) { /* preparing the GeosGeometries */ @@ -453,38 +633,46 @@ if (p2->preparedGeosGeom) { /* returning the corresponding GeosPreparedGeometry */ *gPrep = p2->preparedGeosGeom; *geom = geom1; - return 1; + retcode = 1; + goto end; } - return 0; + retcode = 0; + goto end; } /* updating the GEOS cache item#1 */ - memcpy (p1->gaiaBlob, blob1, 46); - p1->gaiaBlobSize = size1; + memcpy (p1->gaiaBlob, p_blob1, 46); + p1->gaiaBlobSize = sz1; p1->crc32 = crc1; if (p1->preparedGeosGeom) GEOSPreparedGeom_destroy_r (handle, p1->preparedGeosGeom); if (p1->geosGeom) GEOSGeom_destroy_r (handle, p1->geosGeom); p1->geosGeom = NULL; p1->preparedGeosGeom = NULL; /* updating the GEOS cache item#2 */ - memcpy (p2->gaiaBlob, blob2, 46); - p2->gaiaBlobSize = size2; + memcpy (p2->gaiaBlob, p_blob2, 46); + p2->gaiaBlobSize = sz2; p2->crc32 = crc2; if (p2->preparedGeosGeom) GEOSPreparedGeom_destroy_r (handle, p2->preparedGeosGeom); if (p2->geosGeom) GEOSGeom_destroy_r (handle, p2->geosGeom); p2->geosGeom = NULL; p2->preparedGeosGeom = NULL; + retcode = 0; - return 0; + end: + if (tiny1 != NULL) + free (tiny1); + if (tiny2 != NULL) + free (tiny2); + return retcode; } GAIAGEO_DECLARE int gaiaGeomCollEquals (gaiaGeomCollPtr geom1, gaiaGeomCollPtr geom2) { @@ -1488,11 +1676,11 @@ matrix = malloc (len + 1); strcpy (matrix, retMatrix); GEOSFree (retMatrix); return matrix; #else - if (geom1 == NULL || geom2 == NULL || pattern == NULL) + if (geom1 == NULL || geom2 == NULL || mode == 0) geom1 = NULL; /* silencing stupid compiler warnings */ #endif return NULL; } @@ -1554,13 +1742,13 @@ } GAIAGEO_DECLARE int gaiaIntersectionMatrixPatternMatch (const char *matrix, const char *pattern) { -/* evalutes is an intersection matrix [DE-9IM] matches a matrix pattern */ +/* evalutes if an intersection matrix [DE-9IM] matches a matrix pattern */ +#ifndef GEOS_USE_ONLY_R_API /* obsolete versions non fully thread-safe */ int ret; -#ifndef GEOS_USE_ONLY_R_API /* obsolete versions non fully thread-safe */ gaiaResetGeosMsg (); if (matrix == NULL || pattern == NULL) return -1; ret = GEOSRelatePatternMatch (matrix, pattern); if (ret == 0 || ret == 1) @@ -3057,11 +3245,11 @@ if (d == NULL) return NULL; detail = gaiaFromGeos_XY (d); GEOSGeom_destroy (d); #else - if (geom == NULL) + if (geom == NULL && esri_flag == 0) geom = NULL; /* silencing stupid compiler warnings */ #endif return detail; } Index: src/gaiageo/gg_rttopo.c ================================================================== --- src/gaiageo/gg_rttopo.c +++ src/gaiageo/gg_rttopo.c @@ -2611,7 +2611,114 @@ result->Srid = geom->Srid; done: return result; } + +GAIAGEO_DECLARE int +gaiaToTWKB (const void *p_cache, gaiaGeomCollPtr geom, + unsigned char precision_xy, unsigned char precision_z, + unsigned char precision_m, int with_size, int with_bbox, + unsigned char **twkb, int *size_twkb) +{ +/* wrapping RTGEOM rtgeom_to_twkb */ + const RTCTX *ctx = NULL; + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + unsigned char variant = 0; + RTGEOM *g; + unsigned char *p_twkb; + size_t twkb_size; + + *twkb = NULL; + *size_twkb = 0; + + if (!geom) + return 0; + if (cache == NULL) + return 0; + if (cache->magic1 != SPATIALITE_CACHE_MAGIC1 + || cache->magic2 != SPATIALITE_CACHE_MAGIC2) + return 0; + ctx = cache->RTTOPO_handle; + if (ctx == NULL) + return 0; + + if (with_size) + variant |= TWKB_SIZE; + if (with_bbox) + variant |= TWKB_BBOX; + + g = toRTGeom (ctx, geom); + p_twkb = + rtgeom_to_twkb (ctx, g, variant, precision_xy, precision_z, precision_m, + &twkb_size); + rtgeom_free (ctx, g); + + if (p_twkb == NULL) + return 0; + *twkb = p_twkb; + *size_twkb = twkb_size; + return 1; +} + +GAIAGEO_DECLARE gaiaGeomCollPtr +gaiaFromTWKB (const void *p_cache, const unsigned char *twkb, int twkb_size, + int srid) +{ +/* wrapping RTGEOM rtgeom_from_twkb */ + const RTCTX *ctx = NULL; + int dims = GAIA_XY_Z_M; + int type = GAIA_GEOMETRYCOLLECTION; + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + RTGEOM *g; + gaiaGeomCollPtr result; + + if (twkb == NULL) + return NULL; + if (cache == NULL) + return NULL; + if (cache->magic1 != SPATIALITE_CACHE_MAGIC1 + || cache->magic2 != SPATIALITE_CACHE_MAGIC2) + return NULL; + ctx = cache->RTTOPO_handle; + if (ctx == NULL) + return NULL; + + g = rtgeom_from_twkb (ctx, (unsigned char *) twkb, twkb_size, 0); + if (g == NULL) + return NULL; + if ((*(twkb + 0) & 0x01) == 0x01) + type = GAIA_POINT; + if ((*(twkb + 0) & 0x02) == 0x02) + type = GAIA_LINESTRING; + if ((*(twkb + 0) & 0x03) == 0x03) + type = GAIA_POLYGON; + if ((*(twkb + 0) & 0x04) == 0x04) + type = GAIA_MULTIPOINT; + if ((*(twkb + 0) & 0x05) == 0x05) + type = GAIA_MULTILINESTRING; + if ((*(twkb + 0) & 0x06) == 0x06) + type = GAIA_MULTIPOLYGON; + if ((*(twkb + 0) & 0x07) == 0x07) + type = GAIA_GEOMETRYCOLLECTION; + if ((*(twkb + 1) & 0x08) == 0x08) + { + if ((*(twkb + 2) & 0x01) == 0x01) + dims = GAIA_XY_Z; + if ((*(twkb + 2) & 0x02) == 0x02) + dims = GAIA_XY_M; + if ((*(twkb + 2) & 0x03) == 0x03) + dims = GAIA_XY_Z_M; + } + else + dims = GAIA_XY; + result = fromRTGeom (ctx, g, dims, type); + spatialite_init_geos (); + rtgeom_free (ctx, g); + if (result != NULL) + result->Srid = srid; + return result; +} #endif /* end enabling RTTOPO support */ Index: src/gaiageo/gg_shape.c ================================================================== --- src/gaiageo/gg_shape.c +++ src/gaiageo/gg_shape.c @@ -525,10 +525,14 @@ || shape == GAIA_SHP_POLYGONM || shape == GAIA_SHP_MULTIPOINT || shape == GAIA_SHP_MULTIPOINTZ || shape == GAIA_SHP_MULTIPOINTM) ; else goto unsupported; + shp->MinX = gaiaImport64 (buf_shp + 36, GAIA_LITTLE_ENDIAN, endian_arch); + shp->MinY = gaiaImport64 (buf_shp + 44, GAIA_LITTLE_ENDIAN, endian_arch); + shp->MaxX = gaiaImport64 (buf_shp + 52, GAIA_LITTLE_ENDIAN, endian_arch); + shp->MaxY = gaiaImport64 (buf_shp + 60, GAIA_LITTLE_ENDIAN, endian_arch); /* reading DBF file header */ rd = fread (bf, sizeof (unsigned char), 32, fl_dbf); if (rd != 32) goto error; switch (*bf) @@ -1663,11 +1667,11 @@ /* trying to read an entity from shapefile */ unsigned char buf[512]; int len; int rd; int skpos; - int offset; + gaia_off_t offset; int off_shp; int sz; int shape; double x; double y; @@ -1694,39 +1698,43 @@ struct shp_ring_collection ringsColl; /* initializing the RING collection */ ringsColl.First = NULL; ringsColl.Last = NULL; /* positioning and reading the SHX file */ - offset = 100 + (current_row * 8); /* 100 bytes for the header + current row displacement; each SHX row = 8 bytes */ - skpos = fseek (shp->flShx, offset, SEEK_SET); + offset = 100 + ((gaia_off_t) current_row * (gaia_off_t) 8); /* 100 bytes for the header + current row displacement; each SHX row = 8 bytes */ + skpos = gaia_fseek (shp->flShx, offset, SEEK_SET); if (skpos != 0) goto eof; rd = fread (buf, sizeof (unsigned char), 8, shp->flShx); if (rd != 8) goto eof; off_shp = gaiaImport32 (buf, GAIA_BIG_ENDIAN, shp->endian_arch); /* positioning and reading the DBF file */ - offset = shp->DbfHdsz + (current_row * shp->DbfReclen); - skpos = fseek (shp->flDbf, offset, SEEK_SET); + offset = + shp->DbfHdsz + + ((gaia_off_t) current_row * (gaia_off_t) (shp->DbfReclen)); + skpos = gaia_fseek (shp->flDbf, offset, SEEK_SET); if (skpos != 0) goto error; rd = fread (shp->BufDbf, sizeof (unsigned char), shp->DbfReclen, shp->flDbf); if (rd != shp->DbfReclen) goto error; if (*(shp->BufDbf) == '*') goto dbf_deleted; /* positioning and reading corresponding SHP entity - geometry */ - offset = off_shp * 2; - skpos = fseek (shp->flShp, offset, SEEK_SET); + offset = (gaia_off_t) off_shp *2; + skpos = gaia_fseek (shp->flShp, offset, SEEK_SET); if (skpos != 0) goto error; rd = fread (buf, sizeof (unsigned char), 12, shp->flShp); if (rd != 12) goto error; + int rno = gaiaImport32 (buf, GAIA_BIG_ENDIAN, shp->endian_arch); sz = gaiaImport32 (buf + 4, GAIA_BIG_ENDIAN, shp->endian_arch); shape = gaiaImport32 (buf + 8, GAIA_LITTLE_ENDIAN, shp->endian_arch); + fprintf (stderr, "\t%d\t%d\t%d\n", rno, sz, shape); if (shape == GAIA_SHP_NULL) { /* handling a NULL shape */ goto null_shape; } @@ -1849,20 +1857,45 @@ geom->Srid = srid; } if (shape == GAIA_SHP_POLYLINE) { /* shape polyline */ + int extra_check = 0; rd = fread (shp->BufShp, sizeof (unsigned char), 32, shp->flShp); if (rd != 32) goto error; rd = fread (shp->BufShp, sizeof (unsigned char), (sz * 2) - 36, shp->flShp); if (rd != (sz * 2) - 36) - goto error; + { + if (rd == (sz * 2) - 44) + { + /* sandro 2018-02-17 + * it could be some defective SHP badly computing the + * expected record length. + * some unknown software producing defective shapefiles + * of the 2D PolyLine type has been positively identified; + * all record lengths were constantly declaring 4 extra words, + * possibly because the Record Number and the Content Length + * fields were wrongly included into the record length + * calculation. + */ + extra_check = 1; + } + else + goto error; + } n = gaiaImport32 (shp->BufShp, GAIA_LITTLE_ENDIAN, shp->endian_arch); n1 = gaiaImport32 (shp->BufShp + 4, GAIA_LITTLE_ENDIAN, shp->endian_arch); + if (extra_check) + { + /* checking the expected buffer size */ + int expected = 8 + (n * 4) + (n1 * 16); + if (rd != expected) + goto error; + } base = 8 + (n * 4); start = 0; for (ind = 0; ind < n; ind++) { if (ind < (n - 1)) @@ -4393,11 +4426,11 @@ double miny = shp->MinY; double maxx = shp->MaxX; double maxy = shp->MaxY; unsigned char *buf_shp = shp->BufShp; /* writing the SHP file header */ - fseek (fl_shp, 0, SEEK_SET); /* repositioning at SHP file start */ + gaia_fseek (fl_shp, 0, SEEK_SET); /* repositioning at SHP file start */ gaiaExport32 (buf_shp, 9994, GAIA_BIG_ENDIAN, endian_arch); /* SHP magic number */ gaiaExport32 (buf_shp + 4, 0, GAIA_BIG_ENDIAN, endian_arch); gaiaExport32 (buf_shp + 8, 0, GAIA_BIG_ENDIAN, endian_arch); gaiaExport32 (buf_shp + 12, 0, GAIA_BIG_ENDIAN, endian_arch); gaiaExport32 (buf_shp + 16, 0, GAIA_BIG_ENDIAN, endian_arch); @@ -4413,11 +4446,11 @@ gaiaExport64 (buf_shp + 76, 0.0, GAIA_LITTLE_ENDIAN, endian_arch); gaiaExport64 (buf_shp + 84, 0.0, GAIA_LITTLE_ENDIAN, endian_arch); gaiaExport64 (buf_shp + 92, 0.0, GAIA_LITTLE_ENDIAN, endian_arch); fwrite (buf_shp, 1, 100, fl_shp); /* writing the SHX file header */ - fseek (fl_shx, 0, SEEK_SET); /* repositioning at SHX file start */ + gaia_fseek (fl_shx, 0, SEEK_SET); /* repositioning at SHX file start */ gaiaExport32 (buf_shp, 9994, GAIA_BIG_ENDIAN, endian_arch); /* SHP magic number */ gaiaExport32 (buf_shp + 4, 0, GAIA_BIG_ENDIAN, endian_arch); gaiaExport32 (buf_shp + 8, 0, GAIA_BIG_ENDIAN, endian_arch); gaiaExport32 (buf_shp + 12, 0, GAIA_BIG_ENDIAN, endian_arch); gaiaExport32 (buf_shp + 16, 0, GAIA_BIG_ENDIAN, endian_arch); @@ -4435,11 +4468,11 @@ gaiaExport64 (buf_shp + 92, 0.0, GAIA_LITTLE_ENDIAN, endian_arch); fwrite (buf_shp, 1, 100, fl_shx); /* writing the DBF file header */ *buf_shp = 0x1a; /* DBF - this is theEOF marker */ fwrite (buf_shp, 1, 1, fl_dbf); - fseek (fl_dbf, 0, SEEK_SET); /* repositioning at DBF file start */ + gaia_fseek (fl_dbf, 0, SEEK_SET); /* repositioning at DBF file start */ memset (buf_shp, '\0', 32); *buf_shp = 0x03; /* DBF magic number */ *(buf_shp + 1) = 1; /* this is supposed to be the last update date [Year, Month, Day], but we ignore it at all */ *(buf_shp + 2) = 1; *(buf_shp + 3) = 1; @@ -4456,11 +4489,11 @@ / the same check is needed in order to detect if there are POLYGONS or MULTIPOLYGONS */ unsigned char buf[512]; int rd; int skpos; - int offset; + gaia_off_t offset; int off_shp; int sz; int shape; int points; int n; @@ -4480,21 +4513,21 @@ gaiaRingPtr ring = NULL; while (1) { /* positioning and reading the SHX file */ - offset = 100 + (current_row * 8); /* 100 bytes for the header + current row displacement; each SHX row = 8 bytes */ - skpos = fseek (shp->flShx, offset, SEEK_SET); + offset = 100 + ((gaia_off_t) current_row * (gaia_off_t) 8); /* 100 bytes for the header + current row displacement; each SHX row = 8 bytes */ + skpos = gaia_fseek (shp->flShx, offset, SEEK_SET); if (skpos != 0) goto exit; rd = fread (buf, sizeof (unsigned char), 8, shp->flShx); if (rd != 8) goto exit; off_shp = gaiaImport32 (buf, GAIA_BIG_ENDIAN, shp->endian_arch); /* positioning and reading corresponding SHP entity - geometry */ - offset = off_shp * 2; - skpos = fseek (shp->flShp, offset, SEEK_SET); + offset = (gaia_off_t) off_shp *2; + skpos = gaia_fseek (shp->flShp, offset, SEEK_SET); if (skpos != 0) goto exit; rd = fread (buf, sizeof (unsigned char), 12, shp->flShp); if (rd != 12) goto exit; @@ -5198,11 +5231,11 @@ int endian_arch = dbf->endian_arch; unsigned char bf[64]; /* writing the DBF file header */ *bf = 0x1a; /* DBF - this is theEOF marker */ fwrite (bf, 1, 1, fl_dbf); - fseek (fl_dbf, 0, SEEK_SET); /* repositioning at DBF file start */ + gaia_fseek (fl_dbf, 0, SEEK_SET); /* repositioning at DBF file start */ memset (bf, '\0', 32); *bf = 0x03; /* DBF magic number */ *(bf + 1) = 1; /* this is supposed to be the last update date [Year, Month, Day], but we ignore it at all */ *(bf + 2) = 1; *(bf + 3) = 1; @@ -5223,17 +5256,19 @@ int text_dates) { /* trying to read an entity from DBF */ int rd; int skpos; - int offset; + gaia_off_t offset; int len; char errMsg[1024]; gaiaDbfFieldPtr pFld; /* positioning and reading the DBF file */ - offset = dbf->DbfHdsz + (current_row * dbf->DbfReclen); - skpos = fseek (dbf->flDbf, offset, SEEK_SET); + offset = + dbf->DbfHdsz + + ((gaia_off_t) current_row * (gaia_off_t) (dbf->DbfReclen)); + skpos = gaia_fseek (dbf->flDbf, offset, SEEK_SET); if (skpos != 0) goto eof; rd = fread (dbf->BufDbf, sizeof (unsigned char), dbf->DbfReclen, dbf->flDbf); if (rd != dbf->DbfReclen) Index: src/gaiageo/gg_transform.c ================================================================== --- src/gaiageo/gg_transform.c +++ src/gaiageo/gg_transform.c @@ -1626,19 +1626,20 @@ return degs * DEG_TO_RAD; } static gaiaGeomCollPtr gaiaTransformCommon (projCtx handle, gaiaGeomCollPtr org, char *proj_from, - char *proj_to) + char *proj_to, int ignore_zm) { /* creates a new GEOMETRY reprojecting coordinates from the original one */ int ib; int cnt; int i; double *xx; double *yy; double *zz; + double *old_zz = NULL; double *mm = NULL; double x; double y; double z = 0.0; double m = 0.0; @@ -1699,10 +1700,14 @@ { /* reprojecting POINTs */ xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); + if (ignore_zm + && (org->DimensionModel == GAIA_XY_Z + || org->DimensionModel == GAIA_XY_Z_M)) + old_zz = malloc (sizeof (double) * cnt); if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); i = 0; pt = org->FirstPoint; @@ -1722,10 +1727,17 @@ if (org->DimensionModel == GAIA_XY_Z || org->DimensionModel == GAIA_XY_Z_M) zz[i] = pt->Z; else zz[i] = 0.0; + if (ignore_zm + && (org->DimensionModel == GAIA_XY_Z + || org->DimensionModel == GAIA_XY_Z_M)) + { + zz[i] = 0.0; + old_zz[i] = pt->Z; + } if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) mm[i] = pt->M; i++; pt = pt->Next; @@ -1749,10 +1761,14 @@ if (org->DimensionModel == GAIA_XY_Z || org->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; + if (ignore_zm + && (org->DimensionModel == GAIA_XY_Z + || org->DimensionModel == GAIA_XY_Z_M)) + z = old_zz[i]; if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; @@ -1769,10 +1785,12 @@ else error = 1; free (xx); free (yy); free (zz); + if (old_zz != NULL) + free (old_zz); if (org->DimensionModel == GAIA_XY_M || org->DimensionModel == GAIA_XY_Z_M) free (mm); } if (error) @@ -1783,10 +1801,14 @@ /* reprojecting LINESTRINGs */ cnt = ln->Points; xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); + if (ignore_zm + && (ln->DimensionModel == GAIA_XY_Z + || ln->DimensionModel == GAIA_XY_Z_M)) + old_zz = malloc (sizeof (double) * cnt); if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); for (i = 0; i < cnt; i++) { @@ -1820,10 +1842,17 @@ if (ln->DimensionModel == GAIA_XY_Z || ln->DimensionModel == GAIA_XY_Z_M) zz[i] = z; else zz[i] = 0.0; + if (ignore_zm + && (ln->DimensionModel == GAIA_XY_Z + || ln->DimensionModel == GAIA_XY_Z_M)) + { + zz[i] = 0.0; + old_zz[i] = z; + } if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) mm[i] = m; } /* applying reprojection */ @@ -1847,10 +1876,14 @@ if (ln->DimensionModel == GAIA_XY_Z || ln->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; + if (ignore_zm + && (ln->DimensionModel == GAIA_XY_Z + || ln->DimensionModel == GAIA_XY_Z_M)) + z = old_zz[i]; if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; @@ -1875,10 +1908,12 @@ else error = 1; free (xx); free (yy); free (zz); + if (old_zz != NULL) + free (old_zz); if (ln->DimensionModel == GAIA_XY_M || ln->DimensionModel == GAIA_XY_Z_M) free (mm); if (error) goto stop; @@ -1892,10 +1927,14 @@ cnt = rng->Points; dst_pg = gaiaAddPolygonToGeomColl (dst, cnt, pg->NumInteriors); xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); + if (ignore_zm + && (org->DimensionModel == GAIA_XY_Z + || org->DimensionModel == GAIA_XY_Z_M)) + old_zz = malloc (sizeof (double) * cnt); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); for (i = 0; i < cnt; i++) { @@ -1929,10 +1968,17 @@ if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) zz[i] = z; else zz[i] = 0.0; + if (ignore_zm + && (rng->DimensionModel == GAIA_XY_Z + || rng->DimensionModel == GAIA_XY_Z_M)) + { + zz[i] = 0.0; + old_zz[i] = z; + } if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm[i] = m; } /* applying reprojection */ @@ -1956,10 +2002,14 @@ if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; + if (ignore_zm + && (rng->DimensionModel == GAIA_XY_Z + || rng->DimensionModel == GAIA_XY_Z_M)) + z = old_zz[i]; if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; @@ -1984,10 +2034,12 @@ else error = 1; free (xx); free (yy); free (zz); + if (old_zz != NULL) + free (old_zz); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) free (mm); if (error) goto stop; @@ -1997,10 +2049,14 @@ rng = pg->Interiors + ib; cnt = rng->Points; xx = malloc (sizeof (double) * cnt); yy = malloc (sizeof (double) * cnt); zz = malloc (sizeof (double) * cnt); + if (ignore_zm + && (org->DimensionModel == GAIA_XY_Z + || org->DimensionModel == GAIA_XY_Z_M)) + old_zz = malloc (sizeof (double) * cnt); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm = malloc (sizeof (double) * cnt); for (i = 0; i < cnt; i++) { @@ -2034,10 +2090,17 @@ if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) zz[i] = z; else zz[i] = 0.0; + if (ignore_zm + && (rng->DimensionModel == GAIA_XY_Z + || rng->DimensionModel == GAIA_XY_Z_M)) + { + zz[i] = 0.0; + old_zz[i] = z; + } if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) mm[i] = m; } /* applying reprojection */ @@ -2061,10 +2124,14 @@ if (rng->DimensionModel == GAIA_XY_Z || rng->DimensionModel == GAIA_XY_Z_M) z = zz[i]; else z = 0.0; + if (ignore_zm + && (rng->DimensionModel == GAIA_XY_Z + || rng->DimensionModel == GAIA_XY_Z_M)) + z = old_zz[i]; if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) m = mm[i]; else m = 0.0; @@ -2090,10 +2157,12 @@ else error = 1; free (xx); free (yy); free (zz); + if (old_zz != NULL) + free (old_zz); if (rng->DimensionModel == GAIA_XY_M || rng->DimensionModel == GAIA_XY_Z_M) free (mm); if (error) goto stop; @@ -2150,11 +2219,11 @@ } GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransform (gaiaGeomCollPtr org, char *proj_from, char *proj_to) { - return gaiaTransformCommon (NULL, org, proj_from, proj_to); + return gaiaTransformCommon (NULL, org, proj_from, proj_to, 0); } GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransform_r (const void *p_cache, gaiaGeomCollPtr org, char *proj_from, char *proj_to) @@ -2168,9 +2237,33 @@ || cache->magic2 != SPATIALITE_CACHE_MAGIC2) return NULL; handle = cache->PROJ_handle; if (handle == NULL) return NULL; - return gaiaTransformCommon (handle, org, proj_from, proj_to); + return gaiaTransformCommon (handle, org, proj_from, proj_to, 0); +} + +GAIAGEO_DECLARE gaiaGeomCollPtr +gaiaTransformXY (gaiaGeomCollPtr org, char *proj_from, char *proj_to) +{ + return gaiaTransformCommon (NULL, org, proj_from, proj_to, 1); +} + +GAIAGEO_DECLARE gaiaGeomCollPtr +gaiaTransformXY_r (const void *p_cache, gaiaGeomCollPtr org, char *proj_from, + char *proj_to) +{ + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + projCtx handle = NULL; + if (cache == NULL) + return NULL; + if (cache->magic1 != SPATIALITE_CACHE_MAGIC1 + || cache->magic2 != SPATIALITE_CACHE_MAGIC2) + return NULL; + handle = cache->PROJ_handle; + if (handle == NULL) + return NULL; + return gaiaTransformCommon (handle, org, proj_from, proj_to, 1); } #endif /* end including PROJ.4 */ Index: src/gaiageo/gg_wkb.c ================================================================== --- src/gaiageo/gg_wkb.c +++ src/gaiageo/gg_wkb.c @@ -1068,10 +1068,87 @@ default: break; }; } } + +static gaiaGeomCollPtr +doParseTinyPointBlob (const unsigned char *blob, unsigned int size) +{ +/* decoding from SpatiaLite TinyPoint BLOB to GEOMETRY */ + unsigned char pointType; + int type; + int little_endian; + int endian_arch = gaiaEndianArch (); + gaiaGeomCollPtr geo = NULL; + + if (size < 24) + return NULL; /* cannot be an internal BLOB TinyPoint geometry */ + if (*(blob + 0) != GAIA_MARK_START) + return NULL; /* failed to recognize START signature */ + if (*(blob + (size - 1)) != GAIA_MARK_END) + return NULL; /* failed to recognize END signature */ + if (*(blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN) + little_endian = 1; + else if (*(blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + little_endian = 0; + else + return NULL; /* unknown encoding; nor little-endian neither big-endian */ + + pointType = *(blob + 6); + geo = gaiaAllocGeomColl (); + geo->Srid = gaiaImport32 (blob + 2, little_endian, endian_arch); + geo->endian_arch = (char) endian_arch; + geo->endian = (char) little_endian; + geo->blob = blob; + geo->size = size; + geo->offset = 7; + switch (pointType) + { + /* setting up DimensionModel */ + case GAIA_TINYPOINT_XYZ: + type = GAIA_POINTZ; + geo->DimensionModel = GAIA_XY_Z; + break; + case GAIA_TINYPOINT_XYM: + type = GAIA_POINTM; + geo->DimensionModel = GAIA_XY_M; + break; + case GAIA_TINYPOINT_XYZM: + type = GAIA_POINTZM; + geo->DimensionModel = GAIA_XY_Z_M; + break; + default: + type = GAIA_POINT; + geo->DimensionModel = GAIA_XY; + break; + }; + switch (type) + { + /* parsing elementary geometries */ + case GAIA_POINT: + ParseWkbPoint (geo); + break; + case GAIA_POINTZ: + ParseWkbPointZ (geo); + break; + case GAIA_POINTM: + ParseWkbPointM (geo); + break; + case GAIA_POINTZM: + ParseWkbPointZM (geo); + break; + default: + break; + }; + geo->MinX = geo->FirstPoint->X; + geo->MinY = geo->FirstPoint->Y; + geo->MaxX = geo->FirstPoint->X; + geo->MaxY = geo->FirstPoint->Y; + geo->DeclaredType = GAIA_POINT; + return geo; +} GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobWkbEx (const unsigned char *blob, unsigned int size, int gpkg_mode, int gpkg_amphibious) { @@ -1094,10 +1171,20 @@ return NULL; /* must accept only GPKG geometries */ #else ; #endif /* end GEOPACKAGE: supporting GPKG geometries */ } + + if (size == 24 || size == 32 || size == 40) + { + /* testing for a possible TinyPoint BLOB */ + if (*(blob + 0) == GAIA_MARK_START && + (*(blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN + || *(blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + && *(blob + (size - 1)) == GAIA_MARK_END) + return doParseTinyPointBlob (blob, size); + } if (size < 45) return NULL; /* cannot be an internal BLOB WKB geometry */ if (*(blob + 0) != GAIA_MARK_START) return NULL; /* failed to recognize START signature */ @@ -1314,10 +1401,49 @@ * decoding from SpatiaLite BLOB to GEOMETRY * convenience method - always disabling GPKG compatibility Modes */ return gaiaFromSpatiaLiteBlobWkbEx (blob, size, 0, 0); } + +static gaiaGeomCollPtr +doParseTinyPointBlobMbr (const unsigned char *blob, unsigned int size) +{ +/* decoding from SpatiaLite TinyPoint BLOB (MBR only) */ + int little_endian; + int endian_arch = gaiaEndianArch (); + double x; + double y; + gaiaGeomCollPtr geo = NULL; + gaiaPolygonPtr polyg; + gaiaRingPtr ring; + + if (size < 24) + return NULL; /* cannot be an internal BLOB TinyPoint geometry */ + if (*(blob + 0) != GAIA_MARK_START) + return NULL; /* failed to recognize START signature */ + if (*(blob + (size - 1)) != GAIA_MARK_END) + return NULL; /* failed to recognize END signature */ + if (*(blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN) + little_endian = 1; + else if (*(blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + little_endian = 0; + else + return NULL; /* unknown encoding; nor little-endian neither big-endian */ + + x = gaiaImport64 (blob + 7, little_endian, endian_arch); + y = gaiaImport64 (blob + 15, little_endian, endian_arch); + + geo = gaiaAllocGeomColl (); + polyg = gaiaAddPolygonToGeomColl (geo, 5, 0); + ring = polyg->Exterior; + gaiaSetPoint (ring->Coords, 0, x, y); /* vertex # 1 */ + gaiaSetPoint (ring->Coords, 1, x, y); /* vertex # 2 */ + gaiaSetPoint (ring->Coords, 2, x, y); /* vertex # 3 */ + gaiaSetPoint (ring->Coords, 3, x, y); /* vertex # 4 */ + gaiaSetPoint (ring->Coords, 4, x, y); /* vertex # 5 [same as vertex # 1 to close the polygon] */ + return geo; +} GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromSpatiaLiteBlobMbr (const unsigned char *blob, unsigned int size) { /* decoding from SpatiaLite BLOB to GEOMETRY [MBR only] */ @@ -1328,10 +1454,20 @@ double maxx; double maxy; gaiaGeomCollPtr geo = NULL; gaiaPolygonPtr polyg; gaiaRingPtr ring; + + if (size == 24 || size == 32 || size == 40) + { + /* testing for a possible TinyPoint BLOB */ + if (*(blob + 0) == GAIA_MARK_START && + (*(blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN + || *(blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + && *(blob + (size - 1)) == GAIA_MARK_END) + return doParseTinyPointBlobMbr (blob, size); + } if (size < 45) return NULL; /* cannot be an internal BLOB WKB geometry */ if (*(blob + 0) != GAIA_MARK_START) return NULL; /* failed to recognize START signature */ if (*(blob + (size - 1)) != GAIA_MARK_END) @@ -1360,10 +1496,83 @@ } GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx (gaiaGeomCollPtr geom, unsigned char **result, int *size, int gpkg_mode) +{ +/* simply defaults to gaiaToSpatiaLiteBlobWkbEx2 tiny_point=FALSE */ + gaiaToSpatiaLiteBlobWkbEx2 (geom, result, size, gpkg_mode, 0); +} + +static void +doEncodeTinyPointBlob (gaiaGeomCollPtr geom, unsigned char **result, int *size) +{ +/* encoding a TinyPoint BLOB */ + int sz; + unsigned char *blob; + unsigned char *ptr; + int endian_arch = gaiaEndianArch (); + gaiaPointPtr point = geom->FirstPoint; + +/* compunting the BLOB size */ + if (geom->DimensionModel == GAIA_XY_Z) + sz = 32; + else if (geom->DimensionModel == GAIA_XY_M) + sz = 32; + else if (geom->DimensionModel == GAIA_XY_Z_M) + sz = 40; + else + sz = 24; +/* allocating the BLOB */ + blob = malloc (sz); + ptr = blob; +/* and finally we build the BLOB */ + *ptr = GAIA_MARK_START; /* START signature */ + ptr++; + *(ptr) = GAIA_TINYPOINT_LITTLE_ENDIAN; /* byte ordering */ + ptr++; + gaiaExport32 (ptr, geom->Srid, 1, endian_arch); /* the SRID */ + ptr += 4; + if (geom->DimensionModel == GAIA_XY_Z) + *ptr = GAIA_TINYPOINT_XYZ; + else if (geom->DimensionModel == GAIA_XY_M) + *ptr = GAIA_TINYPOINT_XYM; + else if (geom->DimensionModel == GAIA_XY_Z_M) + *ptr = GAIA_TINYPOINT_XYZM; + else + *ptr = GAIA_TINYPOINT_XY; + ptr++; + gaiaExport64 (ptr, point->X, 1, endian_arch); /* X */ + ptr += 8; + gaiaExport64 (ptr, point->Y, 1, endian_arch); /* Y */ + ptr += 8; + if (geom->DimensionModel == GAIA_XY_Z) + { + gaiaExport64 (ptr, point->Z, 1, endian_arch); /* Z */ + ptr += 8; + } + else if (geom->DimensionModel == GAIA_XY_M) + { + gaiaExport64 (ptr, point->M, 1, endian_arch); /* M */ + ptr += 8; + } + else if (geom->DimensionModel == GAIA_XY_Z_M) + { + gaiaExport64 (ptr, point->Z, 1, endian_arch); /* Z */ + ptr += 8; + gaiaExport64 (ptr, point->M, 1, endian_arch); /* M */ + ptr += 8; + } + *ptr = GAIA_MARK_END; /* END signature */ + + *result = blob; + *size = sz; +} + +GAIAGEO_DECLARE void +gaiaToSpatiaLiteBlobWkbEx2 (gaiaGeomCollPtr geom, unsigned char **result, + int *size, int gpkg_mode, int tiny_point) { /* builds the SpatiaLite BLOB representation for this GEOMETRY */ int ib; int iv; double x; @@ -1418,14 +1627,24 @@ polyg = pg; entities++; n_polygons++; pg = pg->Next; } + *size = 0; *result = NULL; if (n_points == 0 && n_polygons == 0 && n_linestrings == 0) return; + if (n_points == 1 && n_linestrings == 0 && n_polygons == 0 && entities == 1 + && geom->DeclaredType != GAIA_MULTIPOINT + && geom->DeclaredType != GAIA_GEOMETRYCOLLECTION && tiny_point) + { + /* using the TinyPoint BLOB encoding */ + doEncodeTinyPointBlob (geom, result, size); + return; + } + /* ok, we can determine the geometry class */ if (n_points == 1 && n_linestrings == 0 && n_polygons == 0) { if (geom->DeclaredType == GAIA_MULTIPOINT) { Index: src/gaiageo/gg_xml.c ================================================================== --- src/gaiageo/gg_xml.c +++ src/gaiageo/gg_xml.c @@ -2596,10 +2596,12 @@ GAIAGEO_DECLARE char * gaiaXmlTextFromBlob (const unsigned char *blob, int blob_size, int indent) { /* attempting to extract an XMLDocument from within an XmlBLOB buffer */ + +#ifndef OMIT_ICONV /* only if ICONV is supported */ int compressed = 0; int little_endian = 0; unsigned char flag; const unsigned char *ptr; int xml_len; @@ -2736,10 +2738,16 @@ xmlSetGenericErrorFunc ((void *) stderr, NULL); return (char *) out; } xmlSetGenericErrorFunc ((void *) stderr, NULL); return NULL; + +#else + if (blob != NULL && blob_size == 0 && indent == 0) + blob = NULL; /* silencing stupid compiler warnings */ +#endif + return NULL; } GAIAGEO_DECLARE void gaiaXmlFromBlob (const unsigned char *blob, int blob_size, int indent, unsigned char **result, int *res_size) Index: src/geopackage/Makefile.am ================================================================== --- src/geopackage/Makefile.am +++ src/geopackage/Makefile.am @@ -1,8 +1,8 @@ AM_CFLAGS = $(GCOV_FLAGS) -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgeopackage.la geopackage.la SHARED_SOURCES = \ @@ -25,15 +25,15 @@ libgeopackage_la_CFLAGS = -fvisibility=hidden geopackage_la_SOURCES = $(SHARED_SOURCES) -geopackage_la_CPPFLAGS = @CFLAGS@ +geopackage_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ geopackage_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. geopackage_la_CPPFLAGS += -DLOADABLE_EXTENSION geopackage_la_CPPFLAGS += -fvisibility=hidden geopackage_la_LDFLAGS = -module geopackage_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda EXTRA_DIST = geopackage_internal.h Index: src/geopackage/Makefile.in ================================================================== --- src/geopackage/Makefile.in +++ src/geopackage/Makefile.in @@ -337,11 +337,11 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = $(GCOV_FLAGS) -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libgeopackage.la geopackage.la SHARED_SOURCES = \ gpkg_add_tile_triggers.c \ gpkg_get_normal_row.c \ gpkg_get_normal_zoom.c \ @@ -358,12 +358,13 @@ gaia_cvt_gpkg.c libgeopackage_la_SOURCES = $(SHARED_SOURCES) libgeopackage_la_CFLAGS = -fvisibility=hidden geopackage_la_SOURCES = $(SHARED_SOURCES) -geopackage_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION -fvisibility=hidden +geopackage_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ \ + -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION \ + -fvisibility=hidden geopackage_la_LDFLAGS = -module geopackage_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda EXTRA_DIST = geopackage_internal.h all: all-am Index: src/headers/Makefile.am ================================================================== --- src/headers/Makefile.am +++ src/headers/Makefile.am @@ -24,7 +24,8 @@ spatialite/debug.h \ spatialite/geopackage.h \ spatialite/control_points.h \ spatialite/gaia_topology.h \ spatialite/gaia_network.h \ - spatialite/gg_sequence.h + spatialite/gg_sequence.h \ + spatialite/stored_procedures.h endif Index: src/headers/Makefile.in ================================================================== --- src/headers/Makefile.in +++ src/headers/Makefile.in @@ -129,11 +129,11 @@ spatialite/gg_dynamic.h spatialite/gg_advanced.h \ spatialite/gg_xml.h spatialite/gg_wfs.h spatialite/gg_dxf.h \ spatialite/spatialite.h spatialite/sqlite.h spatialite/debug.h \ spatialite/geopackage.h spatialite/control_points.h \ spatialite/gaia_topology.h spatialite/gaia_network.h \ - spatialite/gg_sequence.h + spatialite/gg_sequence.h spatialite/stored_procedures.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; @@ -334,11 +334,12 @@ @MODULE_ONLY_FALSE@ spatialite/debug.h \ @MODULE_ONLY_FALSE@ spatialite/geopackage.h \ @MODULE_ONLY_FALSE@ spatialite/control_points.h \ @MODULE_ONLY_FALSE@ spatialite/gaia_topology.h \ @MODULE_ONLY_FALSE@ spatialite/gaia_network.h \ -@MODULE_ONLY_FALSE@ spatialite/gg_sequence.h +@MODULE_ONLY_FALSE@ spatialite/gg_sequence.h \ +@MODULE_ONLY_FALSE@ spatialite/stored_procedures.h @MODULE_ONLY_TRUE@nobase_include_HEADERS = all: all-am .SUFFIXES: Index: src/headers/spatialite.h ================================================================== --- src/headers/spatialite.h +++ src/headers/spatialite.h @@ -973,11 +973,11 @@ \param multiId name of the column identifying origins in the output table \param rows on completion will contain the total number of inserted rows \param transaction boolena; if set to TRUE will internally handle a SQL Transaction - \sa elementary_geometries + \sa elementary_geometries_ex3 \note if the input table contains some kind of complex Geometry (MULTIPOINT, MULTILINESTRING, MULTIPOLYGON or GEOMETRYCOLLECTION), then many rows are inserted into the output table: each single row will contain the same attributes and an elementaty Geometry. @@ -990,10 +990,43 @@ char *outTable, char *pKey, char *multiId, int *rows, int transaction); +/** + Creates a derived table surely containing elementary Geometries + + \param sqlite handle to current DB connection + \param inTable name of the input table + \param geometry name of the Geometry column + \param outTable name of the output table to be created + \param pKey name of the Primary Key column in the output table + \param multiId name of the column identifying origins in the output table + \param options pointer to an Options list created by gaiaAuxClonerCreate() + \param rows on completion will contain the total number of inserted rows + \param transaction boolena; if set to TRUE will internally handle + a SQL Transaction + + \sa elementary_geometries + + \note if the input table contains some kind of complex Geometry + (MULTIPOINT, MULTILINESTRING, MULTIPOLYGON or GEOMETRYCOLLECTION), + then many rows are inserted into the output table: each single + row will contain the same attributes and an elementaty Geometry. + All the rows created by expanding the same input row will expose + the same value in the "multiId" column. + */ + SPATIALITE_DECLARE void elementary_geometries_ex3 (sqlite3 * sqlite, + char *inTable, + char *geometry, + char *outTable, + char *pKey, + char *multiId, + const void *options, + int *rows, + int transaction); + /** Dumps a full geometry-table into an external GeoJSON file \param sqlite handle to current DB connection \param table the name of the table to be exported @@ -1134,11 +1167,12 @@ \sa gaiaFreeVectorLayersList, update_layer_statistics, gaiaStatisticsInvalidate, gaiaGetLayerExtent, gaiaGetVectorLayersList \note you are responsible to destroy (before or after) any allocated VectorLayersList returned by gaiaGetVectorLayersList(). - \n If the table arg is NULL all VectorLayers defined within the DB will be reported; + \n If the table arg is NULL all VectorLayers defined within the DB will be reported + (and in this case all AttributeField Infos will be always suppressed); otherwise only a single Layer will be reported (if existing). \n By defining the geometry arg (not NULL) you can further restrict the returned report. \n When the mode arg is set to GAIA_VECTORS_LIST_OPTIMISTIC (default) then the returned infos will be simply retrieved from the staticized statistic tables (faster, but could be inaccurate). \n If the mode arg is set to GAIA_VECTORS_LIST_PESSIMISTIC a preliminary attempt to update the @@ -1635,10 +1669,94 @@ const char *blade_geom, const char *output_table, int transaction, int ram_tmp_store, char **message); +/** + Will attempt to create the Routing Nodes columns for a spatial table + + \param db_handle handle to the current SQLite connection + \param cache a memory pointer returned by spatialite_alloc_connection() + \param prefix schema prefix identifying the target DB (could be + eventually NULL)\n + \param table name of the table to be processed. + \param geom_column name of the table column containing Linestring Geometries + (could be eventually NULL). + \param from_column name of the table column where NodeFrom values + will be stored. + \param to_column name of the column where ToFrom values + will be stored. + + \return 0 on failure, any other value on success + */ + SPATIALITE_DECLARE int gaia_create_routing_nodes (sqlite3 * db_handle, + const void *cache, + const char *prefix, + const char *table, + const char *geom_column, + const char *from_column, + const char *to_column); + +/** + Will attempt to create a VirtualRouting from an input table + + \param db_handle handle to the current SQLite connection + \param cache a memory pointer returned by spatialite_alloc_connection() + \param routing_data_table name of the Routing Data Table to be created. + \param virtual_routing_table name of the VirtualRouting Table to be created. + \param input_table name of the input table to be processed. + \param from_column name of the input table column containing NodeFrom. + \param to_column name of the input table column containing NodeTo. + \param geom_column name of the input table column containing Linestring Geometries + (could be eventually NULL). + \param cost_column name of the input table column containing Cost values + (could be eventually NULL). + \param name_column name of the input table column containing RoadName + (could be eventually NULL). + \param a_star_enabled if set to TRUE the Routing Data Table will support + both Djiskra's Shortest Path and A* algorithms; if set to FALSE only + the Djiskra's algorithm will be supported. + \param bidirectional if set to TRUE all input arcs/links will be assumed + to be bidirectional (from-to and to-from); if set to FALSE all input + arcs/links will be assumed to be unidirectional (from-to only). + \param oneway_from name of the input table column containing OneWayFrom + (could be eventually NULL). + \param oneway_to name of the input table column containing OneWayTo + (could be eventually NULL). + \param overwrite if set to TRUE both the Routing Data Table and the + VirtualRouting Table will be dropped if already existing; if set to + FALSE an already existing Routing Data Table or VirtualRouting Table + will cause a fatal error. + + \return 0 on failure, any other value on success + + \note at least one between geom_column and cost_column shall not be NULL. + both oneway_from and oneway_to must be NULL or must contain a valid + column name; mixing a column name and a NULL will be considered a + fatal error. + */ + SPATIALITE_DECLARE int gaia_create_routing (sqlite3 * db_handle, + const void *cache, + const char *routing_data_table, + const char + *virtual_routing_table, + const char *input_table, + const char *from_column, + const char *to_column, + const char *geom_column, + const char *cost_column, + const char *name_column, + int a_star_enabled, + int bidirectional, + const char *oneway_from, + const char *oneway_to, + int overwrite); + + SPATIALITE_DECLARE const char *gaia_create_routing_get_last_error (const + void + *cache); + SPATIALITE_DECLARE int gaiaGPKG2Spatialite (sqlite3 * handle_in, const char *gpkg_in_path, sqlite3 * handle_out, const char *splite_out_path); SPATIALITE_DECLARE int gaiaSpatialite2GPKG (sqlite3 * handle_in, Index: src/headers/spatialite/gaia_network.h ================================================================== --- src/headers/spatialite/gaia_network.h +++ src/headers/spatialite/gaia_network.h @@ -434,11 +434,11 @@ \param ptr pointer to the Topology Accessor Object. \return 1 on success; 0 on failure. - \sa gaiaTopologyFromDBMS + \sa gaiaNetworkFromDBMS */ GAIANET_DECLARE int gaiaValidLogicalNet (GaiaNetworkAccessorPtr ptr); /** Creates a temporary table containing a validation report for a given @@ -446,11 +446,11 @@ \param ptr pointer to the Topology Accessor Object. \return 1 on success; 0 on failure. - \sa gaiaTopologyFromDBMS + \sa gaiaNetworkFromDBMS */ GAIANET_DECLARE int gaiaValidSpatialNet (GaiaNetworkAccessorPtr ptr); /** Find the ID of a NetNode at a Point location @@ -512,10 +512,24 @@ \sa gaiaNetworkFromDBMS */ GAIANET_DECLARE gaiaGeomCollPtr gaiaGetLinkSeed (GaiaNetworkAccessorPtr ptr, sqlite3_int64 link); +/** + Ensures that all Links on a Topology-Network will have not less + than three vertices; for all Links found being simple two-points + segments a third intermediate point will be interpolated. + + \param ptr pointer to the Network Accessor Object. + + \return the total number of changed Links; a negativa number on error + + \sa gaiaNetworkFromDBMS + */ + GAIANET_DECLARE int + gaiaTopoNet_DisambiguateSegmentLinks (GaiaNetworkAccessorPtr ptr); + /** Will update all Seeds for a Topology-Network \param ptr pointer to the Network Accessor Object. \param mode if set to 0 a full update of all Seeds will be performed, @@ -542,11 +556,11 @@ \param with_spatial_index boolean flag: if set to TRUE (non ZERO) a Spatial Index supporting the output table will be created. \return 1 on success; -1 on failure (will raise an exception). - \sa gaiaTopologyFromDBMS + \sa gaiaNetworkFromDBMS */ GAIANET_DECLARE int gaiaTopoNet_ToGeoTable (GaiaNetworkAccessorPtr ptr, const char *db_prefix, const char *ref_table, const char *ref_column, const char *out_table, @@ -568,22 +582,46 @@ \param with_spatial_index boolean flag: if set to TRUE (non ZERO) a Spatial Index supporting the output table will be created. \return 1 on success; -1 on failure (will raise an exception). - \sa gaiaTopologyFromDBMS + \sa gaiaNetworkFromDBMS */ GAIANET_DECLARE int gaiaTopoNet_ToGeoTableGeneralize (GaiaNetworkAccessorPtr ptr, const char *db_prefix, const char *ref_table, const char *ref_column, const char *out_table, double tolerance, int with_spatial_index); + +/** + Creates and populates a Table containing a comprehensive report + about all intesections between the Links of some Network and + a given reference Table of the Linestring/Multilinestring type. + + \param ptr pointer to the Network Accessor Object. + \param db-prefix prefix of the DB containing the reference GeoTable. + If NULL the "main" DB will be intended by default. + \param ref_table name of the reference GeoTable. + \param ref_column name of the reference Geometry Column. + Could be NULL is the reference table has just a single Geometry Column. + \param out_table name of the output output table to be created and populated. + + \return 1 on success; -1 on failure (will raise an exception). + + \sa gaiaNetworkFromDBMS + */ + GAIANET_DECLARE int + gaiaTopoNet_LineLinksList (GaiaNetworkAccessorPtr ptr, + const char *db_prefix, const char *ref_table, + const char *ref_column, + const char *out_table); + #ifdef __cplusplus } #endif #endif /* _GAIANET_H */ Index: src/headers/spatialite/gaia_topology.h ================================================================== --- src/headers/spatialite/gaia_topology.h +++ src/headers/spatialite/gaia_topology.h @@ -623,23 +623,23 @@ /** Snap Geometry to Topology. \param ptr pointer to the Topology Accessor Object. \param geom pointer to the input Geometry. - \param tolerance approximation factor. + \param tolerance_snap snap tolerance. + \param tolerance_removal removal tolerance (use -1 to skip removal phase). \param iterate if non zero, allows snapping to more than a single - vertex, iteratively - \param remove_vertices if non zero, makes an initial pass removing - vertices within tolerance + vertex, iteratively. \return pointer to the snapped Geometry; NULL on failure. \sa gaiaTopologyFromDBMS */ GAIATOPO_DECLARE gaiaGeomCollPtr gaiaTopoSnap (GaiaTopologyAccessorPtr ptr, gaiaGeomCollPtr geom, - double tolerance, int iterate, int remove_vertices); + double tolerance_snap, double tolerance_removal, + int iterate); /** Adds a Polygon to an existing Topology and possibly splitting Edges/Faces. \param ptr pointer to the Topology Accessor Object. @@ -799,26 +799,25 @@ If NULL the "main" DB will be intended by default. \param table name of the input GeoTable. \param column name of the input Geometry Column. Could be NULL is the input table has just a single Geometry Column. \param outtable name of the output GeoTable. - \param tolerance approximation factor. + \param tolerance_snap snap tolerance. + \param tolerance_removal removal tolerance (use -1 to skip removal phase). \param iterate if non zero, allows snapping to more than a single - vertex, iteratively - \param remove_vertices if non zero, makes an initial pass removing - vertices within tolerance + vertex, iteratively. \return 1 on success; -1 on failure (will raise an exception). \sa gaiaTopologyFromDBMS */ GAIATOPO_DECLARE int gaiaTopoGeo_SnappedGeoTable (GaiaTopologyAccessorPtr ptr, const char *db_prefix, const char *table, const char *column, const char *outtable, - double tolerance, int iterate, - int remove_vertices); + double tolerance_snap, + double tolerance_removal, int iterate); /** Creates a temporary table containing a validation report for a given TopoGeo. \param ptr pointer to the Topology Accessor Object. @@ -853,10 +852,24 @@ \sa gaiaTopologyFromDBMS */ GAIATOPO_DECLARE gaiaGeomCollPtr gaiaGetFaceSeed (GaiaTopologyAccessorPtr ptr, sqlite3_int64 face); +/** + Ensures that all Edges on a Topology-Geometry will have not less + than three vertices; for all Edges found being simple two-points + segments a third intermediate point will be interpolated. + + \param ptr pointer to the Topology Accessor Object. + + \return the total number of changed Edges; a negativa number on error + + \sa gaiaTopologyFromDBMS + */ + GAIATOPO_DECLARE int + gaiaTopoGeo_DisambiguateSegmentEdges (GaiaTopologyAccessorPtr ptr); + /** Will update all Seeds for a Topology-Geometry \param ptr pointer to the Topology Accessor Object. \param mode if set to 0 a full update of all Seeds will be performed, @@ -921,10 +934,56 @@ gaiaTopoGeo_ToGeoTable (GaiaTopologyAccessorPtr ptr, const char *db_prefix, const char *ref_table, const char *ref_column, const char *out_table, int with_spatial_index); +/** + Creates and populates a Table containing a comprehensive report + about all intesections between the Faces of some Topology and + a given reference Table of the Polygon/Multipolygon type. + + \param ptr pointer to the Topology Accessor Object. + \param db-prefix prefix of the DB containing the reference GeoTable. + If NULL the "main" DB will be intended by default. + \param ref_table name of the reference GeoTable. + \param ref_column name of the reference Geometry Column. + Could be NULL is the reference table has just a single Geometry Column. + \param out_table name of the output output table to be created and populated. + + \return 1 on success; -1 on failure (will raise an exception). + + \sa gaiaTopologyFromDBMS + */ + GAIATOPO_DECLARE int + gaiaTopoGeo_PolyFacesList (GaiaTopologyAccessorPtr ptr, + const char *db_prefix, const char *ref_table, + const char *ref_column, + const char *out_table); + +/** + Creates and populates a Table containing a comprehensive report + about all intesections between the Edges of some Topology and + a given reference Table of the Linestring/Multilinestring type. + + \param ptr pointer to the Topology Accessor Object. + \param db-prefix prefix of the DB containing the reference GeoTable. + If NULL the "main" DB will be intended by default. + \param ref_table name of the reference GeoTable. + \param ref_column name of the reference Geometry Column. + Could be NULL is the reference table has just a single Geometry Column. + \param out_table name of the output output table to be created and populated. + + \return 1 on success; -1 on failure (will raise an exception). + + \sa gaiaTopologyFromDBMS + */ + GAIATOPO_DECLARE int + gaiaTopoGeo_LineEdgesList (GaiaTopologyAccessorPtr ptr, + const char *db_prefix, const char *ref_table, + const char *ref_column, + const char *out_table); + /** Extracts a simplified/generalized Simple Features Table out from a Topology by matching Topology Seeds to a given reference Table. \param ptr pointer to the Topology Accessor Object. @@ -1050,12 +1109,12 @@ \return 1 on success; -1 on failure (will raise an exception). \sa gaiaTopologyFromDBMS, gaiaTopoGeo_NewEdgeHeal */ GAIATOPO_DECLARE int gaiaTopoGeo_ModEdgeSplit (GaiaTopologyAccessorPtr ptr, - int line_max_points, - double max_length); + int line_max_points, + double max_length); /** creates a TopoLayer and its corresponding Feature relations for a given Topology by matching Topology Seeds to a given reference Table. Index: src/headers/spatialite/gaiaaux.h ================================================================== --- src/headers/spatialite/gaiaaux.h +++ src/headers/spatialite/gaiaaux.h @@ -400,10 +400,11 @@ /** Return a percent-encoded URL \param url the URL to be percent-encoded + \param out_charset the charset encoding adopted by the encoded URL \return the corresponding percent-encoded URL text string, or NULL on failure \sa gaiaDecodeURL @@ -410,16 +411,18 @@ \note this function will return a dynamically allocated buffer created by malloc(). You are required to explicitly free() any string returned by this function. */ - GAIAAUX_DECLARE char *gaiaEncodeURL (const char *url); + GAIAAUX_DECLARE char *gaiaEncodeURL (const char *url, + const char *in_charset); /** Return a clean URL from its percent-encoded representation \param encoded the percent-encoded URL to be decoded + \param in_charset the charset encoding adopted by the URL to be decoded \return the corresponding clean URL text string, or NULL on failure \sa gaiaEncodeURL @@ -426,11 +429,12 @@ \note this function will return a dynamically allocated buffer created by malloc(). You are required to explicitly free() any string returned by this function. */ - GAIAAUX_DECLARE char *gaiaDecodeURL (const char *encoded); + GAIAAUX_DECLARE char *gaiaDecodeURL (const char *encoded, + const char *out_charset); /** Return the DirName component (if any) from a Path \param path full or relative pathname Index: src/headers/spatialite/gaiaexif.h ================================================================== --- src/headers/spatialite/gaiaexif.h +++ src/headers/spatialite/gaiaexif.h @@ -93,10 +93,12 @@ #define GAIA_JP2_BLOB 11 /** this BLOB does actually contain a SpatiaLite XmlBLOB */ #define GAIA_XML_BLOB 12 /** this BLOB does actually contain a GPKG Geometry */ #define GAIA_GPB_BLOB 13 +/** this BLOB does actually contain a SpatiaLite TinyPoint */ +#define GAIA_TINYPOINT_BLOB 14 /* constants used for EXIF value types */ /** unrecognized EXIF value */ #define GAIA_EXIF_NONE 0 /** EXIF value of the BYTE type */ Index: src/headers/spatialite/gg_advanced.h ================================================================== --- src/headers/spatialite/gg_advanced.h +++ src/headers/spatialite/gg_advanced.h @@ -120,11 +120,11 @@ \param proj_to geodetic parameters string [EPSG format] qualifying the output Reference System \return the pointer to newly created Geometry object: NULL on failure. - \sa gaiaTransform_r, gaiaFreeGeomColl + \sa gaiaTransform_r, gaiaTransformXY, gaiaFreeGeomColl \note you are responsible to destroy (before or after) any allocated Geometry, this including any Geometry returned by gaiaGeometryTransform()\n not reentrant and thread unsafe. \remark \b PROJ.4 support required @@ -144,11 +144,11 @@ \param proj_to geodetic parameters string [EPSG format] qualifying the output Reference System \return the pointer to newly created Geometry object: NULL on failure. - \sa gaiaTransform, gaiaFreeGeomColl + \sa gaiaTransform, gaiaTransformXY_r, gaiaFreeGeomColl \note you are responsible to destroy (before or after) any allocated Geometry, this including any Geometry returned by gaiaGeometryTransform()\n reentrant and thread-safe. \remark \b PROJ.4 support required @@ -155,10 +155,67 @@ */ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransform_r (const void *p_cache, gaiaGeomCollPtr org, char *proj_from, char *proj_to); + +/** + Tansforms a Geometry object into a different Reference System + [aka Reprojection] + This is a special "flavor" of gaiaTransform() just considering X and Y coordinates; + Z and M values will be left untouched. + Mainly intended as a workaround possibily useful when facing partially + broken PROJ.4 definitions. + + \param org pointer to input Geometry object. + \param proj_from geodetic parameters string [EPSG format] qualifying the + input Reference System + \param proj_to geodetic parameters string [EPSG format] qualifying the + output Reference System + + \return the pointer to newly created Geometry object: NULL on failure. + + \sa gaiaTransformXY_r, gaiaTransform, gaiaFreeGeomColl + + \note you are responsible to destroy (before or after) any allocated Geometry, this including any Geometry returned by gaiaGeometryTransform()\n + not reentrant and thread unsafe. + + \remark \b PROJ.4 support required + */ + GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransformXY (gaiaGeomCollPtr org, + char *proj_from, + char *proj_to); + +/** + Tansforms a Geometry object into a different Reference System + [aka Reprojection] + This is a special "flavor" of gaiaTransform_r() just considering X and Y coordinates; + Z and M values will be left untouched. + Mainly intended as a workaround possibily useful when facing partially + broken PROJ.4 definitions. + + \param p_cache a memory pointer returned by spatialite_alloc_connection() + \param org pointer to input Geometry object. + \param proj_from geodetic parameters string [EPSG format] qualifying the + input Reference System + \param proj_to geodetic parameters string [EPSG format] qualifying the + output Reference System + + \return the pointer to newly created Geometry object: NULL on failure. + + \sa gaiaTransformXY, gaiaTransform_r, gaiaFreeGeomColl + + \note you are responsible to destroy (before or after) any allocated Geometry, this including any Geometry returned by gaiaGeometryTransform()\n + reentrant and thread-safe. + + \remark \b PROJ.4 support required + */ + GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTransformXY_r (const void *p_cache, + gaiaGeomCollPtr org, + char *proj_from, + char *proj_to); + #endif /* end including PROJ.4 */ #ifndef OMIT_GEOS /* including GEOS */ @@ -3073,12 +3130,11 @@ */ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSquareGrid (gaiaGeomCollPtr geom, double origin_x, double origin_y, - double size, - int mode); + double size, int mode); /** Utility function: SquareGrid \param p_cache a memory pointer returned by spatialite_alloc_connection() @@ -3103,12 +3159,11 @@ */ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaSquareGrid_r (const void *p_cache, gaiaGeomCollPtr geom, double origin_x, double origin_y, - double size, - int mode); + double size, int mode); /** Utility function: TriangularGrid \param geom the Geometry to be covered by the Grid. @@ -3131,12 +3186,11 @@ */ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaTriangularGrid (gaiaGeomCollPtr geom, double origin_x, double origin_y, - double size, - int mode); + double size, int mode); /** Utility function: TriangularGrid \param p_cache a memory pointer returned by spatialite_alloc_connection() @@ -3190,12 +3244,11 @@ */ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaHexagonalGrid (gaiaGeomCollPtr geom, double origin_x, double origin_y, - double size, - int mode); + double size, int mode); /** Utility function: HexagonalGrid \param p_cache a memory pointer returned by spatialite_alloc_connection() @@ -3220,12 +3273,11 @@ */ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaHexagonalGrid_r (const void *p_cache, gaiaGeomCollPtr geom, double origin_x, double origin_y, - double size, - int mode); + double size, int mode); #endif /* end GEOS advanced features */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS #ifdef GEOS_TRUNK @@ -3858,12 +3910,120 @@ \remark \b RTTOPO support required. */ GAIAGEO_DECLARE gaiaGeomCollPtr gaiaNodeLines (const void *p_cache, gaiaGeomCollPtr input); +/** + Converts a native binary Geometry into a compressed TWKB Geometry + + \param p_cache a memory pointer returned by spatialite_alloc_connection() + \param geom the Geometry to be converted + \param precision_xy how much precision (decimal digits) X and Y + \param precision_z how much precision (decimal digits) Z + \param precision_m how much precision (decimal digits) M + \param with_size including sizes into the TWKB + \param with_bbox including a BBOX into the TWKB + \param twkb on succesfull completion this pointer will reference the + TWKB geometry + \param size_twkb on succesfull completion this pointer will reference + the size (in bytes) of the TWKB geometry + + \return 0 on failure: any other value on success. + + \sa gaiaFromTWKB + + \note you are responsible to free (before or after) the TWKB geometry + created by gaiaToTWKB(). + + \remark \b RTTOPO support required. + */ + GAIAGEO_DECLARE int gaiaToTWKB (const void *p_cache, + gaiaGeomCollPtr geom, + unsigned char precision_xy, + unsigned char precision_z, + unsigned char precision_m, int with_size, + int with_bbox, unsigned char **twkb, + int *size_twkb); + +/** + Converts a compressed TWKB Geometry into a native binary Geometry + + \param p_cache a memory pointer returned by spatialite_alloc_connection() + \param twkb pointer to TWKB geometry + \param twkb_size size (in bytes) of the TWKB geometry + \param srid the SRID of the returned Geometry + + \return the pointer to newly created Geometry object: NULL on failure. + + \sa gaiaToTWKB + + \note you are responsible to destroy the native geometry + returned by gaiaFromTWKB(). + + \remark \b RTTOPO support required. + */ + GAIAGEO_DECLARE gaiaGeomCollPtr gaiaFromTWKB (const void *p_cache, + const unsigned char *twkb, + int twkb_size, int srid); + #endif /* end RTTOPO support */ +/** + Utility function: DrapeLine + + \param geom1 the first Geometry object (expected to be a 2D Linestring). + \param geom2 the second Geometry object (expected to be a 3D Linestring). + \param tolerance tolerance radius. + + \return the pointer to newly created Geometry object: NULL on failure. + \n this function will return a Geometry of the Linestring type having + all points defined by geom1 and dimensions as defined by geom2. + Missing Z and/or M coords will by recovered by corresponding points + found in geom2 within the given tolerance radius. + \n both geom1 and geom2 must share the same SRID. + + \sa gaiaFreeGeomColl, gaiaDrapeLineExceptions + + \note you are responsible to destroy (before or after) any allocated Geometry, + this including any Geometry returned by gaiaDrapeLine() + + */ + GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDrapeLine (sqlite3 * db_handle, + gaiaGeomCollPtr geom1, + gaiaGeomCollPtr geom2, + double tolerance); + +/** + Utility function: DrapeLineExceptions + + \param geom1 the first Geometry object (expected to be a 2D Linestring). + \param geom2 the second Geometry object (expected to be a 3D Linestring). + \param tolerance tolerance radius. + \param interpolated boolean: if TRUE all Vertices for whom Z (and/or M) + values had been succesfully interpolated will be considered as valid. + + \return the pointer to newly created Geometry object: NULL on failure. + \n this function will return a Geometry of the MultiPoint type containing + all Vertices from geom1 lacking a corresponding Vertex in geom2, thus + leading to dubious Z and/or M coords. + \n both geom1 and geom2 must share the same SRID. + + \sa gaiaFreeGeomColl, gaiaDrapeLine + + \note you are responsible to destroy (before or after) any allocated Geometry, + this including any Geometry returned by gaiaDrapeLine() + + */ + GAIAGEO_DECLARE gaiaGeomCollPtr gaiaDrapeLineExceptions (sqlite3 * + db_handle, + gaiaGeomCollPtr + geom1, + gaiaGeomCollPtr + geom2, + double tolerance, + int interpolated); + #endif /* end including GEOS */ /** Utility function: SnapToGrid Index: src/headers/spatialite/gg_const.h ================================================================== --- src/headers/spatialite/gg_const.h +++ src/headers/spatialite/gg_const.h @@ -124,10 +124,14 @@ /* constants that defines byte storage order */ /** Big-Endian marker */ #define GAIA_BIG_ENDIAN 0 /** Little-Endian marker */ #define GAIA_LITTLE_ENDIAN 1 +/** TinyPoint Big-Endian marker */ +#define GAIA_TINYPOINT_BIG_ENDIAN 0x80 +/** TinyPoint Little-Endian marker */ +#define GAIA_TINYPOINT_LITTLE_ENDIAN 0x81 /* constants that defines special markers used for encoding of SpatiaLite internal BLOB geometries */ /** BLOB-Geometry internal marker: START */ #define GAIA_MARK_START 0x00 /** BLOB-Geometry internal marker: END */ @@ -194,10 +198,20 @@ #define GAIA_MULTILINESTRINGZM 3005 /** BLOB-Geometry CLASS: MULTIPOLYGON ZM */ #define GAIA_MULTIPOLYGONZM 3006 /** BLOB-Geometry CLASS: GEOMETRYCOLLECTION ZM */ #define GAIA_GEOMETRYCOLLECTIONZM 3007 + +/* constants that defines TinyPoint Types */ +/** BLOB-TinyPoint Type: POINT XY */ +#define GAIA_TINYPOINT_XY 0x01 +/** BLOB-TinyPoint Type: POINT XYZ */ +#define GAIA_TINYPOINT_XYZ 0x02 +/** BLOB-TinyPoint Type: POINT XYM */ +#define GAIA_TINYPOINT_XYM 0x03 +/** BLOB-TinyPoint Type: POINT XYZM */ +#define GAIA_TINYPOINT_XYZM 0x04 /* constants that defines Compressed GEOMETRY CLASSes */ /** BLOB-Geometry CLASS: compressed LINESTRING */ #define GAIA_COMPRESSED_LINESTRING 1000002 /** BLOB-Geometry CLASS: compressed POLYGON */ @@ -406,12 +420,14 @@ /* constants used for Clone Special modes */ /** Clone Special Mode: Same Order as input */ #define GAIA_SAME_ORDER 0 /** Clone Special Mode: Reversed Order */ #define GAIA_REVERSE_ORDER -1 -/** Clone Special Mode: apply Left Handle Rule to Polygon Rings */ -#define GAIA_LHR_ORDER -2 +/** Clone Special Mode: apply Clockwise Rule to Polygon Rings */ +#define GAIA_CW_ORDER -2 +/** Clone Special Mode: apply Counter-Clockwise Rule to Polygon Rings */ +#define GAIA_CCW_ORDER -3 /* constants used for DBF column-names case */ /** Leave all DBF column-names as they are */ #define GAIA_DBF_COLNAME_CASE_IGNORE 0 /** Convert all DBF column names to LowerCase */ Index: src/headers/spatialite/gg_core.h ================================================================== --- src/headers/spatialite/gg_core.h +++ src/headers/spatialite/gg_core.h @@ -816,20 +816,22 @@ /** Duplicates a Polygon object (special) \param polyg pointer to Polygon object [origin]. - \param mode one of GAIA_SAME_ORDER, GAIA_REVERSE_ORDER or GAIA_LHR_ORDER. + \param mode one of GAIA_SAME_ORDER, GAIA_REVERSE_ORDER, or GAIA_LHR_ORDER. \return the pointer to newly created Polygon object: NULL on failure. \sa gaiaClonePolygon, gaiaCloneGeomCollSpecial \note if GAIA_REVERSE_ORDER is specified, then any Ring into the newly created - object will be in reverse order. If GAIA_LHR_ORDER is specified instead, any + object will be in reverse order. If GAIA_CW_ORDER is specified, any Exterior Ring will have clockwise orientation, and any Interior Ring will have - counter-clockwise orientation. In any other case this function will simply + counter-clockwise orientation. If GAIA_CCW_ORDER is specified, any + Exterior Ring will have counter-clockwise orientation, and any Interior Ring + will have clockwise orientation. In any other case this function will simply default to gaiaClonePolygon. */ GAIAGEO_DECLARE gaiaPolygonPtr gaiaClonePolygonSpecial (gaiaPolygonPtr polyg, int mode); @@ -1159,10 +1161,38 @@ \note an empty Geometry is a Geometry not containing any elementary item: i.e. no Points, no Linestrings and no Polygons at all. */ GAIAGEO_DECLARE int gaiaIsEmpty (gaiaGeomCollPtr geom); +/** + Checks for Clockwise Geometry object + + \param geom pointer to Geometry object + + \return 0 if the Geometry is not clockwise: otherwise any other different value. + + \note a Clockwise Geometry contains no Polygons, or alternatively + contains only Clockwise Polygons. + A Clockwise Polygon has a Clockwise exterior ring and all interior rings + are Counter-Clockwise. + */ + GAIAGEO_DECLARE int gaiaCheckClockwise (gaiaGeomCollPtr geom); + +/** + Checks for CounterClockwise Geometry object + + \param geom pointer to Geometry object + + \return 0 if the Geometry is not counter-clockwise: otherwise any other different value. + + \note a CounterClockwise Geometry contains no Polygons, or alternatively + contains only CounterClockwise Polygons. + A CounterClockwise Polygon has a CounterClockwise exterior ring and all + interior rings are Clockwise. + */ + GAIAGEO_DECLARE int gaiaCheckCounterClockwise (gaiaGeomCollPtr geom); + /** Checks for toxic Geometry object \param geom pointer to Geometry object @@ -1482,10 +1512,47 @@ gaiaGeomCollPtr geom1, gaiaGeomCollPtr geom2); +/** + Will return a new GEOMETRY (supporting M) with measures linearly + interpolated between the start and end points. + + \param geom pointer to Geometry object of the Linestring or MultiLinestring type. + \param m_start M start value + \param m_end M end value + + \return the pointer to newly created Geometry: NULL on failure. + + \note you are responsible to destroy (before or after) any allocated Geometry, + this including any Geometry created by gaiaAddMeasure() + \n the newly created Geometry will contain Linestrings. + \n if the input Geometry has no M dimension it will be added, otherwise + it will overwritten. + \n an eventual Z will be preserved unaffected. + */ + GAIAGEO_DECLARE gaiaGeomCollPtr + gaiaAddMeasure (gaiaGeomCollPtr geom, double m_start, double m_end); + +/** + Will interpolate the M-value for a LinestringM at the point closest to the + given Point. + + \param p_cache a memory pointer returned by spatialite_alloc_connection() + \param line pointer to Geometry object of the Linestring type and supporting + the M dimension. + \param point pointer to Geometry object of the Point type. + \param m_value on succesfull completion this variable will contain the + interpolated M value + + \return 0 on failure: any other value on success. + */ + GAIAGEO_DECLARE int + gaiaInterpolatePoint (const void *p_cache, gaiaGeomCollPtr line, + gaiaGeomCollPtr point, double *m_value); + /** Return a GeometryCollection containing elements matching the specified range of measures \param geom pointer to Geometry object \param m_start range of measures: start value Index: src/headers/spatialite/gg_formats.h ================================================================== --- src/headers/spatialite/gg_formats.h +++ src/headers/spatialite/gg_formats.h @@ -511,22 +511,46 @@ \param geom pointer to the Geometry object. \param result on completion will containt a pointer to BLOB-Geometry: NULL on failure. \param size on completion this variable will contain the BLOB's size (in bytes) - \param gpkg_mode is set to TRUE will always return GPKG Geometry-BLOBs + \param gpkg_mode if set to TRUE will always return GPKG Geometry-BLOBs - \sa gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb + \sa gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb, + gaiaToSpatiaLiteBlobWkbEx2 \note the BLOB buffer corresponds to dynamically allocated memory: so you are responsible to free() it [unless SQLite will take care of memory cleanup via buffer binding]. */ GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx (gaiaGeomCollPtr geom, unsigned char **result, int *size, int gpkg_mode); +/** + Creates a BLOB-Geometry corresponding to a Geometry object + + \param geom pointer to the Geometry object. + \param result on completion will containt a pointer to BLOB-Geometry: + NULL on failure. + \param size on completion this variable will contain the BLOB's size (in bytes) + \param gpkg_mode if set to TRUE will always return GPKG Geometry-BLOBs + \param tiny_point if set to TRUE all POINT Geometries will be encoded + by using the TinyPoint BLOB format. + + \sa gaiaFromSpatiaLiteBlobWkb, gaiaToCompressedBlobWkb, + gaiaToSpatiaLiteBlobWkbEx + + \note the BLOB buffer corresponds to dynamically allocated memory: + so you are responsible to free() it [unless SQLite will take care + of memory cleanup via buffer binding]. + */ + GAIAGEO_DECLARE void gaiaToSpatiaLiteBlobWkbEx2 (gaiaGeomCollPtr geom, + unsigned char **result, + int *size, int gpkg_mode, + int tiny_point); + /** Creates a Compressed BLOB-Geometry corresponding to a Geometry object \param geom pointer to the Geometry object. \param result on completion will containt a pointer to Compressed BLOB-Geometry: Index: src/headers/spatialite/gg_structs.h ================================================================== --- src/headers/spatialite/gg_structs.h +++ src/headers/spatialite/gg_structs.h @@ -60,10 +60,19 @@ #ifdef __cplusplus extern "C" { #endif +/* supporting files bigger than 2 GB */ +#ifdef _WIN32 /* windows */ +#define gaia_off_t __int64 +#define gaia_fseek _fseeki64 +#else /* not windows */ +#define gaia_off_t off_t +#define gaia_fseek fseeko +#endif + /** Container for OGC POINT Geometry */ typedef struct gaiaPointStruct { @@ -497,11 +506,11 @@ */ struct vrttxt_line { /* a struct representing a full LINE (aka Record) */ /** current offset (parsing) */ - off_t offset; + gaia_off_t offset; /** line length (in bytes) */ int len; /** array of field offsets (where each field starts) */ int field_offsets[VRTTXT_FIELDS_MAX]; /** number of field into the record */ @@ -517,11 +526,11 @@ { /* a struct storing Row offsets */ /** Line Number */ int line_no; /** start offset */ - off_t offset; + gaia_off_t offset; /** record (line) length (in bytes) */ int len; /** number of fields into this record */ int num_fields; }; @@ -650,10 +659,16 @@ { /** Read-Only layer: TRUE or FALSE */ int IsReadOnly; /** Hidden layer: TRUE or FALSE */ int IsHidden; +/** Flag indicating if the Capabilities of the SpatialView supports Inserting: TRUE or FALSE */ + int HasTriggerInsert; +/** Flag indicating if the Capabilities of the SpatialView supports Updating: TRUE or FALSE */ + int HasTriggerUpdate; +/** Flag indicating if the Capabilities of the SpatialView supports Deleting: TRUE or FALSE */ + int HasTriggerDelete; } gaiaLayerAuth; /** Typedef for Layer Auth infos ADDED src/headers/spatialite/stored_procedures.h Index: src/headers/spatialite/stored_procedures.h ================================================================== --- src/headers/spatialite/stored_procedures.h +++ src/headers/spatialite/stored_procedures.h @@ -0,0 +1,641 @@ +/* + stored_procedues.h -- SQL Procedures and Stored Procedures functions + + version 4.5, 2017 October 22 + + 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) 2017 +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. + +*/ + +/** + \file stored_procedures.h + + SQL Procedures and Stored Procedures functions + */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#ifdef DLL_EXPORT +#define SQLPROC_DECLARE __declspec(dllexport) +#else +#define SQLPROC_DECLARE extern +#endif +#endif + +#ifndef _SQLPROC_H +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#define _SQLPROC_H +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* constants */ +/** SQL Procedure BLOB start marker */ +#define SQLPROC_START 0xcd +/** SQL Procedure BLOB delimiter marker */ +#define SQLPROC_DELIM 0x87 +/** SQL Procedure BLOB stop marker */ +#define SQLPROC_STOP 0xdc + +/* data structures */ +/** + SqlProc: Variable with value + */ + typedef struct gaiaSqlProc_VariableStruct + { +/** Variable Name */ + char *Name; +/** Variable Value */ + char *Value; +/** Pointer to next Variable (linked list) */ + struct gaiaSqlProc_VariableStruct *Next; + } SqlProc_Variable; +/** + Typedef for SqlProc Variable structure + + \sa SqlProc_VarList + */ + typedef SqlProc_Variable *SqlProc_VariablePtr; + +/** + SqlProc: List of Variables with values + */ + typedef struct gaiaSqlProc_VarListStruct + { +/** invalid object */ + int Error; +/** Error Message (if any) */ + char *ErrMessage; +/** pointer to first Variable [linked list] */ + SqlProc_VariablePtr First; /* Variables linked list - first */ +/** pointer to last Variable [linked list] */ + SqlProc_VariablePtr Last; /* Variables linked list - last */ + } SqlProc_VarList; +/** + Typedef for SqlProc Variables List structure + + \sa SqlProc_Variable + */ + typedef SqlProc_VarList *SqlProc_VarListPtr; + + +/* function prototypes */ + +/** + Return the most recent SQL Procedure error (if any) + + \param ptr a memory pointer returned by spatialite_alloc_connection() + + \return the most recent SQL Procedure error message (if any); + NULL in any other case. + */ + SQLPROC_DECLARE char *gaia_sql_proc_get_last_error (const void *p_cache); + +/** + Will enable/disable a Logfile supporting Execute methods + + \param ptr a memory pointer returned by spatialite_alloc_connection() + \param filepath the pathname of the Logfile. NULL to disable logging. + \param append if TRUE the Logfile will be opened in append mode, + otherwise will be trucated. + + \return 0 on failure, any other value on success. + + \sa gaia_sql_proc_execute + */ + SQLPROC_DECLARE int gaia_sql_proc_logfile (const void *p_cache, + const char *filepath, + int append); + +/** + Creates an empty list of Variables with Values + + \return pointer to the Variables List + + \sa gaia_sql_proc_destroy_variables, gaia_sql_proc_add_variable, + gaia_sql_proc_cooked_sql, gaia_sql_proc_execute + + \note you are responsible to destroy (before or after) the Variables List + Object returned by this function by calling gaia_sql_proc_destroy_variables(). + */ + SQLPROC_DECLARE SqlProc_VarListPtr gaia_sql_proc_create_variables (); + +/** + Destroys a list of Variables with Values + + \param list pointer to the Variables List Object to be destroyed. + + \sa gaia_sql_proc_create_variables + */ + SQLPROC_DECLARE void + gaia_sql_proc_destroy_variables (SqlProc_VarListPtr list); + +/** + Add a Variable with Value to the List + + \param list pointer to the Variables List Object. + \param str text string expected to contain a Variable with Value + in the canonical form '@varname@=value'. + + \return 0 on failure, any other value on success. + + \sa gaia_sql_proc_create_variables, gaia_sql_proc_destroy_variables + */ + SQLPROC_DECLARE int + gaia_sql_proc_add_variable (SqlProc_VarListPtr list, const char *str); + +/** + Builds a SQL Procedure BLOB object from Text + + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param sql body of the SQL-script + \param charset the GNU ICONV name identifying the sql body charset + \param blob on succesfull completion this pointer will reference the + BLOB SQL Procedure Object (NULL on failure). + \param blob_sz on succesfull completion this pointer will reference + the size (in bytes) of the BLOB SQL Procedure Object. + + \return 0 on failure, any other value on success. + + \sa gaia_sql_proc_import, gaia_sql_proc_get_last_error, + gaia_sql_proc_is_valid, gaia_sql_proc_count, + gaia_sql_proc_variable, gaia_sql_proc_all_variables, + gaia_sql_proc_raw_sql, gaia_sql_proc_cooked_sql + + \note you are responsible to free (before or after) the BLOB + SQL Procedure Object returned by this function. + */ + SQLPROC_DECLARE int gaia_sql_proc_parse (const void *cache, + const char *sql, + const char *charset, + unsigned char **blob, + int *blob_sz); + +/** + Builds a SQL Procedure BLOB object from an external file + + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param filepath path to the SQL-script to be loaded. + \param charset the GNU ICONV name identifying the sql body charset + \param blob on succesfull completion this pointer will reference the + BLOB SQL Procedure Object (NULL on failure). + \param blob_sz on succesfull completion this pointer will reference + the size (in bytes) of the BLOB SQL Procedure Object. + + \return 0 on failure, any other value on success. + + \sa gaia_sql_proc_parse, gaia_sql_proc_get_last_error + + \note you are responsible to free (before or after) the BLOB + SQL Procedure Object returned by this function. + */ + SQLPROC_DECLARE int gaia_sql_proc_import (const void *cache, + const char *filepath, + const char *charset, + unsigned char **blob, + int *blob_sz); + +/** + Checks if a BLOB is a valid SQL Procedure Object + + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + + \return 0 on failure: any other different value on success. + + \sa gaia_sql_proc_parse +*/ + SQLPROC_DECLARE int gaia_sql_proc_is_valid (const unsigned char + *blob, int blob_sz); + +/** + Checks if a TEXT is a valid SQL Variable with Value + + \param str the text string to be evaluated. + + \return 0 on failure: any other different value on success. +*/ + SQLPROC_DECLARE int gaia_sql_proc_is_valid_var_value (const char *str); + +/** + Return the total count of Variables from a SQL Procedure Object + + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + + \return the total count of Variables or -1 on invalid Object + + \sa gaia_sql_proc_parse, gaia_sql_proc_variable +*/ + SQLPROC_DECLARE int gaia_sql_proc_var_count (const unsigned char + *blob, int blob_sz); + +/** + Return the Name of the Nth Variable from a SQL Procedure Object + + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + \param index the first Variable has Index=0. + + \return the name of the Nth Variable or NULL on invalid Object or + invalid Index. + + \sa gaia_sql_proc_parse, gaia_sql_proc_var_count, + gaia_sql_proc_all_variables, gaia_sql_proc_raw_sql + + \note you are responsible to free (before or after) the Variable Name + returned by this function. +*/ + SQLPROC_DECLARE char *gaia_sql_proc_variable (const unsigned + char *blob, + int blob_sz, int index); + +/** + Return the Names of all Variables from a SQL Procedure Object + + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + + \return a list of Variable Names separated by spaces or NULL on + invalid arguments. + + \sa gaia_sql_proc_parse, gaia_sql_proc_var_count + + \note you are responsible to free (before or after) the Variable Names + returned by this function. +*/ + SQLPROC_DECLARE char *gaia_sql_proc_all_variables (const + unsigned char + *blob, int blob_sz); + +/** + Return the raw SQL body from a SQL Procedure Object + + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + + \return the raw SQL body or NULL on invalid arguments. + + \sa gaia_sql_proc_parse, gaia_sql_proc_var_count + + \note you are responsible to free (before or after) the raw SQL body + returned by this function. +*/ + SQLPROC_DECLARE char *gaia_sql_proc_raw_sql (const unsigned char + *blob, int blob_sz); + +/** + Return a cooked SQL body from a raw SQL body by replacing Variable Values + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + \param variables list of Variables with Values. + \param sql on succesfull completions will point to the "cooked" SQL body; + NULL on failure. + + \return 0 on failure: any other different value on success. + + \sa gaia_sql_proc_parse, gaia_sql_proc_var_count, + gaia_sql_proc_create_variables + + \note you are responsible to free (before or after) the cooked SQL body + returned by this function. +*/ + SQLPROC_DECLARE int gaia_sql_proc_cooked_sql (sqlite3 * handle, + const void *cache, + const unsigned char *blob, + int blob_sz, + SqlProc_VarListPtr variables, + char **sql); + +/** + Will attempt to create the Stored Procedures Tables if not already existing + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_store, gaia_stored_proc_fetch, + gaia_stored_proc_delete, gaia_stored_proc_update_title, + gaia_stored_proc_update_sql, gaia_stored_var_store, + gaia_stored_var_fetch, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_proc_create_tables (sqlite3 * + handle, + const void *cache); + +/** + Permanently inserts a Stored Procedure into the DB + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Procedure. + \param title short description of the Stored Procedure. + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_fetch, + gaia_stored_proc_delete, gaia_stored_proc_update_title, + gaia_stored_proc_update_sql, gaia_stored_var_store, + gaia_stored_var_fetch, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_proc_store (sqlite3 * handle, + const void *cache, + const char *name, + const char *title, + const unsigned char + *blob, int blob_sz); + +/** + Retrieves a permanent Stored Procedure from the DB + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Procedure. + \param blob on succesfull completion this pointer will reference the + BLOB SQL Procedure Object (NULL on failure). + \param blob_sz on succesfull completion this pointer will reference + the size (in bytes) of the BLOB SQL Procedure Object. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_delete, gaia_stored_proc_update_title, + gaia_stored_proc_update_sql, gaia_stored_var_store, + gaia_stored_var_fetch, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value + + \note you are responsible to free (before or after) the BLOB + SQL Procedure Object returned by this function. +*/ + SQLPROC_DECLARE int gaia_stored_proc_fetch (sqlite3 * handle, + const void *cache, + const char *name, + unsigned char **blob, + int *blob_sz); + +/** + Removes a permanent Stored Procedure from the DB + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Procedure. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetche, gaia_stored_proc_update_title, + gaia_stored_proc_update_sql, gaia_stored_var_store, + gaia_stored_var_fetch, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_proc_delete (sqlite3 * handle, + const void *cache, + const char *name); + +/** + Updates the Title on a permanent Stored Procedure + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Procedure. + \param title short description of the Stored Procedure. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetch, gaia_stored_proc_delete, + gaia_stored_proc_update_sql, gaia_stored_var_store, + gaia_stored_var_fetch, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_proc_update_title (sqlite3 * + handle, + const void + *cache, + const char + *name, + const char *title); + +/** + Updates the Raw SQL Body on a permanent Stored Procedure + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Procedure. + \param blob pointer to the BLOB Object. + \param blob_sz size (in bytes) of the BLOB Object. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetch, gaia_stored_proc_delete, + gaia_stored_proc_update_title, gaia_stored_var_store, + gaia_stored_var_fetch, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_proc_update_sql (sqlite3 * + handle, + const void + *cache, + const char + *name, + const + unsigned char + *blob, int blob_sz); + +/** + Permanently inserts a Stored Variable into the DB + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Variable. + \param title short description of the Stored Variable. + \param value the Variable Value in its textual representation. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetch, gaia_stored_proc_delete, + gaia_stored_proc_update_title, gaia_stored_proc_update_sql, + gaia_stored_var_fetch, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_var_store (sqlite3 * handle, + const void *cache, + const char *name, + const char *title, + const char *value); + +/** + Retrieves a Stored Variable from the DB + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Variable. + \param var_with_val if set to TRUE value will point to a Variable with + Name string, otherwise (FALSE) it will point to a bare textual value. + \param value on succesfull completion this pointer will reference + the Stored Variable represented as a Variable with Value or as a bare + textual value depending on var_with_val setting. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetch, gaia_stored_proc_delete, + gaia_stored_proc_update_title, gaia_stored_proc_update_sql, + gaia_stored_var_store, gaia_stored_var_delete, + gaia_stored_var_update_title, gaia_stored_var_update_value + + \note you are responsible to free (before or after) the Text + String returned by this function. +*/ + SQLPROC_DECLARE int gaia_stored_var_fetch (sqlite3 * handle, + const void *cache, + const char *name, + int var_with_val, char **value); + +/** + Removes a Stored Variable from the DB + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Variable. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetch, gaia_stored_proc_delete, + gaia_stored_proc_update_title, gaia_stored_proc_update_sql, + gaia_stored_var_store, gaia_stored_var_fetch, + gaia_stored_var_update_title, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_var_delete (sqlite3 * handle, + const void *cache, + const char *name); + +/** + Updates the Title on a Stored Variable + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Variable. + \param title short description of the Stored Variable. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetch, gaia_stored_proc_delete, + gaia_stored_proc_update_title, gaia_stored_proc_update_sql, + gaia_stored_var_store, gaia_stored_var_store, gaia_stored_var_fetch, + gaia_stored_var_delete, gaia_stored_var_update_value +*/ + SQLPROC_DECLARE int gaia_stored_var_update_title (sqlite3 * + handle, + const void + *cache, + const char + *name, const char *title); + +/** + Updates the Value on a Stored Variable + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param name unique identifier of the Stored Variable. + \param value the Variable Value in its textual representation. + + \return 0 on failure: any other different value on success. + + \sa gaia_stored_proc_create_tables, gaia_stored_proc_store, + gaia_stored_proc_fetch, gaia_stored_proc_delete, + gaia_stored_proc_update_title, gaia_stored_proc_update_sql, + gaia_stored_var_store, gaia_stored_var_store, gaia_stored_var_fetch, + gaia_stored_var_delete, gaia_stored_var_update_title +*/ + SQLPROC_DECLARE int gaia_stored_var_update_value (sqlite3 * + handle, + const void + *cache, + const char + *name, const char *value); + +/** + Executing a cooked SQL Procedure + + \param handle pointer to the current DB connection. + \param cache the same memory pointer passed to the corresponding call to + spatialite_init_ex() and returned by spatialite_alloc_connection() + \param sql the cooked SQL Body to be executed. + + \return 0 on failure: any other different value on success. + + \sa gaia_sql_proc_logfile +*/ + SQLPROC_DECLARE int gaia_sql_proc_execute (sqlite3 * + handle, + const void *cache, + const char *sql); + +#ifdef __cplusplus +} +#endif + +#endif /* _SQLPROC_H */ Index: src/headers/spatialite_private.h ================================================================== --- src/headers/spatialite_private.h +++ src/headers/spatialite_private.h @@ -131,10 +131,22 @@ { char *savepoint_name; struct splite_savepoint *prev; struct splite_savepoint *next; }; + + struct splite_shp_extent + { + char *table; + double minx; + double maxx; + double miny; + double maxy; + int srid; + struct splite_shp_extent *prev; + struct splite_shp_extent *next; + }; #define MAX_XMLSCHEMA_CACHE 16 struct splite_internal_cache { @@ -147,10 +159,12 @@ void *RTTOPO_handle; void *xmlParsingErrors; void *xmlSchemaValidationErrors; void *xmlXPathErrors; char *cutterMessage; + char *storedProcError; + char *createRoutingError; struct splite_geos_cache_item cacheItem1; struct splite_geos_cache_item cacheItem2; struct splite_xmlSchema_cache_item xmlSchemaCache[MAX_XMLSCHEMA_CACHE]; int pool_index; void (*geos_warning) (const char *fmt, ...); @@ -171,12 +185,18 @@ unsigned int next_network_savepoint; struct splite_savepoint *first_net_svpt; struct splite_savepoint *last_net_svpt; gaiaSequencePtr first_seq; gaiaSequencePtr last_seq; + struct splite_shp_extent *first_shp_extent; + struct splite_shp_extent *last_shp_extent; int ok_last_used_sequence; int last_used_sequence_val; + char *SqlProcLogfile; + FILE *SqlProcLog; + int SqlProcContinue; + int tinyPointEnabled; unsigned char magic2; }; struct epsg_defs { @@ -290,10 +310,13 @@ SPATIALITE_PRIVATE void free_epsg (struct epsg_defs *first); SPATIALITE_PRIVATE int exists_spatial_ref_sys (void *handle); SPATIALITE_PRIVATE int checkSpatialMetaData (const void *sqlite); + + SPATIALITE_PRIVATE int checkSpatialMetaData_ex (const void *sqlite, + const char *db_prefix); SPATIALITE_PRIVATE int delaunay_triangle_check (void *pg); SPATIALITE_PRIVATE void *voronoj_build (int pgs, void *first, double extra_frame_size); @@ -614,10 +637,11 @@ const char *fileIdentifier); SPATIALITE_PRIVATE int createRasterCoveragesTable (void *p_sqlite); SPATIALITE_PRIVATE int checkPopulatedCoverage (void *p_sqlite, + const char *db_prefix, const char *coverage_name); SPATIALITE_PRIVATE int createVectorCoveragesTable (void *p_sqlite); SPATIALITE_PRIVATE int register_vector_coverage (void *p_sqlite, @@ -625,21 +649,71 @@ *coverage_name, const char *f_table_name, const char *f_geometry_column, const char *title, - const char *abstract); + const char *abstract, + int is_queryable, + int is_editable); + + SPATIALITE_PRIVATE int register_spatial_view_coverage (void *p_sqlite, + const char + *coverage_name, + const char + *view_name, + const char + *view_geometry, + const char *title, + const char *abstract, + int is_queryable, + int is_editable); + + SPATIALITE_PRIVATE int register_virtual_shp_coverage (void *p_sqlite, + const char + *coverage_name, + const char *virt_name, + const char + *virt_geometry, + const char *title, + const char *abstract, + int is_queryable); + + SPATIALITE_PRIVATE int register_topogeo_coverage (void *p_sqlite, + const char + *coverage_name, + const char *topogeo_name, + const char *title, + const char *abstract, + int is_queryable, + int is_editable); + + SPATIALITE_PRIVATE int register_toponet_coverage (void *p_sqlite, + const char + *coverage_name, + const char *toponet_name, + const char *title, + const char *abstract, + int is_queryable, + int is_editable); SPATIALITE_PRIVATE int unregister_vector_coverage (void *p_sqlite, const char *coverage_name); SPATIALITE_PRIVATE int set_vector_coverage_infos (void *p_sqlite, const char *coverage_name, const char *title, - const char *abstract); + const char *abstract, + int is_queryable, + int is_editable); + + SPATIALITE_PRIVATE int set_vector_coverage_copyright (void *p_sqlite, + const char + *coverage_name, + const char *copyright, + const char *license); SPATIALITE_PRIVATE int register_vector_coverage_srid (void *p_sqlite, const char *coverage_name, int srid); @@ -709,10 +783,16 @@ SPATIALITE_PRIVATE int set_wms_getmap_infos (void *p_sqlite, const char *url, const char *layer_name, const char *title, const char *abstract); + + SPATIALITE_PRIVATE int set_wms_getmap_copyright (void *p_sqlite, + const char *url, + const char *layer_name, + const char *copyright, + const char *license); SPATIALITE_PRIVATE int set_wms_getmap_bgcolor (void *p_sqlite, const char *url, const char *layer_name, const char *bgcolor); @@ -790,10 +870,25 @@ int y, double minx, double miny, double maxx, double maxy, int feature_count); + + SPATIALITE_PRIVATE int register_data_license (void *p_sqlite, + const char *license_name, + const char *url); + + SPATIALITE_PRIVATE int unregister_data_license (void *p_sqlite, + const char *license_name); + + SPATIALITE_PRIVATE int rename_data_license (void *p_sqlite, + const char *old_name, + const char *new_name); + + SPATIALITE_PRIVATE int set_data_license_url (void *p_sqlite, + const char *license_name, + const char *url); SPATIALITE_PRIVATE const char *splite_rttopo_version (void); SPATIALITE_PRIVATE void splite_free_geos_cache_item (struct splite_geos_cache_item @@ -859,10 +954,17 @@ SPATIALITE_PRIVATE int gaiaAuxClonerCheckValidTarget (const void *cloner); SPATIALITE_PRIVATE int gaiaAuxClonerExecute (const void *cloner); + SPATIALITE_PRIVATE const void *gaiaElemGeomOptionsCreate (); + + SPATIALITE_PRIVATE void gaiaElemGeomOptionsAdd (const void *options, + const char *option); + + SPATIALITE_PRIVATE void gaiaElemGeomOptionsDestroy (const void *options); + SPATIALITE_PRIVATE int gaia_matrix_to_arrays (const unsigned char *blob, int blob_sz, double *E, double *N, double *Z); /* Topology SQL functions */ @@ -874,10 +976,18 @@ SPATIALITE_PRIVATE void fnctaux_GetLastTopologyException (const void *context, int argc, const void *argv); + + SPATIALITE_PRIVATE void fnctaux_CreateTopoTables (const void *context, + int argc, + const void *argv); + + SPATIALITE_PRIVATE int do_create_topologies (void *sqlite_handle); + + SPATIALITE_PRIVATE int do_create_networks (void *sqlite_handle); SPATIALITE_PRIVATE void fnctaux_CreateTopology (const void *context, int argc, const void *argv); SPATIALITE_PRIVATE void fnctaux_DropTopology (const void *context, @@ -1005,10 +1115,18 @@ const void *argv); SPATIALITE_PRIVATE void fnctaux_TopoGeo_ToGeoTable (const void *context, int argc, const void *argv); + + SPATIALITE_PRIVATE void fnctaux_TopoGeo_PolyFacesList (const void *context, + int argc, + const void *argv); + + SPATIALITE_PRIVATE void fnctaux_TopoGeo_LineEdgesList (const void *context, + int argc, + const void *argv); SPATIALITE_PRIVATE void fnctaux_TopoGeo_ToGeoTableGeneralize (const void *context, int argc, const void @@ -1042,12 +1160,12 @@ SPATIALITE_PRIVATE void fnctaux_TopoGeo_NewEdgesSplit (const void *context, int argc, const void *argv); SPATIALITE_PRIVATE void fnctaux_TopoGeo_ModEdgeSplit (const void *context, - int argc, - const void *argv); + int argc, + const void *argv); SPATIALITE_PRIVATE void fnctaux_TopoGeo_CreateTopoLayer (const void *context, int argc, const void *argv); @@ -1080,10 +1198,16 @@ SPATIALITE_PRIVATE void fnctaux_TopoGeo_SubdivideLines (const void *context, int argc, const void *argv); + + SPATIALITE_PRIVATE void fnctaux_TopoGeo_DisambiguateSegmentEdges (const void + *context, + int argc, + const void + *argv); SPATIALITE_PRIVATE void fnctaux_TopoGeo_GetEdgeSeed (const void *context, int argc, const void *argv); @@ -1111,10 +1235,23 @@ SPATIALITE_PRIVATE void release_topo_savepoint (const void *handle, const void *cache); SPATIALITE_PRIVATE void rollback_topo_savepoint (const void *handle, const void *cache); + + SPATIALITE_PRIVATE void add_shp_extent (const char *table, double minx, + double miny, double maxx, + double maxy, int srid, + const void *cache); + + SPATIALITE_PRIVATE void remove_shp_extent (const char *table, + const void *cache); + + SPATIALITE_PRIVATE int get_shp_extent (const char *table, double *minx, + double *miny, double *maxx, + double *maxy, int *srid, + const void *cache); /* Topology-Network SQL functions */ SPATIALITE_PRIVATE void fnctaux_GetLastNetworkException (const void *context, int argc, @@ -1221,10 +1358,20 @@ const void *argv); SPATIALITE_PRIVATE void fnctaux_TopoNet_UpdateSeeds (const void *context, int argc, const void *argv); + + SPATIALITE_PRIVATE void fnctaux_TopoNet_DisambiguateSegmentLinks (const void + *context, + int argc, + const void + *argv); + + SPATIALITE_PRIVATE void fnctaux_TopoNet_LineLinksList (const void *context, + int argc, + const void *argv); SPATIALITE_PRIVATE void start_net_savepoint (const void *handle, const void *cache); SPATIALITE_PRIVATE void release_net_savepoint (const void *handle, @@ -1232,11 +1379,61 @@ SPATIALITE_PRIVATE void rollback_net_savepoint (const void *handle, const void *cache); SPATIALITE_PRIVATE int test_inconsistent_topology (const void *handle); + + SPATIALITE_PRIVATE char *url_toUtf8 (const char *url, + const char *in_charset); + + SPATIALITE_PRIVATE char *url_fromUtf8 (const char *url, + const char *out_charset); + + SPATIALITE_PRIVATE int gaia_check_reference_geo_table (const void *handle, + const char + *db_prefix, + const char *table, + const char *column, + char **xtable, + char **xcolumn, + int *srid, + int *family); + + SPATIALITE_PRIVATE int gaia_check_output_table (const void *handle, + const char *table); + + SPATIALITE_PRIVATE int gaia_check_spatial_index (const void *handle, + const char *db_prefix, + const char *ref_table, + const char *ref_column); + + SPATIALITE_PRIVATE int gaia_do_eval_disjoint (const void *handle, + const char *matrix); + + SPATIALITE_PRIVATE int gaia_do_eval_overlaps (const void *handle, + const char *matrix); + + SPATIALITE_PRIVATE int gaia_do_eval_covers (const void *handle, + const char *matrix); + + SPATIALITE_PRIVATE int gaia_do_eval_covered_by (const void *handle, + const char *matrix); + + SPATIALITE_PRIVATE void gaia_do_check_direction (const void *x1, + const void *x2, + char *direction); + + SPATIALITE_PRIVATE int gaia_do_check_linestring (const void *geom); + + SPATIALITE_PRIVATE void spatialite_internal_init (void *db_handle, + const void *ptr); + + SPATIALITE_PRIVATE void spatialite_internal_cleanup (const void *ptr); + + SPATIALITE_PRIVATE void gaia_sql_proc_set_error (const void *p_cache, + const char *errmsg); #ifdef __cplusplus } #endif #endif /* _SPATIALITE_PRIVATE_H */ Index: src/md5/Makefile.am ================================================================== --- src/md5/Makefile.am +++ src/md5/Makefile.am @@ -1,18 +1,18 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers -I. noinst_HEADERS = md5.h noinst_LTLIBRARIES = libmd5.la md5.la libmd5_la_SOURCES = md5.c gaia_md5.c md5_la_SOURCES = md5.c gaia_md5.c -md5_la_CPPFLAGS = @CFLAGS@ +md5_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ md5_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. md5_la_CPPFLAGS += -DLOADABLE_EXTENSION md5_la_LDFLAGS = -module md5_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/md5/Makefile.in ================================================================== --- src/md5/Makefile.in +++ src/md5/Makefile.in @@ -307,16 +307,16 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers -I. noinst_HEADERS = md5.h noinst_LTLIBRARIES = libmd5.la md5.la libmd5_la_SOURCES = md5.c gaia_md5.c md5_la_SOURCES = md5.c gaia_md5.c -md5_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ +md5_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers -I. \ -DLOADABLE_EXTENSION md5_la_LDFLAGS = -module md5_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/shapefiles/Makefile.am ================================================================== --- src/shapefiles/Makefile.am +++ src/shapefiles/Makefile.am @@ -1,17 +1,17 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libshapefiles.la shapefiles.la libshapefiles_la_SOURCES = shapefiles.c validator.c shapefiles_la_SOURCES = shapefiles.c validator.c -shapefiles_la_CPPFLAGS = @CFLAGS@ +shapefiles_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ shapefiles_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. shapefiles_la_CPPFLAGS += -DLOADABLE_EXTENSION shapefiles_la_LDFLAGS = -module shapefiles_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/shapefiles/Makefile.in ================================================================== --- src/shapefiles/Makefile.in +++ src/shapefiles/Makefile.in @@ -306,16 +306,16 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libshapefiles.la shapefiles.la libshapefiles_la_SOURCES = shapefiles.c validator.c shapefiles_la_SOURCES = shapefiles.c validator.c -shapefiles_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +shapefiles_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ \ + -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION shapefiles_la_LDFLAGS = -module shapefiles_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/shapefiles/shapefiles.c ================================================================== --- src/shapefiles/shapefiles.c +++ src/shapefiles/shapefiles.c @@ -116,10 +116,25 @@ struct resultset_values *current; int num_columns; sqlite3_int64 previous_rowid; sqlite3_int64 current_rowid; }; + +struct aux_elemgeom_ignore +{ +/* an Elementary Geometries Ignore option */ + char *column; + struct aux_elemgeom_ignore *next; +}; + +struct aux_elemgeom_options +{ +/* Elementary Geometries Options */ + struct aux_elemgeom_ignore *first; + struct aux_elemgeom_ignore *last; + int cast2multi; +}; static struct resultset_comparator * create_resultset_comparator (int columns) { /* creating an empty resultset comparator object */ @@ -1664,11 +1679,10 @@ free (srsWkt); return; } #ifndef OMIT_ICONV /* ICONV enabled: supporting SHAPEFILE and DBF */ - static int get_default_dbf_fields (sqlite3 * sqlite, const char *xtable, const char *db_prefix, const char *table_name, gaiaDbfListPtr * dbf_export_list) @@ -5616,10 +5630,39 @@ SPATIALITE_DECLARE void elementary_geometries_ex2 (sqlite3 * sqlite, char *inTable, char *geometry, char *outTable, char *pKey, char *multiId, int *xrows, int transaction) +{ +/* attempting to create a derived table surely containing elemetary Geoms */ + elementary_geometries_ex3 (sqlite, inTable, geometry, outTable, pKey, + multiId, NULL, xrows, transaction); +} + +static int +test_elemgeom_ignore (struct aux_elemgeom_options *options, const char *column) +{ +/* testing for a column to be ignored */ + struct aux_elemgeom_ignore *ign; + if (options == NULL) + return 0; + + ign = options->first; + while (ign != NULL) + { + if (strcasecmp (ign->column, column) == 0) + return 1; + ign = ign->next; + } + return 0; +} + +SPATIALITE_DECLARE void +elementary_geometries_ex3 (sqlite3 * sqlite, + char *inTable, char *geometry, char *outTable, + char *pKey, char *multiId, const void *opts, + int *xrows, int transaction) { /* attempting to create a derived table surely containing elemetary Geoms */ char type[128]; int srid; char dims[64]; @@ -5637,16 +5680,18 @@ char *errMsg = NULL; int i; char **results; int rows; int columns; + int i_col; int geom_idx = -1; sqlite3_stmt *stmt_in = NULL; sqlite3_stmt *stmt_out = NULL; int n_columns; sqlite3_int64 id = 0; int inserted = 0; + struct aux_elemgeom_options *options = (struct aux_elemgeom_options *) opts; if (check_elementary (sqlite, inTable, geometry, outTable, pKey, multiId, type, &srid, dims) == 0) { @@ -5710,12 +5755,20 @@ } if (rows < 1) ; else { + i_col = 0; for (i = 1; i <= rows; i++) { + if (test_elemgeom_ignore (options, results[(i * columns) + 1]) + && strcasecmp (geometry, results[(i * columns) + 1]) != 0) + { + /* skipping a column to be ignored */ + continue; + } + i_col++; xname = gaiaDoubleQuotedSql (results[(i * columns) + 1]); if (comma) sql = sqlite3_mprintf (", \"%s\"", xname); else { @@ -5723,15 +5776,26 @@ sql = sqlite3_mprintf ("\"%s\"", xname); } free (xname); gaiaAppendToOutBuffer (&sql_statement, sql); gaiaAppendToOutBuffer (&sql2, sql); - gaiaAppendToOutBuffer (&sql3, ", ?"); + if (strcasecmp (geometry, results[(i * columns) + 1]) == 0) + { + int cast2multi = 0; + if (options != NULL) + cast2multi = options->cast2multi; + if (cast2multi) + gaiaAppendToOutBuffer (&sql3, ", CastToMulti(?)"); + else + gaiaAppendToOutBuffer (&sql3, ", ?"); + } + else + gaiaAppendToOutBuffer (&sql3, ", ?"); sqlite3_free (sql); if (strcasecmp (geometry, results[(i * columns) + 1]) == 0) - geom_idx = i - 1; + geom_idx = i_col - 1; else { xname = gaiaDoubleQuotedSql (results[(i * columns) + 1]); if (atoi (results[(i * columns) + 3]) != 0) sql = @@ -5759,13 +5823,42 @@ gaiaAppendToOutBuffer (&sql2, sql3.Buffer); gaiaAppendToOutBuffer (&sql2, ")"); gaiaAppendToOutBuffer (&sql4, ")"); gaiaOutBufferReset (&sql3); - sql_geom = - sqlite3_mprintf ("SELECT AddGeometryColumn(%Q, %Q, %d, %Q, %Q)", - outTable, geometry, srid, type, dims); + if (options != NULL) + { + if (options->cast2multi) + { + char multi_type[128]; + if (strcasecmp (type, "POINT") == 0) + strcpy (multi_type, "MULTIPOINT"); + else if (strcasecmp (type, "LINESTRING") == 0) + strcpy (multi_type, "MULTILINESTRING"); + else if (strcasecmp (type, "POLYGON") == 0) + strcpy (multi_type, "MULTIPOLYGON"); + else + strcpy (multi_type, type); + sql_geom = + sqlite3_mprintf + ("SELECT AddGeometryColumn(%Q, %Q, %d, %Q, %Q)", outTable, + geometry, srid, multi_type, dims); + } + else + { + sql_geom = + sqlite3_mprintf + ("SELECT AddGeometryColumn(%Q, %Q, %d, %Q, %Q)", outTable, + geometry, srid, type, dims); + } + } + else + { + sql_geom = + sqlite3_mprintf ("SELECT AddGeometryColumn(%Q, %Q, %d, %Q, %Q)", + outTable, geometry, srid, type, dims); + } /* creating the output table */ ret = sqlite3_exec (sqlite, sql4.Buffer, NULL, NULL, &errMsg); gaiaOutBufferReset (&sql4); if (ret != SQLITE_OK) @@ -6630,5 +6723,75 @@ fclose (out); } spatialite_e ("The SQL SELECT returned no data to export...\n"); return 0; } + +SPATIALITE_PRIVATE const void * +gaiaElemGeomOptionsCreate () +{ +/* creating an Elementary Geometries Options object */ + struct aux_elemgeom_options *options = + malloc (sizeof (struct aux_elemgeom_options)); + options->first = NULL; + options->last = NULL; + options->cast2multi = 0; + return options; +} + +SPATIALITE_PRIVATE void +gaiaElemGeomOptionsDestroy (const void *opts) +{ +/* destroying an Elementary Geometries Options object */ + struct aux_elemgeom_ignore *ign; + struct aux_elemgeom_ignore *ign2; + struct aux_elemgeom_options *options = (struct aux_elemgeom_options *) opts; + if (options == NULL) + return; + + ign = options->first; + while (ign != NULL) + { + ign2 = ign->next; + if (ign->column != NULL) + free (ign->column); + free (ign); + ign = ign2; + } + free (options); +} + +static void +ignore_column (struct aux_elemgeom_options *options, const char *column) +{ +/* marking a Column to be ignored */ + int len; + struct aux_elemgeom_ignore *ign; + if (options == NULL) + return; + + ign = malloc (sizeof (struct aux_elemgeom_ignore)); + len = strlen (column); + ign->column = malloc (len + 1); + strcpy (ign->column, column); + ign->next = NULL; + + if (options->first == NULL) + options->first = ign; + if (options->last != NULL) + options->last->next = ign; + options->last = ign; +} + +SPATIALITE_PRIVATE void +gaiaElemGeomOptionsAdd (const void *opts, const char *option) +{ +/* adding an Elementary Geometries Option */ + struct aux_elemgeom_options *options = (struct aux_elemgeom_options *) opts; + if (options == NULL) + return; + + if (strncasecmp (option, "::cast2multi::", 14) == 0) + options->cast2multi = 1; + if (strncasecmp (option, "::ignore::", 10) == 0) + ignore_column (options, option + 10); +} Index: src/spatialite/Makefile.am ================================================================== --- src/spatialite/Makefile.am +++ src/spatialite/Makefile.am @@ -1,7 +1,7 @@ -AM_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libsplite.la splite.la SPATIALITE_COMMON_SOURCES = mbrcache.c \ @@ -22,21 +22,22 @@ virtualnetwork.c \ virtualrouting.c \ virtualshape.c \ virtualxpath.c \ virtualelementary.c \ - virtualknn.c + virtualknn.c \ + create_routing.c libsplite_la_SOURCES = $(SPATIALITE_COMMON_SOURCES) libsplite_la_CFLAGS = -fvisibility=hidden splite_la_SOURCES = $(SPATIALITE_COMMON_SOURCES) -splite_la_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ +splite_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ splite_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. splite_la_CPPFLAGS += -DLOADABLE_EXTENSION splite_la_CPPFLAGS += -fvisibility=hidden splite_la_LDFLAGS = -module splite_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/spatialite/Makefile.in ================================================================== --- src/spatialite/Makefile.in +++ src/spatialite/Makefile.in @@ -111,11 +111,12 @@ libsplite_la-virtualXL.lo libsplite_la-virtualfdo.lo \ libsplite_la-virtualgpkg.lo libsplite_la-virtualbbox.lo \ libsplite_la-virtualspatialindex.lo \ libsplite_la-virtualnetwork.lo libsplite_la-virtualrouting.lo \ libsplite_la-virtualshape.lo libsplite_la-virtualxpath.lo \ - libsplite_la-virtualelementary.lo libsplite_la-virtualknn.lo + libsplite_la-virtualelementary.lo libsplite_la-virtualknn.lo \ + libsplite_la-create_routing.lo am_libsplite_la_OBJECTS = $(am__objects_1) libsplite_la_OBJECTS = $(am_libsplite_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent @@ -132,11 +133,11 @@ splite_la-virtualXL.lo splite_la-virtualfdo.lo \ splite_la-virtualgpkg.lo splite_la-virtualbbox.lo \ splite_la-virtualspatialindex.lo splite_la-virtualnetwork.lo \ splite_la-virtualrouting.lo splite_la-virtualshape.lo \ splite_la-virtualxpath.lo splite_la-virtualelementary.lo \ - splite_la-virtualknn.lo + splite_la-virtualknn.lo splite_la-create_routing.lo am_splite_la_OBJECTS = $(am__objects_2) splite_la_OBJECTS = $(am_splite_la_OBJECTS) splite_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(splite_la_LDFLAGS) $(LDFLAGS) -o $@ @@ -329,11 +330,11 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ \ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ \ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libsplite.la splite.la SPATIALITE_COMMON_SOURCES = mbrcache.c \ spatialite.c \ spatialite_init.c \ @@ -352,18 +353,19 @@ virtualnetwork.c \ virtualrouting.c \ virtualshape.c \ virtualxpath.c \ virtualelementary.c \ - virtualknn.c + virtualknn.c \ + create_routing.c libsplite_la_SOURCES = $(SPATIALITE_COMMON_SOURCES) libsplite_la_CFLAGS = -fvisibility=hidden splite_la_SOURCES = $(SPATIALITE_COMMON_SOURCES) -splite_la_CPPFLAGS = @CFLAGS@ @GEOS_CFLAGS@ @LIBXML2_CFLAGS@ \ - -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION \ - -fvisibility=hidden +splite_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @GEOS_CFLAGS@ \ + @LIBXML2_CFLAGS@ -I$(top_srcdir)/src/headers -I. \ + -DLOADABLE_EXTENSION -fvisibility=hidden splite_la_LDFLAGS = -module splite_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am @@ -420,10 +422,11 @@ -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-create_routing.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-extra_tables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-mbrcache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-metatables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-se_helpers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-spatialite.Plo@am__quote@ @@ -441,10 +444,11 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualnetwork.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualrouting.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualshape.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualspatialindex.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsplite_la-virtualxpath.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-create_routing.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-extra_tables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-mbrcache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-metatables.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-se_helpers.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/splite_la-spatialite.Plo@am__quote@ @@ -631,10 +635,17 @@ @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-virtualknn.Tpo $(DEPDIR)/libsplite_la-virtualknn.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='virtualknn.c' object='libsplite_la-virtualknn.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-virtualknn.lo `test -f 'virtualknn.c' || echo '$(srcdir)/'`virtualknn.c +libsplite_la-create_routing.lo: create_routing.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -MT libsplite_la-create_routing.lo -MD -MP -MF $(DEPDIR)/libsplite_la-create_routing.Tpo -c -o libsplite_la-create_routing.lo `test -f 'create_routing.c' || echo '$(srcdir)/'`create_routing.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsplite_la-create_routing.Tpo $(DEPDIR)/libsplite_la-create_routing.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='create_routing.c' object='libsplite_la-create_routing.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libsplite_la_CFLAGS) $(CFLAGS) -c -o libsplite_la-create_routing.lo `test -f 'create_routing.c' || echo '$(srcdir)/'`create_routing.c + splite_la-mbrcache.lo: mbrcache.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-mbrcache.lo -MD -MP -MF $(DEPDIR)/splite_la-mbrcache.Tpo -c -o splite_la-mbrcache.lo `test -f 'mbrcache.c' || echo '$(srcdir)/'`mbrcache.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-mbrcache.Tpo $(DEPDIR)/splite_la-mbrcache.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mbrcache.c' object='splite_la-mbrcache.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @@ -778,10 +789,17 @@ @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-virtualknn.Tpo $(DEPDIR)/splite_la-virtualknn.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='virtualknn.c' object='splite_la-virtualknn.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-virtualknn.lo `test -f 'virtualknn.c' || echo '$(srcdir)/'`virtualknn.c +splite_la-create_routing.lo: create_routing.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT splite_la-create_routing.lo -MD -MP -MF $(DEPDIR)/splite_la-create_routing.Tpo -c -o splite_la-create_routing.lo `test -f 'create_routing.c' || echo '$(srcdir)/'`create_routing.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/splite_la-create_routing.Tpo $(DEPDIR)/splite_la-create_routing.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='create_routing.c' object='splite_la-create_routing.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(splite_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(splite_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o splite_la-create_routing.lo `test -f 'create_routing.c' || echo '$(srcdir)/'`create_routing.c + mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ADDED src/spatialite/create_routing.c Index: src/spatialite/create_routing.c ================================================================== --- src/spatialite/create_routing.c +++ src/spatialite/create_routing.c @@ -0,0 +1,3154 @@ +/* + + create_routing.c -- Creating a VirtualRouting from an input table + + version 4.5, 2017 December 15 + + 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) 2017 +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 +#include +#include +#include + +#if defined(_WIN32) && !defined(__MINGW32__) +#include "config-msvc.h" +#else +#include "config.h" +#endif + +#include +#include +#include + +#include +#include + +#ifdef _WIN32 +#define strcasecmp _stricmp +#endif /* not WIN32 */ + +/* 64 bit integer: portable format for printf() */ +#if defined(_WIN32) && !defined(__MINGW32__) +#define FRMT64 "%I64d" +#else +#define FRMT64 "%lld" +#endif + +#define MAX_BLOCK 1048576 + +static void +gaia_create_routing_set_error (const void *ctx, const char *errmsg) +{ +/* setting the CreateRouting Last Error Message */ + struct splite_internal_cache *cache = (struct splite_internal_cache *) ctx; + if (cache != NULL) + { + int len; + if (cache->createRoutingError != NULL) + { + free (cache->createRoutingError); + cache->createRoutingError = NULL; + } + if (errmsg == NULL) + return; + + len = strlen (errmsg); + cache->createRoutingError = malloc (len + 1); + strcpy (cache->createRoutingError, errmsg); + } +} + +SPATIALITE_DECLARE const char * +gaia_create_routing_get_last_error (const void *p_cache) +{ +/* return the last CreateRouting Error Message (if any) */ + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + + if (cache == NULL) + return NULL; + return cache->createRoutingError; +} + +static void +do_drop_temp_tables (sqlite3 * db_handle) +{ +/* attempting to drop existing temp-tables (just in case) */ + const char *sql; + + /* attempting to drop the Nodes Temp-Table */ + sql = "DROP TABLE IF EXISTS create_routing_nodes"; + sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + +/* attempting to drop the Routing Data Table */ + sql = "DROP TABLE IF EXISTS create_routing_links"; + sqlite3_exec (db_handle, sql, NULL, NULL, NULL); +} + +static void +do_drop_tables (sqlite3 * db_handle, const char *routing_data_table, + const char *virtual_routing_table) +{ +/* attempting to drop existing tables (just in case) */ + char *xtable; + char *sql; + +/* attempting to drop the VirtualRouting Table */ + xtable = gaiaDoubleQuotedSql (virtual_routing_table); + sql = sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\"", xtable); + free (xtable); + sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + +/* attempting to drop the Routing Data Table */ + xtable = gaiaDoubleQuotedSql (routing_data_table); + sql = sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\"", xtable); + free (xtable); + sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); +} + +static int +do_check_data_table (sqlite3 * db_handle, const char *routing_data_table) +{ +/* testing if the Routing Data Table is already defined */ + char *xtable; + char *sql; + int ret; + int i; + char **results; + int rows; + int columns; + int nr = 0; + + xtable = gaiaDoubleQuotedSql (routing_data_table); + sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", xtable); + free (xtable); + ret = sqlite3_get_table (db_handle, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + nr++; + sqlite3_free_table (results); + return nr; +} + +static int +do_check_virtual_table (sqlite3 * db_handle, const char *virtual_routing_table) +{ +/* testing if the VirtualRouting Table is already defined */ + char *xtable; + char *sql; + int ret; + int i; + char **results; + int rows; + int columns; + int nr = 0; + + xtable = gaiaDoubleQuotedSql (virtual_routing_table); + sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", xtable); + free (xtable); + ret = sqlite3_get_table (db_handle, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + nr++; + sqlite3_free_table (results); + return nr; +} + +static int +check_geom (gaiaGeomCollPtr geom, int *is3d, double *x_from, double *y_from, + double *z_from, double *x_to, double *y_to, double *z_to) +{ +/* checking an Arc/Link Geometry for validity */ + gaiaPointPtr pt; + gaiaLinestringPtr ln; + gaiaPolygonPtr pg; + int points = 0; + int lines = 0; + int polygons = 0; + int end; + + if (geom == NULL) + return 0; + + pt = geom->FirstPoint; + while (pt != NULL) + { + points++; + pt = pt->Next; + } + ln = geom->FirstLinestring; + while (ln != NULL) + { + lines++; + ln = ln->Next; + } + pg = geom->FirstPolygon; + while (pg != NULL) + { + polygons++; + pg = pg->Next; + } + if (points == 0 && lines == 1 && polygons == 0) + ; + else + return 0; + + ln = geom->FirstLinestring; + end = ln->Points - 1; + if (ln->DimensionModel == GAIA_XY_Z) + { + *is3d = 1; + gaiaGetPointXYZ (ln->Coords, 0, x_from, y_from, z_from); + gaiaGetPointXYZ (ln->Coords, end, x_to, y_to, z_to); + } + else if (ln->DimensionModel == GAIA_XY_Z_M) + { + double m; + *is3d = 1; + gaiaGetPointXYZM (ln->Coords, 0, x_from, y_from, z_from, &m); + gaiaGetPointXYZM (ln->Coords, end, x_to, y_to, z_to, &m); + } + else if (ln->DimensionModel == GAIA_XY_M) + { + double m; + *is3d = 0; + gaiaGetPointXYM (ln->Coords, 0, x_from, y_from, &m); + *z_from = 0.0; + gaiaGetPointXYM (ln->Coords, end, x_to, y_to, &m); + *z_to = 0.0; + } + else + { + *is3d = 0; + gaiaGetPoint (ln->Coords, 0, x_from, y_from); + *z_from = 0.0; + gaiaGetPoint (ln->Coords, end, x_to, y_to); + *z_to = 0.0; + } + + return 1; +} + +static int +do_update_internal_index (sqlite3 * db_handle, const void *cache, + sqlite3_stmt * stmt, sqlite3_int64 rowid, int index) +{ +/* assigning the Internal Index to some Node */ + int ret; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_int (stmt, 1, index); + sqlite3_bind_int64 (stmt, 2, rowid); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + return 1; +} + +static int +do_search_srid (sqlite3 * handle, const char *table, const char *geom, + int *srid, int *dims, int *is_geographic) +{ +/* seraching the SRID and DIMS for Geometry */ + char *sql; + int ret; + sqlite3_stmt *stmt = NULL; + int xsrid; + int type; + int count = 0; + + sql = + sqlite3_mprintf + ("SELECT srid, geometry_type FROM geometry_columns WHERE " + "Lower(f_table_name) = Lower(%Q) AND Lower(f_geometry_column) = Lower(%Q)", + table, geom); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + xsrid = sqlite3_column_int (stmt, 0); + type = sqlite3_column_int (stmt, 1); + count++; + } + } + sqlite3_finalize (stmt); + if (count == 1) + { + int geographic; + if (!srid_is_geographic (handle, xsrid, &geographic)) + return 0; + switch (type) + { + case GAIA_LINESTRING: + *dims = GAIA_XY; + break; + case GAIA_LINESTRINGZ: + *dims = GAIA_XY_Z; + break; + case GAIA_LINESTRINGM: + *dims = GAIA_XY_M; + break; + case GAIA_LINESTRINGZM: + *dims = GAIA_XY_Z_M; + break; + default: + return 0; + }; + *srid = xsrid; + *is_geographic = geographic; + return 1; + } + return 0; +} + +static int +do_check_input_table (sqlite3 * db_handle, const void *cache, + const char *input_table, const char *from_column, + const char *to_column, const char *geom_column, + const char *cost_column, const char *name_column, + const char *oneway_from, const char *oneway_to, + int a_star_enabled, int bidirectional, int *has_ids, + int *n_nodes, int *max_code_length, double *a_star_coeff) +{ +/* testing if the Input Table exists and it's correctly defined */ + char *xtable; + char *sql; + char *prev; + char *xname; + sqlite3_stmt *stmt; + sqlite3_stmt *stmt_ins_nodes = NULL; + sqlite3_stmt *stmt_ins_links = NULL; + sqlite3_stmt *stmt_check_nodes = NULL; + sqlite3_stmt *stmt_update_nodes = NULL; + sqlite3_stmt *stmt_sel_nodes = NULL; + sqlite3_stmt *stmt_update_links_from = NULL; + sqlite3_stmt *stmt_update_links_to = NULL; + int ret; + int i; + char **results; + int rows; + int columns; + int ok_from = 0; + int ok_to = 0; + int ok_geom = 0; + int ok_cost = 0; + int ok_name = 0; + int ok_oneway_from = 0; + int ok_oneway_to = 0; + int error = 0; + int first = 1; + int glob_srid; + int glob_dims; + sqlite3_int64 last_id; + char *last_code = NULL; + double last_x; + double last_y; + double last_z; + int is_geographic = 0; + +/* setting a Savepoint */ + sql = "SAVEPOINT create_routing_one"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + + xtable = gaiaDoubleQuotedSql (input_table); + sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", xtable); + free (xtable); + ret = sqlite3_get_table (db_handle, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + { + const char *col = results[(i * columns) + 1]; + if (strcasecmp (col, from_column) == 0) + ok_from = 1; + if (strcasecmp (col, to_column) == 0) + ok_to = 1; + if (geom_column != NULL) + { + if (strcasecmp (col, geom_column) == 0) + ok_geom = 1; + } + if (cost_column != NULL) + { + if (strcasecmp (col, cost_column) == 0) + ok_cost = 1; + } + if (name_column != NULL) + { + if (strcasecmp (col, name_column) == 0) + ok_name = 1; + } + if (oneway_from != NULL) + { + if (strcasecmp (col, oneway_from) == 0) + ok_oneway_from = 1; + } + if (oneway_to != NULL) + { + if (strcasecmp (col, oneway_to) == 0) + ok_oneway_to = 1; + } + } + sqlite3_free_table (results); + +/* final validity check */ + if (!ok_from) + { + char *msg = + sqlite3_mprintf + ("FromNode Column \"%s\" is not defined in the Input Table", + from_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + if (!ok_to) + { + char *msg = + sqlite3_mprintf + ("ToNode Column \"%s\" is not defined in the Input Table", + to_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + if (geom_column != NULL) + { + if (!ok_geom) + { + char *msg = + sqlite3_mprintf + ("Geometry Column \"%s\" is not defined in the Input Table", + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + } + if (cost_column != NULL) + { + if (!ok_cost) + { + char *msg = + sqlite3_mprintf + ("Cost Column \"%s\" is not defined in the Input Table", + cost_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + } + if (name_column != NULL) + { + if (!ok_name) + { + char *msg = + sqlite3_mprintf + ("Name Column \"%s\" is not defined in the Input Table", + name_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + } + if (oneway_from != NULL) + { + if (!ok_oneway_from) + { + char *msg = + sqlite3_mprintf + ("OnewayFromTo Column \"%s\" is not defined in the Input Table", + oneway_from); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + } + if (!ok_oneway_to) + { + if (oneway_to != NULL) + { + char *msg = + sqlite3_mprintf + ("OnewayToFrom Column \"%s\" is not defined in the Input Table", + oneway_to); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + } + + if (geom_column != NULL) + { + /* searching the SRID and DIMS of Geometry */ + if (!do_search_srid + (db_handle, input_table, geom_column, &glob_srid, &glob_dims, + &is_geographic)) + { + char *msg = sqlite3_mprintf ("Unable to find geometry %Q.%Q", + input_table, geom_column); + gaia_create_routing_set_error (cache, msg); + return 0; + } + } + +/* testing actual values for consistency */ + sql = sqlite3_mprintf ("SELECT ROWID"); + prev = sql; + xname = gaiaDoubleQuotedSql (from_column); + sql = sqlite3_mprintf ("%s, \"%s\"", prev, xname); + free (xname); + sqlite3_free (prev); + prev = sql; + xname = gaiaDoubleQuotedSql (to_column); + sql = sqlite3_mprintf ("%s, \"%s\"", prev, xname); + free (xname); + sqlite3_free (prev); + prev = sql; + if (geom_column == NULL) + { + sql = sqlite3_mprintf ("%s, NULL", prev); + sqlite3_free (prev); + } + else + { + xname = gaiaDoubleQuotedSql (geom_column); + sql = sqlite3_mprintf ("%s, \"%s\"", prev, xname); + free (xname); + sqlite3_free (prev); + } + prev = sql; + if (a_star_enabled || cost_column == NULL) + { + xname = gaiaDoubleQuotedSql (geom_column); + if (is_geographic) + sql = sqlite3_mprintf ("%s, ST_Length(\"%s\", 1)", prev, xname); + else + sql = sqlite3_mprintf ("%s, ST_Length(\"%s\")", prev, xname); + free (xname); + sqlite3_free (prev); + } + else + { + sql = sqlite3_mprintf ("%s, NULL", prev); + sqlite3_free (prev); + } + prev = sql; + if (cost_column == NULL) + { + sql = sqlite3_mprintf ("%s, NULL", prev); + sqlite3_free (prev); + } + else + { + xname = gaiaDoubleQuotedSql (cost_column); + sql = sqlite3_mprintf ("%s, \"%s\"", prev, xname); + free (xname); + sqlite3_free (prev); + } + prev = sql; + if (name_column == NULL) + { + sql = sqlite3_mprintf ("%s, NULL", prev); + sqlite3_free (prev); + } + else + { + xname = gaiaDoubleQuotedSql (name_column); + sql = sqlite3_mprintf ("%s, \"%s\"", prev, xname); + free (xname); + sqlite3_free (prev); + } + prev = sql; + if (oneway_from == NULL) + { + sql = sqlite3_mprintf ("%s, NULL", prev); + sqlite3_free (prev); + } + else + { + xname = gaiaDoubleQuotedSql (oneway_from); + sql = sqlite3_mprintf ("%s, \"%s\"", prev, xname); + free (xname); + sqlite3_free (prev); + } + prev = sql; + if (oneway_to == NULL) + { + sql = sqlite3_mprintf ("%s, NULL", prev); + sqlite3_free (prev); + } + else + { + xname = gaiaDoubleQuotedSql (oneway_to); + sql = sqlite3_mprintf ("%s, \"%s\"", prev, xname); + free (xname); + sqlite3_free (prev); + } + prev = sql; + xtable = gaiaDoubleQuotedSql (input_table); + sql = sqlite3_mprintf ("%s FROM \"%s\"", prev, xtable); + free (xtable); + sqlite3_free (prev); + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + +/* preparing the temp-nodes table */ + sql = "CREATE TEMPORARY TABLE create_routing_nodes (" + "internal_index INTEGER,\n" + "node_id INTEGER,\n" + "node_code TEXT,\n" + "node_x DOUBLE,\n" "node_y DOUBLE,\n" "node_z DOUBLE)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + + sql = "INSERT INTO create_routing_nodes " + "(node_id, node_code, node_x, node_y, node_z) " + "VALUES (?, ?, ?, ?, ?)"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_ins_nodes, + NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + +/* preparing the temp-links table */ + sql = "CREATE TEMPORARY TABLE create_routing_links (" + "rowid INTEGER,\n" + "id_node_from INTEGER,\n" + "cod_node_from TEXT,\n" + "id_node_to INTEGER,\n" + "cod_node_to INTEGER,\n" + "cost DOUBLE,\n" "index_from INTEGER,\n" "index_to INTEGER)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + + sql = "INSERT INTO create_routing_links " + "(rowid, id_node_from, cod_node_from, id_node_to, cod_node_to, cost) " + "VALUES (?, ?, ?, ?, ?, ?)"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_ins_links, + NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + +/* exploring all arcs/links */ + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 rowid; + sqlite3_int64 id_from; + sqlite3_int64 id_to; + const char *from; + const char *to; + int int_from; + int int_to; + int is3d; + double x_from; + double y_from; + double z_from; + double x_to; + double y_to; + double z_to; + double length = -1.0; + double cost = -1.0; + int from_to = -1; + int to_from = -1; + int len; + rowid = sqlite3_column_int64 (stmt, 0); + if (sqlite3_column_type (stmt, 1) == SQLITE_INTEGER) + { + id_from = sqlite3_column_int64 (stmt, 1); + int_from = 1; + } + else if (sqlite3_column_type (stmt, 1) == SQLITE_TEXT) + { + from = (const char *) sqlite3_column_text (stmt, 1); + len = strlen (from); + if (len > *max_code_length) + *max_code_length = len; + int_from = 0; + } + else + { + char *msg = + sqlite3_mprintf + ("NodeFrom column \"%s\": found a value that's neither TEXT nor INTEGER", + from_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + if (first) + *has_ids = int_from; + if (int_from != *has_ids) + { + char *msg = + sqlite3_mprintf + ("NodeFrom column \"%s\": found a mismatching value", + from_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + if (sqlite3_column_type (stmt, 2) == SQLITE_INTEGER) + { + id_to = sqlite3_column_int64 (stmt, 2); + int_to = 1; + } + else if (sqlite3_column_type (stmt, 2) == SQLITE_TEXT) + { + to = (const char *) sqlite3_column_text (stmt, 2); + len = strlen (to); + if (len > *max_code_length) + *max_code_length = len; + int_to = 0; + } + else + { + char *msg = + sqlite3_mprintf + ("NodeTo column \"%s\": found a value that's neither TEXT nor INTEGER", + to_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + if (int_to != *has_ids) + { + char *msg = + sqlite3_mprintf + ("NodeTo column \"%s\": found a mismatching value", + to_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + if (geom_column != NULL) + { + if (sqlite3_column_type (stmt, 3) == SQLITE_BLOB) + { + int srid; + int dims; + struct splite_internal_cache *p_cache = + (struct splite_internal_cache *) cache; + int gpkg_amphibious = 0; + int gpkg_mode = 0; + unsigned char *blob = + (unsigned char *) sqlite3_column_blob (stmt, 3); + int bytes = sqlite3_column_bytes (stmt, 3); + if (cache != NULL) + { + gpkg_amphibious = + p_cache->gpkg_amphibious_mode; + gpkg_mode = p_cache->gpkg_mode; + } + gaiaGeomCollPtr g = + gaiaFromSpatiaLiteBlobWkbEx (blob, bytes, + gpkg_mode, + gpkg_amphibious); + if (g == NULL) + { + char *msg = + sqlite3_mprintf + ("Geometry column \"%s\": found a BLOB value that's not a Geometry", + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + ok_geom = + check_geom (g, &is3d, &x_from, &y_from, &z_from, + &x_to, &y_to, &z_to); + if (ok_geom) + { + srid = g->Srid; + dims = g->DimensionModel; + } + gaiaFreeGeomColl (g); + if (!ok_geom) + { + char *msg = + sqlite3_mprintf + ("Geometry column \"%s\": found a Geometry that's not a simple Linestring", + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + if (srid != glob_srid) + { + char *msg = + sqlite3_mprintf + ("Geometry column \"%s\": found a mismatching SRID", + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + if (dims != glob_dims) + { + char *msg = + sqlite3_mprintf + ("Geometry column \"%s\": found mismatching Dimensions", + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + else + { + char *msg = + sqlite3_mprintf + ("Geometry column \"%s\": found a value that's not a BLOB", + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + else + { + /* no geometry columns */ + x_from = 0.0; + y_from = 0.0; + z_from = 0.0; + x_to = 0.0; + y_to = 0.0; + z_to = 0.0; + } + if (a_star_enabled || cost_column == NULL) + { + if (sqlite3_column_type (stmt, 4) == SQLITE_FLOAT) + length = sqlite3_column_double (stmt, 4); + else + { + char *msg = + sqlite3_mprintf + ("Geometry column \"%s\": ST_Length() returned an invalid value", + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + if (cost_column != NULL) + { + if (sqlite3_column_type (stmt, 5) == SQLITE_FLOAT) + { + cost = sqlite3_column_double (stmt, 5); + if (cost <= 0.0) + { + char *msg = + sqlite3_mprintf + ("Cost column \"%s\": found a negative or zero value", + cost_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + else + { + char *msg = + sqlite3_mprintf + ("Cost column \"%s\": found a value that's not a DOUBLE", + cost_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + else + cost = length; + if (a_star_enabled) + { + if (cost_column == NULL) + *a_star_coeff = 1.0; + else + { + double coeff = cost / length; + if (coeff < *a_star_coeff) + *a_star_coeff = coeff; + } + } + if (name_column != NULL) + { + if (sqlite3_column_type (stmt, 6) == SQLITE_TEXT) + ; + else + { + char *msg = + sqlite3_mprintf + ("Name column \"%s\": found a value that's not a TEXT string", + name_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + if (oneway_from != NULL) + { + if (sqlite3_column_type (stmt, 7) == SQLITE_INTEGER) + from_to = sqlite3_column_int (stmt, 7); + else + { + char *msg = + sqlite3_mprintf + ("OnewayFromTo column \"%s\": found a value that's not an INTEGER", + oneway_from); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + if (oneway_to != NULL) + { + if (sqlite3_column_type (stmt, 8) == SQLITE_INTEGER) + to_from = sqlite3_column_int (stmt, 8); + else + { + char *msg = + sqlite3_mprintf + ("OnewayToFrom column \"%s\": found a value that's not an INTEGER", + oneway_to); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + if (first) + first = 0; + + /* inserting NodeFrom */ + sqlite3_reset (stmt_ins_nodes); + sqlite3_clear_bindings (stmt_ins_nodes); + if (int_from) + { + sqlite3_bind_int64 (stmt_ins_nodes, 1, id_from); + sqlite3_bind_null (stmt_ins_nodes, 2); + } + else + { + sqlite3_bind_null (stmt_ins_nodes, 1); + sqlite3_bind_text (stmt_ins_nodes, 2, from, strlen (from), + SQLITE_STATIC); + } + sqlite3_bind_double (stmt_ins_nodes, 3, x_from); + sqlite3_bind_double (stmt_ins_nodes, 4, y_from); + sqlite3_bind_double (stmt_ins_nodes, 5, z_from); + ret = sqlite3_step (stmt_ins_nodes); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + + /* inserting NodeTo */ + sqlite3_reset (stmt_ins_nodes); + sqlite3_clear_bindings (stmt_ins_nodes); + if (int_to) + { + sqlite3_bind_int64 (stmt_ins_nodes, 1, id_to); + sqlite3_bind_null (stmt_ins_nodes, 2); + } + else + { + sqlite3_bind_null (stmt_ins_nodes, 1); + sqlite3_bind_text (stmt_ins_nodes, 2, to, strlen (to), + SQLITE_STATIC); + } + sqlite3_bind_double (stmt_ins_nodes, 3, x_to); + sqlite3_bind_double (stmt_ins_nodes, 4, y_to); + sqlite3_bind_double (stmt_ins_nodes, 5, z_to); + ret = sqlite3_step (stmt_ins_nodes); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + + /* inserting the Link(s) */ + if (bidirectional) + { + if (from_to) + { + sqlite3_reset (stmt_ins_links); + sqlite3_clear_bindings (stmt_ins_links); + sqlite3_bind_int64 (stmt_ins_links, 1, rowid); + if (int_from) + { + sqlite3_bind_int64 (stmt_ins_links, 2, + id_from); + sqlite3_bind_null (stmt_ins_links, 3); + } + else + { + sqlite3_bind_null (stmt_ins_links, 2); + sqlite3_bind_text (stmt_ins_links, 3, from, + strlen (from), + SQLITE_STATIC); + } + if (int_to) + { + sqlite3_bind_int64 (stmt_ins_links, 4, id_to); + sqlite3_bind_null (stmt_ins_links, 5); + } + else + { + sqlite3_bind_null (stmt_ins_links, 4); + sqlite3_bind_text (stmt_ins_links, 5, to, + strlen (to), + SQLITE_STATIC); + } + sqlite3_bind_double (stmt_ins_links, 6, cost); + ret = sqlite3_step (stmt_ins_links); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg + (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + } + if (to_from) + { + sqlite3_reset (stmt_ins_links); + sqlite3_clear_bindings (stmt_ins_links); + sqlite3_bind_int64 (stmt_ins_links, 1, rowid); + if (int_to) + { + sqlite3_bind_int64 (stmt_ins_links, 2, id_to); + sqlite3_bind_null (stmt_ins_links, 3); + } + else + { + sqlite3_bind_null (stmt_ins_links, 2); + sqlite3_bind_text (stmt_ins_links, 3, to, + strlen (to), + SQLITE_STATIC); + } + if (int_from) + { + sqlite3_bind_int64 (stmt_ins_links, 4, + id_from); + sqlite3_bind_null (stmt_ins_links, 5); + } + else + { + sqlite3_bind_null (stmt_ins_links, 4); + sqlite3_bind_text (stmt_ins_links, 5, from, + strlen (from), + SQLITE_STATIC); + } + sqlite3_bind_double (stmt_ins_links, 6, cost); + ret = sqlite3_step (stmt_ins_links); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg + (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + } + } + else + { + sqlite3_reset (stmt_ins_links); + sqlite3_clear_bindings (stmt_ins_links); + sqlite3_bind_int64 (stmt_ins_links, 1, rowid); + if (int_from) + { + sqlite3_bind_int64 (stmt_ins_links, 2, id_from); + sqlite3_bind_null (stmt_ins_links, 3); + } + else + { + sqlite3_bind_null (stmt_ins_links, 2); + sqlite3_bind_text (stmt_ins_links, 3, from, + strlen (from), SQLITE_STATIC); + } + if (int_to) + { + sqlite3_bind_int64 (stmt_ins_links, 4, id_to); + sqlite3_bind_null (stmt_ins_links, 5); + } + else + { + sqlite3_bind_null (stmt_ins_links, 4); + sqlite3_bind_text (stmt_ins_links, 5, to, + strlen (to), SQLITE_STATIC); + } + sqlite3_bind_double (stmt_ins_links, 6, length); + sqlite3_bind_double (stmt_ins_links, 7, cost); + ret = sqlite3_step (stmt_ins_links); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + } + } + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto stop; + } + } + stop: + if (stmt_ins_nodes != NULL) + sqlite3_finalize (stmt_ins_nodes); + if (stmt_ins_links != NULL) + sqlite3_finalize (stmt_ins_links); + sqlite3_finalize (stmt); + if (error) + { + /* rolling back the Savepoint */ + sql = "ROLLBACK TO create_routing_one"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + return 0; + } + +/* releasing the Savepoint */ + sql = "RELEASE SAVEPOINT create_routing_one"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto stop; + } + +/* setting a Savepoint */ + sql = "SAVEPOINT create_routing_two"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + +/* preparing the UPDATE tmp-Nodes statement */ + sql = "UPDATE create_routing_nodes SET internal_index = ? WHERE rowid = ?"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_update_nodes, + NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* checking Nodes topological consistency */ + if (*has_ids) + { + sql = "SELECT rowid, node_id, node_x, node_y, node_z " + "FROM create_routing_nodes ORDER BY node_id, rowid"; + } + else + { + sql = "SELECT rowid, node_code, node_x, node_y, node_z " + "FROM create_routing_nodes ORDER BY node_code, rowid"; + } + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_check_nodes, + NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + + first = 1; + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt_check_nodes); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 rowid; + const char *code; + sqlite3_int64 id; + double x; + double y; + double z; + int mismatch = 0; + rowid = sqlite3_column_int64 (stmt_check_nodes, 0); + if (*has_ids) + id = sqlite3_column_int64 (stmt_check_nodes, 1); + else + code = + (const char *) sqlite3_column_text (stmt_check_nodes, + 1); + x = sqlite3_column_double (stmt_check_nodes, 2); + y = sqlite3_column_double (stmt_check_nodes, 3); + z = sqlite3_column_double (stmt_check_nodes, 4); + if (first) + { + first = 0; + if (!do_update_internal_index + (db_handle, cache, stmt_update_nodes, rowid, + *n_nodes)) + goto error; + *n_nodes += 1; + goto skip_first; + } + if (*has_ids) + { + if (last_id != id) + { + last_x = x; + last_y = y; + last_z = z; + if (!do_update_internal_index + (db_handle, cache, stmt_update_nodes, rowid, + *n_nodes)) + goto error; + *n_nodes += 1; + } + } + else + { + if (strcmp (last_code, code) != 0) + { + last_x = x; + last_y = y; + last_z = z; + if (!do_update_internal_index + (db_handle, cache, stmt_update_nodes, rowid, + *n_nodes)) + goto error; + *n_nodes += 1; + } + } + if (x != last_x) + mismatch = 1; + if (y != last_y) + mismatch = 1; + if (z != last_z) + mismatch = 1; + if (mismatch) + { + if (*has_ids) + { + char *msg; + char xid[64]; + sprintf (xid, FRMT64, id); + msg = sqlite3_mprintf + ("Node Id=%s: topology error", xid); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + else + { + char *msg = + sqlite3_mprintf + ("Node Code=%s: topology error", code); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + } + skip_first: + if (*has_ids) + last_id = id; + else + { + int len = strlen (code); + if (last_code != NULL) + free (last_code); + last_code = malloc (len + 1); + strcpy (last_code, code); + } + last_x = x; + last_y = y; + last_z = z; + } + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + } + error: + if (last_code != NULL) + free (last_code); + if (stmt_check_nodes != NULL) + sqlite3_finalize (stmt_check_nodes); + if (stmt_update_nodes != NULL) + sqlite3_finalize (stmt_update_nodes); + if (error) + { + /* rolling back the Savepoint */ + sql = "ROLLBACK TO create_routing_two"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + return 0; + } + +/* releasing the Savepoint */ + sql = "RELEASE SAVEPOINT create_routing_two"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + +/* setting a Savepoint */ + sql = "SAVEPOINT create_routing_three"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + +/* preparing an index supporting Temp-Nodes - internal index */ + sql = "CREATE INDEX idx_create_routing_internal " + "ON create_routing_nodes (internal_index)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + + if (*has_ids) + { + /* preparing an index supporting Temp-Links - Id Node From */ + sql = + "CREATE INDEX idx_create_routing_internal_from ON create_routing_links (id_node_from)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + /* preparing an index supporting Temp-Links - Id Node To */ + sql = + "CREATE INDEX idx_create_routing_internal_to ON create_routing_links (id_node_to)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + } + else + { + /* preparing an index supporting Temp-Links - Code Node From */ + sql = + "CREATE INDEX idx_create_routing_internal_from ON create_routing_links (cod_node_from)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto end; + error = 1; + } + /* preparing an index supporting Temp-Links - Code Node To */ + sql = + "CREATE INDEX idx_create_routing_internal_to ON create_routing_links (cod_node_to)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + } + + if (*has_ids) + { + /* preparing the UPDATE tmp-Links statement - index from */ + sql = + "UPDATE create_routing_links SET index_from = ? WHERE id_node_from = ?"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), + &stmt_update_links_from, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + /* preparing the UPDATE tmp-Links statement - index to */ + sql = + "UPDATE create_routing_links SET index_to = ? WHERE id_node_to = ?"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), + &stmt_update_links_to, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + /* preparing the SELECT tmp-Nodes statement */ + sql = "SELECT internal_index, node_id FROM create_routing_nodes " + "WHERE internal_index IS NOT NULL"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_sel_nodes, + NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + } + else + { + /* preparing the UPDATE tmp-Links statement - index from */ + sql = + "UPDATE create_routing_links SET index_from = ? WHERE cod_node_from = ?"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), + &stmt_update_links_from, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + /* preparing the UPDATE tmp-Links statement - index to */ + sql = + "UPDATE create_routing_links SET index_to = ? WHERE cod_node_to = ?"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), + &stmt_update_links_to, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + /* preparing the SELECT tmp-Nodes statement */ + sql = "SELECT internal_index, node_code FROM create_routing_nodes " + "WHERE internal_index IS NOT NULL"; + ret = + sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_sel_nodes, + NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + } + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt_sel_nodes); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + int index; + const char *code; + sqlite3_int64 id; + index = sqlite3_column_int (stmt_sel_nodes, 0); + if (*has_ids) + id = sqlite3_column_int64 (stmt_sel_nodes, 1); + else + code = + (const char *) sqlite3_column_text (stmt_sel_nodes, 1); + /* updating Index From */ + sqlite3_reset (stmt_update_links_from); + sqlite3_clear_bindings (stmt_update_links_from); + sqlite3_bind_int (stmt_update_links_from, 1, index); + if (*has_ids) + sqlite3_bind_int64 (stmt_update_links_from, 2, id); + else + sqlite3_bind_text (stmt_update_links_from, 2, code, + strlen (code), SQLITE_STATIC); + ret = sqlite3_step (stmt_update_links_from); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + /* updating Index To */ + sqlite3_reset (stmt_update_links_to); + sqlite3_clear_bindings (stmt_update_links_to); + sqlite3_bind_int (stmt_update_links_to, 1, index); + if (*has_ids) + sqlite3_bind_int64 (stmt_update_links_to, 2, id); + else + sqlite3_bind_text (stmt_update_links_to, 2, code, + strlen (code), SQLITE_STATIC); + ret = sqlite3_step (stmt_update_links_to); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + } + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + } + +/* dropping Temp-Links indices */ + sql = "DROP INDEX idx_create_routing_internal_from"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + sql = "DROP INDEX idx_create_routing_internal_to"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } +/* preparing an index supporting Temp-Links - final */ + sql = + "CREATE INDEX idx_create_routing_internal_final ON create_routing_links (index_from, cost, index_to)"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto end; + } + + end: + if (stmt_sel_nodes != NULL) + sqlite3_finalize (stmt_sel_nodes); + if (stmt_update_links_from != NULL) + sqlite3_finalize (stmt_update_links_from); + if (stmt_update_links_to != NULL) + sqlite3_finalize (stmt_update_links_to); + if (error) + { + /* rolling back the Savepoint */ + sql = "ROLLBACK TO create_routing_three"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + return 0; + } + +/* releasing the Savepoint */ + sql = "RELEASE SAVEPOINT create_routing_three"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + + return 1; +} + +static int +do_prepare_header (unsigned char *buf, int endian_arch, int n_nodes, + int has_ids, int max_code_length, const char *input_table, + const char *from_column, const char *to_column, + const char *geom_column, const char *name_column, + int a_star_supported, double a_star_coeff) +{ +/* preparing the HEADER block */ + int len; + unsigned char *out = buf; + if (a_star_supported) + *out++ = GAIA_NET64_A_STAR_START; + else + *out++ = GAIA_NET64_START; + *out++ = GAIA_NET_HEADER; + gaiaExport32 (out, n_nodes, 1, endian_arch); /* how many Nodes are there */ + out += 4; + if (has_ids) + *out++ = GAIA_NET_ID; /* Nodes are identified by an INTEGER id */ + else + *out++ = GAIA_NET_CODE; /* Nodes are identified by a TEXT code */ + if (has_ids) + *out++ = 0x00; + else + *out++ = max_code_length; /* max TEXT code length */ +/* inserting the main Table name */ + *out++ = GAIA_NET_TABLE; + len = strlen (input_table) + 1; + gaiaExport16 (out, len, 1, endian_arch); /* the Table Name length, including last '\0' */ + out += 2; + memset (out, '\0', len); + strcpy ((char *) out, input_table); + out += len; +/* inserting the NodeFrom column name */ + *out++ = GAIA_NET_FROM; + len = strlen (from_column) + 1; + gaiaExport16 (out, len, 1, endian_arch); /* the NodeFrom column Name length, including last '\0' */ + out += 2; + memset (out, '\0', len); + strcpy ((char *) out, from_column); + out += len; +/* inserting the NodeTo column name */ + *out++ = GAIA_NET_TO; + len = strlen (to_column) + 1; + gaiaExport16 (out, len, 1, endian_arch); /* the NodeTo column Name length, including last '\0' */ + out += 2; + memset (out, '\0', len); + strcpy ((char *) out, to_column); + out += len; +/* inserting the Geometry column name */ + *out++ = GAIA_NET_GEOM; + if (!geom_column) + len = 1; + else + len = strlen (geom_column) + 1; + gaiaExport16 (out, len, 1, endian_arch); /* the Geometry column Name length, including last '\0' */ + out += 2; + memset (out, '\0', len); + if (geom_column) + strcpy ((char *) out, geom_column); + out += len; +/* inserting the Name column name - may be empty */ + *out++ = GAIA_NET_NAME; + if (!name_column) + len = 1; + else + len = strlen (name_column) + 1; + gaiaExport16 (out, len, 1, endian_arch); /* the Name column Name length, including last '\0' */ + out += 2; + memset (out, '\0', len); + if (name_column) + strcpy ((char *) out, name_column); + out += len; + if (a_star_supported) + { + /* inserting the A* Heuristic Coeff */ + *out++ = GAIA_NET_A_STAR_COEFF; + gaiaExport64 (out, a_star_coeff, 1, endian_arch); + out += 8; + } + *out++ = GAIA_NET_END; + return out - buf; +} + +static int +output_node (unsigned char *auxbuf, int *size, int index, int has_ids, + int max_code_length, int endian_arch, int a_star_enabled, + sqlite3_int64 id, const char *code, double x, double y, + short count_outcomings, sqlite3 * db_handle, const void *cache, + sqlite3_stmt * stmt_to) +{ +/* exporting a Node into NETWORK-DATA */ + int ret; + unsigned char *out = auxbuf; + *out++ = GAIA_NET_NODE; + gaiaExport32 (out, index, 1, endian_arch); /* the Node internal index */ + out += 4; + if (has_ids) + { + /* Nodes are identified by an INTEGER Id */ + gaiaExportI64 (out, id, 1, endian_arch); /* the Node ID */ + out += 8; + } + else + { + /* Nodes are identified by a TEXT Code */ + memset (out, '\0', max_code_length); + strcpy ((char *) out, code); + out += max_code_length; + } + if (a_star_enabled) + { + /* in order to support the A* algorithm [X,Y] are required for each node */ + gaiaExport64 (out, x, 1, endian_arch); + out += 8; + gaiaExport64 (out, y, 1, endian_arch); + out += 8; + } + gaiaExport16 (out, count_outcomings, 1, endian_arch); /* # of outcoming arcs */ + out += 2; + +/* querying all outcoming arcs/links */ + sqlite3_reset (stmt_to); + sqlite3_clear_bindings (stmt_to); + sqlite3_bind_int (stmt_to, 1, index); + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt_to); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 rowid = sqlite3_column_int64 (stmt_to, 0); + int index_to = sqlite3_column_int (stmt_to, 1); + double cost = sqlite3_column_double (stmt_to, 2); + *out++ = GAIA_NET_ARC; + gaiaExportI64 (out, rowid, 1, endian_arch); /* the Arc rowid */ + out += 8; + gaiaExport32 (out, index_to, 1, endian_arch); /* the ToNode internal index */ + out += 4; + gaiaExport64 (out, cost, 1, endian_arch); /* the Arc Cost */ + out += 8; + *out++ = GAIA_NET_END; + } + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + } + + *out++ = GAIA_NET_END; + *size = out - auxbuf; + return 1; +} + +static int +do_create_data (sqlite3 * db_handle, const void *cache, + const char *output_table, const char *input_table, + const char *from_column, const char *to_column, + const char *geom_column, const char *name_column, + int a_star_enabled, double a_star_coeff, int has_ids, + int n_nodes, int max_code_length) +{ +/* creating and populating the Routing Data table */ + char *sql; + int ret; + char *xtable; + sqlite3_stmt *stmt_from = NULL; + sqlite3_stmt *stmt_to = NULL; + sqlite3_stmt *stmt_out = NULL; + int error = 0; + unsigned char *auxbuf = NULL; + unsigned char *buf = NULL; + unsigned char *out; + int nodes_cnt; + int size; + int endian_arch = gaiaEndianArch (); + +/* setting a Savepoint */ + sql = "SAVEPOINT create_routing_four"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* creating the NETWORK-DATA table */ + xtable = gaiaDoubleQuotedSql (output_table); + sql = sqlite3_mprintf ("CREATE TABLE \"%s\" (" + "Id INTEGER PRIMARY KEY,\nNetworkData BLOB NOT NULL)", + xtable); + free (xtable); + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + +/* preparing the Insert SQL statement */ + xtable = gaiaDoubleQuotedSql (output_table); + sql = + sqlite3_mprintf + ("INSERT INTO \"%s\" (Id, NetworkData) VALUES (?, ?)", xtable); + free (xtable); + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_out, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + +/* preparing the Select Node From SQL statement */ + if (has_ids) + sql = + "SELECT n.internal_index, n.node_id, n.node_x, n.node_y, Count(l.rowid) " + "FROM create_routing_nodes AS n " + "LEFT JOIN create_routing_links as l ON (l.index_from = n.internal_index) " + "WHERE n.internal_index IS NOT NULL " "GROUP BY n.internal_index"; + else + sql = + "SELECT n.internal_index, n.node_code, n.node_x, n.node_y, Count(l.rowid) " + "FROM create_routing_nodes AS n " + "LEFT JOIN create_routing_links as l ON (l.index_from = n.internal_index) " + "WHERE n.internal_index IS NOT NULL " "GROUP BY n.internal_index"; + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_from, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + +/* preparing the Select Node To SQL statement */ + sql = "SELECT rowid, index_to, cost " + "FROM create_routing_links " + "WHERE index_from = ? " "ORDER BY cost, index_to"; + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_to, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + +/* preparing and inserting the Routing Header block */ + buf = malloc (MAX_BLOCK); + size = + do_prepare_header (buf, endian_arch, n_nodes, has_ids, max_code_length, + input_table, from_column, to_column, geom_column, + name_column, a_star_enabled, a_star_coeff); + sqlite3_reset (stmt_out); + sqlite3_clear_bindings (stmt_out); + sqlite3_bind_int (stmt_out, 1, 0); + sqlite3_bind_blob (stmt_out, 2, buf, size, SQLITE_STATIC); + ret = sqlite3_step (stmt_out); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + +/* +/ looping on Nodes +/ preparing a new data block +*/ + out = buf; + *out++ = GAIA_NET_BLOCK; + gaiaExport16 (out, 0, 1, endian_arch); /* how many Nodes are into this block */ + out += 2; + nodes_cnt = 0; + auxbuf = malloc (MAX_BLOCK); + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt_from); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + int index; + const char *code = NULL; + sqlite3_int64 id = -1; + double x; + double y; + int count_outcomings; + index = sqlite3_column_int (stmt_from, 0); + if (has_ids) + id = sqlite3_column_int64 (stmt_from, 1); + else + code = (const char *) sqlite3_column_text (stmt_from, 1); + x = sqlite3_column_double (stmt_from, 2); + y = sqlite3_column_double (stmt_from, 3); + count_outcomings = sqlite3_column_int (stmt_from, 4); + if (!output_node + (auxbuf, &size, index, has_ids, max_code_length, + endian_arch, a_star_enabled, id, code, x, y, + count_outcomings, db_handle, cache, stmt_to)) + { + error = 1; + goto error; + } + if (size >= (MAX_BLOCK - (out - buf))) + { + /* inserting the last block */ + gaiaExport16 (buf + 1, nodes_cnt, 1, endian_arch); /* how many Nodes are into this block */ + sqlite3_reset (stmt_out); + sqlite3_clear_bindings (stmt_out); + sqlite3_bind_null (stmt_out, 1); + sqlite3_bind_blob (stmt_out, 2, buf, out - buf, + SQLITE_STATIC); + ret = sqlite3_step (stmt_out); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + /* preparing a new block */ + out = buf; + *out++ = GAIA_NET_BLOCK; + gaiaExport16 (out, 0, 1, endian_arch); /* how many Nodes are into this block */ + out += 2; + nodes_cnt = 0; + } + /* inserting the current Node into the block */ + nodes_cnt++; + memcpy (out, auxbuf, size); + out += size; + } + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + } + if (nodes_cnt) + { + /* inserting the last data block */ + gaiaExport16 (buf + 1, nodes_cnt, 1, endian_arch); /* how many Nodes are into this block */ + sqlite3_reset (stmt_out); + sqlite3_clear_bindings (stmt_out); + sqlite3_bind_null (stmt_out, 1); + sqlite3_bind_blob (stmt_out, 2, buf, out - buf, SQLITE_STATIC); + ret = sqlite3_step (stmt_out); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = + sqlite3_mprintf + ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + error = 1; + goto error; + } + } + + error: + if (auxbuf != NULL) + free (auxbuf); + if (buf != NULL) + free (buf); + if (stmt_out != NULL) + sqlite3_finalize (stmt_out); + if (stmt_from != NULL) + sqlite3_finalize (stmt_from); + if (stmt_to != NULL) + sqlite3_finalize (stmt_to); + if (error) + { + /* rolling back the Savepoint */ + sql = "ROLLBACK TO create_routing_four"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + return 0; + } + +/* releasing the Savepoint */ + sql = "RELEASE SAVEPOINT create_routing_four"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + + return 1; +} + +static int +do_create_virtual_routing (sqlite3 * db_handle, const void *cache, + const char *routing_data_table, + const char *virtual_routing_table) +{ +/* creating the VirtualRouting table - dropping the Temp-Tables */ + char *xtable1; + char *xtable2; + char *sql; + int ret; + + xtable1 = gaiaDoubleQuotedSql (virtual_routing_table); + xtable2 = gaiaDoubleQuotedSql (routing_data_table); + sql = + sqlite3_mprintf + ("CREATE VIRTUAL TABLE \"%s\" USING VirtualRouting(\"%s\")", xtable1, + xtable2); + free (xtable1); + free (xtable2); + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto rollback; + } + do_drop_temp_tables (db_handle); + +/* releasing the Savepoint */ + sql = "RELEASE SAVEPOINT create_routing_zero"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + return 1; + + rollback: + sql = "ROLLBACK TO create_routing_zero"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + return 0; +} + +static int +do_check_registered_spatial_table (sqlite3 * db_handle, const char *db_prefix, + const char *table, const char *geom_column, + char **geom_name) +{ +/* checking for a valid Spatial Table */ + char *xprefix; + char *sql; + char *name = NULL; + int ret; + sqlite3_stmt *stmt = NULL; + int type; + int count = 0; + int is_linestring = 0; + + if (db_prefix == NULL) + db_prefix = "MAIN"; + xprefix = gaiaDoubleQuotedSql (db_prefix); + + if (geom_column == NULL) + { + sql = + sqlite3_mprintf + ("SELECT f_geometry_column, geometry_type FROM \"%s\".geometry_columns WHERE " + "Lower(f_table_name) = Lower(%Q)", xprefix, table); + } + else + { + sql = + sqlite3_mprintf + ("SELECT f_geometry_column, geometry_type FROM \"%s\".geometry_columns WHERE " + "Lower(f_table_name) = Lower(%Q) AND Lower(f_geometry_column) = Lower(%Q)", + xprefix, table, geom_column); + } + free (xprefix); + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + const char *geom = (const char *) sqlite3_column_text (stmt, 0); + int len = strlen (geom); + if (name != NULL) + free (name); + name = malloc (len + 1); + strcpy (name, geom); + type = sqlite3_column_int (stmt, 1); + count++; + } + } + sqlite3_finalize (stmt); + if (count == 1) + { + switch (type) + { + case GAIA_LINESTRING: + case GAIA_LINESTRINGZ: + case GAIA_LINESTRINGM: + case GAIA_LINESTRINGZM: + is_linestring = 1; + break; + default: + is_linestring = 0; + break; + }; + } + if (is_linestring) + { + *geom_name = name; + return 1; + } + if (name != NULL) + free (name); + return 0; +} + +static int +do_check_spatial_table (sqlite3 * db_handle, const void *cache, + const char *db_prefix, const char *table, + const char *geom_column, const char *from_column, + const char *to_column, char **geom_name) +{ +/* testing if the Spatial Table exists and it's correctly defined */ + char *xprefix; + char *xtable; + char *sql; + int ret; + int i; + char **results; + int rows; + int columns; + int ok_from = 0; + int ok_to = 0; + int ok_geom = 0; + +/* checking for a valid Spatial Table */ + *geom_name = NULL; + if (!do_check_registered_spatial_table + (db_handle, db_prefix, table, geom_column, geom_name)) + { + char *msg; + if (geom_column == NULL) + msg = + sqlite3_mprintf + ("%Q is not a valid Spatial Table (LINESTRING)", table); + else + msg = + sqlite3_mprintf + ("%Q.%Q is not a valid Spatial Table (LINESTRING)", table, + geom_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free(msg); + return 0; + } + +/* checking the table's columns */ + if (db_prefix == NULL) + db_prefix = "MAIN"; + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (table); + sql = sqlite3_mprintf ("PRAGMA \"%s\".table_info(\"%s\")", xprefix, xtable); + free (xprefix); + free (xtable); + ret = sqlite3_get_table (db_handle, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + { + const char *col = results[(i * columns) + 1]; + if (strcasecmp (col, from_column) == 0) + ok_from = 1; + if (strcasecmp (col, to_column) == 0) + ok_to = 1; + if (strcasecmp (col, *geom_name) == 0) + ok_geom = 1; + } + sqlite3_free_table (results); + +/* final validity check */ + if (ok_from) + { + char *msg = + sqlite3_mprintf + ("FromNode Column \"%s\" is already defined in the Spatial Table", + from_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + if (ok_to) + { + char *msg = + sqlite3_mprintf + ("ToNode Column \"%s\" is already defined in the Spatial Table", + to_column); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + if (!ok_geom) + { + char *msg = + sqlite3_mprintf + ("Geometry Column \"%s\" is not defined in the Spatial Table", + geom_name); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + + return 1; +} + +static int +do_insert_temp_aux_node (sqlite3 * db_handle, sqlite3_stmt * stmt, double x, + double y, double z, char **msg) +{ +/* inserting an Aux Node */ + int ret; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, x); + sqlite3_bind_double (stmt, 2, y); + sqlite3_bind_double (stmt, 3, z); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + return 1; + +/* some error occurred */ + *msg = sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + fprintf (stderr, "%s\n", *msg); + return 0; +} + +static int +do_update_link (sqlite3 * db_handle, sqlite3_stmt * stmt, + sqlite3_stmt * stmt_upd, int rowid, double from_x, + double from_y, double from_z, double to_x, double to_y, + double to_z, char **msg) +{ +/* updating the Spatial Table - step #1 */ + int ret; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, from_x); + sqlite3_bind_double (stmt, 2, from_y); + sqlite3_bind_double (stmt, 3, from_z); + sqlite3_bind_double (stmt, 4, to_x); + sqlite3_bind_double (stmt, 5, to_y); + sqlite3_bind_double (stmt, 6, to_z); + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + int node_from = sqlite3_column_int (stmt, 0); + int node_to = sqlite3_column_int (stmt, 1); + + sqlite3_reset (stmt_upd); + sqlite3_clear_bindings (stmt_upd); + sqlite3_bind_int (stmt_upd, 1, node_from); + sqlite3_bind_int (stmt_upd, 2, node_to); + sqlite3_bind_int (stmt_upd, 3, rowid); + ret = sqlite3_step (stmt_upd); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + return 1; + else + { + *msg = + sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + return 0; + } + +/* some error occurred */ + *msg = + sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + return 0; + } + else + { + *msg = + sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + return 0; + } + } + return 1; +} + +static int +do_create_routing_nodes (sqlite3 * db_handle, const void *cache, + const char *db_prefix, const char *table, + const char *geom_column, const char *from_column, + const char *to_column) +{ +/* creating and populating the Routing Nodes columns */ + char *xprefix; + char *xtable; + char *xcolumn; + char *xfrom; + char *xto; + char *sql; + int ret; + sqlite3_stmt *stmt_q1 = NULL; + sqlite3_stmt *stmt_ins = NULL; + sqlite3_stmt *stmt_q2 = NULL; + sqlite3_stmt *stmt_upd = NULL; + +/* adding the FromNode column */ + if (db_prefix == NULL) + db_prefix = "MAIN"; + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (table); + xcolumn = gaiaDoubleQuotedSql (from_column); + sql = + sqlite3_mprintf ("ALTER TABLE \"%s\".\"%s\" ADD COLUMN \"%s\" INTEGER", + xprefix, xtable, xcolumn); + free (xprefix); + free (xtable); + free (xcolumn); + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* adding the ToNode column */ + if (db_prefix == NULL) + db_prefix = "MAIN"; + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (table); + xcolumn = gaiaDoubleQuotedSql (to_column); + sql = + sqlite3_mprintf ("ALTER TABLE \"%s\".\"%s\" ADD COLUMN \"%s\" INTEGER", + xprefix, xtable, xcolumn); + free (xprefix); + free (xtable); + free (xcolumn); + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* dropping the Temporary Aux Table (just in case) */ + sql = "DROP TABLE temp_create_routing_aux_nodes"; + sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + +/* creating the Temporary Aux Table for Nodes */ + sql = "CREATE TEMPORARY TABLE temp_create_routing_aux_nodes (" + "x DOUBLE, y DOUBLE, z DOUBLE, " + "CONSTRAINT pk_create_routing_aux_nodes PRIMARY KEY (x, y, z))"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* preparing the query statement for identifying all Nodes */ + if (db_prefix == NULL) + db_prefix = "MAIN"; + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (table); + xcolumn = gaiaDoubleQuotedSql (geom_column); + sql = + sqlite3_mprintf + ("SELECT ROWID, ST_StartPoint(\"%s\"), ST_EndPoint(\"%s\") " + "FROM \"%s\".\"%s\"", xcolumn, xcolumn, xprefix, xtable); + free (xprefix); + free (xtable); + free (xcolumn); + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_q1, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* preparing the INSERT statement for Aux Nodes */ + sql = "INSERT OR IGNORE INTO temp_create_routing_aux_nodes " + "VALUES (?, ?, ?)"; + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_ins, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* preparing the query statement for identifying all Node-IDs */ + sql = "SELECT a.ROWID, b.ROWID " + "FROM temp_create_routing_aux_nodes AS a, " + "temp_create_routing_aux_nodes AS b " + "WHERE a.x = ? AND a.y = ? AND a.z = ? " + "AND b.x = ? AND b.y = ? AND b.z = ?"; + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_q2, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* preparing the UPDATE statement */ + if (db_prefix == NULL) + db_prefix = "MAIN"; + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (table); + xfrom = gaiaDoubleQuotedSql (from_column); + xto = gaiaDoubleQuotedSql (to_column); + sql = sqlite3_mprintf ("UPDATE \"%s\".\"%s\" SET \"%s\" = ?, \"%s\" = ? " + "WHERE ROWID = ?", xprefix, xtable, xfrom, xto); + free (xprefix); + free (xtable); + free (xfrom); + free (xto); + ret = sqlite3_prepare_v2 (db_handle, sql, strlen (sql), &stmt_upd, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* populating the Temp Aux Nodes */ + while (1) + { + ret = sqlite3_step (stmt_q1); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + const unsigned char *blob; + int size; + gaiaGeomCollPtr geom; + gaiaPointPtr pt; + double x; + double y; + double z; + char *msg; + if (sqlite3_column_type (stmt_q1, 1) == SQLITE_BLOB) + { + blob = + (const unsigned char *) sqlite3_column_blob (stmt_q1, + 1); + size = sqlite3_column_bytes (stmt_q1, 1); + geom = gaiaFromSpatiaLiteBlobWkb (blob, size); + if (geom) + { + pt = geom->FirstPoint; + x = pt->X; + y = pt->Y; + if (geom->DimensionModel == GAIA_XY_Z + || geom->DimensionModel == GAIA_XY_Z_M) + z = pt->Z; + else + z = 0.0; + gaiaFreeGeomColl (geom); + if (!do_insert_temp_aux_node + (db_handle, stmt_ins, x, y, z, &msg)) + { + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + } + } + if (sqlite3_column_type (stmt_q1, 2) == SQLITE_BLOB) + { + blob = + (const unsigned char *) sqlite3_column_blob (stmt_q1, + 2); + size = sqlite3_column_bytes (stmt_q1, 2); + geom = gaiaFromSpatiaLiteBlobWkb (blob, size); + if (geom) + { + pt = geom->FirstPoint; + x = pt->X; + y = pt->Y; + if (geom->DimensionModel == GAIA_XY_Z + || geom->DimensionModel == GAIA_XY_Z_M) + z = pt->Z; + else + z = 0.0; + gaiaFreeGeomColl (geom); + if (!do_insert_temp_aux_node + (db_handle, stmt_ins, x, y, z, &msg)) + { + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + } + } + } + else + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + } + +/* updating the Spatial Table */ + sqlite3_reset (stmt_q1); + while (1) + { + ret = sqlite3_step (stmt_q1); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + const unsigned char *blob; + int size; + gaiaGeomCollPtr geom; + gaiaPointPtr pt; + double from_x = DBL_MIN; + double from_y = DBL_MIN; + double from_z = DBL_MIN; + double to_x = DBL_MIN; + double to_y = DBL_MIN; + double to_z = DBL_MIN; + char *msg; + int rowid = sqlite3_column_int (stmt_q1, 0); + if (sqlite3_column_type (stmt_q1, 1) == SQLITE_BLOB) + { + blob = + (const unsigned char *) sqlite3_column_blob (stmt_q1, + 1); + size = sqlite3_column_bytes (stmt_q1, 1); + geom = gaiaFromSpatiaLiteBlobWkb (blob, size); + if (geom) + { + pt = geom->FirstPoint; + from_x = pt->X; + from_y = pt->Y; + if (geom->DimensionModel == GAIA_XY_Z + || geom->DimensionModel == GAIA_XY_Z_M) + from_z = pt->Z; + else + from_z = 0.0; + gaiaFreeGeomColl (geom); + } + } + if (sqlite3_column_type (stmt_q1, 2) == SQLITE_BLOB) + { + blob = + (const unsigned char *) sqlite3_column_blob (stmt_q1, + 2); + size = sqlite3_column_bytes (stmt_q1, 2); + geom = gaiaFromSpatiaLiteBlobWkb (blob, size); + if (geom) + { + pt = geom->FirstPoint; + to_x = pt->X; + to_y = pt->Y; + if (geom->DimensionModel == GAIA_XY_Z + || geom->DimensionModel == GAIA_XY_Z_M) + to_z = pt->Z; + else + to_z = 0.0; + gaiaFreeGeomColl (geom); + } + } + if (!do_update_link + (db_handle, stmt_q2, stmt_upd, rowid, from_x, from_y, + from_z, to_x, to_y, to_z, &msg)) + { + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + } + else + { + char *msg = sqlite3_mprintf ("SQL error: %s", + sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + } + + sqlite3_finalize (stmt_q1); + sqlite3_finalize (stmt_q2); + sqlite3_finalize (stmt_ins); + sqlite3_finalize (stmt_upd); + +/* dropping the Temporary Aux Table */ + sql = "DROP TABLE temp_create_routing_aux_nodes"; + sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + +/* COMMIT */ + sql = "RELEASE SAVEPOINT create_routing_nodes"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + return 1; + + error: + if (stmt_q1 != NULL) + sqlite3_finalize (stmt_q1); + if (stmt_q2 != NULL) + sqlite3_finalize (stmt_q2); + if (stmt_ins != NULL) + sqlite3_finalize (stmt_ins); + if (stmt_upd != NULL) + sqlite3_finalize (stmt_upd); +/* ROLLBACK */ + sql = "ROLLBACK TO create_routing_nodes"; + sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + return 0; +} + +SPATIALITE_DECLARE int +gaia_create_routing_nodes (sqlite3 * db_handle, + const void *cache, + const char *db_prefix, + const char *table, + const char *geom_column, + const char *from_column, const char *to_column) +{ +/* attempting to create a Routing Nodes columns for a spatial table */ + const char *sql; + int ret; + char *geom_name = NULL; + + if (db_handle == NULL || cache == NULL) + return 0; + + if (table == NULL) + { + gaia_create_routing_set_error (cache, "Spatial Table Name is NULL"); + return 0; + } + if (from_column == NULL) + { + gaia_create_routing_set_error (cache, "FromNode Column Name is NULL"); + return 0; + } + if (to_column == NULL) + { + gaia_create_routing_set_error (cache, "ToNode Column Name is NULL"); + return 0; + } + +/* testing the spatial table */ + if (!do_check_spatial_table + (db_handle, cache, db_prefix, table, geom_column, from_column, + to_column, &geom_name)) + goto error; + +/* setting a global Savepoint */ + sql = "SAVEPOINT create_routing_nodes"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + goto error; + } + +/* creating and populating the Routing Nodes columns */ + if (!do_create_routing_nodes + (db_handle, cache, db_prefix, table, geom_name, from_column, to_column)) + goto error; + + free (geom_name); + return 1; + + error: + if (geom_name != NULL) + free (geom_name); + return 0; +} + +SPATIALITE_DECLARE int +gaia_create_routing (sqlite3 * db_handle, + const void *cache, + const char *routing_data_table, + const char + *virtual_routing_table, + const char *input_table, + const char *from_column, + const char *to_column, + const char *geom_column, + const char *cost_column, + const char *name_column, + int a_star_enabled, + int bidirectional, + const char *oneway_from, + const char *oneway_to, int overwrite) +{ +/* attempting to create a VirtualRouting from an input table */ + int has_ids; + int n_nodes = 0; + int max_code_length = 0; + double a_star_coeff = DBL_MAX; + const char *sql; + int ret; + + if (db_handle == NULL || cache == NULL) + return 0; + + gaia_create_routing_set_error (cache, NULL); + if (routing_data_table == NULL) + { + gaia_create_routing_set_error (cache, + "Routing Data Table Name is NULL"); + return 0; + } + if (virtual_routing_table == NULL) + { + gaia_create_routing_set_error (cache, + "VirtualRouting Table Name is NULL"); + return 0; + } + if (input_table == NULL) + { + gaia_create_routing_set_error (cache, "Input Table Name is NULL"); + return 0; + } + if (from_column == NULL) + { + gaia_create_routing_set_error (cache, "FromNode Column Name is NULL"); + return 0; + } + if (to_column == NULL) + { + gaia_create_routing_set_error (cache, "ToNode Column Name is NULL"); + return 0; + } + if (geom_column == NULL && cost_column == NULL) + { + gaia_create_routing_set_error (cache, + "Both Geometry Column and Cost Column Names are NULL at the same time"); + return 0; + } + if (oneway_from == NULL && oneway_to != NULL) + { + gaia_create_routing_set_error (cache, + "OnewayFromTo is NULL but OnewayToFrom is NOT NULL"); + return 0; + } + if (oneway_from != NULL && oneway_to == NULL) + { + gaia_create_routing_set_error (cache, + "OnewayFromTo is NOT NULL but OnewayToFrom is NULL"); + return 0; + } + if (oneway_from != NULL && oneway_to != NULL && !bidirectional) + { + gaia_create_routing_set_error (cache, + "Both OnewayFromTo and OnewayToFrom are NOT NULL but Unidirectional has been specified"); + return 0; + } + if (a_star_enabled && geom_column == NULL) + { + gaia_create_routing_set_error (cache, + "Geometry Columns is NULL but A* is enabled"); + return 0; + } + +/* setting a global Savepoint */ + sql = "SAVEPOINT create_routing_zero"; + ret = sqlite3_exec (db_handle, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("SQL error: %s", sqlite3_errmsg (db_handle)); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + +/* dropping the TempTables (just in case) */ + do_drop_temp_tables (db_handle); + + if (overwrite) + { + /* attempting to drop existing tables (just in case) */ + do_drop_tables (db_handle, routing_data_table, virtual_routing_table); + } + +/* testing for existing tables */ + if (do_check_data_table (db_handle, routing_data_table)) + { + char *msg = + sqlite3_mprintf ("Routing Data Table \"%s\" already exists", + routing_data_table); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + if (do_check_virtual_table (db_handle, virtual_routing_table)) + { + char *msg = + sqlite3_mprintf ("VirtualRouting Table \"%s\" already exists", + virtual_routing_table); + gaia_create_routing_set_error (cache, msg); + sqlite3_free (msg); + return 0; + } + +/* testing the input table */ + if (!do_check_input_table + (db_handle, cache, input_table, from_column, to_column, geom_column, + cost_column, name_column, oneway_from, oneway_to, a_star_enabled, + bidirectional, &has_ids, &n_nodes, &max_code_length, &a_star_coeff)) + return 0; + +/* creating and populating the Routing Data table */ + if (!do_create_data + (db_handle, cache, routing_data_table, input_table, from_column, + to_column, geom_column, name_column, a_star_enabled, a_star_coeff, + has_ids, n_nodes, max_code_length)) + return 0; + +/* creating the VirtualRouting table */ + if (!do_create_virtual_routing + (db_handle, cache, routing_data_table, virtual_routing_table)) + return 0; + + return 1; +} Index: src/spatialite/extra_tables.c ================================================================== --- src/spatialite/extra_tables.c +++ src/spatialite/extra_tables.c @@ -893,18 +893,22 @@ "strict_resolution INTEGER NOT NULL,\n" "mixed_resolutions INTEGER NOT NULL,\n" "section_paths INTEGER NOT NULL,\n" "section_md5 INTEGER NOT NULL,\n" "section_summary INTEGER NOT NULL,\n" - "is_queryable INTEGER,\n" + "is_queryable INTEGER NOT NULL,\n" "red_band_index INTEGER,\n" "green_band_index INTEGER,\n" "blue_band_index INTEGER,\n" "nir_band_index INTEGER,\n" "enable_auto_ndvi INTEGER,\n" + "copyright TEXT NOT NULL DEFAULT '*** unknown ***',\n" + "license INTEGER NOT NULL DEFAULT 0,\n" "CONSTRAINT fk_rc_srs FOREIGN KEY (srid) " - "REFERENCES spatial_ref_sys (srid))"; + "REFERENCES spatial_ref_sys (srid),\n" + "CONSTRAINT fk_rc_lic FOREIGN KEY (license) " + "REFERENCES data_licenses (id))"; ret = sqlite3_exec (sqlite, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { spatialite_e ("CREATE TABLE 'raster_coverages' error: %s\n", err_msg); sqlite3_free (err_msg); @@ -1785,11 +1789,11 @@ } sql = "CREATE TRIGGER raster_coverages_update\n" "BEFORE UPDATE ON 'raster_coverages'\nFOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT, 'update on raster_coverages violates constraint: " "attempting to change the definition of an already populated Coverage')\n" - "WHERE IsPopulatedCoverage(OLD.coverage_name) = 1 AND " + "WHERE IsPopulatedCoverage(NULL, OLD.coverage_name) = 1 AND " "((OLD.sample_type <> NEW.sample_type) AND (OLD.pixel_type <> NEW.sample_type) " "OR (OLD.num_bands <> NEW.num_bands) OR (OLD.compression <> NEW.compression) " "OR (OLD.quality <> NEW.quality) OR (OLD.tile_width <> NEW.tile_width) " "OR (OLD.tile_height <> NEW.tile_height) OR (OLD.horz_resolution <> NEW.horz_resolution) " "OR (OLD.vert_resolution <> NEW.vert_resolution) OR " @@ -1803,11 +1807,11 @@ } sql = "CREATE TRIGGER raster_coverages_delete\n" "BEFORE DELETE ON 'raster_coverages'\nFOR EACH ROW BEGIN\n" "SELECT RAISE(ABORT, 'delete on raster_coverages violates constraint: " "attempting to delete the definition of an already populated Coverage')\n" - "WHERE IsPopulatedCoverage(OLD.coverage_name) = 1;\nEND"; + "WHERE IsPopulatedCoverage(NULL, OLD.coverage_name) = 1;\nEND"; ret = sqlite3_exec (sqlite, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s\n", err_msg); sqlite3_free (err_msg); @@ -2029,11 +2033,12 @@ error: return 0; } static int -check_if_coverage_exists (sqlite3 * sqlite, const char *coverage) +check_if_coverage_exists (sqlite3 * sqlite, const char *db_prefix, + const char *coverage) { /* checking if a Coverage table already exists */ int exists = 0; char *sql_statement; char *errMsg = NULL; @@ -2040,13 +2045,20 @@ int ret; char **results; int rows; int columns; int i; + char *xdb_prefix; + + if (db_prefix == NULL) + db_prefix = "MAIN"; + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = - sqlite3_mprintf ("SELECT name FROM sqlite_master WHERE type = 'table' " - "AND Upper(name) = Upper(%Q)", coverage); + sqlite3_mprintf + ("SELECT name FROM \"%s\".sqlite_master WHERE type = 'table' " + "AND Upper(name) = Upper(%Q)", xdb_prefix, coverage); + free (xdb_prefix); ret = sqlite3_get_table (sqlite, sql_statement, &results, &rows, &columns, &errMsg); sqlite3_free (sql_statement); if (ret != SQLITE_OK) @@ -2059,14 +2071,16 @@ sqlite3_free_table (results); return exists; } SPATIALITE_PRIVATE int -checkPopulatedCoverage (void *p_sqlite, const char *coverage_name) +checkPopulatedCoverage (void *p_sqlite, const char *db_prefix, + const char *coverage_name) { /* checking if a Coverage table is already populated */ int is_populated = 0; + char *xdb_prefix; char *xname; char *xxname; char *sql_statement; char *errMsg = NULL; int ret; @@ -2073,20 +2087,26 @@ char **results; int rows; int columns; int i; sqlite3 *sqlite = p_sqlite; + xname = sqlite3_mprintf ("%s_tile_data", coverage_name); - if (!check_if_coverage_exists (sqlite, xname)) + if (!check_if_coverage_exists (sqlite, db_prefix, xname)) { sqlite3_free (xname); return 0; } + if (db_prefix == NULL) + db_prefix = "MAIN"; + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xxname = gaiaDoubleQuotedSql (xname); sqlite3_free (xname); sql_statement = - sqlite3_mprintf ("SELECT ROWID FROM \"%s\" LIMIT 10", xxname); + sqlite3_mprintf ("SELECT ROWID FROM \"%s\".\"%s\" LIMIT 10", xdb_prefix, + xxname); + free (xdb_prefix); free (xxname); ret = sqlite3_get_table (sqlite, sql_statement, &results, &rows, &columns, &errMsg); sqlite3_free (sql_statement); @@ -2220,12 +2240,18 @@ char *sql; int ret; char *err_msg = NULL; sql = "CREATE TABLE vector_coverages (\n" "coverage_name TEXT NOT NULL PRIMARY KEY,\n" - "f_table_name TEXT NOT NULL,\n" - "f_geometry_column TEXT NOT NULL,\n" + "f_table_name TEXT,\n" + "f_geometry_column,\n" + "view_name TEXT,\n" + "view_geometry,\n" + "virt_name TEXT,\n" + "virt_geometry,\n" + "topology_name TEXT,\n" + "network_name TEXT,\n" "geo_minx DOUBLE,\n" "geo_miny DOUBLE,\n" "geo_maxx DOUBLE,\n" "geo_maxy DOUBLE,\n" "extent_minx DOUBLE,\n" @@ -2232,14 +2258,25 @@ "extent_miny DOUBLE,\n" "extent_maxx DOUBLE,\n" "extent_maxy DOUBLE,\n" "title TEXT NOT NULL DEFAULT '*** missing Title ***',\n" "abstract TEXT NOT NULL DEFAULT '*** missing Abstract ***',\n" - "is_queryable INTEGER,\n" - "CONSTRAINT fk_vector_coverages FOREIGN KEY (f_table_name, f_geometry_column) " + "is_queryable INTEGER NOT NULL,\n" + "is_editable INTEGER NOT NULL,\n" + "copyright TEXT NOT NULL DEFAULT '*** unknown ***',\n" + "license INTEGER NOT NULL DEFAULT 0,\n" + "CONSTRAINT fk_vc_gc FOREIGN KEY (f_table_name, f_geometry_column) " "REFERENCES geometry_columns (f_table_name, f_geometry_column) " - "ON DELETE CASCADE)"; + "ON DELETE CASCADE,\n" + "CONSTRAINT fk_vc_sv FOREIGN KEY (view_name, view_geometry) " + "REFERENCES views_geometry_columns (view_name, view_geometry) " + "ON DELETE CASCADE,\n" + "CONSTRAINT fk_vc_vt FOREIGN KEY (virt_name, virt_geometry) " + "REFERENCES virts_geometry_columns (virt_name, virt_geometry) " + "ON DELETE CASCADE,\n" + "CONSTRAINT fk_vc_lic FOREIGN KEY (license) " + "REFERENCES data_licenses (id))"; ret = sqlite3_exec (sqlite, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { spatialite_e ("CREATE TABLE 'vector_coverages' error: %s\n", err_msg); sqlite3_free (err_msg); @@ -2353,31 +2390,73 @@ return 0; } /* creating the vector_coverages_ref_sys view */ sql = "CREATE VIEW vector_coverages_ref_sys AS\n" - "SELECT v.coverage_name AS coverage_name, v.title AS title, " - "v.abstract AS abstract, v.is_queryable AS is_queryable, " - "v.geo_minx AS geo_minx, " - "v.geo_miny AS geo_miny, v.geo_maxx AS geo_maxx, " - "v.geo_maxy AS geo_may, v.extent_minx AS extent_minx, " - "v.extent_miny AS extent_miny, v.extent_maxx AS extent_maxx, " - "v.extent_maxy AS extent_maxy, s.srid AS srid, 1 AS native_srid, " - "s.auth_name AS auth_name, s.auth_srid AS auth_srid, " + "SELECT v.coverage_name AS coverage_name, v.title AS title, v.abstract AS abstract, " + "v.is_queryable AS is_queryable, v.geo_minx AS geo_minx, v.geo_miny AS geo_miny, " + "v.geo_maxx AS geo_maxx, v.geo_maxy AS geo_maxy, v.extent_minx AS extent_minx, " + "v.extent_miny AS extent_miny, v.extent_maxx AS extent_maxx, v.extent_maxy AS extent_maxy, " + "s.srid AS srid, 1 AS native_srid, s.auth_name AS auth_name, s.auth_srid AS auth_srid, " + "s.ref_sys_name AS ref_sys_name, s.proj4text AS proj4text\n" + "FROM vector_coverages AS v\n" + "JOIN geometry_columns AS x ON (v.topology_name IS NULL AND v.network_name IS NULL AND " + "v.f_table_name IS NOT NULL AND v.f_geometry_column IS NOT NULL AND " + "v.f_table_name = x.f_table_name AND v.f_geometry_column = x.f_geometry_column)\n" + "LEFT JOIN spatial_ref_sys AS s ON (x.srid = s.srid)\n" + "UNION\n" + "SELECT v.coverage_name AS coverage_name, v.title AS title, v.abstract AS abstract, " + "v.is_queryable AS is_queryable, v.geo_minx AS geo_minx, v.geo_miny AS geo_miny, " + "v.geo_maxx AS geo_maxx, v.geo_maxy AS geo_maxy, v.extent_minx AS extent_minx, " + "v.extent_miny AS extent_miny, v.extent_maxx AS extent_maxx, v.extent_maxy AS extent_maxy, " + "s.srid AS srid, 1 AS native_srid, s.auth_name AS auth_name, s.auth_srid AS auth_srid, " + "s.ref_sys_name AS ref_sys_name, s.proj4text AS proj4text\n" + "FROM vector_coverages AS v\n" + "JOIN views_geometry_columns AS y ON (v.view_name IS NOT NULL AND " + "v.view_geometry IS NOT NULL AND v.view_name = y.view_name AND " + "v.view_geometry = y.view_geometry)\n" + "JOIN geometry_columns AS x ON (y.f_table_name = x.f_table_name AND " + "y.f_geometry_column = x.f_geometry_column)\n" + "LEFT JOIN spatial_ref_sys AS s ON (x.srid = s.srid)\n" + "UNION\n" + "SELECT v.coverage_name AS coverage_name, v.title AS title, v.abstract AS abstract, " + "v.is_queryable AS is_queryable, v.geo_minx AS geo_minx, v.geo_miny AS geo_miny, " + "v.geo_maxx AS geo_maxx, v.geo_maxy AS geo_maxy, v.extent_minx AS extent_minx, " + "v.extent_miny AS extent_miny, v.extent_maxx AS extent_maxx, v.extent_maxy AS extent_maxy, " + "s.srid AS srid, 1 AS native_srid, s.auth_name AS auth_name, s.auth_srid AS auth_srid, " + "s.ref_sys_name AS ref_sys_name, s.proj4text AS proj4text\n" + "FROM vector_coverages AS v\n" + "JOIN virts_geometry_columns AS x ON (v.virt_name IS NOT NULL " + "AND v.virt_geometry IS NOT NULL AND v.virt_name = x.virt_name " + "AND v.virt_geometry = x.virt_geometry)\n" + "LEFT JOIN spatial_ref_sys AS s ON (x.srid = s.srid)\n" + "UNION\n" + "SELECT v.coverage_name AS coverage_name, v.title AS title, v.abstract AS abstract, " + "v.is_queryable AS is_queryable, v.geo_minx AS geo_minx, v.geo_miny AS geo_miny, " + "v.geo_maxx AS geo_maxx, v.geo_maxy AS geo_maxy, v.extent_minx AS extent_minx, " + "v.extent_miny AS extent_miny, v.extent_maxx AS extent_maxx, v.extent_maxy AS extent_maxy, " + "s.srid AS srid, 1 AS native_srid, s.auth_name AS auth_name, s.auth_srid AS auth_srid, " + "s.ref_sys_name AS ref_sys_name, s.proj4text AS proj4text\n" + "FROM vector_coverages AS v\n" + "JOIN topologies AS x ON (v.topology_name IS NOT NULL AND v.topology_name = x.topology_name)\n" + "LEFT JOIN spatial_ref_sys AS s ON (x.srid = s.srid)\n" + "UNION\n" + "SELECT v.coverage_name AS coverage_name, v.title AS title, v.abstract AS abstract, " + "v.is_queryable AS is_queryable, v.geo_minx AS geo_minx, v.geo_miny AS geo_miny, " + "v.geo_maxx AS geo_maxx, v.geo_maxy AS geo_maxy, v.extent_minx AS extent_minx, " + "v.extent_miny AS extent_miny, v.extent_maxx AS extent_maxx, v.extent_maxy AS extent_maxy, " + "s.srid AS srid, 1 AS native_srid, s.auth_name AS auth_name, s.auth_srid AS auth_srid, " "s.ref_sys_name AS ref_sys_name, s.proj4text AS proj4text\n" "FROM vector_coverages AS v\n" - "JOIN geometry_columns AS x ON (v.f_table_name = x.f_table_name " - "AND v.f_geometry_column = x.f_geometry_column)\n" + "JOIN networks AS x ON (v.network_name IS NOT NULL AND v.network_name = x.network_name)\n" "LEFT JOIN spatial_ref_sys AS s ON (x.srid = s.srid)\n" - "UNION\nSELECT v.coverage_name AS coverage_name, v.title AS title, " - "v.abstract AS abstract, v.is_queryable AS is_queryable, " - "v.geo_minx AS geo_minx, " - "v.geo_miny AS geo_miny, v.geo_maxx AS geo_maxx, " - "v.geo_maxy AS geo_may, x.extent_minx AS extent_minx, " - "x.extent_miny AS extent_miny, x.extent_maxx AS extent_maxx, " - "x.extent_maxy AS extent_maxy, s.srid AS srid, 0 AS native_srid, " - "s.auth_name AS auth_name, s.auth_srid AS auth_srid, " + "UNION\n" + "SELECT v.coverage_name AS coverage_name, v.title AS title, v.abstract AS abstract, " + "v.is_queryable AS is_queryable, v.geo_minx AS geo_minx, v.geo_miny AS geo_miny, " + "v.geo_maxx AS geo_maxx, v.geo_maxy AS geo_maxy, x.extent_minx AS extent_minx, " + "x.extent_miny AS extent_miny, x.extent_maxx AS extent_maxx, x.extent_maxy AS extent_maxy, " + "s.srid AS srid, 0 AS native_srid, s.auth_name AS auth_name, s.auth_srid AS auth_srid, " "s.ref_sys_name AS ref_sys_name, s.proj4text AS proj4text\n" "FROM vector_coverages AS v\n" "JOIN vector_coverages_srid AS x ON (v.coverage_name = x.coverage_name)\n" "LEFT JOIN spatial_ref_sys AS s ON (x.srid = s.srid)"; ret = sqlite3_exec (sqlite, sql, NULL, NULL, &err_msg); @@ -2448,10 +2527,16 @@ createVectorCoveragesTable (void *p_sqlite) { /* Creating the main VectorCoverages table */ int ok_table; sqlite3 *sqlite = p_sqlite; + +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + +/* attempting to create Topologies and Networks tables */ + do_create_topologies (sqlite); + do_create_networks (sqlite); /* checking if already defined */ ok_table = check_vector_coverages (sqlite); if (ok_table) { @@ -2484,10 +2569,17 @@ /* creating the main VectorCoverages table */ if (!create_vector_coverages (sqlite)) goto error; return 1; +#else + + spatialite_e + ("CreateVectorCoveragesTable() error: libspatialite was built by disabling Topology\n"); + +#endif /* end ENABLE_RTTOPO conditionals */ + error: return 0; } static int @@ -2651,12 +2743,16 @@ "bgcolor TEXT,\n" "tiled INTEGER NOT NULL CHECK (tiled IN (0, 1)),\n" "tile_width INTEGER NOT NULL CHECK (tile_width BETWEEN 256 AND 5000),\n" "tile_height INTEGER NOT NULL CHECK (tile_width BETWEEN 256 AND 5000),\n" "is_cached INTEGER NOT NULL CHECK (is_cached IN (0, 1)),\n" + "copyright TEXT NOT NULL DEFAULT '*** unknown ***',\n" + "license INTEGER NOT NULL DEFAULT 0,\n" "CONSTRAINT fk_wms_getmap FOREIGN KEY (parent_id) " - "REFERENCES wms_getcapabilities (id) ON DELETE CASCADE)"; + "REFERENCES wms_getcapabilities (id) ON DELETE CASCADE,\n" + "CONSTRAINT fk_wms_lic FOREIGN KEY (license) " + "REFERENCES data_licenses (id))"; ret = sqlite3_exec (sqlite, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { spatialite_e ("CREATE TABLE 'wms_getmap' error: %s\n", err_msg); sqlite3_free (err_msg); @@ -4035,13 +4131,15 @@ while (*p_tbl != NULL) { ok_table = check_styling_table (sqlite, *p_tbl, *p_view); if (ok_table) { - spatialite_e - ("CreateStylingTables() error: table '%s' already exists\n", - *p_tbl); + /* + spatialite_e + ("CreateStylingTables() error: table '%s' already exists\n", + *p_tbl); + */ goto error; } p_tbl++; p_view++; } @@ -4051,16 +4149,21 @@ { /* creating the main RasterCoverages table as well */ if (!create_raster_coverages (sqlite)) goto error; } +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ if (!check_vector_coverages (sqlite)) { + /* creating both TOPOLOGIES and NETWORKS tables */ + do_create_topologies (sqlite); + do_create_networks (sqlite); /* creating the main VectorCoverages table as well */ if (!create_vector_coverages (sqlite)) goto error; } +#endif /* end TOPOLOGY conditionals */ if (!create_external_graphics (sqlite)) goto error; if (!create_fonts (sqlite)) goto error; if (!create_vector_styles (sqlite, relaxed)) Index: src/spatialite/metatables.c ================================================================== --- src/spatialite/metatables.c +++ src/spatialite/metatables.c @@ -28,10 +28,13 @@ the Initial Developer. All Rights Reserved. Contributor(s): Pepijn Van Eeckhoudt (implementing Android support) + +Mark Johnson +(checking triggers supporting a supposed Writable Spatial View) 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 @@ -218,10 +221,17 @@ create_views_geometry_columns (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIEWS_GEOMETRY_COLUMNS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "views_geometry_columns (\n"); strcat (sql, "view_name TEXT NOT NULL,\n"); strcat (sql, "view_geometry TEXT NOT NULL,\n"); @@ -501,10 +511,17 @@ create_virts_geometry_columns (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIRTS_GEOMETRY_COLUMNS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "virts_geometry_columns (\n"); strcat (sql, "virt_name TEXT NOT NULL,\n"); strcat (sql, "virt_geometry TEXT NOT NULL,\n"); @@ -704,10 +721,17 @@ create_geometry_columns_statistics (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the GEOMETRY_COLUMNS_STATISTICS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "geometry_columns_statistics (\n"); strcat (sql, "f_table_name TEXT NOT NULL,\n"); strcat (sql, "f_geometry_column TEXT NOT NULL,\n"); @@ -834,10 +858,17 @@ create_views_geometry_columns_statistics (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIEWS_GEOMETRY_COLUMNS_STATISTICS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "views_geometry_columns_statistics (\n"); strcat (sql, "view_name TEXT NOT NULL,\n"); strcat (sql, "view_geometry TEXT NOT NULL,\n"); @@ -962,10 +993,17 @@ create_virts_geometry_columns_statistics (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIRTS_GEOMETRY_COLUMNS_STATISTICS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "virts_geometry_columns_statistics (\n"); strcat (sql, "virt_name TEXT NOT NULL,\n"); strcat (sql, "virt_geometry TEXT NOT NULL,\n"); @@ -1090,10 +1128,17 @@ create_geometry_columns_field_infos (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the GEOMETRY_COLUMNS_FIELD_INFOS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "geometry_columns_field_infos (\n"); strcat (sql, "f_table_name TEXT NOT NULL,\n"); strcat (sql, "f_geometry_column TEXT NOT NULL,\n"); @@ -1228,10 +1273,17 @@ create_views_geometry_columns_field_infos (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIEWS_COLUMNS_FIELD_INFOS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "views_geometry_columns_field_infos (\n"); strcat (sql, "view_name TEXT NOT NULL,\n"); strcat (sql, "view_geometry TEXT NOT NULL,\n"); @@ -1362,10 +1414,17 @@ create_virts_geometry_columns_field_infos (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIRTS_GEOMETRY_COLUMNS_FIELD_INFOS table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "virts_geometry_columns_field_infos (\n"); strcat (sql, "virt_name TEXT NOT NULL,\n"); strcat (sql, "virt_geometry TEXT NOT NULL,\n"); @@ -1496,10 +1555,17 @@ create_geometry_columns_times (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the GEOMETRY_COLUMNS_TIME table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "geometry_columns_time (\n"); strcat (sql, "f_table_name TEXT NOT NULL,\n"); strcat (sql, "f_geometry_column TEXT NOT NULL,\n"); @@ -1629,10 +1695,17 @@ create_geometry_columns_auth (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the GEOMETRY_COLUMNS_AUTH table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "geometry_columns_auth (\n"); strcat (sql, "f_table_name TEXT NOT NULL,\n"); strcat (sql, "f_geometry_column TEXT NOT NULL,\n"); @@ -1762,10 +1835,17 @@ create_views_geometry_columns_auth (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIEWS_GEOMETRY_COLUMNS_AUTH table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "views_geometry_columns_auth (\n"); strcat (sql, "view_name TEXT NOT NULL,\n"); strcat (sql, "view_geometry TEXT NOT NULL,\n"); @@ -1888,10 +1968,17 @@ create_virts_geometry_columns_auth (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VIRTS_GEOMETRY_COLUMNS_AUTH table */ strcpy (sql, "CREATE TABLE IF NOT EXISTS "); strcat (sql, "virts_geometry_columns_auth (\n"); strcat (sql, "virt_name TEXT NOT NULL,\n"); strcat (sql, "virt_geometry TEXT NOT NULL,\n"); @@ -2014,10 +2101,17 @@ create_geometry_columns_views (sqlite3 * sqlite) { char sql[4186]; char *errMsg = NULL; int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + /* creating the VECTOR_LAYERS view */ strcpy (sql, "CREATE VIEW IF NOT EXISTS "); strcat (sql, "vector_layers AS\n"); strcat (sql, "SELECT 'SpatialTable' AS layer_type, "); strcat (sql, "f_table_name AS table_name, "); @@ -2183,10 +2277,145 @@ strcat (sql, "double_min AS double_min, "); strcat (sql, "double_max double_max\n"); strcat (sql, "FROM virts_geometry_columns_field_infos"); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } + return 1; +} + +static int +create_data_licenses (sqlite3 * sqlite) +{ + char sql[4186]; + char *errMsg = NULL; + int ret; + + if (sqlite3_db_readonly (sqlite, "MAIN") == 1) + { + /* ignoring a read-only database */ + return 1; + } + +/* creating the DATA_LICENSES table */ + strcpy (sql, "CREATE TABLE IF NOT EXISTS data_licenses (\n"); + strcat (sql, "\tid INTEGER PRIMARY KEY AUTOINCREMENT,\n"); + strcat (sql, "\tname TEXT NOT NULL UNIQUE,\n"); + strcat (sql, "\turl TEXT)"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the UNDEFINED license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, "VALUES (0, 'Undefined', NULL)"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the PROPRIETARY license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, "VALUES (1, 'Proprietary - Non Free', NULL)"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the PUBLIC DOMAIN license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, "VALUES (2, 'PD - Public Domain', NULL)"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the CC0 1.0 license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, + "VALUES (3, 'CC0 1.0', 'https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt')"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the CC BY 3.0 license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, + "VALUES (4, 'CC BY 3.0', 'https://creativecommons.org/licenses/by/3.0/legalcode.txt')"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the CC BY 4.0 license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, + "VALUES (5, 'CC BY 4.0', 'https://creativecommons.org/licenses/by/4.0/legalcode.txt')"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the CC BY-SA 3.0 license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, + "VALUES (6, 'CC BY-SA 3.0', 'https://creativecommons.org/licenses/by-sa/3.0/legalcode.txt')"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the CC BY-SA 4.0 license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, + "VALUES (7, 'CC BY-SA 4.0', 'https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt')"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the CC BY-SA-NC 3.0 license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, + "VALUES (8, 'CC BY-SA-NC 3.0', 'https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode.txt')"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e ("SQL error: %s: %s\n", sql, errMsg); + sqlite3_free (errMsg); + return 0; + } +/* inserting the CC BY-SA-NC 4.0 license */ + strcpy (sql, "INSERT OR IGNORE INTO data_licenses (id, name, url) "); + strcat (sql, + "VALUES (9, 'CC BY-SA-NC 4.0', 'https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt')"); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) { spatialite_e ("SQL error: %s: %s\n", sql, errMsg); sqlite3_free (errMsg); return 0; } @@ -2546,10 +2775,12 @@ if (!create_views_geometry_columns_auth (sqlite)) return 0; if (!create_virts_geometry_columns_auth (sqlite)) return 0; if (!create_geometry_columns_views (sqlite)) + return 0; + if (!create_data_licenses (sqlite)) return 0; if (!create_sql_statements_log (sqlite)) return 0; return 1; @@ -3814,10 +4045,15 @@ 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_table = gaiaDoubleQuotedSql (table); @@ -3834,15 +4070,28 @@ 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 buildSpatialIndexEx (void *p_sqlite, const unsigned char *table, @@ -4279,12 +4528,75 @@ lyr = lyr->Next; } } static void -addVectorLayerAuth (gaiaVectorLayersListPtr list, const char *table_name, - const char *geometry_column, int read_only, int hidden) +doCheckWritableSpatialView (sqlite3 * handle, const char *view_name, + int *has_trigger_insert, int *has_trigger_update, + int *has_trigger_delete, int *is_read_only) +{ +/* +* checking if a supposed Writable Spatial View do +* effectively declares all expected Triggers +* +* patch kindly submitted by Mark Johnson +* see ticket: https://www.gaia-gis.it/fossil/libspatialite/tktview/597fce55f2884668a24b591840162ffebda390e1 +*/ + int ret; + char *sql; + sqlite3_stmt *stmt; + +/* Claims to be a Writable SpatialView, we shall see ... */ + *has_trigger_insert = 0; + *has_trigger_update = 0; + *has_trigger_delete = 0; + *is_read_only = 1; + + sql = + sqlite3_mprintf ("SELECT " + "(SELECT Exists(SELECT rootpage FROM sqlite_master " + "WHERE (type = 'trigger' AND Lower(tbl_name) = Lower(%Q) AND " + "(instr(upper(sql),'INSTEAD OF INSERT') > 0)))), " + "(SELECT Exists(SELECT rootpage FROM sqlite_master " + "WHERE (type = 'trigger' AND Lower(tbl_name) = Lower(%Q) AND " + "(instr(upper(sql),'INSTEAD OF UPDATE') > 0)))), " + "(SELECT Exists(SELECT rootpage FROM sqlite_master " + "WHERE (type = 'trigger' AND Lower(tbl_name) = Lower(%Q) AND " + "(instr(upper(sql),'INSTEAD OF DELETE') > 0))))", + view_name, view_name, view_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret == SQLITE_OK) + { + while (sqlite3_step (stmt) == SQLITE_ROW) + { + if (sqlite3_column_type (stmt, 0) != SQLITE_NULL) + { + if (sqlite3_column_int (stmt, 0) == 1) + *has_trigger_insert = 1; + } + if (sqlite3_column_type (stmt, 1) != SQLITE_NULL) + { + if (sqlite3_column_int (stmt, 1) == 1) + *has_trigger_update = 1; + } + if (sqlite3_column_type (stmt, 2) != SQLITE_NULL) + { + if (sqlite3_column_int (stmt, 2) == 1) + *has_trigger_delete = 1; + } + } + ret = sqlite3_finalize (stmt); + } + if (*has_trigger_insert || *has_trigger_update || *has_trigger_delete) + *is_read_only = 0; /* Yes, this could be a functional Writable SpatialView */ +} + +static void +addVectorLayerAuth (sqlite3 * handle, gaiaVectorLayersListPtr list, + const char *table_name, const char *geometry_column, + int read_only, int hidden) { /* appending a LayerAuth object to the corresponding VectorLayer */ gaiaVectorLayerPtr lyr = list->First; while (lyr) { @@ -4293,10 +4605,29 @@ { gaiaLayerAuthPtr auth = malloc (sizeof (gaiaLayerAuth)); lyr->AuthInfos = auth; auth->IsReadOnly = read_only; auth->IsHidden = hidden; + auth->HasTriggerInsert = 0; + auth->HasTriggerUpdate = 0; + auth->HasTriggerDelete = 0; + if ((lyr->LayerType == GAIA_VECTOR_VIEW) && (!auth->IsReadOnly)) + { + int has_trigger_insert = 0; + int has_trigger_update = 0; + int has_trigger_delete = 0; + int is_read_only = 1; + doCheckWritableSpatialView (handle, table_name, + &has_trigger_insert, + &has_trigger_update, + &has_trigger_delete, + &is_read_only); + auth->HasTriggerInsert = has_trigger_insert; + auth->HasTriggerUpdate = has_trigger_update; + auth->HasTriggerDelete = has_trigger_delete; + auth->IsReadOnly = is_read_only; + } return; } lyr = lyr->Next; } } @@ -4317,11 +4648,11 @@ } static void freeVectorLayer (gaiaVectorLayerPtr lyr) { -/* destroyng a VectorLayer object */ +/* destroying a VectorLayer object */ gaiaLayerAttributeFieldPtr fld; gaiaLayerAttributeFieldPtr fldn; if (!lyr) return; if (lyr->TableName) @@ -4369,10 +4700,19 @@ char *sql; int ret; sqlite3_stmt *stmt; int error = 0; +/* +* attempting first to recover all SpatialViews registered into +* views_geometry_columns but not into views_geometry_columns_auth +*/ + sql = "INSERT OR IGNORE INTO views_geometry_columns_auth " + "(view_name, view_geometry, hidden) " + "SELECT view_name, view_geometry, 0 FROM views_geometry_columns"; + sqlite3_exec (handle, sql, NULL, NULL, NULL); + /* querying the vector_layers view */ if (table == NULL) sql = sqlite3_mprintf ("SELECT layer_type, table_name, geometry_column, geometry_type, " @@ -4561,12 +4901,12 @@ if (sqlite3_column_type (stmt, 3) == SQLITE_NULL) is_null = 1; else hidden = sqlite3_column_int (stmt, 3); if (!is_null) - addVectorLayerAuth (list, table_name, geometry_column, - read_only, hidden); + addVectorLayerAuth (handle, list, table_name, + geometry_column, read_only, hidden); } } ret = sqlite3_finalize (stmt); stop3: @@ -4795,10 +5135,12 @@ || strcasecmp (dims, "4") == 0) geometry_type += 3000; addVectorLayer (list, "SpatialTable", table_name, geometry_column, geometry_type, srid, spatial_index); + addVectorLayerAuth (handle, list, table_name, geometry_column, + 1, 0); } else error = 1; } ret = sqlite3_finalize (stmt); @@ -5344,12 +5686,12 @@ if (sqlite3_column_type (stmt, 3) == SQLITE_NULL) is_null = 1; else hidden = sqlite3_column_int (stmt, 3); if (!is_null) - addVectorLayerAuth (list, table_name, geometry_column, - read_only, hidden); + addVectorLayerAuth (handle, list, table_name, + geometry_column, read_only, hidden); } } ret = sqlite3_finalize (stmt); stop: return 1; Index: src/spatialite/se_helpers.c ================================================================== --- src/spatialite/se_helpers.c +++ src/spatialite/se_helpers.c @@ -72,12 +72,19 @@ #ifdef _WIN32 #define strcasecmp _stricmp #endif /* not WIN32 */ - #ifdef ENABLE_LIBXML2 /* including LIBXML2 */ + +/* Constant definitions: Vector Coverage Types */ +#define VECTOR_UNKNOWN 0 +#define VECTOR_GEOTABLE 1 +#define VECTOR_SPATIALVIEW 2 +#define VECTOR_VIRTUALSHP 3 +#define VECTOR_TOPOGEO 4 +#define VECTOR_TOPONET 5 static int check_external_graphic (sqlite3 * sqlite, const char *xlink_href) { /* checks if an ExternalGraphic Resource already exists */ @@ -3106,11 +3113,12 @@ SPATIALITE_PRIVATE int register_vector_coverage (void *p_sqlite, const char *coverage_name, const char *f_table_name, const char *f_geometry_column, const char *title, - const char *abstract) + const char *abstract, int is_queryable, + int is_editable) { /* auxiliary function: inserts a Vector Coverage definition */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; int ret; const char *sql; @@ -3119,12 +3127,13 @@ if (coverage_name != NULL && f_table_name != NULL && f_geometry_column != NULL && title != NULL && abstract != NULL) { /* attempting to insert the Vector Coverage */ sql = "INSERT INTO vector_coverages " - "(coverage_name, f_table_name, f_geometry_column, title, abstract) " - "VALUES (Lower(?), Lower(?), Lower(?), ?, ?)"; + "(coverage_name, f_table_name, f_geometry_column, title, " + "abstract, is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), ?, ?, ?, ?)"; ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); if (ret != SQLITE_OK) { spatialite_e ("registerVectorCoverage: \"%s\"\n", sqlite3_errmsg (sqlite)); @@ -3139,10 +3148,16 @@ sqlite3_bind_text (stmt, 3, f_geometry_column, strlen (f_geometry_column), SQLITE_STATIC); sqlite3_bind_text (stmt, 4, title, strlen (title), SQLITE_STATIC); sqlite3_bind_text (stmt, 5, abstract, strlen (abstract), SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + if (is_editable) + is_editable = 1; + sqlite3_bind_int (stmt, 6, is_queryable); + sqlite3_bind_int (stmt, 7, is_editable); ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) ; else { @@ -3157,12 +3172,13 @@ else if (coverage_name != NULL && f_table_name != NULL && f_geometry_column != NULL) { /* attempting to insert the Vector Coverage */ sql = "INSERT INTO vector_coverages " - "(coverage_name, f_table_name, f_geometry_column) " - "VALUES (Lower(?), Lower(?), Lower(?))"; + "(coverage_name, f_table_name, f_geometry_column, " + "is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), ?, ?)"; ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); if (ret != SQLITE_OK) { spatialite_e ("registerVectorCoverage: \"%s\"\n", sqlite3_errmsg (sqlite)); @@ -3174,10 +3190,219 @@ SQLITE_STATIC); sqlite3_bind_text (stmt, 2, f_table_name, strlen (f_table_name), SQLITE_STATIC); sqlite3_bind_text (stmt, 3, f_geometry_column, strlen (f_geometry_column), SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + if (is_editable) + is_editable = 1; + sqlite3_bind_int (stmt, 4, is_queryable); + sqlite3_bind_int (stmt, 5, is_editable); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerVectorCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else + return 0; +} + +SPATIALITE_PRIVATE int +register_spatial_view_coverage (void *p_sqlite, const char *coverage_name, + const char *view_name, + const char *view_geometry, const char *title, + const char *abstract, int is_queryable, + int is_editable) +{ +/* auxiliary function: inserts a Spatial View Coverage definition */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + + if (coverage_name != NULL && view_name != NULL + && view_geometry != NULL && title != NULL && abstract != NULL) + { + /* attempting to insert the Vector Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, view_name, view_geometry, title, " + "abstract, is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), ?, ?, ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerVectorCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, view_name, strlen (view_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, view_geometry, + strlen (view_geometry), SQLITE_STATIC); + sqlite3_bind_text (stmt, 4, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_text (stmt, 5, abstract, strlen (abstract), + SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + if (is_editable) + is_editable = 1; + sqlite3_bind_int (stmt, 6, is_queryable); + sqlite3_bind_int (stmt, 7, is_editable); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerVectorCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else if (coverage_name != NULL && view_name != NULL + && view_geometry != NULL) + { + /* attempting to insert the Spatial View Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, view_name, view_geometry, " + "is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerVectorCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, view_name, strlen (view_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, view_geometry, + strlen (view_geometry), SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + if (is_editable) + is_editable = 1; + sqlite3_bind_int (stmt, 4, is_queryable); + sqlite3_bind_int (stmt, 5, is_editable); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerVectorCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else + return 0; +} + +SPATIALITE_PRIVATE int +register_virtual_shp_coverage (void *p_sqlite, const char *coverage_name, + const char *virt_name, const char *virt_geometry, + const char *title, const char *abstract, + int is_queryable) +{ +/* auxiliary function: inserts a VirtualShapefile Coverage definition */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + + if (coverage_name != NULL && virt_name != NULL + && virt_geometry != NULL && title != NULL && abstract != NULL) + { + /* attempting to insert the Vector Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, virt_name, virt_geometry, title, " + "abstract, is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), ?, ?, ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerVectorCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, virt_name, strlen (virt_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, virt_geometry, + strlen (virt_geometry), SQLITE_STATIC); + sqlite3_bind_text (stmt, 4, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_text (stmt, 5, abstract, strlen (abstract), + SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + sqlite3_bind_int (stmt, 6, is_queryable); + sqlite3_bind_int (stmt, 7, 0); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerVectorCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else if (coverage_name != NULL && virt_name != NULL + && virt_geometry != NULL) + { + /* attempting to insert the VirtualShapefile Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, virt_name, virt_geometry, " + "is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerVectorCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, virt_name, strlen (virt_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, virt_geometry, + strlen (virt_geometry), SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + sqlite3_bind_int (stmt, 4, is_queryable); + sqlite3_bind_int (stmt, 5, 0); ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) ; else { @@ -3190,10 +3415,298 @@ return 1; } else return 0; } + +SPATIALITE_PRIVATE int +register_topogeo_coverage (void *p_sqlite, const char *coverage_name, + const char *topogeo_name, const char *title, + const char *abstract, int is_queryable, + int is_editable) +{ +/* auxiliary function: inserts a Vector Coverage definition + * based on some Topology-Geometry */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + char *xsql; + int i; + char **results; + int rows; + int columns; + char *errMsg = NULL; + char *f_table_name = NULL; + char *f_geometry_column = NULL; + sqlite3_stmt *stmt; + + if (topogeo_name == NULL) + return 0; + +/* testing if the Topology-Geometry do really exist */ + xsql = sqlite3_mprintf ("SELECT topology_name " + "FROM topologies WHERE Lower(topology_name) = %Q", + topogeo_name); + ret = sqlite3_get_table (sqlite, xsql, &results, &rows, &columns, &errMsg); + sqlite3_free (xsql); + if (ret != SQLITE_OK) + { + sqlite3_free (errMsg); + return 0; + } + for (i = 1; i <= rows; i++) + { + const char *value = results[(i * columns) + 0]; + if (f_table_name != NULL) + sqlite3_free (f_table_name); + if (f_geometry_column != NULL) + sqlite3_free (f_geometry_column); + f_table_name = sqlite3_mprintf ("%s_edge", value); + f_geometry_column = sqlite3_mprintf ("geom"); + } + sqlite3_free_table (results); + + if (coverage_name != NULL && f_table_name != NULL + && f_geometry_column != NULL && title != NULL && abstract != NULL) + { + /* attempting to insert the Vector Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, f_table_name, f_geometry_column, " + "topology_name, title, abstract, is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), Lower(?), ?, ?, ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerTopoGeoCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, f_table_name, strlen (f_table_name), + sqlite3_free); + sqlite3_bind_text (stmt, 3, f_geometry_column, + strlen (f_geometry_column), sqlite3_free); + sqlite3_bind_text (stmt, 4, topogeo_name, strlen (topogeo_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 5, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_text (stmt, 6, abstract, strlen (abstract), + SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + if (is_editable) + is_editable = 1; + sqlite3_bind_int (stmt, 7, is_queryable); + sqlite3_bind_int (stmt, 8, is_editable); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerTopoGeoCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else if (coverage_name != NULL && f_table_name != NULL + && f_geometry_column != NULL) + { + /* attempting to insert the Vector Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, f_table_name, f_geometry_column, " + "topology_name, is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), Lower(?), ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerTopoGeoCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, f_table_name, strlen (f_table_name), + sqlite3_free); + sqlite3_bind_text (stmt, 3, f_geometry_column, + strlen (f_geometry_column), sqlite3_free); + sqlite3_bind_text (stmt, 4, topogeo_name, strlen (topogeo_name), + SQLITE_STATIC); + sqlite3_bind_int (stmt, 5, is_queryable); + sqlite3_bind_int (stmt, 6, is_editable); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerTopoGeoCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else + { + if (f_table_name != NULL) + sqlite3_free (f_table_name); + if (f_geometry_column != NULL) + sqlite3_free (f_geometry_column); + return 0; + } +} + +SPATIALITE_PRIVATE int +register_toponet_coverage (void *p_sqlite, const char *coverage_name, + const char *toponet_name, const char *title, + const char *abstract, int is_queryable, + int is_editable) +{ +/* auxiliary function: inserts a Vector Coverage definition + * based on some Topology-Network */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + char *xsql; + int i; + char **results; + int rows; + int columns; + char *errMsg = NULL; + char *f_table_name = NULL; + char *f_geometry_column = NULL; + sqlite3_stmt *stmt; + + if (toponet_name == NULL) + return 0; + +/* testing if the Topology-Network do really exist */ + xsql = sqlite3_mprintf ("SELECT network_name " + "FROM networks WHERE Lower(network_name) = %Q", + toponet_name); + ret = sqlite3_get_table (sqlite, xsql, &results, &rows, &columns, &errMsg); + sqlite3_free (xsql); + if (ret != SQLITE_OK) + { + sqlite3_free (errMsg); + return 0; + } + for (i = 1; i <= rows; i++) + { + const char *value = results[(i * columns) + 0]; + if (f_table_name != NULL) + sqlite3_free (f_table_name); + if (f_geometry_column != NULL) + sqlite3_free (f_geometry_column); + f_table_name = sqlite3_mprintf ("%s_link", value); + f_geometry_column = sqlite3_mprintf ("geometry"); + } + sqlite3_free_table (results); + + if (coverage_name != NULL && f_table_name != NULL + && f_geometry_column != NULL && title != NULL && abstract != NULL) + { + /* attempting to insert the Vector Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, f_table_name, f_geometry_column, " + "network_name, title, abstract, is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), Lower(?), ?, ?, ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerTopoNetCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, f_table_name, strlen (f_table_name), + sqlite3_free); + sqlite3_bind_text (stmt, 3, f_geometry_column, + strlen (f_geometry_column), sqlite3_free); + sqlite3_bind_text (stmt, 4, toponet_name, strlen (toponet_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 5, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_text (stmt, 6, abstract, strlen (abstract), + SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + if (is_editable) + is_editable = 1; + sqlite3_bind_int (stmt, 7, is_queryable); + sqlite3_bind_int (stmt, 8, is_editable); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerTopoNetCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else if (coverage_name != NULL && f_table_name != NULL + && f_geometry_column != NULL) + { + /* attempting to insert the Vector Coverage */ + sql = "INSERT INTO vector_coverages " + "(coverage_name, f_table_name, f_geometry_column, " + "network_name, is_queryable, is_editable) VALUES " + "(Lower(?), Lower(?), Lower(?), Lower(?), ?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerTopoNetCoverage: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, f_table_name, strlen (f_table_name), + sqlite3_free); + sqlite3_bind_text (stmt, 3, f_geometry_column, + strlen (f_geometry_column), sqlite3_free); + sqlite3_bind_text (stmt, 4, toponet_name, strlen (toponet_name), + SQLITE_STATIC); + sqlite3_bind_int (stmt, 5, is_queryable); + sqlite3_bind_int (stmt, 6, is_editable); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerTopoNetCoverage() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; + } + else + { + if (f_table_name != NULL) + sqlite3_free (f_table_name); + if (f_geometry_column != NULL) + sqlite3_free (f_geometry_column); + return 0; + } +} static int check_vector_coverage (sqlite3 * sqlite, const char *coverage_name) { /* checks if a Vector Coverage do actually exists */ @@ -3421,37 +3934,74 @@ return do_delete_vector_coverage (sqlite, coverage_name); } SPATIALITE_PRIVATE int set_vector_coverage_infos (void *p_sqlite, const char *coverage_name, - const char *title, const char *abstract) + const char *title, const char *abstract, + int is_queryable, int is_editable) { /* auxiliary function: updates the descriptive infos supporting a Vector Coverage */ sqlite3 *sqlite = (sqlite3 *) p_sqlite; int ret; const char *sql; sqlite3_stmt *stmt; + int prev_changes; + int curr_changes; if (coverage_name != NULL && title != NULL && abstract != NULL) { + prev_changes = sqlite3_total_changes (sqlite); + /* attempting to update the Vector Coverage */ - sql = "UPDATE vector_coverages SET title = ?, abstract = ? " - "WHERE Lower(coverage_name) = Lower(?)"; - ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); - if (ret != SQLITE_OK) - { - spatialite_e ("setVectorCoverageInfos: \"%s\"\n", - sqlite3_errmsg (sqlite)); - return 0; - } - sqlite3_reset (stmt); - sqlite3_clear_bindings (stmt); - sqlite3_bind_text (stmt, 1, title, strlen (title), SQLITE_STATIC); - sqlite3_bind_text (stmt, 2, abstract, strlen (abstract), - SQLITE_STATIC); - sqlite3_bind_text (stmt, 3, coverage_name, strlen (coverage_name), - SQLITE_STATIC); + if (is_queryable < 0 || is_editable < 0) + { + sql = "UPDATE vector_coverages SET title = ?, abstract = ? " + "WHERE Lower(coverage_name) = Lower(?)"; + ret = + sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setVectorCoverageInfos: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, title, strlen (title), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, abstract, strlen (abstract), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, coverage_name, + strlen (coverage_name), SQLITE_STATIC); + } + else + { + sql = "UPDATE vector_coverages SET title = ?, abstract = ?, " + "is_queryable = ?, is_editable = ? WHERE Lower(coverage_name) = Lower(?)"; + ret = + sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setVectorCoverageInfos: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, title, strlen (title), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, abstract, strlen (abstract), + SQLITE_STATIC); + if (is_queryable) + is_queryable = 1; + if (is_editable) + is_editable = 1; + sqlite3_bind_int (stmt, 3, is_queryable); + sqlite3_bind_int (stmt, 4, is_editable); + sqlite3_bind_text (stmt, 5, coverage_name, + strlen (coverage_name), SQLITE_STATIC); + } ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) ; else { @@ -3459,15 +4009,107 @@ sqlite3_errmsg (sqlite)); sqlite3_finalize (stmt); return 0; } sqlite3_finalize (stmt); + + curr_changes = sqlite3_total_changes (sqlite); + if (prev_changes == curr_changes) + return 0; return 1; } else return 0; } + +SPATIALITE_PRIVATE int +set_vector_coverage_copyright (void *p_sqlite, const char *coverage_name, + const char *copyright, const char *license) +{ +/* auxiliary function: updates the copyright infos supporting a Vector Coverage */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + + if (coverage_name == NULL) + return 0; + if (copyright == NULL && license == NULL) + return 1; + + if (copyright == NULL) + { + /* just updating the License */ + sql = "UPDATE vector_coverages SET license = (" + "SELECT id FROM data_licenses WHERE name = ?) " + "WHERE Lower(coverage_name) = Lower(?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setVectorCoverageCopyright: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, license, strlen (license), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, coverage_name, + strlen (coverage_name), SQLITE_STATIC); + } + else if (license == NULL) + { + /* just updating the Copyright */ + sql = "UPDATE vector_coverages SET copyright = ? " + "WHERE Lower(coverage_name) = Lower(?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setVectorCoverageCopyright: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, copyright, strlen (copyright), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + } + else + { + /* updating both Copyright and License */ + sql = "UPDATE vector_coverages SET copyright = ?, license = (" + "SELECT id FROM data_licenses WHERE name = ?) " + "WHERE Lower(coverage_name) = Lower(?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setVectorCoverageCopyright: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, copyright, strlen (copyright), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, license, strlen (license), SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, coverage_name, + strlen (coverage_name), SQLITE_STATIC); + } + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("setVectorCoverageCopyright() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; +} static int check_vector_coverage_srid2 (sqlite3 * sqlite, const char *coverage_name, int srid) { @@ -3505,10 +4147,63 @@ return 1; return 0; stop: return 0; } + +static int +find_vector_coverage_type (sqlite3 * sqlite, const char *coverage_name) +{ +/* determining the Vector Coverage Type */ + int ret; + int i; + char **results; + int rows; + int columns; + char *value1; + char *value2; + int type = VECTOR_UNKNOWN; + char *sql; + + sql = + sqlite3_mprintf + ("SELECT f_table_name, f_geometry_column, view_name, view_geometry, " + "virt_name, virt_geometry, topology_name, network_name " + "FROM vector_coverages WHERE coverage_name = %Q", coverage_name); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return VECTOR_UNKNOWN; + if (rows < 1) + ; + else + { + for (i = 1; i <= rows; i++) + { + value1 = results[(i * columns) + 0]; + value2 = results[(i * columns) + 1]; + if (value1 != NULL && value2 != NULL) + type = VECTOR_GEOTABLE; + value1 = results[(i * columns) + 2]; + value2 = results[(i * columns) + 3]; + if (value1 != NULL && value2 != NULL) + type = VECTOR_SPATIALVIEW; + value1 = results[(i * columns) + 4]; + value2 = results[(i * columns) + 5]; + if (value1 != NULL && value2 != NULL) + type = VECTOR_VIRTUALSHP; + value1 = results[(i * columns) + 6]; + if (value1 != NULL) + type = VECTOR_TOPOGEO; + value1 = results[(i * columns) + 7]; + if (value1 != NULL) + type = VECTOR_TOPONET; + } + } + sqlite3_free_table (results); + return type; +} static int check_vector_coverage_srid1 (sqlite3 * sqlite, const char *coverage_name, int srid) { @@ -3516,26 +4211,62 @@ int ret; const char *sql; sqlite3_stmt *stmt; int count = 0; int same_srid = 0; - - sql = "SELECT c.srid FROM vector_coverages AS v " - "JOIN geometry_columns AS c ON (Lower(v.f_table_name) = Lower(c.f_table_name) " - "AND Lower(v.f_geometry_column) = Lower(c.f_geometry_column)) " - "WHERE Lower(v.coverage_name) = Lower(?)"; - ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); - if (ret != SQLITE_OK) - { - spatialite_e ("check Vector Coverage SRID: \"%s\"\n", - sqlite3_errmsg (sqlite)); - goto stop; - } - sqlite3_reset (stmt); - sqlite3_clear_bindings (stmt); - sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), - SQLITE_STATIC); + int type = find_vector_coverage_type (sqlite, coverage_name); + + switch (type) + { + case VECTOR_GEOTABLE: + sql = sqlite3_mprintf ("SELECT c.srid FROM vector_coverages AS v " + "JOIN geometry_columns AS c ON (v.f_table_name IS NOT NULL AND v.f_geometry_column IS NOT NULL " + "AND v.topology_name IS NULL AND v.network_name IS NULL AND " + "Lower(v.f_table_name) = Lower(c.f_table_name) " + "AND Lower(v.f_geometry_column) = Lower(c.f_geometry_column)) " + "WHERE Lower(v.coverage_name) = Lower(%Q)", + coverage_name); + break; + case VECTOR_SPATIALVIEW: + sql = sqlite3_mprintf ("SELECT c.srid FROM vector_coverages AS v " + "JOIN views_geometry_columns AS x ON (v.view_name IS NOT NULL AND v.view_geometry IS NOT NULL " + "AND Lower(v.view_name) = Lower(x.view_name) AND Lower(v.view_geometry) = Lower(x.view_geometry)) " + "JOIN geometry_columns AS c ON (Lower(x.f_table_name) = Lower(c.f_table_name) " + "AND Lower(x.f_geometry_column) = Lower(c.f_geometry_column)) " + "WHERE Lower(v.coverage_name) = Lower(%Q)", + coverage_name); + break; + case VECTOR_VIRTUALSHP: + sql = sqlite3_mprintf ("SELECT c.srid FROM vector_coverages AS v " + "JOIN virts_geometry_columns AS c ON (v.virt_name IS NOT NULL AND v.virt_geometry IS NOT NULL " + "AND Lower(v.virt_name) = Lower(c.virt_name) AND Lower(v.virt_geometry) = Lower(c.virt_geometry)) " + "WHERE Lower(v.coverage_name) = Lower(%Q)", + coverage_name); + break; + case VECTOR_TOPOGEO: + sql = sqlite3_mprintf ("SELECT c.srid FROM vector_coverages AS v " + "JOIN topologies AS c ON (v.topology_name IS NOT NULL " + "AND Lower(v.topology_name) = Lower(c.topology_name)) " + "WHERE Lower(v.coverage_name) = Lower(%Q)", + coverage_name); + break; + case VECTOR_TOPONET: + sql = sqlite3_mprintf ("SELECT c.srid FROM vector_coverages AS v " + "JOIN networks AS c ON (v.network_name IS NOT NULL " + "AND Lower(v.network_name) = Lower(c.network_name)) " + "WHERE Lower(v.coverage_name) = Lower(%Q)", + coverage_name); + break; + case VECTOR_UNKNOWN: + default: + goto stop; + break; + }; + + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + goto stop; while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) @@ -4100,10 +4831,11 @@ sqlite3_stmt *stmt_ext = NULL; sqlite3_stmt *stmt_upd_cvg = NULL; sqlite3_stmt *stmt_upd_srid = NULL; sqlite3_stmt *stmt_null_srid = NULL; sqlite3_stmt *stmt_srid = NULL; + sqlite3_stmt *stmt_virt = NULL; /* preparing the ancillary SQL statements */ sql = "SELECT srid FROM vector_coverages_srid " "WHERE Lower(coverage_name) = Lower(?)"; ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt_srid, NULL); @@ -4153,21 +4885,43 @@ { sql = "SELECT v.coverage_name, v.f_table_name, v.f_geometry_column, " "c.srid FROM vector_coverages AS v " "JOIN geometry_columns AS c ON (Lower(v.f_table_name) = " "Lower(c.f_table_name) AND Lower(v.f_geometry_column) = " - "Lower(c.f_geometry_column))"; + "Lower(c.f_geometry_column)) " + "WHERE v.f_table_name IS NOT NULL AND v.f_geometry_column IS NOT NULL " + "UNION " + "SELECT v.coverage_name, w.f_table_name, w.f_geometry_column, c.srid " + "FROM vector_coverages AS v " + "JOIN views_geometry_columns AS w ON " + "(Lower(v.view_name) = Lower(w.view_name) AND " + "Lower(v.view_geometry) = Lower(w.view_geometry)) " + "JOIN geometry_columns AS c ON " + "(Lower(w.f_table_name) = Lower(c.f_table_name) AND " + "Lower(w.f_geometry_column) = Lower(c.f_geometry_column)) " + "WHERE v.view_name IS NOT NULL AND v.view_geometry IS NOT NULL"; } else { - sql = "SELECT v.coverage_name, v.f_table_name, v.f_geometry_column, " "c.srid FROM vector_coverages AS v " "JOIN geometry_columns AS c ON (Lower(v.f_table_name) = " "Lower(c.f_table_name) AND Lower(v.f_geometry_column) = " "Lower(c.f_geometry_column)) " - "WHERE Lower(v.coverage_name) = Lower(?)"; + "WHERE Lower(v.coverage_name) = Lower(?) AND " + "v.f_table_name IS NOT NULL AND v.f_geometry_column IS NOT NULL " + "UNION " + "SELECT v.coverage_name, w.f_table_name, w.f_geometry_column, c.srid " + "FROM vector_coverages AS v " + "JOIN views_geometry_columns AS w ON " + "(Lower(v.view_name) = Lower(w.view_name) AND " + "Lower(v.view_geometry) = Lower(w.view_geometry)) " + "JOIN geometry_columns AS c ON " + "(Lower(w.f_table_name) = Lower(c.f_table_name) AND " + "Lower(w.f_geometry_column) = Lower(c.f_geometry_column)) " + "WHERE Lower(v.coverage_name) = Lower(?) AND " + "v.view_name IS NOT NULL AND v.view_geometry IS NOT NULL"; } ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); if (ret != SQLITE_OK) { spatialite_e ("updateVectorCoverageExtent: \"%s\"\n", @@ -4184,12 +4938,16 @@ } sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); if (coverage_name != NULL) - sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), - SQLITE_STATIC); + { + sqlite3_bind_text (stmt, 1, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, coverage_name, strlen (coverage_name), + SQLITE_STATIC); + } while (1) { /* scrolling the result set rows */ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) @@ -4303,10 +5061,77 @@ spatialite_e ("updateVectorCoverageExtent() error: \"%s\"\n", sqlite3_errmsg (sqlite)); goto error; } } + +/* updating VirtualShapes Extents */ + sql = "UPDATE vector_coverages SET " + "geo_minx = MbrMinX(ST_Transform(GetShapefileExtent(virt_name), 4326)), " + "geo_miny = MbrMinY(ST_Transform(GetShapefileExtent(virt_name), 4326)), " + "geo_maxx = MbrMaxX(ST_Transform(GetShapefileExtent(virt_name), 4326)), " + "geo_maxy = MbrMaxY(ST_Transform(GetShapefileExtent(virt_name), 4326)), " + "extent_minx = MbrMinX(GetShapefileExtent(virt_name)), " + "extent_miny = MbrMinY(GetShapefileExtent(virt_name)), " + "extent_maxx = MbrMaxX(GetShapefileExtent(virt_name)), " + "extent_maxy = MbrMaxY(GetShapefileExtent(virt_name)) " + "WHERE virt_name IS NOT NULL"; + ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("updateVectorCoverageExtent: \"%s\"\n", + sqlite3_errmsg (sqlite)); + goto error; + } + + sql = + "SELECT coverage_name, virt_name FROM vector_coverages WHERE virt_name IS NOT NULL"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt_virt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("updateVectorCoverageExtent: PREPUPPAMELO !!! \"%s\"\n", + sqlite3_errmsg (sqlite)); + goto error; + } + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt_virt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + const char *coverage_name = + (const char *) sqlite3_column_text (stmt_virt, 0); + const char *virt_name = + (const char *) sqlite3_column_text (stmt_virt, 1); + sql = + sqlite3_mprintf ("UPDATE vector_coverages_srid SET " + "extent_minx = MbrMinX(ST_Transform(GetShapefileExtent(%Q), srid)), " + "extent_miny = MbrMinY(ST_Transform(GetShapefileExtent(%Q), srid)), " + "extent_maxx = MbrMaxX(ST_Transform(GetShapefileExtent(%Q), srid)), " + "extent_maxy = MbrMaxY(ST_Transform(GetShapefileExtent(%Q), srid)) " + "WHERE coverage_name = %Q", virt_name, + virt_name, virt_name, virt_name, + coverage_name); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + spatialite_e ("updateVectorCoverageExtent: PUPPAMELO !!! %d \"%s\"\n", ret, + sqlite3_errmsg (sqlite)); + goto error; + } + } + else + { + spatialite_e + ("updateVectorCoverageExtent() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + goto error; + } + } if (transaction) { /* committing the still pending Transaction */ ret = sqlite3_exec (sqlite, "COMMIT", NULL, NULL, NULL); @@ -4317,10 +5142,11 @@ sqlite3_finalize (stmt); sqlite3_finalize (stmt_upd_cvg); sqlite3_finalize (stmt_upd_srid); sqlite3_finalize (stmt_null_srid); sqlite3_finalize (stmt_srid); + sqlite3_finalize (stmt_virt); return 1; error: if (stmt != NULL) sqlite3_finalize (stmt); @@ -4332,10 +5158,13 @@ sqlite3_finalize (stmt_upd_srid); if (stmt_null_srid != NULL) sqlite3_finalize (stmt_null_srid); if (stmt_srid != NULL) sqlite3_finalize (stmt_srid); + if (stmt_virt != NULL) + sqlite3_finalize (stmt_virt); + return 0; } static int check_raster_coverage_srid2 (sqlite3 * sqlite, const char *coverage_name, @@ -6069,10 +6898,102 @@ return 1; } else return 0; } + +SPATIALITE_PRIVATE int +set_wms_getmap_copyright (void *p_sqlite, const char *url, + const char *layer_name, const char *copyright, + const char *license) +{ +/* auxiliary function: updates the copyright infos supporting a WMS layer */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + + if (url == NULL || layer_name == NULL) + return 0; + if (copyright == NULL && license == NULL) + return 1; + + if (copyright == NULL) + { + /* just updating the License */ + sql = "UPDATE wms_getmap SET license = (" + "SELECT id FROM data_licenses WHERE name = ?) " + "WHERE url = ? AND layer_name = ?"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setWMSLayerCopyright: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, license, strlen (license), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, url, strlen (url), SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, layer_name, + strlen (layer_name), SQLITE_STATIC); + } + else if (license == NULL) + { + /* just updating the Copyright */ + sql = "UPDATE wms_getmap SET copyright = ? " + "WHERE url = ? AND layer_name = ?"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setWMSLayerCopyright: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, copyright, strlen (copyright), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, url, strlen (url), SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, layer_name, + strlen (layer_name), SQLITE_STATIC); + } + else + { + /* updating both Copyright and License */ + sql = "UPDATE wms_getmap SET copyright = ?, license = (" + "SELECT id FROM data_licenses WHERE name = ?) " + "WHERE url = ? AND layer_name = ?"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setWMSLayerCopyright: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, copyright, strlen (copyright), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, license, strlen (license), SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, url, strlen (url), SQLITE_STATIC); + sqlite3_bind_text (stmt, 4, layer_name, + strlen (layer_name), SQLITE_STATIC); + } + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("setWMSLayerCopyright() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; +} SPATIALITE_PRIVATE int set_wms_getmap_bgcolor (void *p_sqlite, const char *url, const char *layer_name, const char *bgcolor) @@ -6754,11 +7675,11 @@ sqlite3_bind_double (stmt, 4, miny); sqlite3_bind_double (stmt, 5, maxx); sqlite3_bind_double (stmt, 6, maxy); if (is_default != 0) is_default = 1; - sqlite3_bind_int (stmt, 7, 0); + sqlite3_bind_int (stmt, 7, is_default); ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) ; else { @@ -7066,5 +7987,181 @@ } } sqlite3_finalize (stmt); return request_url; } + +SPATIALITE_PRIVATE int +register_data_license (void *p_sqlite, const char *license_name, + const char *url) +{ +/* auxiliary function: inserts a Data License */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + + if (license_name == NULL) + return 0; + + sql = "INSERT INTO data_licenses (name, url) VALUES (?, ?)"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("registerDataLicense: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, license_name, + strlen (license_name), SQLITE_STATIC); + if (url == NULL) + sqlite3_bind_null (stmt, 2); + else + sqlite3_bind_text (stmt, 2, url, strlen (url), SQLITE_STATIC); + + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("registerDataLicense() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; +} + +SPATIALITE_PRIVATE int +unregister_data_license (void *p_sqlite, const char *license_name) +{ +/* auxiliary function: deletes a Data License */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + + if (license_name == NULL) + return 0; + + sql = "DELETE FROM data_licenses WHERE name = ?"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("unregisterDataLicense: \"%s\"\n", + sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, license_name, + strlen (license_name), SQLITE_STATIC); + + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("unregisterDataLicense() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; +} + +SPATIALITE_PRIVATE int +rename_data_license (void *p_sqlite, const char *old_name, const char *new_name) +{ +/* auxiliary function: renames a Data License */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + int prev_changes; + int curr_changes; + + if (old_name == NULL || new_name == NULL) + return 0; + + prev_changes = sqlite3_total_changes (sqlite); + + sql = "UPDATE data_licenses SET name = ? WHERE name = ?"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("renameDataLicense: \"%s\"\n", sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, new_name, strlen (new_name), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, old_name, strlen (old_name), SQLITE_STATIC); + + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("renameDataLicense() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + + curr_changes = sqlite3_total_changes (sqlite); + if (prev_changes == curr_changes) + return 0; + return 1; +} + +SPATIALITE_PRIVATE int +set_data_license_url (void *p_sqlite, const char *license_name, const char *url) +{ +/* auxiliary function: updates a Data License URL */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int ret; + const char *sql; + sqlite3_stmt *stmt; + int prev_changes; + int curr_changes; + + if (license_name == NULL || url == NULL) + return 0; + + prev_changes = sqlite3_total_changes (sqlite); + + sql = "UPDATE data_licenses SET url = ? WHERE name = ?"; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + spatialite_e ("setDataLicenseUrl: \"%s\"\n", sqlite3_errmsg (sqlite)); + return 0; + } + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, url, strlen (url), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, license_name, + strlen (license_name), SQLITE_STATIC); + + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + spatialite_e ("setDataLicenseUrl() error: \"%s\"\n", + sqlite3_errmsg (sqlite)); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + + curr_changes = sqlite3_total_changes (sqlite); + if (prev_changes == curr_changes) + return 0; + return 1; +} Index: src/spatialite/spatialite.c ================================================================== --- src/spatialite/spatialite.c +++ src/spatialite/spatialite.c @@ -95,10 +95,11 @@ #include #include #include #include #include +#include #include #include #ifdef ENABLE_LIBXML2 /* LIBXML2 (and thus WFS) enabled */ #include @@ -698,11 +699,11 @@ / HasTopology() / / return 1 if built including GroundControlPoints support (GGP); otherwise 0 */ GAIA_UNUSED (); /* LCOV_EXCL_LINE */ -#ifdef RTTOPO /* RTTOPO is supported */ +#ifdef ENABLE_RTTOPO /* RTTOPO is supported */ sqlite3_result_int (context, 1); #else sqlite3_result_int (context, 0); #endif } @@ -912,10 +913,50 @@ p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); n_bytes = sqlite3_value_bytes (argv[0]); } if (p_blob) { + if (n_bytes == 24 || n_bytes == 32 || n_bytes == 40) + { + /* testing for a possible TinyPoint BLOB */ + if (*(p_blob + 0) == GAIA_MARK_START && + (*(p_blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN + || *(p_blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + && *(p_blob + (n_bytes - 1)) == GAIA_MARK_END) + { + /* quick TinyPoint validation */ + int pointType; + if (*(p_blob + 1) == GAIA_TINYPOINT_LITTLE_ENDIAN) + little_endian = 1; + else if (*(p_blob + 1) == GAIA_TINYPOINT_BIG_ENDIAN) + little_endian = 0; + else + goto illegal_geometry; /* unknown encoding; neither little-endian nor big-endian */ + geom_srid = + gaiaImport32 (p_blob + 2, little_endian, endian_arch); + pointType = *(p_blob + 6); + switch (pointType) + { + case GAIA_TINYPOINT_XY: + geom_type = GAIA_POINT; + break; + case GAIA_TINYPOINT_XYZ: + geom_type = GAIA_POINTZ; + break; + case GAIA_TINYPOINT_XYM: + geom_type = GAIA_POINTM; + break; + case GAIA_TINYPOINT_XYZM: + geom_type = GAIA_POINTZM; + break; + default: + goto illegal_geometry; + }; + goto valid_geometry; + } + } + /* quick Geometry validation */ if (n_bytes < 45) goto illegal_geometry; /* cannot be an internal BLOB WKB geometry */ if (*(p_blob + 0) != GAIA_MARK_START) goto illegal_geometry; /* failed to recognize START signature */ @@ -1361,85 +1402,78 @@ static void fnct_IsValidRasterStatistics (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: -/ IsValidRasterStatistics(text coverage, BLOBencoded statistics) +/ IsValidRasterStatistics(text db_prefix, text coverage, +/ BLOBencoded statistics) / or -/ IsValidRasterStatistics(BLOBencoded statistics, text sample_type, int num_bands) +/ IsValidRasterStatistics(BLOBencoded statistics, text sample_type, +/ int num_bands) / / basic version intended to be overloaded by RasterLite-2 / always return 0 (FALSE) / or -1 (INVALID ARGS) / */ GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (argc == 2) - { - if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) - { - sqlite3_result_int (context, -1); - return; - } - if (sqlite3_value_type (argv[1]) != SQLITE_BLOB) - { - sqlite3_result_int (context, -1); - return; - } - } + if ((sqlite3_value_type (argv[0]) == SQLITE_TEXT + || sqlite3_value_type (argv[0]) == SQLITE_NULL) + && sqlite3_value_type (argv[1]) == SQLITE_TEXT + && sqlite3_value_type (argv[2]) == SQLITE_BLOB) + ; + else if (sqlite3_value_type (argv[0]) == SQLITE_BLOB + && sqlite3_value_type (argv[1]) == SQLITE_TEXT + && sqlite3_value_type (argv[2]) == SQLITE_INTEGER) + ; else { - if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) - { - sqlite3_result_int (context, -1); - return; - } - if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) - { - sqlite3_result_int (context, -1); - return; - } - if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER) - { - sqlite3_result_int (context, -1); - return; - } + sqlite3_result_int (context, -1); + return; } sqlite3_result_int (context, 0); } static void fnct_IsValidRasterTile (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: -/ IsValidRasterTile(text coverage, integer level, BLOBencoded tile_odd, -/ BLOBencoded tile_even) +/ IsValidRasterTile(text db_prefix, text coverage, integer level, +/ BLOBencoded tile_odd, BLOBencoded tile_even) / / basic version intended to be overloaded by RasterLite-2 / always return 0 (FALSE) / or -1 (INVALID ARGS) / */ GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) - { - sqlite3_result_int (context, -1); - return; - } - if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER) - { - sqlite3_result_int (context, -1); - return; - } - if (sqlite3_value_type (argv[2]) != SQLITE_BLOB) - { - sqlite3_result_int (context, -1); - return; - } - if (sqlite3_value_type (argv[3]) != SQLITE_BLOB - && sqlite3_value_type (argv[3]) != SQLITE_NULL) + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT + || sqlite3_value_type (argv[0]) == SQLITE_NULL) + ; + else + { + sqlite3_result_int (context, -1); + return; + } + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER) + { + sqlite3_result_int (context, -1); + return; + } + if (sqlite3_value_type (argv[3]) != SQLITE_BLOB) + { + sqlite3_result_int (context, -1); + return; + } + if (sqlite3_value_type (argv[4]) != SQLITE_BLOB + && sqlite3_value_type (argv[4]) != SQLITE_NULL) { sqlite3_result_int (context, -1); return; } sqlite3_result_int (context, 0); @@ -1448,27 +1482,36 @@ static void fnct_IsPopulatedCoverage (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: -/ IsPopulatedCoverage(text coverage) +/ IsPopulatedCoverage(text db_prefix, text coverage) / / check if a RasterCoverage is already populated / returns 1 if TRUE, 0 if FALSE / -1 on invalid arguments */ + const char *db_prefix = NULL; const char *coverage; int ret; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT + || sqlite3_value_type (argv[0]) == SQLITE_NULL) + ; + else + { + sqlite3_result_int (context, -1); + return; + } + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) { sqlite3_result_int (context, -1); return; } coverage = (const char *) sqlite3_value_text (argv[0]); - ret = checkPopulatedCoverage (sqlite, coverage); + ret = checkPopulatedCoverage (sqlite, db_prefix, coverage); sqlite3_result_int (context, ret); return; } static int @@ -1524,14 +1567,52 @@ sqlite3_free_table (results); return without_rowid; } static int -checkGeoPackage (sqlite3 * handle) +checkDatabase (const sqlite3 * handle, const char *db_prefix) +{ +/* testing if some ATTACHED-DB do really exist */ + sqlite3 *sqlite = (sqlite3 *) handle; + char *xdb_prefix; + char sql[1024]; + int ret; + int i; + char **results; + int rows; + int columns; + int exists = 0; + + if (db_prefix == NULL) + db_prefix = "main"; + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); + sprintf (sql, "PRAGMA \"%s\".database_list", xdb_prefix); + free (xdb_prefix); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); + if (ret != SQLITE_OK) + return 0; + if (rows < 1) + ; + else + { + for (i = 1; i <= rows; i++) + { + const char *name = results[(i * columns) + 1]; + if (strcasecmp (name, db_prefix) == 0) + exists = 1; + } + } + sqlite3_free_table (results); + return exists; +} + +static int +checkGeoPackage (sqlite3 * handle, const char *db_prefix) { /* testing for GeoPackage meta-tables */ sqlite3 *sqlite = (sqlite3 *) handle; + char *xdb_prefix; char sql[1024]; int ret; const char *name; int table_name = 0; int column_name = 0; @@ -1545,12 +1626,20 @@ int gpkg_srs = 0; int i; char **results; int rows; int columns; + + if (!checkDatabase (handle, db_prefix)) + return -1; /* checking the GPKG_GEOMETRY_COLUMNS table */ - strcpy (sql, "PRAGMA table_info(gpkg_geometry_columns)"); + if (db_prefix == NULL) + db_prefix = "main"; + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); + sprintf (sql, "PRAGMA \"%s\".table_info(gpkg_geometry_columns)", + xdb_prefix); + free (xdb_prefix); ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); if (ret != SQLITE_OK) goto unknown; if (rows < 1) ; @@ -1605,23 +1694,32 @@ } SPATIALITE_PRIVATE int checkSpatialMetaData (const void *handle) { +/* just calls checkSpatialMetaData_ex */ + return checkSpatialMetaData_ex (handle, NULL); +} + +SPATIALITE_PRIVATE int +checkSpatialMetaData_ex (const void *handle, const char *db_prefix) +{ /* internal utility function: / / for FDO-OGR interoperability and cross-version seamless compatibility: / tests the SpatialMetadata type, returning: / +/ -1 - if no ATTACHED-DB identified by db_prefix exists / 0 - if no valid SpatialMetaData were found / 1 - if SpatiaLite-like (legacy) SpatialMetadata were found / 2 - if FDO-OGR-like SpatialMetadata were found / 3 - if SpatiaLite-like (current) SpatialMetadata were / 4 - if GeoPackage SpatialMetadata were found / */ sqlite3 *sqlite = (sqlite3 *) handle; + char *xdb_prefix; int spatialite_legacy_rs = 0; int spatialite_rs = 0; int fdo_rs = 0; int spatialite_legacy_gc = 0; int spatialite_gc = 0; @@ -1645,12 +1743,19 @@ const char *name; int i; char **results; int rows; int columns; + + if (!checkDatabase (handle, db_prefix)) + return -1; /* checking the GEOMETRY_COLUMNS table */ - strcpy (sql, "PRAGMA table_info(geometry_columns)"); + if (db_prefix == NULL) + db_prefix = "main"; + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); + sprintf (sql, "PRAGMA \"%s\".table_info(geometry_columns)", xdb_prefix); + free (xdb_prefix); ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); if (ret != SQLITE_OK) goto unknown; if (rows < 1) ; @@ -1729,11 +1834,11 @@ if (fdo_gc && fdo_rs) return 2; if (spatialite_gc && spatialite_rs) return 3; unknown: - if (checkGeoPackage (sqlite)) + if (checkGeoPackage (sqlite, db_prefix)) return 4; return 0; } static void @@ -1772,18 +1877,21 @@ static void fnct_AutoFDOStart (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / AutoFDOStart(void) +/ or +/ AutoFDOStart(db_prefix TEXT) / / for FDO-OGR interoperability: / tests the SpatialMetadata type, then automatically / creating a VirtualFDO table for each FDO-OGR main table / declared within FDO-styled SpatialMetadata / */ int ret; + const char *db_prefix = "main"; const char *name; int i; char **results; int rows; int columns; @@ -1796,16 +1904,34 @@ char *xname; char *xxname; char *xtable; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (checkSpatialMetaData (sqlite) == 2) + if (argc == 1) + { + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_prefix; + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + db_prefix = (const char *) sqlite3_value_text (argv[0]); + } + null_prefix: + if (checkSpatialMetaData_ex (sqlite, db_prefix) == 2) { /* ok, creating VirtualFDO tables */ - sql_statement = "SELECT DISTINCT f_table_name FROM geometry_columns"; + char *xdb_prefix = gaiaDoubleQuotedSql (db_prefix); + sql_statement = + sqlite3_mprintf + ("SELECT DISTINCT f_table_name FROM \"%s\".geometry_columns", + xdb_prefix); + free (xdb_prefix); ret = sqlite3_get_table (sqlite, sql_statement, &results, &rows, &columns, NULL); + sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; if (rows < 1) ; else @@ -1823,31 +1949,36 @@ sqlite3_free_table (results); p = first; while (p) { /* destroying the VirtualFDO table [if existing] */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xxname = sqlite3_mprintf ("fdo_%s", p->table); xname = gaiaDoubleQuotedSql (xxname); sqlite3_free (xxname); sql_statement = - sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\"", xname); + sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\".\"%s\"", + xdb_prefix, xname); free (xname); + free (xdb_prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* creating the VirtualFDO table */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xxname = sqlite3_mprintf ("fdo_%s", p->table); xname = gaiaDoubleQuotedSql (xxname); sqlite3_free (xxname); xtable = gaiaDoubleQuotedSql (p->table); sql_statement = sqlite3_mprintf - ("CREATE VIRTUAL TABLE \"%s\" USING VirtualFDO(\"%s\")", - xname, xtable); + ("CREATE VIRTUAL TABLE \"%s\".\"%s\" USING VirtualFDO(\"%s\", \"%s\")", + xdb_prefix, xname, xdb_prefix, xtable); free (xname); free (xtable); + free (xdb_prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; count++; @@ -1865,17 +1996,20 @@ static void fnct_AutoFDOStop (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / AutoFDOStop(void) +/ or +/ AutoFDOStop(db_prefix TEXT) / / for FDO-OGR interoperability: / tests the SpatialMetadata type, then automatically / removes any VirtualFDO table / */ int ret; + const char *db_prefix = "main"; const char *name; int i; char **results; int rows; int columns; @@ -1887,14 +2021,31 @@ int len; char *xname; char *xxname; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (checkSpatialMetaData (sqlite) == 2) + if (argc == 1) + { + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_prefix; + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + db_prefix = (const char *) sqlite3_value_text (argv[0]); + } + null_prefix: + if (checkSpatialMetaData_ex (sqlite, db_prefix) == 2) { /* ok, removing VirtualFDO tables */ - sql_statement = "SELECT DISTINCT f_table_name FROM geometry_columns"; + char *xdb_prefix = gaiaDoubleQuotedSql (db_prefix); + sql_statement = + sqlite3_mprintf + ("SELECT DISTINCT f_table_name FROM \"%s\".geometry_columns", + xdb_prefix); + free (xdb_prefix); ret = sqlite3_get_table (sqlite, sql_statement, &results, &rows, &columns, NULL); if (ret != SQLITE_OK) goto error; if (rows < 1) @@ -1914,16 +2065,19 @@ sqlite3_free_table (results); p = first; while (p) { /* destroying the VirtualFDO table [if existing] */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xxname = sqlite3_mprintf ("fdo_%s", p->table); xname = gaiaDoubleQuotedSql (xxname); sqlite3_free (xxname); sql_statement = - sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\"", xname); + sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\".\"%s\"", + xdb_prefix, xname); free (xname); + free (xdb_prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; count++; @@ -1942,30 +2096,44 @@ fnct_CheckSpatialMetaData (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / CheckSpatialMetaData(void) +/ or +/ CheckSpatialMetaData(db_prefix TEXT) / / for FDO-OGR interoperability: / tests the SpatialMetadata type, returning: / +/ -1 - on invalid args or if no ATTACHED-DB idenfied by db_prefix exists / 0 - if no valid SpatialMetaData were found / 1 - if SpatiaLite-legacy SpatialMetadata were found / 2 - if FDO-OGR-like SpatialMetadata were found / 3 - if SpatiaLite-current SpatialMetadata were found / 4 - if GeoPackage SpatialMetadata were found / */ + const char *db_prefix = NULL; sqlite3 *sqlite; int ret; GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (argc == 1) + { + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + db_prefix = (const char *) sqlite3_value_text (argv[0]); + } sqlite = sqlite3_context_db_handle (context); - ret = checkSpatialMetaData (sqlite); + ret = checkSpatialMetaData_ex (sqlite, db_prefix); if (ret == 3) { /* trying to create the advanced metadata tables >= v.4.0.0 */ - createAdvancedMetaData (sqlite); + if (db_prefix == NULL || strcasecmp (db_prefix, "main") == 0) + createAdvancedMetaData (sqlite); } sqlite3_result_int (context, ret); return; } @@ -2142,10 +2310,181 @@ } } sqlite3_result_int (context, 0); return; } + +static int +do_execute_sql_with_retval (sqlite3 * sqlite, const char *sql, char **errMsg) +{ +/* helper function for InitSpatialMetaDataFull */ + int retval = 0; + int ret; + int i; + char **results; + int rows; + int columns; + char *msg = NULL; + + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, &msg); + if (ret != SQLITE_OK) + goto end; + if (rows < 1) + ; + else + { + for (i = 1; i <= rows; i++) + { + if (atoi (results[(i * columns) + 0]) == 1) + retval = 1; + } + } + sqlite3_free_table (results); + + end: + *errMsg = msg; + return retval; +} + +static void +fnct_InitSpatialMetaDataFull (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ InitSpatialMetaDataFull() +/ or +/ InitSpatialMetaDataFull(text mode) +/ or +/ InitSpatialMetaDataFull(integer transaction) +/ or +/ InitSpatialMetaDataFull(integer transaction, text mode) +/ +/ conveniency "super" function internally calling in a single shot: +/ - InitSpatialMetaData() +/ - CreateRasterCoveragesTable() +/ - CreateVectorCoveragesTables() +/ - CreateStylingTables() +/ returns 1 on success +/ 0 on failure +*/ + char *errMsg = NULL; + int ret; + int transaction = 0; + const char *xmode = NULL; + int retval; + char *sql; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (argc == 1) + { + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + { + xmode = (const char *) sqlite3_value_text (argv[0]); + } + else if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) + transaction = sqlite3_value_int (argv[0]); + else + { + spatialite_e + ("InitSpatialMetaDataFull() error: argument 1 is not of the String or Integer type\n"); + sqlite3_result_int (context, 0); + return; + } + } + if (argc == 2) + { + if (sqlite3_value_type (argv[0]) != SQLITE_INTEGER) + { + spatialite_e + ("InitSpatialMetaDataFull() error: argument 1 is not of the Integer type\n"); + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + { + spatialite_e + ("InitSpatialMetaDataFull() error: argument 2 is not of the String type\n"); + sqlite3_result_int (context, 0); + return; + } + transaction = sqlite3_value_int (argv[0]); + xmode = (const char *) sqlite3_value_text (argv[1]); + } + + if (transaction) + { + /* starting a Transaction */ + ret = sqlite3_exec (sqlite, "BEGIN", NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + goto error; + } + +/* executing InitSpatialMetaData() */ + if (xmode != NULL) + sql = sqlite3_mprintf ("SELECT InitSpatialMetaData(%Q)", xmode); + else + sql = sqlite3_mprintf ("SELECT InitSpatialMetaData()"); + retval = do_execute_sql_with_retval (sqlite, sql, &errMsg); + sqlite3_free (sql); + if (retval != 1) + goto error; + +/* executing CreateRasterCoveragesTable() */ + sql = sqlite3_mprintf ("SELECT CreateRasterCoveragesTable()"); + retval = do_execute_sql_with_retval (sqlite, sql, &errMsg); + sqlite3_free (sql); + if (retval != 1) + goto error; + +/* executing CreateVectorCoveragesTables() */ + sql = sqlite3_mprintf ("SELECT CreateVectorCoveragesTables()"); + retval = do_execute_sql_with_retval (sqlite, sql, &errMsg); + sqlite3_free (sql); + if (retval != 1) + goto error; + +/* executing CreateStylingTables() */ + sql = sqlite3_mprintf ("SELECT CreateStylingTables()"); + retval = do_execute_sql_with_retval (sqlite, sql, &errMsg); + sqlite3_free (sql); + if (retval != 1) + goto error; + +/* executing StoredProc_CreateTables() */ + sql = sqlite3_mprintf ("SELECT StoredProc_CreateTables()"); + retval = do_execute_sql_with_retval (sqlite, sql, &errMsg); + sqlite3_free (sql); + if (retval != 1) + goto error; + + if (transaction) + { + /* confirming the still pending Transaction */ + ret = sqlite3_exec (sqlite, "COMMIT", NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + goto error; + } + + sqlite3_result_int (context, 1); + return; + error: + spatialite_e ("InitSpatiaMetaDataFull() error:\"%s\"\n", errMsg); + sqlite3_free (errMsg); + if (transaction) + { + /* performing a Rollback */ + ret = sqlite3_exec (sqlite, "ROLLBACK", NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + spatialite_e (" InitSpatiaMetaDataFull() error:\"%s\"\n", + errMsg); + sqlite3_free (errMsg); + } + } + sqlite3_result_int (context, 0); + return; +} static void fnct_CloneTable (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: @@ -2201,11 +2540,10 @@ spatialite_e ("CloneTable() error: argument 4 is not of the Integer type\n"); sqlite3_result_null (context); return; } - /* additional options */ if (argc > 4 && sqlite3_value_type (argv[4]) != SQLITE_TEXT) { spatialite_e @@ -2586,20 +2924,32 @@ fnct_CheckGeoPackageMetaData (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / CheckGeoPackageMetaData(void) +/ or +/ CheckGeoPackageMetaData(db_prefix TEXT) / / for OGC GeoPackage interoperability: / tests if GeoPackage metadata tables are found / */ + const char *db_prefix = NULL; sqlite3 *sqlite; int ret; GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (argc == 1) + { + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + db_prefix = (const char *) sqlite3_value_text (argv[0]); + } sqlite = sqlite3_context_db_handle (context); - ret = checkGeoPackage (sqlite); + ret = checkGeoPackage (sqlite, db_prefix); sqlite3_result_int (context, ret); return; } #ifdef ENABLE_GEOPACKAGE /* enabling GeoPackage extensions */ @@ -2640,18 +2990,21 @@ static void fnct_AutoGPKGStart (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / AutoGPKGStart(void) +/ or +/ AutoGPKGStart(db_prefix TEXT) / / for OCG GeoPackage interoperability: / tests the DB layout, then automatically -/ creating a VirtualGPKS table for each GPKG main table +/ creating a VirtualGPGK table for each GPKG main table / declared within gpkg_geometry_colums / */ int ret; + const char *db_prefix = "main"; const char *name; int i; char **results; int rows; int columns; @@ -2664,18 +3017,35 @@ char *xname; char *xxname; char *xtable; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (checkGeoPackage (sqlite)) + if (argc == 1) + { + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_prefix; + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + db_prefix = (const char *) sqlite3_value_text (argv[0]); + } + null_prefix: + if (checkGeoPackage (sqlite, db_prefix)) { /* ok, creating VirtualGPKG tables */ + char *xdb_prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = - "SELECT DISTINCT table_name FROM gpkg_geometry_columns"; + sqlite3_mprintf + ("SELECT DISTINCT table_name FROM \"%s\".gpkg_geometry_columns", + xdb_prefix); + free (xdb_prefix); ret = sqlite3_get_table (sqlite, sql_statement, &results, &rows, &columns, NULL); + sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; if (rows < 1) ; else @@ -2693,31 +3063,36 @@ sqlite3_free_table (results); p = first; while (p) { /* destroying the VirtualGPKG table [if existing] */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xxname = sqlite3_mprintf ("vgpkg_%s", p->table); xname = gaiaDoubleQuotedSql (xxname); sqlite3_free (xxname); sql_statement = - sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\"", xname); + sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\".\"%s\"", + xdb_prefix, xname); free (xname); + free (xdb_prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; /* creating the VirtualGPKG table */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xxname = sqlite3_mprintf ("vgpkg_%s", p->table); xname = gaiaDoubleQuotedSql (xxname); sqlite3_free (xxname); xtable = gaiaDoubleQuotedSql (p->table); sql_statement = sqlite3_mprintf - ("CREATE VIRTUAL TABLE \"%s\" USING VirtualGPKG(\"%s\")", - xname, xtable); + ("CREATE VIRTUAL TABLE \"%s\".\"%s\" USING VirtualGPKG(\"%s\", \"%s\")", + xdb_prefix, xname, xdb_prefix, xtable); free (xname); free (xtable); + free (xdb_prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; count++; @@ -2735,16 +3110,19 @@ static void fnct_AutoGPKGStop (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / AutoGPKGStop(void) +/ or +/ AutoGPKGStop(db_prefix TEXT) / / for OGC GeoPackage interoperability: / tests the DB layout, then automatically removes any VirtualGPKG table / */ int ret; + const char *db_prefix = "main"; const char *name; int i; char **results; int rows; int columns; @@ -2756,18 +3134,35 @@ int len; char *xname; char *xxname; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (checkGeoPackage (sqlite)) + if (argc == 1) + { + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_prefix; + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + db_prefix = (const char *) sqlite3_value_text (argv[0]); + } + null_prefix: + if (checkGeoPackage (sqlite, db_prefix)) { /* ok, removing VirtualGPKG tables */ + char *xdb_prefix = gaiaDoubleQuotedSql (db_prefix); sql_statement = - "SELECT DISTINCT table_name FROM gpkg_geometry_columns"; + sqlite3_mprintf + ("SELECT DISTINCT table_name FROM \"%s\".gpkg_geometry_columns", + xdb_prefix); + free (xdb_prefix); ret = sqlite3_get_table (sqlite, sql_statement, &results, &rows, &columns, NULL); + sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; if (rows < 1) ; else @@ -2785,16 +3180,19 @@ sqlite3_free_table (results); p = first; while (p) { /* destroying the VirtualGPKG table [if existing] */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xxname = sqlite3_mprintf ("vgpkg_%s", p->table); xname = gaiaDoubleQuotedSql (xxname); sqlite3_free (xxname); sql_statement = - sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\"", xname); + sqlite3_mprintf ("DROP TABLE IF EXISTS \"%s\".\"%s\"", + xdb_prefix, xname); free (xname); + free (xdb_prefix); ret = sqlite3_exec (sqlite, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto error; count++; @@ -7382,14 +7780,18 @@ int len; unsigned char *p_result = NULL; gaiaGeomCollPtr geom; sqlite3 *sqlite = sqlite3_context_db_handle (context); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (argc >= 1) { if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { spatialite_e @@ -7423,11 +7825,11 @@ } geom = gaiaGetLayerExtent (sqlite, table, column, pessimistic); if (!geom) goto error; /* builds the BLOB geometry to be returned */ - gaiaToSpatiaLiteBlobWkbEx (geom, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_result, &len, gpkg_mode, tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (geom); return; error: sqlite3_result_null (context); @@ -7923,10 +8325,63 @@ title = (const char *) sqlite3_value_text (argv[2]); abstract = (const char *) sqlite3_value_text (argv[3]); ret = set_wms_getmap_infos (sqlite, url, layer_name, title, abstract); sqlite3_result_int (context, ret); } + +static void +fnct_SetWMSGetMapCopyright (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ WMS_SetGetMapCopyright(Text url, Text layer_name, Text copyright) +/ or +/ WMS_SetGetMapCopyright(Text url, Text layer_name, Text copyright, +/ Text license) +/ +/ updates copyright infos supporting a WMS GetMap +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *url; + const char *layer_name; + const char *copyright = NULL; + const char *license = NULL; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT + || sqlite3_value_type (argv[1]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + url = (const char *) sqlite3_value_text (argv[0]); + layer_name = (const char *) sqlite3_value_text (argv[1]); + if (sqlite3_value_type (argv[2]) == SQLITE_NULL) + ; + else if (sqlite3_value_type (argv[2]) == SQLITE_TEXT) + copyright = (const char *) sqlite3_value_text (argv[2]); + else + { + sqlite3_result_int (context, -1); + return; + } + if (argc >= 4) + { + if (sqlite3_value_type (argv[3]) == SQLITE_TEXT) + license = (const char *) sqlite3_value_text (argv[3]); + else + { + sqlite3_result_int (context, -1); + return; + } + } + ret = + set_wms_getmap_copyright (sqlite, url, layer_name, copyright, license); + sqlite3_result_int (context, ret); +} static void fnct_SetWMSGetMapOptions (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -8616,10 +9071,129 @@ if (url == NULL) sqlite3_result_null (context); else sqlite3_result_text (context, url, strlen (url), sqlite3_free); } + +static void +fnct_RegisterDataLicense (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ RegisterDataLicense(Text license_name) +/ or +/ RegisterDataLicense(Text license_name, Text license_url) +/ +/ inserts a Data License +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *license_name; + const char *url = NULL; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + license_name = (const char *) sqlite3_value_text (argv[0]); + if (argc >= 2) + { + if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) + url = (const char *) sqlite3_value_text (argv[1]); + else + { + sqlite3_result_int (context, -1); + return; + } + } + ret = register_data_license (sqlite, license_name, url); + sqlite3_result_int (context, ret); +} + +static void +fnct_UnRegisterDataLicense (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ UnRegisterDataLicense(Text license_name) +/ +/ deletes a Data License +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *license_name; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + license_name = (const char *) sqlite3_value_text (argv[0]); + ret = unregister_data_license (sqlite, license_name); + sqlite3_result_int (context, ret); +} + +static void +fnct_RenameDataLicense (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ RenameDataLicense(Text old_name, Text new_name) +/ +/ renames an existing Data License +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *old_name; + const char *new_name; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT || + sqlite3_value_type (argv[1]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + old_name = (const char *) sqlite3_value_text (argv[0]); + new_name = (const char *) sqlite3_value_text (argv[1]); + ret = rename_data_license (sqlite, old_name, new_name); + sqlite3_result_int (context, ret); +} + +static void +fnct_SetDataLicenseUrl (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ SetDataLicenseUrl(Text license_name, Text license_url) +/ +/ updates a Data License URL +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *license_name; + const char *url; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT || + sqlite3_value_type (argv[1]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + license_name = (const char *) sqlite3_value_text (argv[0]); + url = (const char *) sqlite3_value_text (argv[1]); + ret = set_data_license_url (sqlite, license_name, url); + sqlite3_result_int (context, ret); +} static void fnct_CreateMetaCatalogTables (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -10505,13 +11079,17 @@ / */ gaiaGeomCollPtr result; gaiaDynamicLinePtr *p = sqlite3_aggregate_context (context, 0); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (!p) { sqlite3_result_null (context); return; } @@ -10522,11 +11100,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } @@ -10542,13 +11121,17 @@ int n_pgs = 0; gaiaPointPtr pt; gaiaLinestringPtr ln; gaiaPolygonPtr pg; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (geom) { pt = geom->FirstPoint; while (pt) { @@ -10631,11 +11214,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } end: gaiaFreeGeomColl (geom); @@ -10742,14 +11326,18 @@ double cy; double r; int srid = 0; double step = 10.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { ival = sqlite3_value_int (argv[0]); cx = ival; } @@ -10815,11 +11403,12 @@ sqlite3_result_null (context); else { if (srid != 0) geom->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (geom, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (geom) gaiaFreeGeomColl (geom); } @@ -10852,14 +11441,18 @@ double start; double stop; int srid = 0; double step = 10.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { ival = sqlite3_value_int (argv[0]); cx = ival; } @@ -10949,11 +11542,12 @@ sqlite3_result_null (context); else { if (srid != 0) geom->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (geom, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (geom) gaiaFreeGeomColl (geom); } @@ -10984,14 +11578,18 @@ double x_axis; double y_axis; int srid = 0; double step = 10.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { ival = sqlite3_value_int (argv[0]); cx = ival; } @@ -11068,11 +11666,12 @@ sqlite3_result_null (context); else { if (srid != 0) geom->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (geom, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (geom) gaiaFreeGeomColl (geom); } @@ -11108,14 +11707,18 @@ double start; double stop; int srid = 0; double step = 10.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { ival = sqlite3_value_int (argv[0]); cx = ival; } @@ -11217,11 +11820,12 @@ sqlite3_result_null (context); else { if (srid != 0) geom->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (geom, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (geom) gaiaFreeGeomColl (geom); } @@ -11256,14 +11860,18 @@ double start; double stop; int srid = 0; double step = 10.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { ival = sqlite3_value_int (argv[0]); cx = ival; } @@ -11375,11 +11983,12 @@ } /* inserting the Centre - last point */ gaiaSetPoint (out->Coords, io, cx, cy); if (srid != 0) sector->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (sector, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (sector, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (geom) gaiaFreeGeomColl (geom); if (sector) @@ -11420,14 +12029,18 @@ double start; double stop; int srid = 0; double step = 10.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { ival = sqlite3_value_int (argv[0]); cx = ival; } @@ -11559,11 +12172,12 @@ /* closing the Polygon Ring */ gaiaGetPoint (out->Coords, 0, &x, &y); gaiaSetPoint (out->Coords, io, x, y); if (srid != 0) stripe->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (stripe, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (stripe, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (arc1) gaiaFreeGeomColl (arc1); if (arc2) @@ -11604,14 +12218,18 @@ double start; double stop; int srid = 0; double step = 10.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { ival = sqlite3_value_int (argv[0]); cx = ival; } @@ -11735,11 +12353,12 @@ } /* inserting the Centre - last point */ gaiaSetPoint (out->Coords, io, cx, cy); if (srid != 0) sector->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (sector, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (sector, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (geom) gaiaFreeGeomColl (geom); if (sector) @@ -11810,13 +12429,17 @@ / */ gaiaGeomCollPtr result; gaiaGeomCollPtr *p = sqlite3_aggregate_context (context, 0); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (!p) { sqlite3_result_null (context); return; } @@ -11831,11 +12454,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } @@ -11853,16 +12477,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -11909,11 +12535,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo2); @@ -11935,14 +12562,18 @@ int len; unsigned char *p_result = NULL; const unsigned char *text; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -11951,11 +12582,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -11974,14 +12605,18 @@ int len; unsigned char *p_result = NULL; const unsigned char *text; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -11996,11 +12631,11 @@ { sqlite3_result_null (context); return; } geo->Srid = sqlite3_value_int (argv[1]); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static int @@ -12065,14 +12700,18 @@ int n_bytes; unsigned char *p_result = NULL; const unsigned char *wkb; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -12084,11 +12723,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -12108,14 +12747,18 @@ int n_bytes; unsigned char *p_result = NULL; const unsigned char *wkb; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -12133,11 +12776,11 @@ { sqlite3_result_null (context); return; } geo->Srid = sqlite3_value_int (argv[1]); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -12157,14 +12800,18 @@ int n_bytes; unsigned char *p_result = NULL; const unsigned char *fgf; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -12174,11 +12821,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -12198,14 +12845,18 @@ int n_bytes; unsigned char *p_result = NULL; const unsigned char *fgf; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -12221,11 +12872,11 @@ { sqlite3_result_null (context); return; } geo->Srid = sqlite3_value_int (argv[1]); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } /* @@ -12347,14 +12998,18 @@ int len; unsigned char *p_result = NULL; const unsigned char *text; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -12364,11 +13019,11 @@ { sqlite3_result_null (context); return; } geo->Srid = 0; - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } /* @@ -12489,14 +13144,18 @@ int n_bytes; unsigned char *p_result = NULL; const unsigned char *wkb; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -12509,11 +13168,11 @@ { sqlite3_result_null (context); return; } geo->Srid = 0; - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -12575,32 +13234,35 @@ int len; unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; - struct splite_internal_cache *cache = sqlite3_user_data (context); - GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (cache != NULL) - { - gpkg_amphibious = cache->gpkg_amphibious_mode; - gpkg_mode = cache->gpkg_mode; - } - if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) - { - sqlite3_result_null (context); - return; - } - p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); - n_bytes = sqlite3_value_bytes (argv[0]); - geo = - gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, - gpkg_amphibious); - if (!geo) - sqlite3_result_null (context); - else - { - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + int tiny_point = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (!geo) + sqlite3_result_null (context); + else + { + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } gaiaFreeGeomColl (geo); } @@ -12625,16 +13287,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr sanitized = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -12647,11 +13311,12 @@ if (!geo) sqlite3_result_null (context); else { sanitized = gaiaSanitize (geo); - gaiaToSpatiaLiteBlobWkbEx (sanitized, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (sanitized, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } gaiaFreeGeomColl (geo); gaiaFreeGeomColl (sanitized); } @@ -12675,16 +13340,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr sanitized = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -12697,11 +13364,12 @@ if (!geo) sqlite3_result_null (context); else { sanitized = gaiaEnsureClosedRings (geo); - gaiaToSpatiaLiteBlobWkbEx (sanitized, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (sanitized, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } gaiaFreeGeomColl (geo); gaiaFreeGeomColl (sanitized); } @@ -12727,16 +13395,18 @@ gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr sanitized = NULL; double tolerance = 0.0; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -12764,11 +13434,12 @@ if (!geo) sqlite3_result_null (context); else { sanitized = gaiaRemoveRepeatedPoints (geo, tolerance); - gaiaToSpatiaLiteBlobWkbEx (sanitized, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (sanitized, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } gaiaFreeGeomColl (geo); gaiaFreeGeomColl (sanitized); } @@ -12824,14 +13495,18 @@ int n_bytes; int len; unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -12846,12 +13521,12 @@ geo = gaiaFromGeoPackageGeometryBlob (p_blob, n_bytes); if (geo == NULL) sqlite3_result_null (context); else { - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, + gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } return; } @@ -12859,11 +13534,12 @@ #endif /* end GEOPACKAGE: supporting GPKG geometries */ sqlite3_result_null (context); } else { - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } } @@ -12885,16 +13561,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -12912,11 +13590,12 @@ if (pts == 1 && lns == 0 && pgs == 0) { geom2 = gaiaCloneGeomColl (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_POINT; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -12943,16 +13622,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -12970,11 +13651,12 @@ if (pts == 0 && lns == 1 && pgs == 0) { geom2 = gaiaCloneGeomColl (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_LINESTRING; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13000,16 +13682,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13027,11 +13711,12 @@ if (pts == 0 && lns == 0 && pgs == 1) { geom2 = gaiaCloneGeomColl (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_POLYGON; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13058,16 +13743,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13085,11 +13772,12 @@ if (pts >= 1 && lns == 0 && pgs == 0) { geom2 = gaiaCloneGeomColl (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_MULTIPOINT; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13116,16 +13804,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13143,11 +13833,12 @@ if (pts == 0 && lns >= 1 && pgs == 0) { geom2 = gaiaCloneGeomColl (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_MULTILINESTRING; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13174,16 +13865,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13201,11 +13894,12 @@ if (pts == 0 && lns == 0 && pgs >= 1) { geom2 = gaiaCloneGeomColl (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_MULTIPOLYGON; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13232,16 +13926,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13259,11 +13955,12 @@ if (pts >= 1 || lns >= 1 || pgs >= 1) { geom2 = gaiaCloneGeomColl (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_GEOMETRYCOLLECTION; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13290,16 +13987,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13326,11 +14025,12 @@ geom2->DeclaredType = GAIA_MULTIPOLYGON; else geom2->DeclaredType = GAIA_GEOMETRYCOLLECTION; if (geo->DeclaredType == GAIA_GEOMETRYCOLLECTION) geom2->DeclaredType = GAIA_GEOMETRYCOLLECTION; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13357,16 +14057,18 @@ int ok; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13396,11 +14098,12 @@ geom2->DeclaredType = GAIA_POINT; else if (lns == 1) geom2->DeclaredType = GAIA_LINESTRING; else geom2->DeclaredType = GAIA_POLYGON; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13423,16 +14126,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13448,11 +14153,12 @@ { geom2 = gaiaCastGeomCollToXY (geo); if (geom2) { geom2->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13475,16 +14181,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13500,11 +14208,12 @@ { geom2 = gaiaCastGeomCollToXYZ (geo); if (geom2) { geom2->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13527,16 +14236,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13552,11 +14263,12 @@ { geom2 = gaiaCastGeomCollToXYM (geo); if (geom2) { geom2->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13579,16 +14291,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13604,11 +14318,12 @@ { geom2 = gaiaCastGeomCollToXYZM (geo); if (geom2) { geom2->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13635,16 +14350,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13662,11 +14379,12 @@ if (pts >= 1) { geom2 = gaiaCloneGeomCollPoints (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_MULTIPOINT; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13693,16 +14411,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13720,11 +14440,12 @@ if (lns >= 1) { geom2 = gaiaCloneGeomCollLinestrings (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_MULTILINESTRING; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13751,16 +14472,18 @@ int pgs; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13778,11 +14501,12 @@ if (pgs >= 1) { geom2 = gaiaCloneGeomCollPolygons (geo); geom2->Srid = geo->Srid; geom2->DeclaredType = GAIA_MULTIPOLYGON; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -13805,16 +14529,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -13828,64 +14554,208 @@ sqlite3_result_null (context); else { geom2 = gaiaCloneGeomCollSpecial (geo, GAIA_REVERSE_ORDER); geom2->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); + gaiaFreeGeomColl (geom2); + sqlite3_result_blob (context, p_result, len, free); + gaiaFreeGeomColl (geo); + } +} + +static void +fnct_ForcePolygonCW (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ ST_ForcePolygonCW(BLOB encoded geometry) +/ or +/ ST_ForceLHR(BLOB encoded geometry) +/ +/ returns a new Geometry: any Exterior Ring will be in clockwise orientation +/ and any Interior Ring will be in counter-clockwise orientation +/ or NULL on invalid geometries +*/ + unsigned char *p_blob; + int n_bytes; + int len; + unsigned char *p_result = NULL; + gaiaGeomCollPtr geo = NULL; + gaiaGeomCollPtr geom2 = NULL; + int gpkg_amphibious = 0; + int gpkg_mode = 0; + int tiny_point = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (!geo) + sqlite3_result_null (context); + else + { + geom2 = gaiaCloneGeomCollSpecial (geo, GAIA_CW_ORDER); + geom2->Srid = geo->Srid; + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (geo); } } static void -fnct_ForceLHR (sqlite3_context * context, int argc, sqlite3_value ** argv) +fnct_ForcePolygonCCW (sqlite3_context * context, int argc, + sqlite3_value ** argv) { /* SQL function: -/ ST_ForceLHR(BLOB encoded geometry) +/ ST_ForcePolygonCCW(BLOB encoded geometry) / -/ returns a new Geometry: any Exterior Ring will be in clockwise orientation -/ and any Interior Ring will be in counter-clockwise orientation -/ or NULL in any other case +/ returns a new Geometry: any Exterior Ring will be in counter-clockwise +/ orientation and any Interior Ring will be in clockwise orientation +/ or NULL on invalid geometries */ unsigned char *p_blob; int n_bytes; int len; unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr geom2 = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; - struct splite_internal_cache *cache = sqlite3_user_data (context); - GAIA_UNUSED (); /* LCOV_EXCL_LINE */ - if (cache != NULL) - { - gpkg_amphibious = cache->gpkg_amphibious_mode; - gpkg_mode = cache->gpkg_mode; - } - if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) - { - sqlite3_result_null (context); - return; - } - p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); - n_bytes = sqlite3_value_bytes (argv[0]); - geo = - gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, - gpkg_amphibious); - if (!geo) - sqlite3_result_null (context); - else - { - geom2 = gaiaCloneGeomCollSpecial (geo, GAIA_LHR_ORDER); + int tiny_point = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (!geo) + sqlite3_result_null (context); + else + { + geom2 = gaiaCloneGeomCollSpecial (geo, GAIA_CCW_ORDER); geom2->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom2, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom2, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom2); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (geo); } } + +static void +fnct_IsPolygonCW (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ ST_IsPolygonCW(BLOB encoded geometry) +/ +/ returns TRUE if all Exterior Rings are in clockwise orientation +/ and all Interior Ring are in counter-clockwise orientation, +/ FALSE if not +/ and -1 on invalid geometries +*/ + unsigned char *p_blob; + int n_bytes; + gaiaGeomCollPtr geo = NULL; + int gpkg_amphibious = 0; + int gpkg_mode = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_int (context, -1); + return; + } + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (!geo) + sqlite3_result_int (context, -1); + else + { + int retval = gaiaCheckClockwise (geo); + sqlite3_result_int (context, retval); + gaiaFreeGeomColl (geo); + } +} + +static void +fnct_IsPolygonCCW (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ ST_IsPolygonCCW(BLOB encoded geometry) +/ +/ returns TRUE if all Exterior Rings are in counter-clockwise +/ orientation and all Interior Ring are in clockwise orientation, +/ FALSE if not +/ and NULL on invalid geometries +*/ + unsigned char *p_blob; + int n_bytes; + gaiaGeomCollPtr geo = NULL; + int gpkg_amphibious = 0; + int gpkg_mode = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_int (context, -1); + return; + } + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (!geo) + sqlite3_result_int (context, -1); + else + { + int retval = gaiaCheckCounterClockwise (geo); + sqlite3_result_int (context, retval); + gaiaFreeGeomColl (geo); + } +} static void fnct_Dimension (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: @@ -14404,16 +15274,18 @@ gaiaGeomCollPtr geo = NULL; int srid; unsigned char *p_result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -14433,11 +15305,12 @@ if (!geo) sqlite3_result_null (context); else { geo->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &n_bytes, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, n_bytes, free); } gaiaFreeGeomColl (geo); } @@ -14882,16 +15755,18 @@ gaiaGeomCollPtr bbox; gaiaPolygonPtr polyg; gaiaRingPtr rect; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -14913,11 +15788,12 @@ gaiaSetPoint (rect->Coords, 0, geo->MinX, geo->MinY); /* vertex # 1 */ gaiaSetPoint (rect->Coords, 1, geo->MaxX, geo->MinY); /* vertex # 2 */ gaiaSetPoint (rect->Coords, 2, geo->MaxX, geo->MaxY); /* vertex # 3 */ gaiaSetPoint (rect->Coords, 3, geo->MinX, geo->MaxY); /* vertex # 4 */ gaiaSetPoint (rect->Coords, 4, geo->MinX, geo->MinY); /* vertex # 5 [same as vertex # 1 to close the polygon] */ - gaiaToSpatiaLiteBlobWkbEx (bbox, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (bbox, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (bbox); sqlite3_result_blob (context, p_result, len, free); } gaiaFreeGeomColl (geo); } @@ -14941,16 +15817,18 @@ gaiaRingPtr rect; double tic; int int_value; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -14984,11 +15862,12 @@ gaiaSetPoint (rect->Coords, 0, geo->MinX - tic, geo->MinY - tic); /* vertex # 1 */ gaiaSetPoint (rect->Coords, 1, geo->MaxX + tic, geo->MinY - tic); /* vertex # 2 */ gaiaSetPoint (rect->Coords, 2, geo->MaxX + tic, geo->MaxY + tic); /* vertex # 3 */ gaiaSetPoint (rect->Coords, 3, geo->MinX - tic, geo->MaxY + tic); /* vertex # 4 */ gaiaSetPoint (rect->Coords, 4, geo->MinX - tic, geo->MinY - tic); /* vertex # 5 [same as vertex # 1 to close the polygon] */ - gaiaToSpatiaLiteBlobWkbEx (bbox, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (bbox, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (bbox); sqlite3_result_blob (context, p_result, len, free); } gaiaFreeGeomColl (geo); } @@ -15469,13 +16348,17 @@ double maxx; double maxy; int *srid_check; double **p = sqlite3_aggregate_context (context, 0); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (!p) { sqlite3_result_null (context); return; } @@ -15509,11 +16392,12 @@ gaiaSetPoint (rect->Coords, 0, minx, miny); /* vertex # 1 */ gaiaSetPoint (rect->Coords, 1, maxx, miny); /* vertex # 2 */ gaiaSetPoint (rect->Coords, 2, maxx, maxy); /* vertex # 3 */ gaiaSetPoint (rect->Coords, 3, minx, maxy); /* vertex # 4 */ gaiaSetPoint (rect->Coords, 4, minx, miny); /* vertex # 5 [same as vertex # 1 to close the polygon] */ - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } free (max_min); } @@ -16128,16 +17012,18 @@ gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; gaiaLinestringPtr line; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -16210,12 +17096,12 @@ result = NULL; if (!result) sqlite3_result_null (context); else { - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, + gpkg_mode, tiny_point); gaiaFreeGeomColl (result); sqlite3_result_blob (context, p_result, len, free); } } } @@ -16268,16 +17154,18 @@ gaiaPolygonPtr polyg; gaiaRingPtr ring; gaiaLinestringPtr line; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -16328,11 +17216,12 @@ { gaiaGetPoint (ring->Coords, iv, &x, &y); gaiaSetPoint (line->Coords, iv, x, y); } } - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (result); sqlite3_result_blob (context, p_result, len, free); } } gaiaFreeGeomColl (geo); @@ -16408,16 +17297,18 @@ gaiaPolygonPtr polyg; gaiaRingPtr ring; gaiaLinestringPtr line; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -16480,12 +17371,12 @@ { gaiaGetPoint (ring->Coords, iv, &x, &y); gaiaSetPoint (line->Coords, iv, x, y); } } - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, + gpkg_mode, tiny_point); gaiaFreeGeomColl (result); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -16777,16 +17668,18 @@ double y; double m; double z; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -16977,11 +17870,11 @@ gaiaSetPoint (out_ln->Coords, out_iv, x, y); } out_iv++; } } - gaiaToSpatiaLiteBlobWkbEx (out, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (out, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (out); sqlite3_result_blob (context, p_result, len, free); stop: gaiaFreeGeomColl (line); gaiaFreeGeomColl (point); @@ -17002,13 +17895,17 @@ double x = 0.0; double y = 0.0; double m = 0.0; double z = 0.0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (is_single_linestring (line) && is_single_point (point)) ; else { @@ -17075,11 +17972,11 @@ else { gaiaSetPoint (out_ln->Coords, iv, x, y); } } - gaiaToSpatiaLiteBlobWkbEx (out, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (out, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (out); sqlite3_result_blob (context, p_result, len, free); stop: gaiaFreeGeomColl (line); gaiaFreeGeomColl (point); @@ -17303,16 +18200,18 @@ double y; double m; double z; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -17405,11 +18304,11 @@ gaiaGetPoint (ln->Coords, iv, &x, &y); gaiaSetPoint (out_ln->Coords, out_iv, x, y); } out_iv++; } - gaiaToSpatiaLiteBlobWkbEx (out, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (out, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (out); sqlite3_result_blob (context, p_result, len, free); stop: gaiaFreeGeomColl (line); } @@ -17431,16 +18330,18 @@ gaiaGeomCollPtr out; int len; unsigned char *p_result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); goto stop; @@ -17477,11 +18378,11 @@ if (!out) { sqlite3_result_null (context); goto stop; } - gaiaToSpatiaLiteBlobWkbEx (out, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (out, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (out); sqlite3_result_blob (context, p_result, len, free); stop: gaiaFreeGeomColl (exterior); gaiaFreeGeomColl (interiors); @@ -17573,16 +18474,18 @@ gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr point = NULL; gaiaGeomCollPtr result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -17806,11 +18709,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -18203,16 +19107,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -18413,11 +19319,12 @@ polyg = polyg->Next; } skip: if (result) { - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (result); sqlite3_result_blob (context, p_result, len, free); } else sqlite3_result_null (context); @@ -18669,16 +19576,18 @@ double shift_x; double shift_y; int int_value; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -18715,11 +19624,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaShiftCoords (geo, shift_x, shift_y); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -18744,16 +19654,18 @@ double shift_y; double shift_z; int int_value; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -18802,11 +19714,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaShiftCoords3D (geo, shift_x, shift_y, shift_z); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -18829,16 +19742,18 @@ int len; unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -18851,11 +19766,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaShiftLongitude (geo); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -18878,16 +19794,18 @@ int len; unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -18900,11 +19818,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaNormalizeLonLat (geo); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -18928,16 +19847,18 @@ double scale_x; double scale_y; int int_value; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -18980,11 +19901,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaScaleCoords (geo, scale_x, scale_y); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -19007,16 +19929,18 @@ gaiaGeomCollPtr geo = NULL; double angle; int int_value; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19041,11 +19965,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaRotateCoords (geo, angle); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -19068,16 +19993,18 @@ gaiaGeomCollPtr geo = NULL; int x_axis; int y_axis; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19104,11 +20031,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaReflectCoords (geo, x_axis, y_axis); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -19129,16 +20057,18 @@ int len; unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19151,11 +20081,12 @@ if (!geo) sqlite3_result_null (context); else { gaiaSwapCoords (geo); - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, + tiny_point); if (!p_result) sqlite3_result_null (context); else sqlite3_result_blob (context, p_result, len, free); } @@ -19261,14 +20192,18 @@ int len; unsigned char *p_result = NULL; const unsigned char *text; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -19277,11 +20212,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -19403,14 +20338,18 @@ int len; unsigned char *p_result = NULL; const unsigned char *text; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -19419,11 +20358,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -19438,14 +20377,18 @@ int len; unsigned char *p_result = NULL; const unsigned char *text; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -19454,11 +20397,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -19473,14 +20416,18 @@ int len; unsigned char *p_result = NULL; const unsigned char *text; gaiaGeomCollPtr geo = NULL; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -19489,11 +20436,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -19510,14 +20457,18 @@ const unsigned char *text; gaiaGeomCollPtr geo = NULL; void *data = sqlite3_user_data (context); sqlite3 *sqlite = sqlite3_context_db_handle (context); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) { sqlite3_result_null (context); return; } @@ -19529,11 +20480,11 @@ if (geo == NULL) { sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geo, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geo); sqlite3_result_blob (context, p_result, len, free); } static void @@ -19553,16 +20504,18 @@ int len; int multi_linestring = 0; unsigned char *p_result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19584,11 +20537,12 @@ } geom_new = gaiaLinearize (geo, multi_linestring); if (!geom_new) goto invalid; gaiaFreeGeomColl (geo); - gaiaToSpatiaLiteBlobWkbEx (geom_new, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom_new, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom_new); sqlite3_result_blob (context, p_result, len, free); return; invalid: if (geo) @@ -19613,16 +20567,18 @@ int n_bytes; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19647,11 +20603,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -19724,13 +20681,17 @@ */ gaiaGeomCollPtr result; gaiaGeomCollPtr geom; gaiaGeomCollPtr *p = sqlite3_aggregate_context (context, 0); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (!p) { sqlite3_result_null (context); return; } @@ -19750,11 +20711,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; geom->Srid = result->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (geom); } gaiaFreeGeomColl (result); } @@ -19776,16 +20738,18 @@ int n_bytes; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19806,11 +20770,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -19829,16 +20794,18 @@ int n_bytes; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19859,11 +20826,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -19885,16 +20853,18 @@ int type; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -19940,16 +20910,165 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); - sqlite3_result_blob (context, p_result, len, free); - gaiaFreeGeomColl (result); - } - } - gaiaFreeGeomColl (geo); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); + sqlite3_result_blob (context, p_result, len, free); + gaiaFreeGeomColl (result); + } + } + gaiaFreeGeomColl (geo); +} + +static void +fnct_AddMeasure (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL functions: +/ ST_AddMeasure(BLOBencoded geometry, Double m_start, Double m_end) +/ +/ Will return a new GEOMETRY (supporting M) with measures linearly +/ interpolated between the start and end points. +/ the input Geometry is expected to be a Linestring or MultiLinestring +/ NULL is returned for invalid arguments +*/ + unsigned char *p_blob; + int n_bytes; + double m_start; + double m_end; + int intval; + gaiaGeomCollPtr geo = NULL; + gaiaGeomCollPtr result; + int gpkg_amphibious = 0; + int gpkg_mode = 0; + int tiny_point = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + if (sqlite3_value_type (argv[1]) == SQLITE_FLOAT) + m_start = sqlite3_value_double (argv[1]); + else if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) + { + intval = sqlite3_value_int (argv[1]); + m_start = intval; + } + else + { + sqlite3_result_null (context); + return; + } + if (sqlite3_value_type (argv[2]) == SQLITE_FLOAT) + m_end = sqlite3_value_double (argv[2]); + else if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) + { + intval = sqlite3_value_int (argv[2]); + m_end = intval; + } + else + { + sqlite3_result_null (context); + return; + } + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (geo == NULL) + sqlite3_result_null (context); + else + { + result = gaiaAddMeasure (geo, m_start, m_end); + if (result == NULL) + sqlite3_result_null (context); + else + { + /* builds the BLOB geometry to be returned */ + int len; + unsigned char *p_result = NULL; + result->Srid = geo->Srid; + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); + sqlite3_result_blob (context, p_result, len, free); + gaiaFreeGeomColl (result); + } + } + gaiaFreeGeomColl (geo); +} + +static void +fnct_InterpolatePoint (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL functions: +/ ST_InterpolatePoint(BLOBencoded line-geometry, BLOBencoded point-geometry) +/ +/ Will return the M-value at the interpolated point nearest to the given point +/ the first input Geometry is expected to be a Linestring supporting M, +/ the second input Geometry is expected to be a Point +/ NULL is returned for invalid arguments +*/ + unsigned char *p_blob1; + int n_bytes1; + unsigned char *p_blob2; + int n_bytes2; + gaiaGeomCollPtr line = NULL; + gaiaGeomCollPtr point = NULL; + double m_value; + int gpkg_amphibious = 0; + int gpkg_mode = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + if (sqlite3_value_type (argv[1]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + p_blob1 = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes1 = sqlite3_value_bytes (argv[0]); + line = + gaiaFromSpatiaLiteBlobWkbEx (p_blob1, n_bytes1, gpkg_mode, + gpkg_amphibious); + p_blob2 = (unsigned char *) sqlite3_value_blob (argv[1]); + n_bytes2 = sqlite3_value_bytes (argv[1]); + point = + gaiaFromSpatiaLiteBlobWkbEx (p_blob2, n_bytes2, gpkg_mode, + gpkg_amphibious); + if (line == NULL || point == NULL) + sqlite3_result_null (context); + else + { + if (!gaiaInterpolatePoint (cache, line, point, &m_value)) + sqlite3_result_null (context); + else + sqlite3_result_double (context, m_value); + } + if (line != NULL) + gaiaFreeGeomColl (line); + if (point != NULL) + gaiaFreeGeomColl (point); } static void fnct_LocateBetweenMeasures (sqlite3_context * context, int argc, sqlite3_value ** argv) @@ -19969,16 +21088,18 @@ int intval; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -20028,11 +21149,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -20044,11 +21166,13 @@ fnct_Transform (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / Transform(BLOBencoded geometry, srid) / -/ returns a new geometry that is the original one received, but transformed / translated to the new SRID [coordinates translation is applied] +/ returns a new geometry that is the original one received, but +/ transformed / translated to the new SRID [coordinates translation +/ is applied] / or NULL if any error is encountered */ unsigned char *p_blob; int n_bytes; gaiaGeomCollPtr geo = NULL; @@ -20059,16 +21183,18 @@ char *proj_to; void *data = sqlite3_user_data (context); sqlite3 *sqlite = sqlite3_context_db_handle (context); int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -20114,11 +21240,109 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = srid_to; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); + sqlite3_result_blob (context, p_result, len, free); + gaiaFreeGeomColl (result); + } + } + gaiaFreeGeomColl (geo); +} + +static void +fnct_TransformXY (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ TransformXY(BLOBencoded geometry, srid) +/ +/ returns a new geometry that is the original one received, but +/ transformed / translated to the new SRID [coordinates translation +/ is applied] +/ +/ NOTE: this is a special "flavor" of ST_Transform() +/ just X and Y coordinates will be transformed, +/ Z and M values (if eventually present) will be +/ left untouched. +/ Mainly intended as a workaround possibily useful +/ when facing partially broken PROJ.4 definitions. +/ +/ or NULL if any error is encountered +*/ + unsigned char *p_blob; + int n_bytes; + gaiaGeomCollPtr geo = NULL; + gaiaGeomCollPtr result; + int srid_from; + int srid_to; + char *proj_from; + char *proj_to; + void *data = sqlite3_user_data (context); + sqlite3 *sqlite = sqlite3_context_db_handle (context); + int gpkg_amphibious = 0; + int gpkg_mode = 0; + int tiny_point = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) + srid_to = sqlite3_value_int (argv[1]); + else + { + sqlite3_result_null (context); + return; + } + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (!geo) + sqlite3_result_null (context); + else + { + srid_from = geo->Srid; + getProjParams (sqlite, srid_from, &proj_from); + getProjParams (sqlite, srid_to, &proj_to); + if (proj_to == NULL || proj_from == NULL) + { + if (proj_from) + free (proj_from); + if (proj_to) + free (proj_to); + gaiaFreeGeomColl (geo); + sqlite3_result_null (context); + return; + } + if (data != NULL) + result = gaiaTransformXY_r (data, geo, proj_from, proj_to); + else + result = gaiaTransformXY (geo, proj_from, proj_to); + free (proj_from); + free (proj_to); + if (!result) + sqlite3_result_null (context); + else + { + /* builds the BLOB geometry to be returned */ + int len; + unsigned char *p_result = NULL; + result->Srid = srid_to; + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -20209,14 +21433,18 @@ */ int srid = -1; gaiaGeomCollPtr geom; void *data = sqlite3_user_data (context); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (argc == 1) { if (sqlite3_value_type (argv[0]) != SQLITE_INTEGER) { sqlite3_result_null (context); @@ -20233,11 +21461,11 @@ else { unsigned char *blob; int len; geom->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (geom, &blob, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &blob, &len, gpkg_mode, tiny_point); gaiaFreeGeomColl (geom); sqlite3_result_blob (context, blob, len, free); } } @@ -20364,16 +21592,18 @@ int esri_flag = 0; unsigned char *p_result = NULL; void *data = sqlite3_user_data (context); int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -20399,11 +21629,12 @@ if (detail == NULL) sqlite3_result_null (context); else { detail->Srid = geom->Srid; - gaiaToSpatiaLiteBlobWkbEx (detail, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (detail, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } if (geom != NULL) gaiaFreeGeomColl (geom); if (detail != NULL) @@ -20425,16 +21656,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr boundary; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -20459,12 +21692,12 @@ boundary = gaiaBoundary (geo); if (!boundary) sqlite3_result_null (context); else { - gaiaToSpatiaLiteBlobWkbEx (boundary, &p_result, &len, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (boundary, &p_result, &len, + gpkg_mode, tiny_point); gaiaFreeGeomColl (boundary); sqlite3_result_blob (context, p_result, len, free); } } } @@ -20787,14 +22020,15 @@ { /* Linestrings */ l = gaiaGeodesicTotalLength (a, b, rf, + line->DimensionModel, + line-> + Coords, line-> - DimensionModel, - line->Coords, - line->Points); + Points); if (l < 0.0) { length = -1.0; break; } @@ -20812,13 +22046,16 @@ { /* exterior Ring */ ring = polyg->Exterior; l = gaiaGeodesicTotalLength (a, b, rf, - ring->DimensionModel, - ring->Coords, - ring->Points); + ring-> + DimensionModel, + ring-> + Coords, + ring-> + Points); if (l < 0.0) { length = -1.0; break; } @@ -21012,10 +22249,206 @@ else sqlite3_result_double (context, length); } gaiaFreeGeomColl (geo); } + +static void +fnct_FromTWKB (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ GeomFromTWKB(TWKB encoded geometry) +/ or +/ GeomFromTWKB(TWKB encoded geometry, INT srid) +/ +/ returns the current geometry by parsing a TWKB encoded string +/ or NULL if any error is encountered +*/ + int len; + unsigned char *p_result = NULL; + const unsigned char *twkb; + int twkb_size; + int srid = -1; + gaiaGeomCollPtr geo = NULL; + int gpkg_mode = 0; + int tiny_point = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + else + { + twkb = sqlite3_value_blob (argv[0]); + twkb_size = sqlite3_value_bytes (argv[0]); + } + if (argc >= 2) + { + if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER) + { + sqlite3_result_null (context); + return; + } + srid = sqlite3_value_int (argv[1]); + if (srid < 0) + srid = -1; + } + geo = gaiaFromTWKB (cache, twkb, twkb_size, srid); + if (geo == NULL) + { + sqlite3_result_null (context); + return; + } + gaiaToSpatiaLiteBlobWkbEx2 (geo, &p_result, &len, gpkg_mode, tiny_point); + gaiaFreeGeomColl (geo); + sqlite3_result_blob (context, p_result, len, free); +} + +static void +fnct_ToTWKB (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ AsTWKB(BLOB encoded geometry) +/ or +/ AsTWKB(BLOB encoded geometry, INT precision_xy) +/ or +/ AsTWKB(BLOB encoded geometry, INT precision_xy, INT precision_z) +/ or +/ AsTWKB(BLOB encoded geometry, INT precision_xy, INT precision_z, +/ INT precision_m) +/ or +/ AsTWKB(BLOB encoded geometry, INT precision_xy, INT precision_z, +/ INT precision_m, INT with_size) +/ or +/ AsTWKB(BLOB encoded geometry, INT precision_xy, INT precision_z, +/ INT precision_m, INT with_size, INT with_bbox) +/ +/ returns a text string corresponding to compressed TWKB notation +/ or NULL if any error is encountered +*/ + unsigned char *p_blob; + int n_bytes; + int value; + unsigned char precision_xy = 0; + unsigned char precision_z = 0; + unsigned char precision_m = 0; + int with_size = 0; + int with_bbox = 0; + int ret; + gaiaGeomCollPtr geo = NULL; + int gpkg_amphibious = 0; + int gpkg_mode = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + } + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_null (context); + return; + } + else + { + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + } + if (argc >= 2) + { + if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER) + { + sqlite3_result_null (context); + return; + } + value = sqlite3_value_int (argv[1]); + if (value < 0) + precision_xy = 0; + else if (value > 20) + precision_xy = 20; + else + precision_xy = value; + } + if (argc >= 3) + { + if (sqlite3_value_type (argv[2]) != SQLITE_INTEGER) + { + sqlite3_result_null (context); + return; + } + value = sqlite3_value_int (argv[2]); + if (value < 0) + precision_z = 0; + else if (value > 20) + precision_z = 20; + else + precision_z = value; + } + if (argc >= 4) + { + if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER) + { + sqlite3_result_null (context); + return; + } + value = sqlite3_value_int (argv[3]); + if (value < 0) + precision_m = 0; + else if (value > 20) + precision_m = 20; + else + precision_m = value; + } + if (argc >= 5) + { + if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER) + { + sqlite3_result_null (context); + return; + } + with_size = sqlite3_value_int (argv[4]); + if (with_size != 0) + with_size = 1; + } + if (argc >= 6) + { + if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER) + { + sqlite3_result_null (context); + return; + } + with_bbox = sqlite3_value_int (argv[5]); + if (with_bbox != 0) + with_bbox = 1; + } + geo = + gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, + gpkg_amphibious); + if (!geo) + sqlite3_result_null (context); + else + { + unsigned char *twkb; + int size_twkb; + ret = + gaiaToTWKB (cache, geo, precision_xy, precision_z, precision_m, + with_size, with_bbox, &twkb, &size_twkb); + if (!ret) + sqlite3_result_null (context); + else + sqlite3_result_blob (context, twkb, size_twkb, free); + } + gaiaFreeGeomColl (geo); +} #endif /* end RTTOPO conditional */ static void fnct_Area (sqlite3_context * context, int argc, sqlite3_value ** argv) @@ -21253,15 +22686,15 @@ if (use_ellipsoid >= 0) { #ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ perimeter = gaiaGeodesicTotalLength (a, b, rf, - pg-> - Exterior->DimensionModel, + pg->Exterior-> + DimensionModel, pg->Exterior->Coords, - pg-> - Exterior->Points); + pg->Exterior-> + Points); if (perimeter < 0.0) ret = 0; else ret = 1; #else @@ -21326,16 +22759,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -21363,12 +22798,12 @@ else { result = gaiaAllocGeomColl (); result->Srid = geo->Srid; gaiaAddPointToGeomColl (result, x, y); - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, + gpkg_mode, tiny_point); gaiaFreeGeomColl (result); sqlite3_result_blob (context, p_result, len, free); } } } @@ -21392,16 +22827,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -21444,11 +22881,12 @@ { result = gaiaAllocGeomColl (); gaiaAddPointToGeomColl (result, x, y); } result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (result); sqlite3_result_blob (context, p_result, len, free); } } gaiaFreeGeomColl (geo); @@ -21469,16 +22907,18 @@ gaiaGeomCollPtr result; int int_value; double tolerance; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -21514,11 +22954,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -21540,16 +22981,18 @@ gaiaGeomCollPtr result; int int_value; double tolerance; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -21586,11 +23029,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -21611,16 +23055,18 @@ unsigned char *p_result = NULL; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -21641,11 +23087,12 @@ result = gaiaConvexHull (geo); if (!result) sqlite3_result_null (context); else { - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -21668,16 +23115,18 @@ double radius; int int_value; int quadrantsegments = 30; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -21726,11 +23175,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -21750,16 +23200,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -21798,11 +23250,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo1); @@ -21937,13 +23390,17 @@ gaiaGeomCollPtr aggregate = NULL; gaiaGeomCollPtr result; void *data = sqlite3_user_data (context); struct gaia_geom_chain **p = sqlite3_aggregate_context (context, 0); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (!p) { sqlite3_result_null (context); return; } @@ -21985,11 +23442,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); } gaiaFreeGeomColl (result); } @@ -22007,16 +23465,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -22055,11 +23515,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo1); @@ -22080,16 +23541,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -22128,11 +23591,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo1); @@ -22153,16 +23617,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -22201,11 +23667,12 @@ else { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo1); @@ -22824,13 +24291,15 @@ sqlite3_result_null (context); else sqlite3_result_text (context, matrix, strlen (matrix), free); } - gaiaFreeGeomColl (geo1); - gaiaFreeGeomColl (geo2); } + if (geo1 != NULL) + gaiaFreeGeomColl (geo1); + if (geo2 != NULL) + gaiaFreeGeomColl (geo2); } static void fnct_RelateMatch (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -23304,13 +24773,17 @@ unsigned char *p_result = NULL; gaiaPolygonPtr pg; int pgs = 0; void *data = sqlite3_user_data (context); int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (!geom_org) goto invalid; if (data != NULL) geom_new = gaiaPolygonize_r (data, geom_org, force_multipolygon); else @@ -23329,11 +24802,12 @@ /* invalid: a POLYGON is expected !!! */ gaiaFreeGeomColl (geom_new); sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geom_new, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom_new, &p_result, &len, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom_new); sqlite3_result_blob (context, p_result, len, free); return; invalid: if (geom_org) @@ -23695,16 +25169,18 @@ gaiaGeomCollPtr result; double radius; int int_value; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -23741,11 +25217,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -23769,16 +25246,18 @@ double radius; int int_value; int left_right; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -23823,11 +25302,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -23909,16 +25389,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -23953,11 +25435,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo1->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo1); @@ -24105,16 +25588,18 @@ double fraction; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24151,11 +25636,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -24178,16 +25664,18 @@ double distance; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24225,11 +25713,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -24318,16 +25807,18 @@ double fraction2; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24376,11 +25867,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -24400,16 +25892,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24483,11 +25977,12 @@ { gaiaGetPoint (ln->Coords, 0, &x, &y); gaiaAddPointToGeomColl (pt, x, y); } pt->Srid = geo1->Srid; - gaiaToSpatiaLiteBlobWkbEx (pt, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (pt, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); gaiaFreeGeomColl (pt); } } @@ -24509,16 +26004,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24554,11 +26051,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo1->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo1); @@ -24582,16 +26080,18 @@ gaiaGeomCollPtr geo1 = NULL; gaiaGeomCollPtr geo2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24638,11 +26138,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo1->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo1); @@ -24664,16 +26165,18 @@ int n_bytes; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24698,11 +26201,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -24721,16 +26225,18 @@ int n_bytes; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24755,11 +26261,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -24795,16 +26302,18 @@ gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr point = NULL; gaiaGeomCollPtr result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -24902,11 +26411,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -24953,16 +26463,18 @@ gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr point = NULL; gaiaGeomCollPtr result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -25061,11 +26573,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -25112,16 +26625,18 @@ gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr point = NULL; gaiaGeomCollPtr result = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -25220,11 +26735,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -25258,16 +26774,18 @@ gaiaGeomCollPtr geom1 = NULL; gaiaGeomCollPtr geom2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -25305,11 +26823,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geom1->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } gaiaFreeGeomColl (geom1); gaiaFreeGeomColl (geom2); @@ -25521,16 +27040,18 @@ gaiaGeomCollPtr geom1 = NULL; gaiaGeomCollPtr geom2 = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -25588,11 +27109,12 @@ { /* there is no need to cut any Ring [no Nodes] */ int len; unsigned char *p_result = NULL; geom1->Srid = geom->Srid; - gaiaToSpatiaLiteBlobWkbEx (geom1, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom1, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (geom); gaiaFreeGeomColl (geom1); return; } @@ -25605,11 +27127,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geom->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } gaiaFreeGeomColl (geom); gaiaFreeGeomColl (geom1); @@ -25638,16 +27161,18 @@ int int_value; double tolerance = 0.0; int only_edges = 0; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -25699,11 +27224,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -25732,16 +27258,18 @@ double tolerance = 0.0; double extra_frame_size = -1.0; int only_edges = 0; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -25810,11 +27338,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -25842,16 +27371,18 @@ double tolerance = 0.0; double factor = 3.0; int allow_holes = 0; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -25917,11 +27448,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -25984,16 +27516,18 @@ int n_bytes; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -26025,11 +27559,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -26050,16 +27585,18 @@ int n_bytes; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -26080,11 +27617,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -26105,16 +27643,18 @@ double dist; gaiaGeomCollPtr geo = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -26147,11 +27687,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = geo->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (geo); @@ -26171,16 +27712,18 @@ gaiaGeomCollPtr input = NULL; gaiaGeomCollPtr blade = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -26220,11 +27763,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = input->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (input); @@ -26245,16 +27789,18 @@ gaiaGeomCollPtr input = NULL; gaiaGeomCollPtr blade = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -26294,11 +27840,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = input->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (input); @@ -26319,16 +27866,18 @@ gaiaGeomCollPtr input = NULL; gaiaGeomCollPtr blade = NULL; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -26368,11 +27917,12 @@ { /* builds the BLOB geometry to be returned */ int len; unsigned char *p_result = NULL; result->Srid = input->Srid; - gaiaToSpatiaLiteBlobWkbEx (result, &p_result, &len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_result, &len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_result, len, free); gaiaFreeGeomColl (result); } } gaiaFreeGeomColl (input); @@ -26984,16 +28534,18 @@ int n_bytes; gaiaGeomCollPtr input; gaiaGeomCollPtr result; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -27012,11 +28564,12 @@ } result = gaiaNodeLines (cache, input); if (result != NULL) { - gaiaToSpatiaLiteBlobWkbEx (result, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_blob, &n_bytes, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_blob, n_bytes, free); gaiaFreeGeomColl (result); } else sqlite3_result_null (context); @@ -27243,16 +28796,18 @@ gaiaGeomCollPtr result; gaiaGeomCollPtr nodes_in; gaiaGeomCollPtr nodes_out; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; @@ -27291,11 +28846,12 @@ gaiaFreeGeomColl (nodes_in); gaiaFreeGeomColl (nodes_out); if (result != NULL) { result->DeclaredType = GAIA_MULTIPOINT; - gaiaToSpatiaLiteBlobWkbEx (result, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_blob, &n_bytes, gpkg_mode, + tiny_point); sqlite3_result_blob (context, p_blob, n_bytes, free); gaiaFreeGeomColl (result); } else sqlite3_result_null (context); @@ -27468,10 +29024,233 @@ if (message == NULL) sqlite3_result_null (context); else sqlite3_result_text (context, message, strlen (message), SQLITE_STATIC); } + +static void +fnct_DrapeLine (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ ST_DrapeLine( line-1 Linestring, line-2 Linestring ) +/ or +/ ST_DrapeLine( line-1 Linestring, line-2 Linestring, tolerance Double ) +/ +/ will drape line-1 over line-2 returning a new linestring +/ NULL on invalid arguments or if any error is encountered +*/ + unsigned char *blob; + int bytes; + gaiaGeomCollPtr geom1 = NULL; + gaiaGeomCollPtr geom2 = NULL; + gaiaGeomCollPtr geom3 = NULL; + double tolerance = 0.0; + sqlite3 *db_handle = sqlite3_context_db_handle (context); + int gpkg_amphibious = 0; + int gpkg_mode = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + } + + if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) + { + blob = (unsigned char *) sqlite3_value_blob (argv[0]); + bytes = sqlite3_value_bytes (argv[0]); + geom1 = + gaiaFromSpatiaLiteBlobWkbEx (blob, bytes, gpkg_mode, + gpkg_amphibious); + } + else + goto error; + if (sqlite3_value_type (argv[1]) == SQLITE_BLOB) + { + blob = (unsigned char *) sqlite3_value_blob (argv[1]); + bytes = sqlite3_value_bytes (argv[1]); + geom2 = + gaiaFromSpatiaLiteBlobWkbEx (blob, bytes, gpkg_mode, + gpkg_amphibious); + } + else + goto error; + if (argc >= 3) + { + if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) + { + int val = sqlite3_value_int (argv[2]); + tolerance = val; + } + else if (sqlite3_value_type (argv[2]) == SQLITE_FLOAT) + tolerance = sqlite3_value_double (argv[2]); + else + goto error; + } + +/* checking the arguments for validity */ + if (geom1 == NULL || geom2 == NULL) + goto error; + if (geom1->Srid != geom2->Srid) + goto error; + if (geom1->DimensionModel == GAIA_XY || geom1->DimensionModel == GAIA_XY_M) + ; + else + goto error; + if (geom2->DimensionModel == GAIA_XY_Z + || geom2->DimensionModel == GAIA_XY_Z_M) + ; + else + goto error; + if (!gaia_do_check_linestring (geom1)) + goto error; + if (!gaia_do_check_linestring (geom2)) + goto error; + if (tolerance < 0.0) + goto error; + + geom3 = gaiaDrapeLine (db_handle, geom1, geom2, tolerance); + if (geom3 == NULL) + goto error; + + gaiaToSpatiaLiteBlobWkb (geom3, &blob, &bytes); + sqlite3_result_blob (context, blob, bytes, free); + gaiaFreeGeomColl (geom1); + gaiaFreeGeomColl (geom2); + gaiaFreeGeomColl (geom3); + return; + + error: + if (geom1 != NULL) + gaiaFreeGeomColl (geom1); + if (geom2 != NULL) + gaiaFreeGeomColl (geom2); + if (geom3 != NULL) + gaiaFreeGeomColl (geom3); + sqlite3_result_null (context); +} + +static void +fnct_DrapeLineExceptions (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ ST_DrapeLineExceptions( line-1 Linestring, line-2 Linestring ) +/ or +/ ST_DrapeLineExceptions( line-1 Linestring, line-2 Linestring, +/ tolerance Double ) +/ or +/ ST_DrapeLineExceptions( line-1 Linestring, line-2 Linestring, +/ tolerance Double, interpolated Integer ) +/ +/ will drape line-1 over line-2 returning a MultiPoint containing +/ all Points from line-1 not correctly draped. +/ NULL on invalid arguments or if any error is encountered or +/ if all Point are correctly draped. +*/ + unsigned char *blob; + int bytes; + gaiaGeomCollPtr geom1 = NULL; + gaiaGeomCollPtr geom2 = NULL; + gaiaGeomCollPtr geom3 = NULL; + double tolerance = 0.0; + int interpolated = 1; + sqlite3 *db_handle = sqlite3_context_db_handle (context); + int gpkg_amphibious = 0; + int gpkg_mode = 0; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache != NULL) + { + gpkg_amphibious = cache->gpkg_amphibious_mode; + gpkg_mode = cache->gpkg_mode; + } + + if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) + { + blob = (unsigned char *) sqlite3_value_blob (argv[0]); + bytes = sqlite3_value_bytes (argv[0]); + geom1 = + gaiaFromSpatiaLiteBlobWkbEx (blob, bytes, gpkg_mode, + gpkg_amphibious); + } + else + goto error; + if (sqlite3_value_type (argv[1]) == SQLITE_BLOB) + { + blob = (unsigned char *) sqlite3_value_blob (argv[1]); + bytes = sqlite3_value_bytes (argv[1]); + geom2 = + gaiaFromSpatiaLiteBlobWkbEx (blob, bytes, gpkg_mode, + gpkg_amphibious); + } + else + goto error; + if (argc >= 3) + { + if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) + { + int val = sqlite3_value_int (argv[2]); + tolerance = val; + } + else if (sqlite3_value_type (argv[2]) == SQLITE_FLOAT) + tolerance = sqlite3_value_double (argv[2]); + else + goto error; + } + if (argc >= 4) + { + if (sqlite3_value_type (argv[3]) == SQLITE_INTEGER) + interpolated = sqlite3_value_int (argv[3]); + else + goto error; + } + +/* checking the arguments for validity */ + if (geom1 == NULL || geom2 == NULL) + goto error; + if (geom1->Srid != geom2->Srid) + goto error; + if (geom1->DimensionModel == GAIA_XY || geom1->DimensionModel == GAIA_XY_M) + ; + else + goto error; + if (geom2->DimensionModel == GAIA_XY_Z + || geom2->DimensionModel == GAIA_XY_Z_M) + ; + else + goto error; + if (!gaia_do_check_linestring (geom1)) + goto error; + if (!gaia_do_check_linestring (geom2)) + goto error; + if (tolerance < 0.0) + goto error; + + geom3 = + gaiaDrapeLineExceptions (db_handle, geom1, geom2, tolerance, + interpolated); + if (geom3 == NULL) + goto error; + + gaiaToSpatiaLiteBlobWkb (geom3, &blob, &bytes); + sqlite3_result_blob (context, blob, bytes, free); + gaiaFreeGeomColl (geom1); + gaiaFreeGeomColl (geom2); + gaiaFreeGeomColl (geom3); + return; + + error: + if (geom1 != NULL) + gaiaFreeGeomColl (geom1); + if (geom2 != NULL) + gaiaFreeGeomColl (geom2); + if (geom3 != NULL) + gaiaFreeGeomColl (geom3); + sqlite3_result_null (context); +} #endif /* end including GEOS */ static int text2double (const unsigned char *str, double *val) @@ -28164,33 +29943,48 @@ sqlite3_result_null (context); else sqlite3_result_text (context, checksum, strlen (checksum), free); } +#if OMIT_ICONV == 0 /* ICONV is absolutely required */ + static void fnct_EncodeURL (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: -/ EncodeURL(text) +/ EncodeURL(text url) +/ or +/ EncodeURL(text url, text out_charset) / / returns a TEXT value containing the percent-encoded URL / or / NULL on invalid arguments */ const char *url; + const char *out_charset = "UTF-8"; char *encoded; GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) url = (const char *) sqlite3_value_text (argv[0]); else { sqlite3_result_null (context); return; + } + if (argc > 1) + { + if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) + out_charset = (const char *) sqlite3_value_text (argv[1]); + else + { + sqlite3_result_null (context); + return; + } } /* encoding the URL */ - encoded = gaiaEncodeURL (url); + encoded = gaiaEncodeURL (url, out_charset); if (encoded == NULL) sqlite3_result_null (context); else sqlite3_result_text (context, encoded, strlen (encoded), free); } @@ -28198,33 +29992,48 @@ static void fnct_DecodeURL (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / DecodeURL(text) +/ or +/ DecodeURL(text url, text in_charset) / / returns a TEXT value containing the URL cleaned from percent-encoding / or / NULL on invalid arguments */ char *url; const char *encoded; + const char *in_charset = "UTF-8"; GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) encoded = (const char *) sqlite3_value_text (argv[0]); else { sqlite3_result_null (context); return; + } + if (argc > 1) + { + if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) + in_charset = (const char *) sqlite3_value_text (argv[1]); + else + { + sqlite3_result_null (context); + return; + } } /* decoding the URL */ - url = gaiaDecodeURL (encoded); + url = gaiaDecodeURL (encoded, in_charset); if (url == NULL) sqlite3_result_null (context); else sqlite3_result_text (context, url, strlen (url), free); } + +#endif /* ICONV enabled/disabled */ static void fnct_DirNameFromPath (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -29190,14 +30999,18 @@ unsigned char *geoblob; int geosize; double longitude; double latitude; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -29206,11 +31019,12 @@ if (gaiaGetGpsCoords (p_blob, n_bytes, &longitude, &latitude)) { geom = gaiaAllocGeomColl (); geom->Srid = 4326; gaiaAddPointToGeomColl (geom, longitude, latitude); - gaiaToSpatiaLiteBlobWkbEx (geom, &geoblob, &geosize, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &geoblob, &geosize, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); sqlite3_result_blob (context, geoblob, geosize, free); } else sqlite3_result_null (context); @@ -29300,11 +31114,11 @@ int request) { /* SQL function: / IsGifBlob(BLOB encoded image) / IsPngBlob, IsJpegBlob, IsExifBlob, IsExifGpsBlob, IsTiffBlob, -/ IsZipBlob, IsPdfBlob, IsJP2Blob, IsGeometryBlob +/ IsZipBlob, IsPdfBlob, IsJP2Blob, IsGeometryBlob, IsTinyPointBlob / / returns: / 1 if the required BLOB_TYPE is TRUE / 0 otherwise / or -1 if any error is encountered @@ -29323,10 +31137,18 @@ blob_type = gaiaGuessBlobType (p_blob, n_bytes); if (request == GAIA_GEOMETRY_BLOB) { if (blob_type == GAIA_GEOMETRY_BLOB) sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; + } + if (request == GAIA_TINYPOINT_BLOB) + { + if (blob_type == GAIA_TINYPOINT_BLOB) + sqlite3_result_int (context, 1); else sqlite3_result_int (context, 0); return; } if (request == GAIA_ZIP_BLOB) @@ -29425,10 +31247,17 @@ static void fnct_IsGeometryBlob (sqlite3_context * context, int argc, sqlite3_value ** argv) { blob_guess (context, argc, argv, GAIA_GEOMETRY_BLOB); } + +static void +fnct_IsTinyPointBlob (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ + blob_guess (context, argc, argv, GAIA_TINYPOINT_BLOB); +} static void fnct_IsZipBlob (sqlite3_context * context, int argc, sqlite3_value ** argv) { blob_guess (context, argc, argv, GAIA_ZIP_BLOB); @@ -30148,10 +31977,13 @@ /* SQL function: / ElementaryGeometries(TEXT input_table, TEXT geo_column, TEXT out_table, / TEXT out_pk, TEXT out_multi_id) / ElementaryGeometries(TEXT input_table, TEXT geo_column, TEXT out_table, / TEXT out_pk, TEXT out_multi_id, BOOL transaction) +/ ElementaryGeometries(TEXT input_table, TEXT geo_column, TEXT out_table, +/ TEXT out_pk, TEXT out_multi_id, BOOL transaction, +/ ... text option1 ..., ... text option2 ..., text option10) / / returns: / the number of inserted rows / NULL on invalid arguments */ @@ -30158,10 +31990,11 @@ char *in_table; char *geo_column; char *out_table; char *out_pk; char *out_multi_id; + const void *options = NULL; int rows; int transaction = 1; sqlite3 *db_handle = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) @@ -30192,23 +32025,136 @@ { sqlite3_result_null (context); return; } out_multi_id = (char *) sqlite3_value_text (argv[4]); - if (argc == 6) + if (argc >= 6) { if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER) { sqlite3_result_null (context); return; } transaction = sqlite3_value_int (argv[5]); } - elementary_geometries_ex2 (db_handle, in_table, geo_column, out_table, - out_pk, out_multi_id, &rows, transaction); +/* additional options */ + if (argc > 6 && sqlite3_value_type (argv[6]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 7 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 7 && sqlite3_value_type (argv[7]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 8 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 8 && sqlite3_value_type (argv[8]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 9 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 9 && sqlite3_value_type (argv[9]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 10 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 10 && sqlite3_value_type (argv[10]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 11 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 11 && sqlite3_value_type (argv[11]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 12 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 12 && sqlite3_value_type (argv[12]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 13 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 13 && sqlite3_value_type (argv[13]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 14 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 14 && sqlite3_value_type (argv[14]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 15 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + if (argc > 15 && sqlite3_value_type (argv[15]) != SQLITE_TEXT) + { + spatialite_e + ("ElementaryGeometries() error: argument 16 is not of the String or TEXT type\n"); + sqlite3_result_null (context); + return; + } + options = gaiaElemGeomOptionsCreate (); + if (options == NULL) + { + sqlite3_result_null (context); + return; + } + +/* additional options */ + if (argc > 6) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[6])); + if (argc > 7) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[7])); + if (argc > 8) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[8])); + if (argc > 9) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[9])); + if (argc > 10) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[10])); + if (argc > 11) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[11])); + if (argc > 12) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[12])); + if (argc > 13) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[13])); + if (argc > 14) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[14])); + if (argc > 15) + gaiaElemGeomOptionsAdd (options, + (const char *) sqlite3_value_text (argv[15])); + + elementary_geometries_ex3 (db_handle, in_table, geo_column, out_table, + out_pk, out_multi_id, options, &rows, + transaction); + + gaiaElemGeomOptionsDestroy (options); if (rows <= 0) sqlite3_result_null (context); else sqlite3_result_int (context, rows); } @@ -30280,10 +32226,1803 @@ ret = 0; } sqlite3_result_int (context, ret); } + +static void +fnct_sp_get_last_error (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_GetLastError() +/ +/ return the most recent SQL Procedures error message (if any) +/ return NULL on any other case +*/ + const char *msg = NULL; + void *data = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (data != NULL) + msg = gaia_sql_proc_get_last_error (data); + if (msg == NULL) + sqlite3_result_null (context); + else + sqlite3_result_text (context, msg, strlen (msg), SQLITE_STATIC); +} + +static void +fnct_sp_set_logfile (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_SetLogfile(TEXT logfile_path) +/ SqlProc_SetLogfile(TEXT logfile_path, INT append) +/ +/ returns: +/ 1 on success +/ raises an exception on invalid argument or unaccessible file +*/ + const char *filepath = NULL; + int append = 0; + char *msg; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + filepath = (const char *) sqlite3_value_text (argv[0]); + else if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + ; + else + goto invalid_filepath; + if (argc >= 2) + { + if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) + append = sqlite3_value_int (argv[1]); + else + goto invalid_append; + } + if (gaia_sql_proc_logfile (cache, filepath, append)) + sqlite3_result_int (context, 1); + else + goto file_error; + return; + + invalid_filepath: + msg = "SqlProc exception - illegal File Path argument."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_append: + msg = "SqlProc exception - illegal Append Mode argument."; + sqlite3_result_error (context, msg, -1); + return; + + file_error: + msg = + sqlite3_mprintf + ("SqlProc exception - unable to open \"%s\" for writing.", filepath); + sqlite3_result_error (context, msg, -1); + sqlite3_free (msg); + return; +} + +static void +fnct_sp_get_logfile (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_GetLogfile(void) +/ +/ returns: +/ the path of the currently set Logfile +/ NULL if no current Logfile is defined +*/ + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + sqlite3_result_null (context); + else + { + const char *path = cache->SqlProcLogfile; + if (path == NULL) + sqlite3_result_null (context); + else + sqlite3_result_text (context, path, strlen (path), SQLITE_STATIC); + } +} + +static void +fnct_sp_from_text (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_FromText(TEXT sql-script) +/ SqlProc_FromText(TEXT sql-script, TEXT charset) +/ +/ returns: +/ a SQL Procedure BLOB object +/ raises an exception on invalid arguments +*/ + const char *sql; + const char *charset = "UTF-8"; + unsigned char *blob = NULL; + int blob_sz = 0; + const char *msg; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_sql_body; + sql = (const char *) sqlite3_value_text (argv[0]); + if (argc >= 2) + { + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_charset; + charset = (const char *) sqlite3_value_text (argv[1]); + } + if (gaia_sql_proc_parse (cache, sql, charset, &blob, &blob_sz)) + sqlite3_result_blob (context, blob, blob_sz, free); + else + { + if (blob != NULL) + free (blob); + goto parse_error; + } + return; + + invalid_sql_body: + msg = "SqlProc exception - illegal SQL Body argument."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_charset: + msg = "SqlProc exception - illegal Charset Encodind argument."; + sqlite3_result_error (context, msg, -1); + return; + + parse_error: + msg = "SqlProc exception - invalid SQL Body."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_from_file (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_FromFile(TEXT filepath) +/ SqlProc_FromFile(TEXT filepath, TEXT charset) +/ +/ returns: +/ a SQL Procedure BLOB object +/ raises an exception on invalid arguments +*/ + const char *filepath; + const char *charset = "UTF-8"; + unsigned char *blob = NULL; + int blob_sz = 0; + const char *msg; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_filepath; + filepath = (const char *) sqlite3_value_text (argv[0]); + if (argc >= 2) + { + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_charset; + charset = (const char *) sqlite3_value_text (argv[1]); + } + if (gaia_sql_proc_import (cache, filepath, charset, &blob, &blob_sz)) + sqlite3_result_blob (context, blob, blob_sz, free); + else + { + if (blob != NULL) + free (blob); + goto read_error; + } + return; + + invalid_filepath: + msg = "SqlProc exception - illegal File Path argument."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_charset: + msg = "SqlProc exception - illegal Charset Encodind argument."; + sqlite3_result_error (context, msg, -1); + return; + + read_error: + msg = "SqlProc exception - unable to parse the external File."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_is_valid (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_IsValid(BLOB) +/ +/ returns: +/ 1 if the argument really is a valid SQL Procedure Object +/ 0 if not +*/ + const unsigned char *blob; + int blob_sz = 0; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + { + sqlite3_result_int (context, 0); + return; + } + blob = sqlite3_value_blob (argv[0]); + blob_sz = sqlite3_value_bytes (argv[0]); + if (gaia_sql_proc_is_valid (blob, blob_sz)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; +} + +static void +fnct_sp_var_count (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_NumVariables(BLOB) +/ +/ returns: +/ the total count of Variables from a SQL Procedure Object +/ raises an exception on invalid argument +*/ + const unsigned char *blob; + int blob_sz = 0; + int count; + const char *msg; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + goto invalid_argument; + blob = sqlite3_value_blob (argv[0]); + blob_sz = sqlite3_value_bytes (argv[0]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + count = gaia_sql_proc_var_count (blob, blob_sz); + sqlite3_result_int (context, count); + return; + + invalid_argument: + msg = "SqlProc exception - illegal SQL Procedure arg [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "SqlProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_variable (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_VariableN(BLOB, INTEGER index) +/ +/ returns: +/ the Name of the Nth Variable from a SQL Procedure Object +/ raises an exception on invalid arguments +*/ + const unsigned char *blob; + int blob_sz = 0; + int count; + int index; + const char *varname; + char *msg; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + goto invalid_blob_argument; + if (sqlite3_value_type (argv[1]) != SQLITE_INTEGER) + goto invalid_int_argument; + blob = sqlite3_value_blob (argv[0]); + blob_sz = sqlite3_value_bytes (argv[0]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + index = sqlite3_value_int (argv[1]); + count = gaia_sql_proc_var_count (blob, blob_sz); + if (index < 0 || index >= count) + goto illegal_index; + varname = gaia_sql_proc_variable (blob, blob_sz, index); + if (varname == NULL) + sqlite3_result_null (context); + else + sqlite3_result_text (context, varname, strlen (varname), free); + return; + + invalid_blob_argument: + msg = "SqlProc exception - illegal SQL Procedure arg [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_int_argument: + msg = "SqlProc exception - illegal Index arg [not an INTEGER]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "SqlProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; + + illegal_index: + msg = + sqlite3_mprintf + ("SqlProc exception - illegal Index (expected to be between 0 and %d).", + count - 1); + sqlite3_result_error (context, msg, -1); + sqlite3_free (msg); + return; +} + +static void +fnct_sp_all_variables (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_AllVariables(BLOB) +/ +/ returns: +/ a space separated list of Variable Names from a SQL Procedure Object +/ raises an exception on invalid arguments +*/ + const unsigned char *blob; + int blob_sz = 0; + const char *varlist; + const char *msg; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + goto invalid_argument; + blob = sqlite3_value_blob (argv[0]); + blob_sz = sqlite3_value_bytes (argv[0]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + varlist = gaia_sql_proc_all_variables (blob, blob_sz); + if (varlist == NULL) + sqlite3_result_null (context); + else + sqlite3_result_text (context, varlist, strlen (varlist), sqlite3_free); + return; + + invalid_argument: + msg = "SqlProc exception - illegal SQL Procedure arg [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "SqlProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; +} + +static int +is_decorated_variable_name (const char *name) +{ +/* testing for an already decorated Variable Name */ + char mark_start = *name; + char mark_stop = *(name + strlen (name) - 1); + if (mark_start == mark_stop && (mark_start == '@' || mark_start == '$')) + return 1; + return 0; +} + +static char * +do_encode_blob_value (const unsigned char *blob, int blob_sz) +{ +/* encoding a BLOB value as an Hex String */ + char *value = sqlite3_malloc ((blob_sz * 2) + 4); + char *p_out = value; + int i; + + *p_out++ = 'x'; + *p_out++ = '\''; + for (i = 0; i < blob_sz; i++) + { + unsigned char byte = *(blob + i); + unsigned char hi = byte / 16; + unsigned char lo = byte - (hi * 16); + switch (hi) + { + case 0: + *p_out++ = '0'; + break; + case 1: + *p_out++ = '1'; + break; + case 2: + *p_out++ = '2'; + break; + case 3: + *p_out++ = '3'; + break; + case 4: + *p_out++ = '4'; + break; + case 5: + *p_out++ = '5'; + break; + case 6: + *p_out++ = '6'; + break; + case 7: + *p_out++ = '7'; + break; + case 8: + *p_out++ = '8'; + break; + case 9: + *p_out++ = '9'; + break; + case 10: + *p_out++ = 'A'; + break; + case 11: + *p_out++ = 'B'; + break; + case 12: + *p_out++ = 'C'; + break; + case 13: + *p_out++ = 'D'; + break; + case 14: + *p_out++ = 'E'; + break; + case 15: + *p_out++ = 'F'; + break; + }; + switch (lo) + { + case 0: + *p_out++ = '0'; + break; + case 1: + *p_out++ = '1'; + break; + case 2: + *p_out++ = '2'; + break; + case 3: + *p_out++ = '3'; + break; + case 4: + *p_out++ = '4'; + break; + case 5: + *p_out++ = '5'; + break; + case 6: + *p_out++ = '6'; + break; + case 7: + *p_out++ = '7'; + break; + case 8: + *p_out++ = '8'; + break; + case 9: + *p_out++ = '9'; + break; + case 10: + *p_out++ = 'A'; + break; + case 11: + *p_out++ = 'B'; + break; + case 12: + *p_out++ = 'C'; + break; + case 13: + *p_out++ = 'D'; + break; + case 14: + *p_out++ = 'E'; + break; + case 15: + *p_out++ = 'F'; + break; + }; + } + *p_out++ = '\''; + *p_out = '\0'; + return value; +} + +static void +fnct_sp_var_arg (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_VarValue(TEXT var-name, NULL) +/ SqlProc_VarValue(TEXT var-name, INT value) +/ SqlProc_VarValue(TEXT var-name, DOUBLE value) +/ SqlProc_VarValue(TEXT var-name, TEXT value) +/ SqlProc_VarValue(TEXT var-name, BLOB value) +/ +/ returns: +/ an SQL Procedure Argument - Variable with Value +/ raises an exception on invalid arguments +*/ + const char *var_name; + const unsigned char *blob; + int blob_sz; + char *var_arg; + const char *msg; + char *value; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument; + var_name = (const char *) sqlite3_value_text (argv[0]); + switch (sqlite3_value_type (argv[1])) + { + case SQLITE_NULL: + value = sqlite3_mprintf ("%s", "NULL"); + break; + case SQLITE_INTEGER: + value = sqlite3_mprintf ("%d", sqlite3_value_int (argv[1])); + break; + case SQLITE_FLOAT: + value = sqlite3_mprintf ("%1.10f", sqlite3_value_double (argv[1])); + break; + case SQLITE_TEXT: + value = sqlite3_mprintf ("%s", sqlite3_value_text (argv[1])); + break; + case SQLITE_BLOB: + default: + blob = sqlite3_value_blob (argv[1]); + blob_sz = sqlite3_value_bytes (argv[1]); + value = do_encode_blob_value (blob, blob_sz); + break; + }; + + if (is_decorated_variable_name (var_name)) + var_arg = sqlite3_mprintf ("%s=%s", var_name, value); + else + var_arg = sqlite3_mprintf ("@%s@=%s", var_name, value); + sqlite3_result_text (context, var_arg, strlen (var_arg), sqlite3_free); + sqlite3_free (value); + return; + + invalid_argument: + msg = "SqlProc exception - illegal Name arg [not TEXT]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_is_valid_var (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_IsValidVarValue(TEXT) +/ +/ returns: +/ 1 if the argument really is a valid SQL Variable with Value +/ 0 if not +*/ + const char *str; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, 0); + return; + } + str = (const char *) sqlite3_value_text (argv[0]); + if (gaia_sql_proc_is_valid_var_value (str)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; +} + +static void +fnct_sp_raw_sql (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_RawSQL(BLOB) +/ +/ returns: +/ the raw SQL body from a SQL Procedure Object +/ raises an exception on invalid arguments +*/ + const unsigned char *blob; + int blob_sz = 0; + const char *sql; + const char *msg; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + goto invalid_argument; + blob = sqlite3_value_blob (argv[0]); + blob_sz = sqlite3_value_bytes (argv[0]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + sql = gaia_sql_proc_raw_sql (blob, blob_sz); + if (sql == NULL) + sqlite3_result_null (context); + else + sqlite3_result_text (context, sql, strlen (sql), free); + return; + + invalid_argument: + msg = "SqlProc exception - illegal SQL Procedure arg [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "SqlProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; +} + +static SqlProc_VarListPtr +get_sql_proc_variables (const void *cache, int argc, sqlite3_value ** argv) +{ +/* common implementation: creating an SQL Procedure Variables List */ + int i; + const char *text; + SqlProc_VarListPtr list = gaia_sql_proc_create_variables (); + for (i = 1; i < argc; i++) + { + if (sqlite3_value_type (argv[i]) != SQLITE_TEXT) + { + char *errmsg = + sqlite3_mprintf + ("Variable Argument #%d is not of the TEXT type.\n", i - 1); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + list->Error = 1; + goto end; + } + text = (const char *) sqlite3_value_text (argv[i]); + if (!gaia_sql_proc_add_variable (list, text)) + { + char *errmsg = + sqlite3_mprintf ("Illegal Variable Argument #%d: %s\n", + i - 1, text); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + list->Error = 1; + goto end; + } + } + end: + return list; +} + +static void +fnct_sp_cooked_sql (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_CookedSQL(BLOB [, arg1 TEXT, arg2 TEXT, ... argN TEXT] ) +/ +/ returns: +/ the cooked SQL body from a SQL Procedure Object +/ raises an exception on invalid arguments +*/ + const unsigned char *blob; + int blob_sz = 0; + char *sql; + const char *msg; + SqlProc_VarListPtr variables = NULL; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + goto invalid_blob_argument; + blob = sqlite3_value_blob (argv[0]); + blob_sz = sqlite3_value_bytes (argv[0]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + +/* retrieving the List of Variables with Values */ + variables = get_sql_proc_variables (cache, argc, argv); + if (variables == NULL) + goto err_variables; + if (variables->Error) + goto illegal_variables; + +/* replacing Variables */ + if (!gaia_sql_proc_cooked_sql + (sqlite, cache, blob, blob_sz, variables, &sql)) + goto cooking_error; + if (sql == NULL) + { + sqlite3_result_null (context); + goto done; + } + sqlite3_result_text (context, sql, strlen (sql), free); + + done: + gaia_sql_proc_destroy_variables (variables); + return; + + invalid_blob_argument: + msg = "SqlProc exception - illegal SQL Procedure arg [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "SqlProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; + + err_variables: + if (variables != NULL) + gaia_sql_proc_destroy_variables (variables); + msg = "SqlProc exception - unable to get a List of Variables with Values."; + sqlite3_result_error (context, msg, -1); + return; + + illegal_variables: + if (variables != NULL) + gaia_sql_proc_destroy_variables (variables); + msg = + "SqlProc exception - the List of Variables with Values contains illegal items."; + sqlite3_result_error (context, msg, -1); + return; + + cooking_error: + if (variables != NULL) + gaia_sql_proc_destroy_variables (variables); + msg = "SqlProc exception - unable to create a Cooked SQL Body."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_execute (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_Execute(BLOB [, arg1 TEXT, arg2 TEXT, ... argN TEXT] ) +/ +/ returns: +/ 1 on succes +/ raises an exception on invalid arguments or errors +*/ + const unsigned char *blob; + int blob_sz = 0; + char *sql; + const char *msg; + SqlProc_VarListPtr variables = NULL; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) + goto invalid_blob_argument; + blob = sqlite3_value_blob (argv[0]); + blob_sz = sqlite3_value_bytes (argv[0]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + +/* retrieving the List of Variables with Values */ + variables = get_sql_proc_variables (cache, argc, argv); + if (variables == NULL) + goto err_variables; + if (variables->Error) + goto illegal_variables; + +/* replacing Variables */ + if (!gaia_sql_proc_cooked_sql + (sqlite, cache, blob, blob_sz, variables, &sql)) + goto cooking_error; + +/* executing the SQL Procedure */ + if (!gaia_sql_proc_execute (sqlite, cache, sql)) + goto sql_error; + sqlite3_result_int (context, 1); + if (sql != NULL) + free (sql); + gaia_sql_proc_destroy_variables (variables); + return; + + invalid_blob_argument: + msg = "SqlProc exception - illegal SQL Procedure arg [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "SqlProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; + + err_variables: + msg = "SqlProc exception - unable to get a List of Variables with Values."; + sqlite3_result_error (context, msg, -1); + return; + + illegal_variables: + if (variables != NULL) + gaia_sql_proc_destroy_variables (variables); + msg = + "SqlProc exception - the List of Variables with Values contains illegal items."; + sqlite3_result_error (context, msg, -1); + return; + + cooking_error: + if (variables != NULL) + gaia_sql_proc_destroy_variables (variables); + msg = "SqlProc exception - unable to create a Cooked SQL Body."; + sqlite3_result_error (context, msg, -1); + return; + + sql_error: + if (variables != NULL) + gaia_sql_proc_destroy_variables (variables); + if (sql != NULL) + free (sql); + msg = "SqlProc exception - a fatal SQL error was encountered."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_exit (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ SqlProc_Exit( void ) +/ StoredProc_Exit( void ) +/ +/ returns: +/ 1 on succes +/ raises an exception on invalid arguments or errors +*/ + const char *msg; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + goto no_cache; + +/* registrering an EXIT request */ + cache->SqlProcContinue = 0; + sqlite3_result_int (context, 1); + return; + + no_cache: + msg = "SqlProc_Exit exception - unable to find a Connection Cache."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_create_tables (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ StoredProc_CreateTables() +/ +/ will attempt to create the Stored Procedures tables if not +/ already existing +/ +/ returns: +/ 1 on success, 0 on failure +*/ + int ret; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + void *data = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + ret = gaia_stored_proc_create_tables (sqlite, data); + sqlite3_result_int (context, ret); +} + +static void +fnct_sp_register (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ StoredProc_Register(name TEXT, title TEXT, sql_body BLOB) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const char *title; + const unsigned char *blob; + int blob_sz = 0; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument_1; + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_argument_2; + if (sqlite3_value_type (argv[2]) != SQLITE_BLOB) + goto invalid_argument_3; + name = (const char *) sqlite3_value_text (argv[0]); + title = (const char *) sqlite3_value_text (argv[1]); + blob = sqlite3_value_blob (argv[2]); + blob_sz = sqlite3_value_bytes (argv[2]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + if (gaia_stored_proc_store (sqlite, cache, name, title, blob, blob_sz)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; + + invalid_argument_1: + msg = + "StoredProc exception - illegal Stored Procedure Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_2: + msg = + "StoredProc exception - illegal Stored Procedure Title [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_3: + msg = "StoredProc exception - illegal Stored Procedure Body [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "StoredProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_get (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ StoredProc_Get(name TEXT) +/ +/ returns: +/ a SQL Procedure BLOB Object +/ raises an exception on invalid arguments +*/ + const char *name; + unsigned char *blob; + int blob_sz = 0; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument; + name = (const char *) sqlite3_value_text (argv[0]); + if (gaia_stored_proc_fetch (sqlite, cache, name, &blob, &blob_sz)) + sqlite3_result_blob (context, blob, blob_sz, free); + else + sqlite3_result_null (context); + return; + + invalid_argument: + msg = + "StoredProc exception - illegal Stored Procedure Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_delete (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ StoredProc_Delete(name TEXT) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument; + name = (const char *) sqlite3_value_text (argv[0]); + if (gaia_stored_proc_delete (sqlite, cache, name)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; + + invalid_argument: + msg = + "StoredProc exception - illegal Stored Procedure Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_update_title (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ StoredProc_UpdateTitle(name TEXT, title TEXT) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const char *title; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument_1; + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_argument_2; + name = (const char *) sqlite3_value_text (argv[0]); + title = (const char *) sqlite3_value_text (argv[1]); + if (gaia_stored_proc_update_title (sqlite, cache, name, title)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; + + invalid_argument_1: + msg = + "StoredProc exception - illegal Stored Procedure Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_2: + msg = + "StoredProc exception - illegal Stored Procedure Title [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_update_sql (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ StoredProc_UpdateSqlBody(name TEXT, sql BLOB) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const unsigned char *blob; + int blob_sz = 0; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument_1; + if (sqlite3_value_type (argv[1]) != SQLITE_BLOB) + goto invalid_argument_2; + name = (const char *) sqlite3_value_text (argv[0]); + blob = sqlite3_value_blob (argv[1]); + blob_sz = sqlite3_value_bytes (argv[1]); + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + if (gaia_stored_proc_update_sql (sqlite, cache, name, blob, blob_sz)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; + + invalid_argument_1: + msg = + "StoredProc exception - illegal Stored Procedure Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_2: + msg = "StoredProc exception - illegal Stored Procedure Body [not a BLOB]."; + sqlite3_result_error (context, msg, -1); + return; + + not_an_sql_proc: + msg = "StoredProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_stored_execute (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ StoredProc_Execute(TEXT [, arg1 TEXT, arg2 TEXT, ... argN TEXT] ) +/ +/ returns: +/ 1 on succes +/ raises an exception on invalid arguments or errors +*/ + const char *name; + unsigned char *blob; + int blob_sz = 0; + char *sql; + const char *msg; + char *message; + SqlProc_VarListPtr variables = NULL; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_name_argument; + name = (const char *) sqlite3_value_text (argv[0]); + if (!gaia_stored_proc_fetch (sqlite, cache, name, &blob, &blob_sz)) + goto invalid_stored_procedure; + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + goto not_an_sql_proc; + +/* retrieving the List of Variables with Values */ + variables = get_sql_proc_variables (cache, argc, argv); + if (variables == NULL) + goto err_variables; + if (variables->Error) + goto illegal_variables; + +/* replacing Variables */ + if (!gaia_sql_proc_cooked_sql + (sqlite, cache, blob, blob_sz, variables, &sql)) + goto cooking_error; + free (blob); + +/* executing the SQL Procedure */ + if (!gaia_sql_proc_execute (sqlite, cache, sql)) + goto sql_error; + sqlite3_result_int (context, 1); + if (sql != NULL) + free (sql); + gaia_sql_proc_destroy_variables (variables); + return; + + invalid_name_argument: + msg = + "StoredProc exception - illegal Stored Procedure Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_stored_procedure: + message = + sqlite3_mprintf + ("StoredProc exception - unable to retrive a Stored Procedure named \"%s\".", + name); + sqlite3_result_error (context, message, -1); + sqlite3_free (message); + return; + + not_an_sql_proc: + free (blob); + msg = "SqlProc exception - invalid SQL Procedure BLOB."; + sqlite3_result_error (context, msg, -1); + return; + + err_variables: + free (blob); + msg = "SqlProc exception - unable to get a List of Variables with Values."; + sqlite3_result_error (context, msg, -1); + return; + + illegal_variables: + free (blob); + gaia_sql_proc_destroy_variables (variables); + msg = + "SqlProc exception - the List of Variables with Values contains illegal items."; + sqlite3_result_error (context, msg, -1); + return; + + cooking_error: + gaia_sql_proc_destroy_variables (variables); + free (blob); + msg = "SqlProc exception - unable to create a Cooked SQL Body."; + sqlite3_result_error (context, msg, -1); + return; + + sql_error: + if (sql != NULL) + free (sql); + gaia_sql_proc_destroy_variables (variables); + msg = "SqlProc exception - a fatal SQL error was encountered."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_var_register (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ StoredVar_Register(name TEXT, title TEXT, value NULL) +/ StoredVar_Register(name TEXT, title TEXT, value INT) +/ StoredVar_Register(name TEXT, title TEXT, value DOUBLE) +/ StoredVar_Register(name TEXT, title TEXT, value TEXT) +/ StoredVar_Register(name TEXT, title TEXT, value BLOB) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const char *title; + const unsigned char *blob; + int blob_sz; + char *value = NULL; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument_1; + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_argument_2; + name = (const char *) sqlite3_value_text (argv[0]); + title = (const char *) sqlite3_value_text (argv[1]); + switch (sqlite3_value_type (argv[2])) + { + case SQLITE_NULL: + value = sqlite3_mprintf ("%s", "NULL"); + break; + case SQLITE_INTEGER: + value = sqlite3_mprintf ("%d", sqlite3_value_int (argv[2])); + break; + case SQLITE_FLOAT: + value = sqlite3_mprintf ("%1.10f", sqlite3_value_double (argv[2])); + break; + case SQLITE_TEXT: + value = sqlite3_mprintf ("%s", sqlite3_value_text (argv[2])); + break; + case SQLITE_BLOB: + default: + blob = sqlite3_value_blob (argv[2]); + blob_sz = sqlite3_value_bytes (argv[2]); + value = do_encode_blob_value (blob, blob_sz); + break; + }; + if (gaia_stored_var_store (sqlite, cache, name, title, value)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + if (value != NULL) + sqlite3_free (value); + return; + + invalid_argument_1: + msg = + "StoredVar exception - illegal Stored Variable Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_2: + msg = + "StoredVar exception - illegal Stored Variable Title [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_var_get (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ StoredVar_Get(name TEXT) +/ +/ returns: +/ a Variable with Value string +/ raises an exception on invalid arguments +*/ + const char *name; + char *value; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument; + name = (const char *) sqlite3_value_text (argv[0]); + if (!gaia_stored_var_fetch (sqlite, cache, name, 1, &value)) + sqlite3_result_null (context); + else + sqlite3_result_text (context, value, strlen (value), free); + return; + + invalid_argument: + msg = + "StoredVar exception - illegal Stored Variable Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_var_get_value (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ StoredVar_GetValue(name TEXT) +/ +/ returns: +/ a Variable with Value string +/ raises an exception on invalid arguments +*/ + const char *name; + char *value; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument; + name = (const char *) sqlite3_value_text (argv[0]); + if (!gaia_stored_var_fetch (sqlite, cache, name, 0, &value)) + sqlite3_result_null (context); + else + sqlite3_result_text (context, value, strlen (value), free); + return; + + invalid_argument: + msg = + "StoredVar exception - illegal Stored Variable Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_var_delete (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ StoredVar_Delete(name TEXT) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument; + name = (const char *) sqlite3_value_text (argv[0]); + if (gaia_stored_var_delete (sqlite, cache, name)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; + + invalid_argument: + msg = + "StoredVar exception - illegal Stored Variable Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_var_update_title (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ StoredVar_UpdateTitle(name TEXT, title TEXT) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const char *title; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument_1; + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_argument_2; + name = (const char *) sqlite3_value_text (argv[0]); + title = (const char *) sqlite3_value_text (argv[1]); + if (gaia_stored_var_update_title (sqlite, cache, name, title)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; + + invalid_argument_1: + msg = + "StoredVar exception - illegal Stored Variable Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_2: + msg = + "StoredVar exception - illegal Stored Variable Title [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_sp_var_update_value (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ StoredVar_UpdateValue(name TEXT, value NULL) +/ StoredVar_UpdateValue(name TEXT, value INT) +/ StoredVar_UpdateValue(name TEXT, value DOUBLE) +/ StoredVar_UpdateValue(name TEXT, value TEXT) +/ StoredVar_UpdateValue(name TEXT, value BLOB) +/ +/ returns: +/ 1 on success, 0 on failure +/ raises an exception on invalid arguments +*/ + const char *name; + const unsigned char *blob; + int blob_sz; + char *value = NULL; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument_1; + name = (const char *) sqlite3_value_text (argv[0]); + switch (sqlite3_value_type (argv[1])) + { + case SQLITE_NULL: + value = sqlite3_mprintf ("%s", "NULL"); + break; + case SQLITE_INTEGER: + value = sqlite3_mprintf ("%d", sqlite3_value_int (argv[1])); + break; + case SQLITE_FLOAT: + value = sqlite3_mprintf ("%1.10f", sqlite3_value_double (argv[1])); + break; + case SQLITE_TEXT: + value = sqlite3_mprintf ("%s", sqlite3_value_text (argv[1])); + break; + case SQLITE_BLOB: + default: + blob = sqlite3_value_blob (argv[1]); + blob_sz = sqlite3_value_bytes (argv[1]); + value = do_encode_blob_value (blob, blob_sz); + break; + }; + if (gaia_stored_var_update_value (sqlite, cache, name, value)) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + if (value != NULL) + sqlite3_free (value); + return; + + invalid_argument_1: + msg = + "StoredVar exception - illegal Stored Variable Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_create_routing_nodes (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ CreateRoutingNodes(db-prefix TEXT, input-table TEXT , geom-column TEXT, +/ node-from-column TEXT , node-to-column TEXT ) +/ +/ returns: +/ 1 on succes +/ raises an exception on invalid arguments or errors +*/ + const char *db_prefix; + const char *input_table; + const char *geom_column; + const char *from_column; + const char *to_column; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + db_prefix = NULL; + else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + db_prefix = (const char *) sqlite3_value_text (argv[0]); + else + goto invalid_argument_1; + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_argument_2; + else + input_table = (const char *) sqlite3_value_text (argv[1]); + if (sqlite3_value_type (argv[2]) == SQLITE_NULL) + geom_column = NULL; + else if (sqlite3_value_type (argv[2]) == SQLITE_TEXT) + geom_column = (const char *) sqlite3_value_text (argv[2]); + else + goto invalid_argument_3; + if (sqlite3_value_type (argv[3]) != SQLITE_TEXT) + goto invalid_argument_4; + from_column = (const char *) sqlite3_value_text (argv[3]); + if (sqlite3_value_type (argv[4]) != SQLITE_TEXT) + goto invalid_argument_5; + to_column = (const char *) sqlite3_value_text (argv[4]); + if (gaia_create_routing_nodes + (sqlite, cache, db_prefix, input_table, geom_column, from_column, + to_column)) + sqlite3_result_int (context, 1); + else + { + /* there was an error, raising an Exception */ + char *msg_err; + msg = gaia_create_routing_get_last_error (cache); + if (msg == NULL) + msg_err = + sqlite3_mprintf + ("CreateRoutingNodes exception - Unknown reason"); + else + msg_err = + sqlite3_mprintf ("CreateRoutingNodes exception - %s", msg); + sqlite3_result_error (context, msg_err, -1); + sqlite3_free (msg_err); + } + return; + + invalid_argument_1: + msg = + "CreateRoutingNodes exception - illegal DB-prefix [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_2: + msg = + "CreateRoutingNodes exception - illegal Spatial-Table Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_3: + msg = + "CreateRoutingNodes exception - illegal Geometry Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_4: + msg = + "CreateRoutingNodes exception - illegal FromNode Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_5: + msg = + "CreateRoutingNodes exception - illegal ToNode Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_create_routing (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ CreateRouting(routing-data-table TEXT , virtual-routing-table TEXT , +/ input-table TEXT , from-column TEXT , to-column TEXT , +/ geom-column TEXT , cost-column TEXT ) +/ CreateRouting(routing-data-table TEXT , virtual-routing-table TEXT , +/ input-table TEXT , from-column TEXT , to-column TEXT , +/ geom-column TEXT , cost-column TEXT , name-column TEXT , +/ a-star-enabled BOOLEAN , bidirectional BOOLEAN ) +/ CreateRouting(routing-data-table TEXT , virtual-routing-table TEXT , +/ input-table TEXT , from-column TEXT , to-column TEXT , +/ geom-column TEXT , cost-column TEXT , name-column TEXT , +/ a-star-enabled BOOLEAN , bidirectional BOOLEAN , +/ oneway-from TEXT , oneway-to TEXT ) +/ CreateRouting(routing-data-table TEXT , virtual-routing-table TEXT , +/ input-table TEXT , from-column TEXT , to-column TEXT , +/ geom-column TEXT , cost-column TEXT , name-column TEXT , +/ a-star-enabled BOOLEAN , bidirectional BOOLEAN , +/ oneway-from TEXT , oneway-to TEXT , overwrite BOOLEAN ) +/ +/ returns: +/ 1 on succes +/ raises an exception on invalid arguments or errors +*/ + const char *routing_data_table; + const char *virtual_routing_table; + const char *input_table; + const char *from_column; + const char *to_column; + const char *geom_column; + const char *cost_column; + const char *name_column; + int a_star_enabled = 1; + int bidirectional = 1; + const char *oneway_from = NULL; + const char *oneway_to = NULL; + int overwrite = 0; + const char *msg; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + goto invalid_argument_1; + routing_data_table = (const char *) sqlite3_value_text (argv[0]); + if (sqlite3_value_type (argv[1]) != SQLITE_TEXT) + goto invalid_argument_2; + virtual_routing_table = (const char *) sqlite3_value_text (argv[1]); + if (sqlite3_value_type (argv[2]) != SQLITE_TEXT) + goto invalid_argument_3; + input_table = (const char *) sqlite3_value_text (argv[2]); + if (sqlite3_value_type (argv[3]) != SQLITE_TEXT) + goto invalid_argument_4; + from_column = (const char *) sqlite3_value_text (argv[3]); + if (sqlite3_value_type (argv[4]) != SQLITE_TEXT) + goto invalid_argument_5; + to_column = (const char *) sqlite3_value_text (argv[4]); + if (sqlite3_value_type (argv[5]) == SQLITE_NULL) + geom_column = NULL; + else if (sqlite3_value_type (argv[5]) == SQLITE_TEXT) + geom_column = (const char *) sqlite3_value_text (argv[5]); + else + goto invalid_argument_6; + if (sqlite3_value_type (argv[6]) == SQLITE_NULL) + cost_column = NULL; + else if (sqlite3_value_type (argv[6]) == SQLITE_TEXT) + cost_column = (const char *) sqlite3_value_text (argv[6]); + else + goto invalid_argument_7; + if (argc >= 10) + { + if (sqlite3_value_type (argv[7]) == SQLITE_NULL) + name_column = NULL; + else if (sqlite3_value_type (argv[7]) == SQLITE_TEXT) + name_column = (const char *) sqlite3_value_text (argv[7]); + else + goto invalid_argument_8; + if (sqlite3_value_type (argv[8]) != SQLITE_INTEGER) + goto invalid_argument_9; + a_star_enabled = sqlite3_value_int (argv[8]); + if (sqlite3_value_type (argv[9]) != SQLITE_INTEGER) + goto invalid_argument_10; + bidirectional = sqlite3_value_int (argv[9]); + } + if (argc >= 12) + { + if (sqlite3_value_type (argv[10]) == SQLITE_NULL) + oneway_from = NULL; + else if (sqlite3_value_type (argv[10]) == SQLITE_TEXT) + oneway_from = (const char *) sqlite3_value_text (argv[10]); + else + goto invalid_argument_11; + if (sqlite3_value_type (argv[11]) == SQLITE_NULL) + oneway_to = NULL; + else if (sqlite3_value_type (argv[11]) == SQLITE_TEXT) + oneway_to = (const char *) sqlite3_value_text (argv[11]); + else + goto invalid_argument_12; + } + if (argc >= 13) + { + if (sqlite3_value_type (argv[12]) != SQLITE_INTEGER) + goto invalid_argument_13; + overwrite = sqlite3_value_int (argv[12]); + } + if (gaia_create_routing + (sqlite, cache, routing_data_table, virtual_routing_table, input_table, + from_column, to_column, geom_column, cost_column, name_column, + a_star_enabled, bidirectional, oneway_from, oneway_to, overwrite)) + sqlite3_result_int (context, 1); + else + { + /* there was an error, raising an Exception */ + char *msg_err; + msg = gaia_create_routing_get_last_error (cache); + if (msg == NULL) + msg_err = + sqlite3_mprintf ("CreateRouting exception - Unknown reason"); + else + msg_err = sqlite3_mprintf ("CreateRouting exception - %s", msg); + sqlite3_result_error (context, msg_err, -1); + sqlite3_free (msg_err); + } + return; + + invalid_argument_1: + msg = + "CreateRouting exception - illegal Routing-Data Table Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_2: + msg = + "CreateRouting exception - illegal VirtualRouting-Table Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_3: + msg = + "CreateRouting exception - illegal Input-Table Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_4: + msg = + "CreateRouting exception - illegal FromNode Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_5: + msg = + "CreateRouting exception - illegal ToNode Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_6: + msg = + "CreateRouting exception - illegal Geometry Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_7: + msg = + "CreateRouting exception - illegal Cost Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_8: + msg = + "CreateRouting exception - illegal RoadName Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_9: + msg = + "CreateRouting exception - illegal A* Enabled option [not an INTEGER]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_10: + msg = + "CreateRouting exception - illegal Bidirectional option [not an INTEGER]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_11: + msg = + "CreateRouting exception - illegal OnewayFromTo Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_12: + msg = + "CreateRouting exception - illegal OnewayToFrom Column Name [not a TEXT string]."; + sqlite3_result_error (context, msg, -1); + return; + + invalid_argument_13: + msg = + "CreateRouting exception - illegal OverWrite option [not an INTEGER]."; + sqlite3_result_error (context, msg, -1); + return; +} + +static void +fnct_create_routing_get_last_error (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ CreateRouting_GetLastError() +/ +/ returns: +/ the most recent error message raised by CreateRouting +/ or NULL if no such message is available +*/ + const char *err_msg; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + { + sqlite3_result_null (context); + return; + } + + err_msg = gaia_create_routing_get_last_error (cache); + if (err_msg == NULL) + sqlite3_result_null (context); + else + sqlite3_result_text (context, err_msg, strlen (err_msg), SQLITE_STATIC); +} #ifndef OMIT_FREEXL /* FREEXL is enabled */ static void fnct_ImportXLS (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -30352,10 +34091,11 @@ else sqlite3_result_int (context, rows); } #endif /* end FREEXL support */ +#ifndef OMIT_ICONV /* ICONV is supported */ static void fnct_ImportDBF (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / ImportDBF(TEXT filename, TEXT table, TEXT charset) @@ -30819,10 +34559,12 @@ sqlite3_result_null (context); else sqlite3_result_int (context, rows); } +#endif /* end ICONV supported */ + static void fnct_ExportKML (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / ExportKML(TEXT table, TEXT geom_column, TEXT filename) @@ -31106,10 +34848,215 @@ sqlite3_result_null (context); else sqlite3_result_int (context, rows); } #endif /* end including LIBXML2 */ + +static int +is_word_delimiter (const char x, int post) +{ +/* testing for a SQL word delimiter */ + if (x == ' ' || x == '\t' || x == '\n' || x == '\r' || x == '(') + return 1; + if (post && x == '(') + return 1; + if (!post && x == ',') + return 1; + return 0; +} + +static int +do_check_eval (const char *str) +{ +/* testing if a Trigger attempts calling the dangerous Eval() function */ + + int contains_eval = 0; + const char *start = str; + const char *ptr; + while (1) + { + char pre; + char post; + ptr = strstr (start, "eval"); + if (ptr == NULL) + break; + if (ptr > str) + pre = *(ptr - 1); + else + pre = ' '; + post = *(ptr + 4); + if (is_word_delimiter (pre, 0) && is_word_delimiter (post, 1)) + contains_eval = 1; + start = ptr + 4; + } + return contains_eval; +} + +static int +do_check_blob_from_file (const char *str) +{ +/* testing if a Trigger attempts calling the dangerous BlobFromFile() function */ + + int contains_blob_from_file = 0; + const char *start = str; + const char *ptr; + while (1) + { + char pre; + char post; + ptr = strstr (start, "blobfromfile"); + if (ptr == NULL) + break; + if (ptr > str) + pre = *(ptr - 1); + else + pre = ' '; + post = *(ptr + 12); + if (is_word_delimiter (pre, 0) && is_word_delimiter (post, 1)) + contains_blob_from_file = 1; + start = ptr + 12; + } + return contains_blob_from_file; +} + +static int +do_check_blob_to_file (const char *str) +{ +/* testing if a Trigger attempts calling the dangerous BlobToFile() function */ + + int contains_blob_to_file = 0; + const char *start = str; + const char *ptr; + while (1) + { + char pre; + char post; + ptr = strstr (start, "blobtofile"); + if (ptr == NULL) + break; + if (ptr > str) + pre = *(ptr - 1); + else + pre = ' '; + post = *(ptr + 10); + if (is_word_delimiter (pre, 0) && is_word_delimiter (post, 1)) + contains_blob_to_file = 1; + start = ptr + 10; + } + return contains_blob_to_file; +} + +static int +do_check_load_xml (const char *str) +{ +/* testing if a Trigger attempts calling the dangerous XB_LoadXml() function */ + + int contains_load_xml = 0; + const char *start = str; + const char *ptr; + while (1) + { + char pre; + char post; + ptr = strstr (start, "xb_loadxml"); + if (ptr == NULL) + break; + if (ptr > str) + pre = *(ptr - 1); + else + pre = ' '; + post = *(ptr + 10); + if (is_word_delimiter (pre, 0) && is_word_delimiter (post, 1)) + contains_load_xml = 1; + start = ptr + 10; + } + return contains_load_xml; +} + +static int +do_check_store_xml (const char *str) +{ +/* testing if a Trigger attempts calling the dangerous XB_StoreXml() function */ + + int contains_store_xml = 0; + const char *start = str; + const char *ptr; + while (1) + { + char pre; + char post; + ptr = strstr (start, "xb_storexml"); + if (ptr == NULL) + break; + if (ptr > str) + pre = *(ptr - 1); + else + pre = ' '; + post = *(ptr + 11); + if (is_word_delimiter (pre, 0) && is_word_delimiter (post, 1)) + contains_store_xml = 1; + start = ptr + 11; + } + return contains_store_xml; +} + +static int +do_check_export_geo_json (const char *str) +{ +/* testing if a Trigger attempts calling the dangerous ExportGeoJSON() function */ + + int contains_export_geo_json = 0; + const char *start = str; + const char *ptr; + while (1) + { + char pre; + char post; + ptr = strstr (start, "exportgeojson"); + if (ptr == NULL) + break; + if (ptr > str) + pre = *(ptr - 1); + else + pre = ' '; + post = *(ptr + 13); + if (is_word_delimiter (pre, 0) && is_word_delimiter (post, 1)) + contains_export_geo_json = 1; + start = ptr + 13; + } + return contains_export_geo_json; +} + +static int +do_check_impexp (const char *str, const char *ref) +{ +/* +/ testing if a Trigger attempts calling one of the dangerous ExportDXF(), +/ ImportDXF(), ExportDBF(), ImportDBF(), ExportSHP(), ExportSHP(), +/ ExportKML(), ImportWFS() or ImportXLS() functions */ + + int contains_impexp = 0; + const char *start = str; + const char *ptr; + while (1) + { + char pre; + char post; + ptr = strstr (start, ref); + if (ptr == NULL) + break; + if (ptr > str) + pre = *(ptr - 1); + else + pre = ' '; + post = *(ptr + 9); + if (is_word_delimiter (pre, 0) && is_word_delimiter (post, 1)) + contains_impexp = 1; + start = ptr + 9; + } + return contains_impexp; +} static void fnct_CountUnsafeTriggers (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -31116,11 +35063,11 @@ /* SQL function: / CountUnsafeTriggers() / / returns: / the total count of *unsafe* triggers found -/ 0 if no dubious trigger has been identifiedfailure +/ 0 if no dubious trigger has been identified */ int ret; int i; char **results; int rows; @@ -31129,11 +35076,11 @@ sqlite3 *sqlite = sqlite3_context_db_handle (context); int count = 0; GAIA_UNUSED (); /* LCOV_EXCL_LINE */ /* checking all Triggers */ - sql = "SELECT Count(*) FROM sqlite_master WHERE " + sql = "SELECT Lower(sql) FROM sqlite_master WHERE " "type IN ('trigger', 'view') AND (sql LIKE '%BlobFromFile%' " "OR sql LIKE '%BlobToFile%' OR sql LIKE '%XB_LoadXML%' " "OR sql LIKE '%XB_StoreXML%' OR sql LIKE '%ImportDXF%' " "OR sql LIKE '%ExportDXF%' OR sql LIKE '%ImportDBF%' " "OR sql LIKE '%ExportDBF%' OR sql LIKE '%ImportSHP%' " @@ -31147,11 +35094,43 @@ ; else { for (i = 1; i <= rows; i++) { - count = atoi (results[(i * columns) + 0]); + int dangerous = 0; + if (do_check_blob_from_file (results[(i * columns) + 0])) + dangerous = 1; + if (do_check_blob_to_file (results[(i * columns) + 0])) + dangerous = 1; + if (do_check_load_xml (results[(i * columns) + 0])) + dangerous = 1; + if (do_check_store_xml (results[(i * columns) + 0])) + dangerous = 1; + if (do_check_export_geo_json (results[(i * columns) + 0])) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "importdxf")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "exportdxf")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "importdbf")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "exportdbf")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "importshp")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "exportshp")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "exportkml")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "importwfs")) + dangerous = 1; + if (do_check_impexp (results[(i * columns) + 0], "importxls")) + dangerous = 1; + if (do_check_eval (results[(i * columns) + 0])) + dangerous = 1; + if (dangerous) + count++; } } sqlite3_free_table (results); unknown: sqlite3_result_int (context, count); @@ -31240,11 +35219,12 @@ for (ib = 0; ib < polyg->NumInteriors; ib++) { /* interior Rings */ ring = polyg->Interiors + ib; l = gaiaGeodesicTotalLength (a, b, rf, - ring->DimensionModel, + ring-> + DimensionModel, ring->Coords, ring->Points); if (l < 0.0) { length = -1.0; @@ -31334,20 +35314,22 @@ { /* exterior Ring */ ring = polyg->Exterior; length += gaiaGreatCircleTotalLength (a, b, - ring->DimensionModel, + ring-> + DimensionModel, ring->Coords, ring->Points); for (ib = 0; ib < polyg->NumInteriors; ib++) { /* interior Rings */ ring = polyg->Interiors + ib; length += gaiaGreatCircleTotalLength (a, b, - ring->DimensionModel, + ring-> + DimensionModel, ring->Coords, ring->Points); } polyg = polyg->Next; } @@ -32003,15 +35985,20 @@ fnct_RegisterVectorCoverage (sqlite3_context * context, int argc, sqlite3_value ** argv) { /* SQL function: / RegisterVectorCoverage(Text coverage_name, Text f_table_name, -* Text f_geometry_column) +/ Text f_geometry_column) / or / RegisterVectorCoverage(Text coverage_name, Text f_table_name, / Text f_geometry_column, Text title, / Text abstract) +/ or +/ RegisterVectorCoverage(Text coverage_name, Text f_table_name, +/ Text f_geometry_column, Text title, +/ Text abstract, Bool is_queryable, +/ Bool is_editable) / / inserts a Vector Coverage / returns 1 on success / 0 on failure, -1 on invalid arguments */ @@ -32019,10 +36006,12 @@ const char *coverage_name; const char *f_table_name; const char *f_geometry_column; const char *title = NULL; const char *abstract = NULL; + int is_queryable = 0; + int is_editable = 0; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (sqlite3_value_type (argv[0]) != SQLITE_TEXT || sqlite3_value_type (argv[1]) != SQLITE_TEXT || sqlite3_value_type (argv[2]) != SQLITE_TEXT) @@ -32042,13 +36031,287 @@ return; } title = (const char *) sqlite3_value_text (argv[3]); abstract = (const char *) sqlite3_value_text (argv[4]); } + if (argc >= 7) + { + if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER + || sqlite3_value_type (argv[6]) != SQLITE_INTEGER) + { + sqlite3_result_int (context, -1); + return; + } + is_queryable = sqlite3_value_int (argv[5]); + is_editable = sqlite3_value_int (argv[6]); + } ret = register_vector_coverage (sqlite, coverage_name, f_table_name, - f_geometry_column, title, abstract); + f_geometry_column, title, abstract, + is_queryable, is_editable); + sqlite3_result_int (context, ret); +} + +static void +fnct_RegisterSpatialViewCoverage (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ RegisterSpatialViewCoverage(Text coverage_name, Text view_name, +/ Text view_geometry) +/ or +/ RegisterSpatialViewCoverage(Text coverage_name, Text view_name, +/ Text view_geometry, Text title, +/ Text abstract) +/ or +/ RegisterSpatialViewCoverage(Text coverage_name, Text view_name, +/ Text view_geometry, Text title, +/ Text abstract, Bool is_queryable, +/ Bool is_editable) +/ +/ inserts a Vector Coverage based upon a Spatial View +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *coverage_name; + const char *view_name; + const char *view_geometry; + const char *title = NULL; + const char *abstract = NULL; + int is_queryable = 0; + int is_editable = 0; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT + || sqlite3_value_type (argv[1]) != SQLITE_TEXT + || sqlite3_value_type (argv[2]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + coverage_name = (const char *) sqlite3_value_text (argv[0]); + view_name = (const char *) sqlite3_value_text (argv[1]); + view_geometry = (const char *) sqlite3_value_text (argv[2]); + if (argc >= 5) + { + if (sqlite3_value_type (argv[3]) != SQLITE_TEXT + || sqlite3_value_type (argv[4]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + title = (const char *) sqlite3_value_text (argv[3]); + abstract = (const char *) sqlite3_value_text (argv[4]); + } + if (argc >= 7) + { + if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER + || sqlite3_value_type (argv[6]) != SQLITE_INTEGER) + { + sqlite3_result_int (context, -1); + return; + } + is_queryable = sqlite3_value_int (argv[5]); + is_editable = sqlite3_value_int (argv[6]); + } + ret = + register_spatial_view_coverage (sqlite, coverage_name, view_name, + view_geometry, title, abstract, + is_queryable, is_editable); + sqlite3_result_int (context, ret); +} + +static void +fnct_RegisterVirtualShapeCoverage (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ RegisterVirtualShapeCoverage(Text coverage_name, Text virt_name, +/ Text virt_geometry) +/ or +/ RegisterVirtualShapeCoverage(Text coverage_name, Text virt_name, +/ Text virt_geometry, Text title, +/ Text abstract) +/ or +/ RegisterVirtualShapeCoverage(Text coverage_name, Text virt_name, +/ Text virt_geometry, Text title, +/ Text abstract, Bool is_queryable) +/ +/ inserts a Vector Coverage based upon a VirtualShapefile +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *coverage_name; + const char *virt_name; + const char *virt_geometry; + const char *title = NULL; + const char *abstract = NULL; + int is_queryable = 0; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT + || sqlite3_value_type (argv[1]) != SQLITE_TEXT + || sqlite3_value_type (argv[2]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + coverage_name = (const char *) sqlite3_value_text (argv[0]); + virt_name = (const char *) sqlite3_value_text (argv[1]); + virt_geometry = (const char *) sqlite3_value_text (argv[2]); + if (argc >= 5) + { + if (sqlite3_value_type (argv[3]) != SQLITE_TEXT + || sqlite3_value_type (argv[4]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + title = (const char *) sqlite3_value_text (argv[3]); + abstract = (const char *) sqlite3_value_text (argv[4]); + } + if (argc >= 6) + { + if (sqlite3_value_type (argv[5]) != SQLITE_INTEGER) + { + sqlite3_result_int (context, -1); + return; + } + is_queryable = sqlite3_value_int (argv[5]); + } + ret = + register_virtual_shp_coverage (sqlite, coverage_name, virt_name, + virt_geometry, title, abstract, + is_queryable); + sqlite3_result_int (context, ret); +} + +static void +fnct_RegisterTopoGeoCoverage (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ RegisterTopoGeoCoverage(Text coverage_name, Text topogeo_name) +/ or +/ RegisterTopoGeoCoverage(Text coverage_name, Text topogeo_name, +/ Text title, Text abstract) +/ or +/ RegisterTopoGeoCoverage(Text coverage_name, Text topogeo_name, +/ Text title, Text abstract, Bool is_queryable, +/ Bool is_editable) +/ +/ inserts a Vector Coverage based on some Topology-Geometry +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *coverage_name; + const char *topogeo_name; + const char *title = NULL; + const char *abstract = NULL; + int is_queryable = 0; + int is_editable = 0; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT + || sqlite3_value_type (argv[1]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + coverage_name = (const char *) sqlite3_value_text (argv[0]); + topogeo_name = (const char *) sqlite3_value_text (argv[1]); + if (argc >= 4) + { + if (sqlite3_value_type (argv[2]) != SQLITE_TEXT + || sqlite3_value_type (argv[3]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + title = (const char *) sqlite3_value_text (argv[2]); + abstract = (const char *) sqlite3_value_text (argv[3]); + } + if (argc >= 6) + { + if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER + || sqlite3_value_type (argv[5]) != SQLITE_INTEGER) + { + sqlite3_result_int (context, -1); + return; + } + is_queryable = sqlite3_value_int (argv[4]); + is_editable = sqlite3_value_int (argv[5]); + } + ret = + register_topogeo_coverage (sqlite, coverage_name, topogeo_name, + title, abstract, is_queryable, is_editable); + sqlite3_result_int (context, ret); +} + +static void +fnct_RegisterTopoNetCoverage (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ RegisterTopoNetCoverage(Text coverage_name, Text toponet_name) +/ or +/ RegisterTopoNetCoverage(Text coverage_name, Text toponet_name, +/ Text title, Text abstract) +/ or +/ RegisterTopoNetCoverage(Text coverage_name, Text toponet_name, +/ Text title, Text abstract, Bool is_queryable, +/ Bool is_editable) +/ +/ inserts a Vector Coverage based on some Topology-Network +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *coverage_name; + const char *toponet_name; + const char *title = NULL; + const char *abstract = NULL; + int is_queryable = 0; + int is_editable = 0; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT + || sqlite3_value_type (argv[1]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + coverage_name = (const char *) sqlite3_value_text (argv[0]); + toponet_name = (const char *) sqlite3_value_text (argv[1]); + if (argc >= 4) + { + if (sqlite3_value_type (argv[2]) != SQLITE_TEXT + || sqlite3_value_type (argv[3]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + title = (const char *) sqlite3_value_text (argv[2]); + abstract = (const char *) sqlite3_value_text (argv[3]); + } + if (argc >= 6) + { + if (sqlite3_value_type (argv[4]) != SQLITE_INTEGER + || sqlite3_value_type (argv[5]) != SQLITE_INTEGER) + { + sqlite3_result_int (context, -1); + return; + } + is_queryable = sqlite3_value_int (argv[4]); + is_editable = sqlite3_value_int (argv[5]); + } + ret = + register_toponet_coverage (sqlite, coverage_name, toponet_name, + title, abstract, is_queryable, is_editable); sqlite3_result_int (context, ret); } static void fnct_UnregisterVectorCoverage (sqlite3_context * context, int argc, @@ -32080,19 +36343,25 @@ sqlite3_value ** argv) { /* SQL function: / SetVectorCoverageInfos(Text coverage_name, Text title, / Text abstract) +/ or +/ SetVectorCoverageInfos(Text coverage_name, Text title, +/ Text abstract, Bool is_queryable, +/ Bool is_editable) / / updates the descriptive infos supporting a Vector Coverage / returns 1 on success / 0 on failure, -1 on invalid arguments */ int ret; const char *coverage_name; const char *title = NULL; const char *abstract = NULL; + int is_queryable = -1; + int is_editable = -1; sqlite3 *sqlite = sqlite3_context_db_handle (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (sqlite3_value_type (argv[0]) != SQLITE_TEXT || sqlite3_value_type (argv[1]) != SQLITE_TEXT || sqlite3_value_type (argv[2]) != SQLITE_TEXT) @@ -32101,11 +36370,75 @@ return; } coverage_name = (const char *) sqlite3_value_text (argv[0]); title = (const char *) sqlite3_value_text (argv[1]); abstract = (const char *) sqlite3_value_text (argv[2]); - ret = set_vector_coverage_infos (sqlite, coverage_name, title, abstract); + if (argc >= 5) + { + if (sqlite3_value_type (argv[3]) != SQLITE_INTEGER + || sqlite3_value_type (argv[4]) != SQLITE_INTEGER) + { + sqlite3_result_int (context, -1); + return; + } + is_queryable = sqlite3_value_int (argv[3]); + is_editable = sqlite3_value_int (argv[4]); + } + ret = + set_vector_coverage_infos (sqlite, coverage_name, title, abstract, + is_queryable, is_editable); + sqlite3_result_int (context, ret); +} + +static void +fnct_SetVectorCoverageCopyright (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ SetVectorCoverageCopyright(Text coverage_name, Text copyright) +/ or +/ SetVectorCoverageCopyright(Text coverage_name, Text copyright, +/ Text license) +/ +/ updates copyright infos supporting a Vector Coverage +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + int ret; + const char *coverage_name; + const char *copyright = NULL; + const char *license = NULL; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) != SQLITE_TEXT) + { + sqlite3_result_int (context, -1); + return; + } + if (sqlite3_value_type (argv[1]) == SQLITE_NULL) + ; + else if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) + copyright = (const char *) sqlite3_value_text (argv[1]); + else + { + sqlite3_result_int (context, -1); + return; + } + coverage_name = (const char *) sqlite3_value_text (argv[0]); + if (argc >= 3) + { + if (sqlite3_value_type (argv[2]) == SQLITE_TEXT) + license = (const char *) sqlite3_value_text (argv[2]); + else + { + sqlite3_result_int (context, -1); + return; + } + } + ret = + set_vector_coverage_copyright (sqlite, coverage_name, copyright, + license); sqlite3_result_int (context, ret); } static void fnct_RegisterVectorCoverageSrid (sqlite3_context * context, int argc, @@ -34579,15 +38912,19 @@ int n_bytes; int blob_len; unsigned char *blob = NULL; gaiaGeomCollPtr geom; int gpkg_mode = 0; + int tiny_point = 0; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) != SQLITE_BLOB) { sqlite3_result_null (context); return; } @@ -34595,11 +38932,12 @@ n_bytes = sqlite3_value_bytes (argv[0]); geom = gaiaXmlBlobMLineFromGPX (p_blob, n_bytes, sqlite); if (geom != NULL) { /* builds the BLOB geometry to be returned */ - gaiaToSpatiaLiteBlobWkbEx (geom, &blob, &blob_len, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &blob, &blob_len, gpkg_mode, + tiny_point); sqlite3_result_blob (context, blob, blob_len, free); gaiaFreeGeomColl (geom); } else sqlite3_result_null (context); @@ -36100,16 +40438,18 @@ gaiaGeomCollPtr g1; gaiaGeomCollPtr g2; int srid = -9999; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } /* validating the input args */ if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) { @@ -36157,11 +40497,11 @@ sqlite3_result_null (context); return; } if (srid != -9999) g2->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (g2, &blob, &blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (g2, &blob, &blob_sz, gpkg_mode, tiny_point); gaiaFreeGeomColl (g2); if (blob == NULL) sqlite3_result_null (context); else sqlite3_result_blob (context, blob, blob_sz, free); @@ -36446,16 +40786,18 @@ gaiaGeomCollPtr g1; gaiaGeomCollPtr g2; int srid = -9999; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } /* validating the input args */ if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) { @@ -36503,11 +40845,11 @@ sqlite3_result_null (context); return; } if (srid != -9999) g2->Srid = srid; - gaiaToSpatiaLiteBlobWkbEx (g2, &blob, &blob_sz, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (g2, &blob, &blob_sz, gpkg_mode, tiny_point); gaiaFreeGeomColl (g2); if (blob == NULL) sqlite3_result_null (context); else sqlite3_result_blob (context, blob, blob_sz, free); @@ -36774,12 +41116,288 @@ sqlite3_result_int (context, -1); return; } sqlite3_result_int (context, cache->decimal_precision); } + +static void +fnct_enableTinyPoint (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ EnableTinyPoint ( void ) +/ +/ returns: nothing +*/ + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + return; + cache->tinyPointEnabled = 1; +} + +static void +fnct_disableTinyPoint (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ DisableTinyPoint ( void ) +/ +/ returns: nothing +*/ + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + return; + cache->tinyPointEnabled = 0; +} + +static void +fnct_isTinyPointEnabled (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ IsTinyPointEnabled ( void ) +/ +/ returns: TRUE or FALSE +*/ + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + { + sqlite3_result_int (context, -1); + return; + } + sqlite3_result_int (context, cache->tinyPointEnabled); +} + +static void +fnct_addShapefileExtent (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ AddShapefileExtent ( table Text, minx Double miny Double, maxx Double, +/ maxy Double, srid Integer ) +/ +/ returns: 1 on success, 0 on failure +*/ + const char *table; + double minx; + double miny; + double maxx; + double maxy; + int srid; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + { + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + table = (const char *) sqlite3_value_text (argv[0]); + else + { + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[1]) == SQLITE_FLOAT) + minx = sqlite3_value_double (argv[1]); + else if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) + { + int val = sqlite3_value_int (argv[1]); + minx = val; + } + else + { + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[2]) == SQLITE_FLOAT) + miny = sqlite3_value_double (argv[2]); + else if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) + { + int val = sqlite3_value_int (argv[2]); + miny = val; + } + else + { + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[3]) == SQLITE_FLOAT) + maxx = sqlite3_value_double (argv[3]); + else if (sqlite3_value_type (argv[3]) == SQLITE_INTEGER) + { + int val = sqlite3_value_int (argv[3]); + maxx = val; + } + else + { + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[4]) == SQLITE_FLOAT) + maxy = sqlite3_value_double (argv[4]); + else if (sqlite3_value_type (argv[4]) == SQLITE_INTEGER) + { + int val = sqlite3_value_int (argv[4]); + maxy = val; + } + else + { + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[5]) == SQLITE_INTEGER) + srid = sqlite3_value_int (argv[5]); + else + { + sqlite3_result_int (context, 0); + return; + } + add_shp_extent (table, minx, miny, maxx, maxy, srid, cache); + sqlite3_result_int (context, 1); +} + +static void +fnct_removeShapefileExtent (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ RemoveShapefileExtent ( table Text ) +/ +/ returns: 1 on success, 0 on failure +*/ + const char *table; + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + { + sqlite3_result_int (context, 0); + return; + } + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + table = (const char *) sqlite3_value_text (argv[0]); + else + { + sqlite3_result_int (context, 0); + return; + } + remove_shp_extent (table, cache); + sqlite3_result_int (context, 1); +} + +static void +fnct_getShapefileExtent (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ +/* SQL function: +/ GetShapefileExtent ( table Text ) +/ +/ returns: the Shapefile's Full Extent (Envelope) +/ or NULL on error +*/ + const char *table; + double minx; + double miny; + double maxx; + double maxy; + int srid; + gaiaGeomCollPtr bbox; + gaiaPolygonPtr polyg; + gaiaRingPtr rect; + char *sql; + char *xtable; + int len; + unsigned char *p_result = NULL; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (cache == NULL) + { + sqlite3_result_null (context); + return; + } + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + table = (const char *) sqlite3_value_text (argv[0]); + else + { + sqlite3_result_null (context); + return; + } + +/* ensuring to initialize the VirtualShape Table */ + xtable = gaiaDoubleQuotedSql (table); + sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", xtable); + free (xtable); + sqlite3_exec (sqlite, sql, NULL, NULL, NULL); + sqlite3_free (sql); + + if (!get_shp_extent (table, &minx, &miny, &maxx, &maxy, &srid, cache)) + { + sqlite3_result_null (context); + return; + } + +/* building the Envelope */ + bbox = gaiaAllocGeomColl (); + bbox->Srid = srid; + polyg = gaiaAddPolygonToGeomColl (bbox, 5, 0); + rect = polyg->Exterior; + gaiaSetPoint (rect->Coords, 0, minx, miny); /* vertex # 1 */ + gaiaSetPoint (rect->Coords, 1, maxx, miny); /* vertex # 2 */ + gaiaSetPoint (rect->Coords, 2, maxx, maxy); /* vertex # 3 */ + gaiaSetPoint (rect->Coords, 3, minx, maxy); /* vertex # 4 */ + gaiaSetPoint (rect->Coords, 4, minx, miny); /* vertex # 5 [same as vertex # 1 to close the polygon] */ +/* builds the BLOB geometry to be returned */ + gaiaToSpatiaLiteBlobWkb (bbox, &p_result, &len); + sqlite3_result_blob (context, p_result, len, free); + gaiaFreeGeomColl (bbox); +} + +static void +fnct_isLowASCII (sqlite3_context * context, int argc, sqlite3_value ** argv) +{ +/* SQL function: +/ IsLowASCII ( string Text ) +/ +/ returns: 1 (TRUE) is the argument is a text string containing +/ all low-ASCII chars (7-bit, < 128) +/ 0 if not +/ -1 on invalid arg +*/ + int len; + int i; + const unsigned char *string; + int result = 1; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + string = (const unsigned char *) sqlite3_value_text (argv[0]); + else + { + sqlite3_result_int (context, -1); + return; + } + + len = strlen ((const char *) string); + for (i = 0; i < len; i++) + { + if (string[i] >= 128) + result = 0; + } + sqlite3_result_int (context, result); +} #ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + +static void +fnct_CreateTopoTables (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ + fnctaux_CreateTopoTables (context, argc, argv); +} static void fnct_CreateTopology (sqlite3_context * context, int argc, sqlite3_value ** argv) { fnctaux_CreateTopology (context, argc, argv); @@ -37001,10 +41619,24 @@ fnct_TopoGeo_ToGeoTable (sqlite3_context * context, int argc, sqlite3_value ** argv) { fnctaux_TopoGeo_ToGeoTable (context, argc, argv); } + +static void +fnct_TopoGeo_PolyFacesList (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ + fnctaux_TopoGeo_PolyFacesList (context, argc, argv); +} + +static void +fnct_TopoGeo_LineEdgesList (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ + fnctaux_TopoGeo_LineEdgesList (context, argc, argv); +} static void fnct_TopoGeo_ToGeoTableGeneralize (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -37053,11 +41685,11 @@ fnctaux_TopoGeo_NewEdgesSplit (context, argc, argv); } static void fnct_TopoGeo_ModEdgeSplit (sqlite3_context * context, int argc, - sqlite3_value ** argv) + sqlite3_value ** argv) { fnctaux_TopoGeo_ModEdgeSplit (context, argc, argv); } static void @@ -37105,10 +41737,17 @@ fnct_TopoGeo_SubdivideLines (sqlite3_context * context, int argc, sqlite3_value ** argv) { fnctaux_TopoGeo_SubdivideLines (context, argc, argv); } + +static void +fnct_TopoGeo_DisambiguateSegmentEdges (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ + fnctaux_TopoGeo_DisambiguateSegmentEdges (context, argc, argv); +} static void fnct_TopoGeo_GetEdgeSeed (sqlite3_context * context, int argc, sqlite3_value ** argv) { @@ -37324,10 +41963,24 @@ fnct_TopoNet_UpdateSeeds (sqlite3_context * context, int argc, sqlite3_value ** argv) { fnctaux_TopoNet_UpdateSeeds (context, argc, argv); } + +static void +fnct_TopoNet_DisambiguateSegmentLinks (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ + fnctaux_TopoNet_DisambiguateSegmentLinks (context, argc, argv); +} + +static void +fnct_TopoNet_LineLinksList (sqlite3_context * context, int argc, + sqlite3_value ** argv) +{ + fnctaux_TopoNet_LineLinksList (context, argc, argv); +} #endif /* end TOPOLOGY conditionals */ #ifdef LOADABLE_EXTENSION static void @@ -37475,33 +42128,42 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsValidPixel, 0, 0, 0); sqlite3_create_function_v2 (db, "IsValidRasterPalette", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsValidRasterPalette, 0, 0, 0); - sqlite3_create_function_v2 (db, "IsValidRasterStatistics", 2, - SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, - fnct_IsValidRasterStatistics, 0, 0, 0); sqlite3_create_function_v2 (db, "IsValidRasterStatistics", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsValidRasterStatistics, 0, 0, 0); - sqlite3_create_function_v2 (db, "IsValidRasterTile", 4, + sqlite3_create_function_v2 (db, "IsValidRasterTile", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsValidRasterTile, 0, 0, 0); - sqlite3_create_function_v2 (db, "IsPopulatedCoverage", 1, + sqlite3_create_function_v2 (db, "IsPopulatedCoverage", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsPopulatedCoverage, 0, 0, 0); sqlite3_create_function_v2 (db, "CheckSpatialMetaData", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_CheckSpatialMetaData, 0, 0, 0); + sqlite3_create_function_v2 (db, "CheckSpatialMetaData", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CheckSpatialMetaData, 0, 0, 0); sqlite3_create_function_v2 (db, "CheckGeoPackageMetaData", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_CheckGeoPackageMetaData, 0, 0, 0); + sqlite3_create_function_v2 (db, "CheckGeoPackageMetaData", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CheckGeoPackageMetaData, 0, 0, 0); sqlite3_create_function_v2 (db, "AutoFDOStart", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_AutoFDOStart, 0, 0, 0); + sqlite3_create_function_v2 (db, "AutoFDOStart", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AutoFDOStart, 0, 0, 0); sqlite3_create_function_v2 (db, "AutoFDOStop", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_AutoFDOStop, 0, 0, 0); + sqlite3_create_function_v2 (db, "AutoFDOStop", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AutoFDOStop, 0, 0, 0); sqlite3_create_function_v2 (db, "InitFDOSpatialMetaData", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_InitFDOSpatialMetaData, 0, 0, 0); sqlite3_create_function_v2 (db, "AddFDOGeometryColumn", 6, @@ -37520,10 +42182,19 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_InitSpatialMetaData, 0, 0, 0); sqlite3_create_function_v2 (db, "InitSpatialMetaData", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_InitSpatialMetaData, 0, 0, 0); + sqlite3_create_function_v2 (db, "InitSpatialMetaDataFull", 0, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_InitSpatialMetaDataFull, 0, 0, 0); + sqlite3_create_function_v2 (db, "InitSpatialMetaDataFull", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_InitSpatialMetaDataFull, 0, 0, 0); + sqlite3_create_function_v2 (db, "InitSpatialMetaDataFull", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_InitSpatialMetaDataFull, 0, 0, 0); sqlite3_create_function_v2 (db, "InsertEpsgSrid", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_InsertEpsgSrid, 0, 0, 0); sqlite3_create_function_v2 (db, "SridIsGeographic", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, @@ -37679,10 +42350,14 @@ fnct_RegisterWMSGetMap, 0, 0); sqlite3_create_function (db, "WMS_UnRegisterGetMap", 2, SQLITE_ANY, 0, fnct_UnregisterWMSGetMap, 0, 0); sqlite3_create_function (db, "WMS_SetGetMapInfos", 4, SQLITE_ANY, 0, fnct_SetWMSGetMapInfos, 0, 0); + sqlite3_create_function (db, "WMS_SetGetMapCopyright", 3, SQLITE_ANY, 0, + fnct_SetWMSGetMapCopyright, 0, 0); + sqlite3_create_function (db, "WMS_SetGetMapCopyright", 4, SQLITE_ANY, 0, + fnct_SetWMSGetMapCopyright, 0, 0); sqlite3_create_function (db, "WMS_SetGetMapOptions", 3, SQLITE_ANY, 0, fnct_SetWMSGetMapOptions, 0, 0); sqlite3_create_function (db, "WMS_SetGetMapOptions", 4, SQLITE_ANY, 0, fnct_SetWMSGetMapOptions, 0, 0); sqlite3_create_function (db, "WMS_SetGetMapOptions", 6, SQLITE_ANY, 0, @@ -37707,10 +42382,20 @@ fnct_WMSGetMapRequestURL, 0, 0); sqlite3_create_function (db, "WMS_GetFeatureInfoRequestURL", 10, SQLITE_ANY, 0, fnct_WMSGetFeatureInfoRequestURL, 0, 0); sqlite3_create_function (db, "WMS_GetFeatureInfoRequestURL", 11, SQLITE_ANY, 0, fnct_WMSGetFeatureInfoRequestURL, 0, 0); + sqlite3_create_function (db, "RegisterDataLicense", 1, SQLITE_ANY, + 0, fnct_RegisterDataLicense, 0, 0); + sqlite3_create_function (db, "RegisterDataLicense", 2, SQLITE_ANY, + 0, fnct_RegisterDataLicense, 0, 0); + sqlite3_create_function (db, "UnRegisterDataLicense", 1, SQLITE_ANY, + 0, fnct_UnRegisterDataLicense, 0, 0); + sqlite3_create_function (db, "RenameDataLicense", 2, SQLITE_ANY, + 0, fnct_RenameDataLicense, 0, 0); + sqlite3_create_function (db, "SetDataLicenseUrl", 2, SQLITE_ANY, + 0, fnct_SetDataLicenseUrl, 0, 0); sqlite3_create_function_v2 (db, "CreateMetaCatalogTables", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_CreateMetaCatalogTables, 0, 0, 0); sqlite3_create_function_v2 (db, "UpdateMetaCatalogStatistics", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, @@ -38287,16 +42972,28 @@ fnct_MD5Checksum, 0, 0, 0); sqlite3_create_function_v2 (db, "MD5TotalChecksum", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, 0, fnct_MD5TotalChecksum_step, fnct_MD5TotalChecksum_final, 0); + +#if OMIT_ICONV == 0 /* ICONV is absolutely required */ + sqlite3_create_function_v2 (db, "EncodeURL", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_EncodeURL, 0, 0, 0); + sqlite3_create_function_v2 (db, "EncodeURL", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_EncodeURL, 0, 0, 0); sqlite3_create_function_v2 (db, "DecodeURL", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_DecodeURL, 0, 0, 0); + sqlite3_create_function_v2 (db, "DecodeURL", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_DecodeURL, 0, 0, 0); + +#endif /* ICONV enabled/disabled */ + sqlite3_create_function_v2 (db, "DirNameFromPath", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_DirNameFromPath, 0, 0, 0); sqlite3_create_function_v2 (db, "FullFileNameFromPath", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, @@ -38361,11 +43058,23 @@ sqlite3_create_function_v2 (db, "ST_Reverse", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_Reverse, 0, 0, 0); sqlite3_create_function_v2 (db, "ST_ForceLHR", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, - fnct_ForceLHR, 0, 0, 0); + fnct_ForcePolygonCW, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_ForcePolygonCW", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ForcePolygonCW, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_ForcePolygonCCW", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ForcePolygonCCW, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_IsPolygonCW", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_IsPolygonCW, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_IsPolygonCCW", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_IsPolygonCCW, 0, 0, 0); sqlite3_create_function_v2 (db, "Dimension", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_Dimension, 0, 0, 0); sqlite3_create_function_v2 (db, "ST_Dimension", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, @@ -38994,10 +43703,16 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_CollectionExtract, 0, 0, 0); sqlite3_create_function_v2 (db, "ST_CollectionExtract", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_CollectionExtract, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_InterpolatePoint", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_InterpolatePoint, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_AddMeasure", 3, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_AddMeasure, 0, 0, 0); sqlite3_create_function_v2 (db, "ST_Locate_Along_Measure", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_LocateBetweenMeasures, 0, 0, 0); sqlite3_create_function_v2 (db, "ST_LocateAlong", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, @@ -39021,10 +43736,13 @@ /* some BLOB/JPEG/EXIF functions */ sqlite3_create_function_v2 (db, "IsGeometryBlob", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsGeometryBlob, 0, 0, 0); + sqlite3_create_function_v2 (db, "IsTinyPointBlob", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_IsTinyPointBlob, 0, 0, 0); sqlite3_create_function_v2 (db, "IsZipBlob", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_IsZipBlob, 0, 0, 0); sqlite3_create_function_v2 (db, "IsPdfBlob", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, @@ -39074,10 +43792,40 @@ sqlite3_create_function_v2 (db, "ElementaryGeometries", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ElementaryGeometries, 0, 0, 0); sqlite3_create_function_v2 (db, "ElementaryGeometries", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 7, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 8, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 9, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 10, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 11, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 12, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 13, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 14, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 15, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_ElementaryGeometries, 0, 0, 0); + sqlite3_create_function_v2 (db, "ElementaryGeometries", 16, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ElementaryGeometries, 0, 0, 0); sqlite3_create_function_v2 (db, "DropGeoTable", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_DropGeoTable, 0, 0, 0); sqlite3_create_function_v2 (db, "DropGeoTable", 2, @@ -39084,10 +43832,177 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_DropGeoTable, 0, 0, 0); sqlite3_create_function_v2 (db, "DropGeoTable", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_DropGeoTable, 0, 0, 0); + + sqlite3_create_function_v2 (db, "SqlProc_GetLastError", 0, SQLITE_UTF8, + cache, fnct_sp_get_last_error, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_GetLogfile", 0, SQLITE_UTF8, + cache, fnct_sp_get_logfile, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_FromText", 1, SQLITE_UTF8, + cache, fnct_sp_from_text, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_FromText", 2, SQLITE_UTF8, + cache, fnct_sp_from_text, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_IsValid", 1, SQLITE_UTF8, 0, + fnct_sp_is_valid, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_NumVariables", 1, SQLITE_UTF8, + 0, fnct_sp_var_count, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_VariableN", 2, SQLITE_UTF8, 0, + fnct_sp_variable, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_AllVariables", 1, SQLITE_UTF8, + 0, fnct_sp_all_variables, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_VarValue", 2, SQLITE_UTF8, 0, + fnct_sp_var_arg, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_IsValidVarValue", 1, SQLITE_UTF8, + 0, fnct_sp_is_valid_var, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_RawSQL", 1, SQLITE_UTF8, 0, + fnct_sp_raw_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 1, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 2, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 3, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 4, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 5, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 6, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 7, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 8, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 9, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 10, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 11, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 12, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 13, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 14, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 15, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 16, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_CookedSQL", 17, SQLITE_UTF8, cache, + fnct_sp_cooked_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 1, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 2, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 3, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 4, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 5, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 6, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 7, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 8, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 9, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 10, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 11, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 12, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 13, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 14, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 15, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 16, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Execute", 17, SQLITE_UTF8, cache, + fnct_sp_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_Exit", 0, SQLITE_UTF8, cache, + fnct_sp_exit, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Exit", 0, SQLITE_UTF8, cache, + fnct_sp_exit, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_CreateTables", 0, SQLITE_UTF8, + cache, fnct_sp_create_tables, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Register", 3, SQLITE_UTF8, + cache, fnct_sp_register, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Get", 1, SQLITE_UTF8, cache, + fnct_sp_get, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Delete", 1, SQLITE_UTF8, cache, + fnct_sp_delete, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_UpdateTitle", 2, SQLITE_UTF8, + cache, fnct_sp_update_title, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_UpdateSqlBody", 2, SQLITE_UTF8, + cache, fnct_sp_update_sql, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredVar_Register", 3, SQLITE_UTF8, cache, + fnct_sp_var_register, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredVar_Get", 1, SQLITE_UTF8, cache, + fnct_sp_var_get, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredVar_GetValue", 1, SQLITE_UTF8, cache, + fnct_sp_var_get_value, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredVar_Delete", 1, SQLITE_UTF8, cache, + fnct_sp_var_delete, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredVar_UpdateTitle", 2, SQLITE_UTF8, + cache, fnct_sp_var_update_title, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredVar_UpdateValue", 2, SQLITE_UTF8, + cache, fnct_sp_var_update_value, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 1, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 2, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 3, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 4, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 5, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 6, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 7, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 8, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 9, SQLITE_UTF8, cache, + fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 10, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 11, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 12, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 13, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 14, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 15, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 16, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + sqlite3_create_function_v2 (db, "StoredProc_Execute", 17, SQLITE_UTF8, + cache, fnct_sp_stored_execute, 0, 0, 0); + + sqlite3_create_function_v2 (db, "CreateRoutingNodes", 5, SQLITE_UTF8, + cache, fnct_create_routing_nodes, 0, 0, 0); + sqlite3_create_function_v2 (db, "CreateRouting", 7, SQLITE_UTF8, + cache, fnct_create_routing, 0, 0, 0); + sqlite3_create_function_v2 (db, "CreateRouting", 10, SQLITE_UTF8, + cache, fnct_create_routing, 0, 0, 0); + sqlite3_create_function_v2 (db, "CreateRouting", 12, SQLITE_UTF8, + cache, fnct_create_routing, 0, 0, 0); + sqlite3_create_function_v2 (db, "CreateRouting", 13, SQLITE_UTF8, + cache, fnct_create_routing, 0, 0, 0); + sqlite3_create_function_v2 (db, "CreateRouting_GetLastError", 0, + SQLITE_UTF8, cache, + fnct_create_routing_get_last_error, 0, 0, 0); /* // enabling BlobFromFile, BlobToFile and XB_LoadXML, XB_StoreXML, // ExportDXF and other import/export functions // @@ -39142,10 +44057,13 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_ExportDXF, 0, 0, 0); sqlite3_create_function_v2 (db, "ExportDXF", 10, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_ExportDXF, 0, 0, 0); + +#ifndef OMIT_ICONV /* ICONV is supported */ + sqlite3_create_function_v2 (db, "ImportDBF", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ImportDBF, 0, 0, 0); sqlite3_create_function_v2 (db, "ImportDBF", 4, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, @@ -39205,10 +44123,13 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ExportSHP, 0, 0, 0); sqlite3_create_function_v2 (db, "ExportSHP", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ExportSHP, 0, 0, 0); + +#endif /* ICONV enabled */ + sqlite3_create_function_v2 (db, "ExportKML", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_ExportKML, 0, 0, 0); sqlite3_create_function_v2 (db, "ExportKML", 4, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, @@ -39231,10 +44152,19 @@ sqlite3_create_function_v2 (db, "eval", 1, SQLITE_UTF8, 0, fnct_EvalFunc, 0, 0, 0); sqlite3_create_function_v2 (db, "eval", 2, SQLITE_UTF8, 0, fnct_EvalFunc, 0, 0, 0); + + sqlite3_create_function_v2 (db, "SqlProc_FromFile", 1, SQLITE_UTF8, + cache, fnct_sp_from_file, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_FromFile", 2, SQLITE_UTF8, + cache, fnct_sp_from_file, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_SetLogfile", 1, SQLITE_UTF8, + cache, fnct_sp_set_logfile, 0, 0, 0); + sqlite3_create_function_v2 (db, "SqlProc_SetLogfile", 2, SQLITE_UTF8, + cache, fnct_sp_set_logfile, 0, 0, 0); #ifdef ENABLE_LIBXML2 /* including LIBXML2 */ sqlite3_create_function_v2 (db, "XB_LoadXML", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, @@ -39305,10 +44235,34 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_setDecimalPrecision, 0, 0, 0); sqlite3_create_function_v2 (db, "GetDecimalPrecision", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_getDecimalPrecision, 0, 0, 0); + + sqlite3_create_function_v2 (db, "*Add-Shapefile+Extent", 6, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_addShapefileExtent, 0, 0, 0); + sqlite3_create_function_v2 (db, "*Remove-Shapefile+Extent", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_removeShapefileExtent, 0, 0, 0); + sqlite3_create_function_v2 (db, "GetShapefileExtent", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_getShapefileExtent, 0, 0, 0); + + sqlite3_create_function_v2 (db, "IsLowASCII", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_isLowASCII, 0, 0, 0); + + sqlite3_create_function_v2 (db, "IsTinyPointEnabled", 0, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_isTinyPointEnabled, 0, 0, 0); + sqlite3_create_function_v2 (db, "EnableTinyPoint", 0, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_enableTinyPoint, 0, 0, 0); + sqlite3_create_function_v2 (db, "DisableTinyPoint", 0, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_disableTinyPoint, 0, 0, 0); /* some Geodesic functions */ sqlite3_create_function_v2 (db, "GreatCircleLength", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_GreatCircleLength, 0, 0, 0); @@ -39564,10 +44518,16 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_Transform, 0, 0, 0); sqlite3_create_function_v2 (db, "ST_Transform", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_Transform, 0, 0, 0); + sqlite3_create_function_v2 (db, "TransformXY", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_TransformXY, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_TransformXY", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_TransformXY, 0, 0, 0); #endif /* end including PROJ.4 */ #ifndef OMIT_GEOS /* including GEOS */ @@ -40231,10 +45191,34 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_SelfIntersections, 0, 0, 0); sqlite3_create_function_v2 (db, "ST_3dLength", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_3dLength, 0, 0, 0); + sqlite3_create_function_v2 (db, "GeomFromTWKB", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_FromTWKB, 0, 0, 0); + sqlite3_create_function_v2 (db, "GeomFromTWKB", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_FromTWKB, 0, 0, 0); + sqlite3_create_function_v2 (db, "AsTWKB", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ToTWKB, 0, 0, 0); + sqlite3_create_function_v2 (db, "AsTWKB", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ToTWKB, 0, 0, 0); + sqlite3_create_function_v2 (db, "AsTWKB", 3, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ToTWKB, 0, 0, 0); + sqlite3_create_function_v2 (db, "AsTWKB", 4, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ToTWKB, 0, 0, 0); + sqlite3_create_function_v2 (db, "AsTWKB", 5, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ToTWKB, 0, 0, 0); + sqlite3_create_function_v2 (db, "AsTWKB", 6, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_ToTWKB, 0, 0, 0); #endif /* end RTTOPO support */ sqlite3_create_function_v2 (db, "ST_Cutter", 7, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, @@ -40246,10 +45230,25 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_Cutter, 0, 0, 0); sqlite3_create_function_v2 (db, "GetCutterMessage", 0, SQLITE_UTF8, cache, fnct_GetCutterMessage, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_DrapeLine", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_DrapeLine, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_DrapeLine", 3, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_DrapeLine, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_DrapeLineExceptions", 2, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_DrapeLineExceptions, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_DrapeLineExceptions", 3, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_DrapeLineExceptions, 0, 0, 0); + sqlite3_create_function_v2 (db, "ST_DrapeLineExceptions", 4, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_DrapeLineExceptions, 0, 0, 0); #endif /* end including GEOS */ #ifdef ENABLE_LIBXML2 /* including LIBXML2 */ @@ -40264,14 +45263,52 @@ fnct_CreateStylingTables, 0, 0, 0); sqlite3_create_function (db, "SE_RegisterVectorCoverage", 3, SQLITE_ANY, 0, fnct_RegisterVectorCoverage, 0, 0); sqlite3_create_function (db, "SE_RegisterVectorCoverage", 5, SQLITE_ANY, 0, fnct_RegisterVectorCoverage, 0, 0); + sqlite3_create_function (db, "SE_RegisterVectorCoverage", 7, SQLITE_ANY, 0, + fnct_RegisterVectorCoverage, 0, 0); + sqlite3_create_function (db, "SE_RegisterSpatialViewCoverage", 3, + SQLITE_ANY, 0, fnct_RegisterSpatialViewCoverage, 0, + 0); + sqlite3_create_function (db, "SE_RegisterSpatialViewCoverage", 5, + SQLITE_ANY, 0, fnct_RegisterSpatialViewCoverage, 0, + 0); + sqlite3_create_function (db, "SE_RegisterSpatialViewCoverage", 7, + SQLITE_ANY, 0, fnct_RegisterSpatialViewCoverage, 0, + 0); + sqlite3_create_function (db, "SE_RegisterVirtualShapeCoverage", 3, + SQLITE_ANY, 0, fnct_RegisterVirtualShapeCoverage, + 0, 0); + sqlite3_create_function (db, "SE_RegisterVirtualShapeCoverage", 5, + SQLITE_ANY, 0, fnct_RegisterVirtualShapeCoverage, + 0, 0); + sqlite3_create_function (db, "SE_RegisterVirtualShapeCoverage", 6, + SQLITE_ANY, 0, fnct_RegisterVirtualShapeCoverage, + 0, 0); + sqlite3_create_function (db, "SE_RegisterTopoGeoCoverage", 2, SQLITE_ANY, 0, + fnct_RegisterTopoGeoCoverage, 0, 0); + sqlite3_create_function (db, "SE_RegisterTopoGeoCoverage", 4, SQLITE_ANY, 0, + fnct_RegisterTopoGeoCoverage, 0, 0); + sqlite3_create_function (db, "SE_RegisterTopoGeoCoverage", 6, SQLITE_ANY, 0, + fnct_RegisterTopoGeoCoverage, 0, 0); + sqlite3_create_function (db, "SE_RegisterTopoNetCoverage", 2, SQLITE_ANY, 0, + fnct_RegisterTopoNetCoverage, 0, 0); + sqlite3_create_function (db, "SE_RegisterTopoNetCoverage", 4, SQLITE_ANY, 0, + fnct_RegisterTopoNetCoverage, 0, 0); + sqlite3_create_function (db, "SE_RegisterTopoNetCoverage", 6, SQLITE_ANY, 0, + fnct_RegisterTopoNetCoverage, 0, 0); sqlite3_create_function (db, "SE_UnRegisterVectorCoverage", 1, SQLITE_ANY, 0, fnct_UnregisterVectorCoverage, 0, 0); sqlite3_create_function (db, "SE_SetVectorCoverageInfos", 3, SQLITE_ANY, 0, fnct_SetVectorCoverageInfos, 0, 0); + sqlite3_create_function (db, "SE_SetVectorCoverageInfos", 5, SQLITE_ANY, 0, + fnct_SetVectorCoverageInfos, 0, 0); + sqlite3_create_function (db, "SE_SetVectorCoverageCopyright", 2, SQLITE_ANY, + 0, fnct_SetVectorCoverageCopyright, 0, 0); + sqlite3_create_function (db, "SE_SetVectorCoverageCopyright", 3, SQLITE_ANY, + 0, fnct_SetVectorCoverageCopyright, 0, 0); sqlite3_create_function (db, "SE_RegisterVectorCoverageSrid", 2, SQLITE_ANY, 0, fnct_RegisterVectorCoverageSrid, 0, 0); sqlite3_create_function (db, "SE_UnRegisterVectorCoverageSrid", 2, SQLITE_ANY, 0, fnct_UnregisterVectorCoverageSrid, 0, 0); @@ -40530,13 +45567,19 @@ #ifdef ENABLE_GEOPACKAGE /* enabling GeoPackage extensions */ sqlite3_create_function_v2 (db, "AutoGPKGStart", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_AutoGPKGStart, 0, 0, 0); + sqlite3_create_function_v2 (db, "AutoGPKGStart", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AutoGPKGStart, 0, 0, 0); sqlite3_create_function_v2 (db, "AutoGPKGStop", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, + fnct_AutoGPKGStop, 0, 0, 0); + sqlite3_create_function_v2 (db, "AutoGPKGStop", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, fnct_AutoGPKGStop, 0, 0, 0); /* not yet finalised geopackage raster functions, plus some convenience API */ sqlite3_create_function_v2 (db, "gpkgCreateBaseTables", 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, @@ -40615,10 +45658,13 @@ #ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ if (sqlite3_libversion_number () >= 3008003) { /* only SQLite >= 3.8.3 can suppoty WITH RECURSIVE */ + sqlite3_create_function_v2 (db, "CreateTopoTables", 0, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_CreateTopoTables, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateTopology", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_CreateTopology, 0, 0, 0); sqlite3_create_function_v2 (db, "CreateTopology", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, @@ -40786,17 +45832,17 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_Polygonize, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_Polygonize", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_Polygonize, 0, 0, 0); - sqlite3_create_function_v2 (db, "TopoGeo_TopoSnap", 4, + sqlite3_create_function_v2 (db, "TopoGeo_TopoSnap", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_TopoSnap, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_TopoSnap", 5, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_TopoSnap, 0, 0, 0); - sqlite3_create_function_v2 (db, "TopoGeo_SnappedGeoTable", 7, + sqlite3_create_function_v2 (db, "TopoGeo_SnappedGeoTable", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_SnappedGeoTable, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_SnappedGeoTable", 8, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_SnappedGeoTable, 0, 0, 0); @@ -40804,10 +45850,16 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_ToGeoTable, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_ToGeoTable", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_ToGeoTable, 0, 0, 0); + sqlite3_create_function_v2 (db, "TopoGeo_PolyFacesList", 5, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_TopoGeo_PolyFacesList, 0, 0, 0); + sqlite3_create_function_v2 (db, "TopoGeo_LineEdgesList", 5, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_TopoGeo_LineEdgesList, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_ToGeoTableGeneralize", 6, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_ToGeoTableGeneralize, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_ToGeoTableGeneralize", 7, @@ -40853,10 +45905,14 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_SubdivideLines, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_SubdivideLines", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_SubdivideLines, 0, 0, 0); + sqlite3_create_function_v2 (db, "TopoGeo_DisambiguateSegmentEdges", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_TopoGeo_DisambiguateSegmentEdges, 0, + 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_GetEdgeSeed", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoGeo_GetEdgeSeed, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoGeo_GetFaceSeed", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, @@ -41004,19 +46060,25 @@ SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoNet_ToGeoTableGeneralize, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoNet_Clone", 3, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoNet_Clone, 0, 0, 0); + sqlite3_create_function_v2 (db, "TopoNet_DisambiguateSegmentLinks", 1, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_TopoNet_DisambiguateSegmentLinks, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoNet_GetLinkSeed", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoNet_GetLinkSeed, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoNet_UpdateSeeds", 1, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoNet_UpdateSeeds, 0, 0, 0); sqlite3_create_function_v2 (db, "TopoNet_UpdateSeeds", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, fnct_TopoNet_UpdateSeeds, 0, 0, 0); + sqlite3_create_function_v2 (db, "TopoNet_LineLinksList", 5, + SQLITE_UTF8 | SQLITE_DETERMINISTIC, cache, + fnct_TopoNet_LineLinksList, 0, 0, 0); #endif /* end TOPOLOGY conditionals */ return cache; } @@ -41218,10 +46280,47 @@ free_internal_cache (cache); sqlite3_reset_auto_extension (); } #endif /* not built as loadable-extension only */ + +SPATIALITE_PRIVATE void +spatialite_internal_init (void *handle, const void *p_cache) +{ +/* used only for internal usage */ + sqlite3 *db_handle = (sqlite3 *) handle; + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + if (p_cache == NULL) + { + spatialite_e + ("ERROR unable to initialize the SpatiaLite extension: NULL cache !!!\n"); + return; + } + register_spatialite_sql_functions (db_handle, cache); + init_spatialite_virtualtables (db_handle, p_cache); +/* setting a timeout handler */ + sqlite3_busy_timeout (db_handle, 5000); +} + +SPATIALITE_PRIVATE void +spatialite_internal_cleanup (const void *ptr) +{ + struct splite_internal_cache *cache = (struct splite_internal_cache *) ptr; + + if (cache == NULL) + return; + if (cache->magic1 != SPATIALITE_CACHE_MAGIC1 + || cache->magic2 != SPATIALITE_CACHE_MAGIC2) + return; + +#ifdef ENABLE_RTTOPO + gaiaResetRtTopoMsg (cache); +#endif + + free_internal_cache (cache); +} #ifdef LOADABLE_EXTENSION /* loadable-extension only */ #if !(defined _WIN32) || defined(__MINGW32__) /* MSVC is unable to understand this declaration */ __attribute__ ((visibility ("default"))) Index: src/spatialite/virtualfdo.c ================================================================== --- src/spatialite/virtualfdo.c +++ src/spatialite/virtualfdo.c @@ -107,10 +107,11 @@ /* extends the sqlite3_vtab struct */ const sqlite3_module *pModule; /* ptr to sqlite module: USED INTERNALLY BY SQLITE */ int nRef; /* # references: USED INTERNALLY BY SQLITE */ char *zErrMsg; /* error message: USE INTERNALLY BY SQLITE */ sqlite3 *db; /* the sqlite db holding the virtual table */ + char *db_prefix; /* the prefix identifying the ATTACHED-DB where the table is */ char *table; /* the real-table name */ int nColumns; /* the # columns into the table */ char **Column; /* the name for each column */ char **Type; /* the type for each column */ int *NotNull; /* NotNull clause for each column */ @@ -244,10 +245,12 @@ { /* memory cleanup; freeing the virtual table struct */ int i; if (!p_vt) return; + if (p_vt->db_prefix) + sqlite3_free (p_vt->db_prefix); if (p_vt->table) sqlite3_free (p_vt->table); if (p_vt->Column) { for (i = 0; i < p_vt->nColumns; i++) @@ -869,16 +872,19 @@ gaiaOutBuffer sql_statement; unsigned char *blob_wkb; int size; char *sql; char buf[256]; + char *xprefix; char *xname; gaiaGeomCollPtr geom = NULL; gaiaOutBufferInitialize (&sql_statement); + xprefix = gaiaDoubleQuotedSql (p_vt->db_prefix); xname = gaiaDoubleQuotedSql (p_vt->table); - sql = sqlite3_mprintf ("INSERT INTO \"%s\" ", xname); + sql = sqlite3_mprintf ("INSERT INTO \"%s\".\"%s\" ", xprefix, xname); free (xname); + free (xprefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); for (ic = 0; ic < p_vt->nColumns; ic++) { if (ic == 0) @@ -953,11 +959,12 @@ if (out_buf.Error == 0 && out_buf.Buffer != NULL) { sqlite3_bind_text (stmt, i - 1, out_buf.Buffer, - out_buf.WriteOffset, + out_buf. + WriteOffset, free); out_buf.Buffer = NULL; gaiaOutBufferReset (&out_buf); } else @@ -1112,16 +1119,19 @@ gaiaOutBuffer sql_statement; unsigned char *blob_wkb; int size; char *sql; char buf[256]; + char *xprefix; char *xname; gaiaGeomCollPtr geom = NULL; gaiaOutBufferInitialize (&sql_statement); + xprefix = gaiaDoubleQuotedSql (p_vt->db_prefix); xname = gaiaDoubleQuotedSql (p_vt->table); - sql = sqlite3_mprintf ("UPDATE \"%s\" SET", xname); + sql = sqlite3_mprintf ("UPDATE \"%s\".\"%s\" SET", xprefix, xname); free (xname); + free (xprefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); for (ic = 0; ic < p_vt->nColumns; ic++) { if (ic == 0) @@ -1187,11 +1197,12 @@ if (out_buf.Error == 0 && out_buf.Buffer != NULL) { sqlite3_bind_text (stmt, i - 1, out_buf.Buffer, - out_buf.WriteOffset, + out_buf. + WriteOffset, free); out_buf.Buffer = NULL; gaiaOutBufferReset (&out_buf); } else @@ -1322,16 +1333,20 @@ { /* trying to delete a row from FDO-OGR real-table */ char *sql_statement; char dummy[256]; int ret; + char *xprefix; char *xname; + xprefix = gaiaDoubleQuotedSql (p_vt->db_prefix); xname = gaiaDoubleQuotedSql (p_vt->table); sprintf (dummy, FRMT64, rowid); sql_statement = - sqlite3_mprintf ("DELETE FROM \"%s\" WHERE ROWID = %s", xname, dummy); + sqlite3_mprintf ("DELETE FROM \"%s\".\"%s\" WHERE ROWID = %s", xprefix, + xname, dummy); free (xname); + free (xprefix); ret = sqlite3_exec (p_vt->db, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); return ret; } @@ -1501,25 +1516,24 @@ vfdo_convertWKT3D ((char *) wkt); if (wkt == NULL) { value_set_null (* - (cursor-> - pVtab-> - Value + - ic)); + (cursor->pVtab->Value + + ic)); continue; } delete_wkt = 1; } geom = gaiaParseWkt (wkt, -1); if (delete_wkt) free ((void *) wkt); if (!geom) value_set_null (* - (cursor->pVtab-> - Value + ic)); + (cursor-> + pVtab->Value + + ic)); else { geom->Srid = *(cursor->pVtab->Srid + ig); gaiaToSpatiaLiteBlobWkb (geom, @@ -1526,22 +1540,20 @@ &xblob, &size); if (xblob) { value_set_blob (* - (cursor-> - pVtab-> - Value + - ic), xblob, + (cursor->pVtab->Value + + ic), + xblob, size); free (xblob); } else value_set_null (* - (cursor-> - pVtab-> - Value + ic)); + (cursor->pVtab->Value + + ic)); gaiaFreeGeomColl (geom); } } else value_set_null (* @@ -1558,12 +1570,13 @@ size = sqlite3_column_bytes (stmt, ic + 1); geom = gaiaFromWkb (blob, size); if (!geom) value_set_null (* - (cursor->pVtab-> - Value + ic)); + (cursor-> + pVtab->Value + + ic)); else { geom->Srid = *(cursor->pVtab->Srid + ig); gaiaToSpatiaLiteBlobWkb (geom, @@ -1570,22 +1583,20 @@ &xblob, &size); if (xblob) { value_set_blob (* - (cursor-> - pVtab-> - Value + - ic), xblob, + (cursor->pVtab->Value + + ic), + xblob, size); free (xblob); } else value_set_null (* - (cursor-> - pVtab-> - Value + ic)); + (cursor->pVtab->Value + + ic)); gaiaFreeGeomColl (geom); } } else value_set_null (* @@ -1602,12 +1613,13 @@ size = sqlite3_column_bytes (stmt, ic + 1); geom = gaiaFromFgf (blob, size); if (!geom) value_set_null (* - (cursor->pVtab-> - Value + ic)); + (cursor-> + pVtab->Value + + ic)); else { geom->Srid = *(cursor->pVtab->Srid + ig); gaiaToSpatiaLiteBlobWkb (geom, @@ -1614,22 +1626,20 @@ &xblob, &size); if (xblob) { value_set_blob (* - (cursor-> - pVtab-> - Value + - ic), xblob, + (cursor->pVtab->Value + + ic), + xblob, size); free (xblob); } else value_set_null (* - (cursor-> - pVtab-> - Value + ic)); + (cursor->pVtab->Value + + ic)); gaiaFreeGeomColl (geom); } } else value_set_null (* @@ -1704,10 +1714,11 @@ vfdo_create (sqlite3 * db, void *pAux, int argc, const char *const *argv, sqlite3_vtab ** ppVTab, char **pzErr) { /* creates the virtual table connected to some FDO-OGR table */ char *vtable = NULL; + char *db_prefix = NULL; char *table = NULL; int ret; int i; int len; int n_rows; @@ -1720,10 +1731,11 @@ int srid; int type; char **results; char *sql; char prefix[16]; + char *xdb_prefix; char *xname; gaiaOutBuffer sql_statement; VirtualFDOPtr p_vt = NULL; if (pAux) pAux = pAux; /* unused arg warning suppression */ @@ -1730,23 +1742,33 @@ gaiaOutBufferInitialize (&sql_statement); /* checking for table_name */ if (argc == 4) { vtable = gaiaDequotedSql ((char *) argv[2]); + db_prefix = gaiaDequotedSql ("main"); table = gaiaDequotedSql ((char *) argv[3]); } + else if (argc == 5) + { + vtable = gaiaDequotedSql ((char *) argv[2]); + db_prefix = gaiaDequotedSql ((char *) argv[3]); + table = gaiaDequotedSql ((char *) argv[4]); + } else { *pzErr = sqlite3_mprintf ("[VirtualFDO module] CREATE VIRTUAL: illegal arg list {table_name}\n"); goto error; } /* retrieving the base table columns */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xname = gaiaDoubleQuotedSql (table); - sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", xname); + sql = + sqlite3_mprintf ("PRAGMA \"%s\".table_info(\"%s\")", xdb_prefix, xname); free (xname); + free (xdb_prefix); ret = sqlite3_get_table (db, sql, &results, &n_rows, &n_columns, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) goto illegal; if (n_rows >= 1) @@ -1755,10 +1777,13 @@ if (!p_vt) return SQLITE_NOMEM; p_vt->db = db; p_vt->nRef = 0; p_vt->zErrMsg = NULL; + len = strlen (db_prefix); + p_vt->db_prefix = sqlite3_malloc (len + 1); + strcpy (p_vt->db_prefix, db_prefix); len = strlen (table); p_vt->table = sqlite3_malloc (len + 1); strcpy (p_vt->table, table); p_vt->nColumns = n_rows; p_vt->Column = sqlite3_malloc (sizeof (char *) * n_rows); @@ -1797,14 +1822,16 @@ sqlite3_free_table (results); } else goto illegal; /* retrieving the base table columns */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("SELECT f_geometry_column, geometry_type, srid, " "geometry_format, coord_dimension\n" - "FROM geometry_columns WHERE Upper(f_table_name) = Upper(%Q)", - table); + "FROM \"%s\".geometry_columns WHERE Upper(f_table_name) = Upper(%Q)", + xdb_prefix, table); + free (xdb_prefix); ret = sqlite3_get_table (db, sql, &results, &n_rows, &n_columns, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) goto illegal; if (n_rows >= 1) @@ -1856,13 +1883,15 @@ sqlite3_free_table (results); } else goto illegal; /* preparing the COLUMNs for this VIRTUAL TABLE */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xname = gaiaDoubleQuotedSql (vtable); - sql = sqlite3_mprintf ("CREATE TABLE \"%s\" ", xname); + sql = sqlite3_mprintf ("CREATE TABLE \"%s\".\"%s\" ", xdb_prefix, xname); free (xname); + free (xdb_prefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); for (i = 0; i < p_vt->nColumns; i++) { if (i == 0) @@ -1896,10 +1925,11 @@ } else goto error; *ppVTab = (sqlite3_vtab *) p_vt; free (vtable); + free (db_prefix); free (table); return SQLITE_OK; illegal: /* something is going the wrong way */ gaiaOutBufferReset (&sql_statement); @@ -1910,10 +1940,12 @@ ("[VirtualFDO module] '%s' isn't a valid FDO-OGR Geometry table\n", table); error: if (vtable) free (vtable); + if (db_prefix) + free (db_prefix); if (table) free (table); gaiaOutBufferReset (&sql_statement); return SQLITE_ERROR; } @@ -1958,10 +1990,11 @@ sqlite3_stmt *stmt = NULL; gaiaOutBuffer sql_statement; int ret; char *sql; int ic; + char *xprefix; char *xname; VirtualFDOCursorPtr cursor = (VirtualFDOCursorPtr) sqlite3_malloc (sizeof (VirtualFDOCursor)); if (cursor == NULL) return SQLITE_ERROR; @@ -1975,13 +2008,15 @@ sql = sqlite3_mprintf (",\"%s\"", xname); free (xname); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); } + xprefix = gaiaDoubleQuotedSql (cursor->pVtab->db_prefix); xname = gaiaDoubleQuotedSql (cursor->pVtab->table); sql = sqlite3_mprintf (" FROM \"%s\" WHERE ROWID >= ?", xname); free (xname); + free (xprefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); if (sql_statement.Error == 0 && sql_statement.Buffer != NULL) ret = sqlite3_prepare_v2 (cursor->pVtab->db, sql_statement.Buffer, Index: src/spatialite/virtualgpkg.c ================================================================== --- src/spatialite/virtualgpkg.c +++ src/spatialite/virtualgpkg.c @@ -96,10 +96,11 @@ /* extends the sqlite3_vtab struct */ const sqlite3_module *pModule; /* ptr to sqlite module: USED INTERNALLY BY SQLITE */ int nRef; /* # references: USED INTERNALLY BY SQLITE */ char *zErrMsg; /* error message: USE INTERNALLY BY SQLITE */ sqlite3 *db; /* the sqlite db holding the virtual table */ + char *db_prefix; /* the prefix identifying the ATTACHED-DB where the table is */ char *table; /* the real-table name */ int nColumns; /* the # columns into the table */ char **Column; /* the name for each column */ char **Type; /* the type for each column */ int *NotNull; /* NotNull clause for each column */ @@ -296,15 +297,18 @@ const unsigned char *blob; gaiaOutBuffer sql_statement; int size; char *sql; char buf[256]; + char *xprefix; char *xname; gaiaOutBufferInitialize (&sql_statement); + xprefix = gaiaDoubleQuotedSql (p_vt->db_prefix); xname = gaiaDoubleQuotedSql (p_vt->table); - sql = sqlite3_mprintf ("INSERT INTO \"%s\" ", xname); + sql = sqlite3_mprintf ("INSERT INTO \"%s\".\"%s\" ", xprefix, xname); free (xname); + free (xprefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); for (ic = 0; ic < p_vt->nColumns; ic++) { if (ic == 0) @@ -393,15 +397,18 @@ const unsigned char *blob; gaiaOutBuffer sql_statement; int size; char *sql; char buf[256]; + char *xprefix; char *xname; gaiaOutBufferInitialize (&sql_statement); + xprefix = gaiaDoubleQuotedSql (p_vt->db_prefix); xname = gaiaDoubleQuotedSql (p_vt->table); - sql = sqlite3_mprintf ("UPDATE \"%s\" SET", xname); + sql = sqlite3_mprintf ("UPDATE \"%s\".\"%s\" SET", xprefix, xname); free (xname); + free (xprefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); for (ic = 0; ic < p_vt->nColumns; ic++) { if (ic == 0) @@ -475,16 +482,19 @@ { /* trying to delete a row from GPKG real-table */ char *sql_statement; char dummy[256]; int ret; + char *xprefix; char *xname; + xprefix = gaiaDoubleQuotedSql (p_vt->db_prefix); xname = gaiaDoubleQuotedSql (p_vt->table); sprintf (dummy, FRMT64, rowid); sql_statement = sqlite3_mprintf ("DELETE FROM \"%s\" WHERE ROWID = %s", xname, dummy); free (xname); + free (xprefix); ret = sqlite3_exec (p_vt->db, sql_statement, NULL, NULL, NULL); sqlite3_free (sql_statement); return ret; } @@ -493,10 +503,12 @@ { /* memory cleanup; freeing the virtual table struct */ int i; if (!p_vt) return; + if (p_vt->db_prefix) + sqlite3_free (p_vt->db_prefix); if (p_vt->table) sqlite3_free (p_vt->table); if (p_vt->Column) { for (i = 0; i < p_vt->nColumns; i++) @@ -535,10 +547,11 @@ vgpkg_create (sqlite3 * db, void *pAux, int argc, const char *const *argv, sqlite3_vtab ** ppVTab, char **pzErr) { /* creates the virtual table connected to some GPKG table */ char *vtable = NULL; + char *db_prefix = NULL; char *table = NULL; int ret; int i; int len; int n_rows; @@ -550,10 +563,11 @@ int has_z; int has_m; char **results; char *sql; char prefix[16]; + char *xdb_prefix; char *xname; gaiaOutBuffer sql_statement; VirtualGPKGPtr p_vt = NULL; if (pAux) pAux = pAux; /* unused arg warning suppression */ @@ -560,23 +574,33 @@ gaiaOutBufferInitialize (&sql_statement); /* checking for table_name */ if (argc == 4) { vtable = gaiaDequotedSql ((char *) argv[2]); + db_prefix = gaiaDequotedSql ("main"); table = gaiaDequotedSql ((char *) argv[3]); } + else if (argc == 5) + { + vtable = gaiaDequotedSql ((char *) argv[2]); + db_prefix = gaiaDequotedSql ((char *) argv[3]); + table = gaiaDequotedSql ((char *) argv[4]); + } else { *pzErr = sqlite3_mprintf ("[VirtualGPKG module] CREATE VIRTUAL: illegal arg list {table_name}\n"); goto error; } /* retrieving the base table columns */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xname = gaiaDoubleQuotedSql (table); - sql = sqlite3_mprintf ("PRAGMA table_info(\"%s\")", xname); + sql = + sqlite3_mprintf ("PRAGMA \"%s\".table_info(\"%s\")", xdb_prefix, xname); free (xname); + free (xdb_prefix); ret = sqlite3_get_table (db, sql, &results, &n_rows, &n_columns, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) goto illegal; if (n_rows >= 1) @@ -585,10 +609,13 @@ if (!p_vt) return SQLITE_NOMEM; p_vt->db = db; p_vt->nRef = 0; p_vt->zErrMsg = NULL; + len = strlen (db_prefix); + p_vt->db_prefix = sqlite3_malloc (len + 1); + strcpy (p_vt->db_prefix, db_prefix); len = strlen (table); p_vt->table = sqlite3_malloc (len + 1); strcpy (p_vt->table, table); p_vt->nColumns = n_rows; p_vt->Column = sqlite3_malloc (sizeof (char *) * n_rows); @@ -624,15 +651,17 @@ sqlite3_free_table (results); } else goto illegal; /* retrieving the base table columns */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); sql = sqlite3_mprintf ("SELECT column_name, geometry_type_name, srs_id, z, m\n" - "FROM gpkg_geometry_columns WHERE Upper(table_name) = Upper(%Q)", - table); + "FROM \"%s\".gpkg_geometry_columns WHERE Upper(table_name) = Upper(%Q)", + xdb_prefix, table); + free (xdb_prefix); ret = sqlite3_get_table (db, sql, &results, &n_rows, &n_columns, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) goto illegal; if (n_rows >= 1) @@ -725,13 +754,15 @@ sqlite3_free_table (results); } else goto illegal; /* preparing the COLUMNs for this VIRTUAL TABLE */ + xdb_prefix = gaiaDoubleQuotedSql (db_prefix); xname = gaiaDoubleQuotedSql (vtable); - sql = sqlite3_mprintf ("CREATE TABLE \"%s\" ", xname); + sql = sqlite3_mprintf ("CREATE TABLE \"%s\".\"%s\" ", xdb_prefix, xname); free (xname); + free (xdb_prefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); for (i = 0; i < p_vt->nColumns; i++) { if (i == 0) @@ -765,10 +796,11 @@ } else goto error; *ppVTab = (sqlite3_vtab *) p_vt; free (vtable); + free (db_prefix); free (table); return SQLITE_OK; illegal: /* something is going the wrong way */ gaiaOutBufferReset (&sql_statement); @@ -779,10 +811,12 @@ ("[VirtualGPKG module] '%s' isn't a valid GPKG Geometry table\n", table); error: if (vtable) free (vtable); + if (db_prefix) + free (db_prefix); if (table) free (table); gaiaOutBufferReset (&sql_statement); return SQLITE_ERROR; } @@ -827,10 +861,11 @@ sqlite3_stmt *stmt; gaiaOutBuffer sql_statement; int ret; char *sql; int ic; + char *xprefix; char *xname; VirtualGPKGCursorPtr cursor = (VirtualGPKGCursorPtr) sqlite3_malloc (sizeof (VirtualGPKGCursor)); if (cursor == NULL) return SQLITE_ERROR; @@ -851,13 +886,15 @@ sql = sqlite3_mprintf (",\"%s\"", xname); free (xname); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); } + xprefix = gaiaDoubleQuotedSql (cursor->pVtab->db_prefix); xname = gaiaDoubleQuotedSql (cursor->pVtab->table); sql = sqlite3_mprintf (" FROM \"%s\" WHERE ROWID >= ?", xname); free (xname); + free (xprefix); gaiaAppendToOutBuffer (&sql_statement, sql); sqlite3_free (sql); if (sql_statement.Error == 0 && sql_statement.Buffer != NULL) ret = sqlite3_prepare_v2 (cursor->pVtab->db, sql_statement.Buffer, Index: src/spatialite/virtualknn.c ================================================================== --- src/spatialite/virtualknn.c +++ src/spatialite/virtualknn.c @@ -83,42 +83,32 @@ unknown in this case); so it should be dynamically built by repeatedly querying the R*Tree until a satisfying solution is found. step #1 ------- -we'll descend the Tree by exploring a Level at each time; all nodes -presenting a BBOX overlapping the reference geometry should be inserted -into a list for future use, but this isn't enough because the -reference geometry in some cases couldn't intersect any upper-level -BBOX (think of some position into the middle of a desert or ocean). -so we should alway insert into each level list two extra-bboxes -corresponding to the first and second (not overlapping) nearest to -the reference geometry. +we'll descend the Tree by exploring a Level at each time so to +identify the lower-level BBOX containing the reference Geometry. +if no BBOX directly contains the reference Geometry then the +nearest one will be identified. step #2 ------- -when descending to a child level all parent BBOXes found in the -previous step should be expanded (the saved list of the parent -level will be applied). +the reference Geometry will now be buffered so to completely +cover the BBOX identified in the previous step. step #3 ------- -when arriving to the lowermost level (0 = Level) the distance of -each candidate feature will be computed; the nearest ones will be -saved into the results list. +an ordinary Spatial Index query will be now performed, using +the buffered Geometry as the search frame, so to identify +all nearest features. step #4 ------- -we've not yet finished; more features potentially satisfying the -KNN query could probably be stored in some Tree branch we've not -yet visited (R*Trees can very often present unexpected layouts). -so we'll now expand the reference BBOX so to cover all features -identified since now, and we'll repeat the cycle by returning to -step #1. -when a full cycle ends without identifying ant more result feature -satisfying the KNN query we can stop walking the R*Tree; we are -finally ready to return a KNN resultset. +if the total number of nearest features identified by the +previous query is less than requested, then the buffer +radius will be repeatedly expanded until all requested +nearest features will be found. */ #include #include @@ -152,70 +142,52 @@ / / VirtualTable structs / ******************************************************************************/ -typedef struct VKnnBBoxStruct -{ -/* a BBOX into an RTree level */ - double minx; - double maxx; - double miny; - double maxy; - int visited; - struct VKnnBBoxStruct *next; -} VKnnBBox; -typedef VKnnBBox *VKnnBBoxPtr; - -typedef struct VKnnLevelStruct -{ -/* an RTree level */ - int level; - VKnnBBoxPtr first; - VKnnBBoxPtr last; - VKnnBBox nearest_1; - double min_dist_1; - VKnnBBox nearest_2; - double min_dist_2; - int nearest_done; - struct VKnnLevelStruct *next; -} VKnnLevel; -typedef VKnnLevel *VKnnLevelPtr; - typedef struct VKnnItemStruct { /* a Feature item into the KNN sorted array */ sqlite3_int64 rowid; double dist; - double minx; - double maxx; - double miny; - double maxy; } VKnnItem; typedef VKnnItem *VKnnItemPtr; typedef struct VKnnContextStruct { /* current KNN context */ char *table_name; char *column_name; - double minx; - double maxx; - double miny; - double maxy; unsigned char *blob; int blob_size; sqlite3_stmt *stmt_dist; - sqlite3_stmt *stmt_rect; + sqlite3_stmt *stmt_map_dist; + sqlite3_stmt *stmt_rect_dist; + sqlite3_stmt *stmt_pt_dist; + sqlite3_stmt *stmt_buffer; + sqlite3_stmt *stmt_rtree; + sqlite3_stmt *stmt_rtree_count; + double bbox_minx; + double bbox_miny; + double bbox_maxx; + double bbox_maxy; + double minx; + double miny; + double maxx; + double maxy; + double min_dist; + double rtree_minx; + double rtree_miny; + double rtree_maxx; + double rtree_maxy; + int level; + int current_level; VKnnItemPtr knn_array; int max_items; double max_dist; int curr_items; - VKnnLevelPtr first; - VKnnLevelPtr last; - int max_level; - int changed; + int rtree_count; } VKnnContext; typedef VKnnContext *VKnnContextPtr; typedef struct VirtualKnnStruct { @@ -235,255 +207,46 @@ int eof; /* the EOF marker */ int CurrentIndex; /* index of the current KNN item */ } VirtualKnnCursor; typedef VirtualKnnCursor *VirtualKnnCursorPtr; -static void -vknn_add_bbox (VKnnLevelPtr pL, double minx, double miny, double maxx, - double maxy) -{ -/* inserting an RTree BBOX into the list */ - VKnnBBoxPtr pR = malloc (sizeof (VKnnBBox)); - pR->minx = minx; - pR->miny = miny; - pR->maxx = maxx; - pR->maxy = maxy; - pR->visited = 0; - pR->next = NULL; - if (pL->first == NULL) - pL->first = pR; - if (pL->last != NULL) - pL->last->next = pR; - pL->last = pR; -} - -static int -vknn_add_nearest_bbox (VKnnLevelPtr pL, double minx, double miny, double maxx, - double maxy, double dist) -{ -/* attempting to insert a nearest RTree BBOX into the list */ - if (pL->nearest_1.minx == minx && pL->nearest_1.miny == miny - && pL->nearest_1.maxx == maxx && pL->nearest_1.maxy == maxy) - return 0; - if (dist < pL->min_dist_1) - { - pL->min_dist_1 = dist; - pL->nearest_1.minx = minx; - pL->nearest_1.miny = miny; - pL->nearest_1.maxx = maxx; - pL->nearest_1.maxy = maxy; - return 1; - } - if (pL->nearest_1.minx == minx && pL->nearest_1.miny == miny - && pL->nearest_1.maxx == maxx && pL->nearest_1.maxy == maxy) - return 0; - if (dist < pL->min_dist_2) - { - pL->min_dist_2 = dist; - pL->nearest_2.minx = minx; - pL->nearest_2.miny = miny; - pL->nearest_2.maxx = maxx; - pL->nearest_2.maxy = maxy; - return 1; - } - return 0; -} - -static void -vknn_flush_bboxes (VKnnLevelPtr pL) -{ -/* destroying the RTree BBoxes list */ - VKnnBBoxPtr pBn; - VKnnBBoxPtr pB = pL->first; - while (pB != NULL) - { - pBn = pB->next; - free (pB); - pB = pBn; - } - pL->first = NULL; - pL->last = NULL; -} - -static VKnnLevelPtr -vknn_nearest_find (VKnnContextPtr ctx, int level) -{ -/* handling RTree Levels */ - VKnnLevelPtr pL = ctx->first; - while (pL != NULL) - { - if (pL->level == level && pL->nearest_done == 0) - { - /* ok, found */ - return pL; - } - pL = pL->next; - } - return NULL; -} - -static int -vknn_recover_nearest (VKnnContextPtr ctx) -{ -/* recovering the nearest BBOXes */ - VKnnLevelPtr pL = NULL; - int lev; - - pL = vknn_nearest_find (ctx, 0); - if (pL != NULL) - return 0; - - for (lev = ctx->max_level; lev > 0; lev--) - { - pL = vknn_nearest_find (ctx, lev); - if (pL != NULL) - break; - } - if (pL == NULL) - return 0; - - if (pL->min_dist_1 != DBL_MAX) - vknn_add_bbox (pL, pL->nearest_1.minx, pL->nearest_1.miny, - pL->nearest_1.maxx, pL->nearest_1.maxy); - if (pL->min_dist_2 != DBL_MAX) - vknn_add_bbox (pL, pL->nearest_2.minx, pL->nearest_2.miny, - pL->nearest_2.maxx, pL->nearest_2.maxy); - pL->nearest_done = 1; - return 1; -} - -static VKnnLevelPtr -vknn_add_level (VKnnContextPtr ctx, int level) -{ -/* inserting an RTree Level into the list */ - VKnnLevelPtr pL = malloc (sizeof (VKnnLevel)); - pL->level = level; - pL->first = NULL; - pL->last = NULL; - pL->nearest_1.minx = DBL_MAX; - pL->nearest_1.miny = DBL_MAX; - pL->nearest_1.maxx = -DBL_MAX; - pL->nearest_1.maxy = -DBL_MAX; - pL->min_dist_1 = DBL_MAX; - pL->nearest_2.minx = DBL_MAX; - pL->nearest_2.miny = DBL_MAX; - pL->nearest_2.maxx = -DBL_MAX; - pL->nearest_2.maxy = -DBL_MAX; - pL->min_dist_2 = DBL_MAX; - pL->nearest_done = 0; - pL->next = NULL; - if (ctx->first == NULL) - ctx->first = pL; - if (ctx->last != NULL) - ctx->last->next = pL; - ctx->last = pL; - return pL; -} - -static void -vknn_flush_levels (VKnnContextPtr ctx) -{ -/* destroying the RTree Levels list */ - VKnnLevelPtr pLn; - VKnnLevelPtr pL = ctx->first; - while (pL != NULL) - { - pLn = pL->next; - vknn_flush_bboxes (pL); - free(pL); - pL = pLn; - } - ctx->first = NULL; - ctx->last = NULL; -} - -static VKnnLevelPtr -vknn_find_level (VKnnContextPtr ctx, int level) -{ -/* handling RTree Levels */ - VKnnLevelPtr pL = ctx->first; - while (pL != NULL) - { - if (pL->level == level) - { - /* already defined */ - return pL; - } - pL = pL->next; - } -/* adding a new RTree Level */ - pL = vknn_add_level (ctx, level); - return pL; -} - -static VKnnBBoxPtr -vknn_find_bbox (VKnnLevelPtr pL, double minx, double miny, double maxx, - double maxy) -{ -/* searching an RTree BBox */ - VKnnBBoxPtr pB = pL->first; - while (pB != NULL) - { - if (pB->minx == minx && pB->miny == miny && pB->maxx == maxx - && pB->maxy == maxy) - return pB; - pB = pB->next; - } - return NULL; -} - -static int -vknn_expand_bbox (VKnnContextPtr ctx) -{ -/* attempting to expand the KNN BBOX */ - int i; - double old_minx = ctx->minx; - double old_miny = ctx->miny; - double old_maxx = ctx->maxx; - double old_maxy = ctx->maxy; - for (i = 0; i < ctx->curr_items; i++) - { - VKnnItemPtr item = ctx->knn_array + i; - if (item->minx < ctx->minx) - ctx->minx = item->minx; - if (item->miny < ctx->miny) - ctx->miny = item->miny; - if (item->maxx > ctx->maxx) - ctx->maxx = item->maxx; - if (item->maxy > ctx->maxy) - ctx->maxy = item->maxy; - } - if (ctx->minx == old_minx && ctx->miny == old_miny && ctx->maxx == old_maxx - && ctx->maxy == old_maxy) - return 0; - return 1; -} - static void vknn_empty_context (VKnnContextPtr ctx) { /* setting an empty KNN context */ if (ctx == NULL) return; ctx->table_name = NULL; ctx->column_name = NULL; - ctx->minx = DBL_MAX; - ctx->maxx = -DBL_MAX; - ctx->miny = DBL_MAX; - ctx->maxy = -DBL_MAX; ctx->blob = NULL; ctx->blob_size = 0; - ctx->max_items = 0; ctx->stmt_dist = NULL; - ctx->stmt_rect = NULL; + ctx->stmt_map_dist = NULL; + ctx->stmt_rect_dist = NULL; + ctx->stmt_pt_dist = NULL; + ctx->stmt_buffer = NULL; + ctx->stmt_rtree = NULL; + ctx->stmt_rtree_count = NULL; + ctx->bbox_minx = -DBL_MAX; + ctx->bbox_miny = -DBL_MAX; + ctx->bbox_maxx = DBL_MAX; + ctx->bbox_maxy = DBL_MAX; + ctx->minx = DBL_MAX; + ctx->miny = DBL_MAX; + ctx->maxx = -DBL_MAX; + ctx->maxy = -DBL_MAX; + ctx->min_dist = DBL_MAX; + ctx->rtree_minx = -DBL_MAX; + ctx->rtree_miny = -DBL_MAX; + ctx->rtree_maxx = DBL_MAX; + ctx->rtree_maxy = DBL_MAX; + ctx->current_level = 0; + ctx->max_items = 0; ctx->knn_array = NULL; - ctx->max_dist = -DBL_MAX; ctx->curr_items = 0; - ctx->first = NULL; - ctx->last = NULL; - ctx->max_level = 0; - ctx->changed = 0; + ctx->rtree_count = 0; + ctx->max_dist = -DBL_MAX; } static VKnnContextPtr vknn_create_context (void) { @@ -505,22 +268,67 @@ free (ctx->column_name); if (ctx->blob != NULL) free (ctx->blob); if (ctx->stmt_dist != NULL) sqlite3_finalize (ctx->stmt_dist); - if (ctx->stmt_rect != NULL) - sqlite3_finalize (ctx->stmt_rect); + if (ctx->stmt_map_dist != NULL) + sqlite3_finalize (ctx->stmt_map_dist); + if (ctx->stmt_rect_dist != NULL) + sqlite3_finalize (ctx->stmt_rect_dist); + if (ctx->stmt_pt_dist != NULL) + sqlite3_finalize (ctx->stmt_pt_dist); + if (ctx->stmt_buffer != NULL) + sqlite3_finalize (ctx->stmt_buffer); + if (ctx->stmt_rtree != NULL) + sqlite3_finalize (ctx->stmt_rtree); + if (ctx->stmt_rtree_count != NULL) + sqlite3_finalize (ctx->stmt_rtree_count); if (ctx->knn_array != NULL) free (ctx->knn_array); - vknn_flush_levels (ctx); vknn_empty_context (ctx); } + +static void +vknn_rtree_count (VKnnContextPtr ctx) +{ +/* approximatively counting how many entries are into the R*Tree */ + int ret; + sqlite3_stmt *stmt; + + + ctx->rtree_count = 0; + if (ctx == NULL) + return; + stmt = ctx->stmt_rtree_count; + if (stmt == NULL) + return; + sqlite3_reset (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) + { + ctx->rtree_count += 1; + } + else + { + ctx->rtree_count = 0; + break; + } + } +} static void vknn_init_context (VKnnContextPtr ctx, const char *table, const char *column, gaiaGeomCollPtr geom, int max_items, - sqlite3_stmt * stmt_dist, sqlite3_stmt * stmt_rect) + sqlite3_stmt * stmt_dist, sqlite3_stmt * stmt_map_dist, + sqlite3_stmt * stmt_rect_dist, sqlite3_stmt * stmt_pt_dist, + sqlite3_stmt * stmt_buffer, sqlite3_stmt * stmt_rtree, + sqlite3_stmt * stmt_rtree_count) { /* initializing a KNN context */ int i; if (ctx == NULL) return; @@ -529,36 +337,29 @@ ctx->table_name = malloc (i + 1); strcpy (ctx->table_name, table); i = strlen (column); ctx->column_name = malloc (i + 1); strcpy (ctx->column_name, column); - ctx->minx = geom->MinX; - ctx->maxx = geom->MaxX; - ctx->miny = geom->MinY; - ctx->maxy = geom->MaxY; gaiaToSpatiaLiteBlobWkb (geom, &(ctx->blob), &(ctx->blob_size)); - ctx->max_items = max_items; ctx->stmt_dist = stmt_dist; - ctx->stmt_rect = stmt_rect; + ctx->stmt_map_dist = stmt_map_dist; + ctx->stmt_rect_dist = stmt_rect_dist; + ctx->stmt_pt_dist = stmt_pt_dist; + ctx->stmt_buffer = stmt_buffer; + ctx->stmt_rtree = stmt_rtree; + ctx->stmt_rtree_count = stmt_rtree_count; + ctx->max_items = max_items; ctx->knn_array = malloc (sizeof (VKnnItem) * max_items); for (i = 0; i < max_items; i++) { /* initializing the KNN sorted array */ VKnnItemPtr item = ctx->knn_array + i; item->rowid = 0; - item->minx = DBL_MAX; - item->miny = DBL_MAX; - item->maxx = -DBL_MAX; - item->maxy = -DBL_MAX; item->dist = DBL_MAX; } - ctx->max_dist = -DBL_MAX; ctx->curr_items = 0; - ctx->first = NULL; - ctx->last = NULL; - ctx->max_level = 0; - ctx->changed = 0; + vknn_rtree_count (ctx); } static void vknn_free_context (void *p) { @@ -566,258 +367,10 @@ VKnnContextPtr ctx = (VKnnContextPtr) p; vknn_reset_context (ctx); free (ctx); } -static void -vknn_shift_items (VKnnContextPtr ctx, int index) -{ -/* shifting down the Features sorted array */ - int i; - for (i = ctx->max_items - 1; i > index; i--) - { - VKnnItemPtr item1 = ctx->knn_array + i - 1; - VKnnItemPtr item2 = ctx->knn_array + i; - item2->rowid = item1->rowid; - item2->dist = item1->dist; - item2->minx = item1->minx; - item2->miny = item1->miny; - item2->maxx = item1->maxx; - item2->maxy = item1->maxy; - if ((i == ctx->max_items - 1) && item2->dist != DBL_MAX) - ctx->max_dist = item2->dist; - } -} - -static void -vknn_update_items (VKnnContextPtr ctx, sqlite3_int64 rowid, double dist, - double rtree_minx, double rtree_miny, double rtree_maxx, - double rtree_maxy) -{ -/* updating the Features sorted array */ - int i; - if (ctx->curr_items == ctx->max_items) - { - if (dist >= ctx->max_dist) - return; - } - for (i = 0; i < ctx->max_items; i++) - { - VKnnItemPtr item = ctx->knn_array + i; - if (rowid == item->rowid) - return; - if (dist < item->dist) - { - vknn_shift_items (ctx, i); - item->rowid = rowid; - item->dist = dist; - item->minx = rtree_minx; - item->miny = rtree_miny; - item->maxx = rtree_maxx; - item->maxy = rtree_maxy; - ctx->changed = 1; - break; - } - } - if (dist > ctx->max_dist) - ctx->max_dist = dist; - if (ctx->curr_items < ctx->max_items) - ctx->curr_items += 1; -} - -static int -vknn_check_mbr (VKnnContextPtr ctx, double rtree_minx, double rtree_miny, - double rtree_maxx, double rtree_maxy) -{ -/* comparing two MBRs */ - if (rtree_minx >= ctx->minx && rtree_maxx <= ctx->maxx - && rtree_miny >= ctx->miny && rtree_maxy <= ctx->maxy) - return FULLY_WITHIN; - if (rtree_maxx < ctx->minx) - return NOT_WITHIN; - if (rtree_minx > ctx->maxx) - return NOT_WITHIN; - if (rtree_maxy < ctx->miny) - return NOT_WITHIN; - if (rtree_miny > ctx->maxy) - return NOT_WITHIN; - return PARTLY_WITHIN; -} - -static double -vknn_compute_distance (VKnnContextPtr ctx, sqlite3_int64 rowid) -{ -/* computing the distance between two geometries (in meters) */ - double dist = DBL_MAX; - int ret; - sqlite3_stmt *stmt; - if (ctx == NULL) - return DBL_MAX; - if (ctx->blob == NULL) - return DBL_MAX; - if (ctx->stmt_dist == NULL) - return DBL_MAX; - stmt = ctx->stmt_dist; - sqlite3_reset (stmt); - sqlite3_clear_bindings (stmt); - sqlite3_bind_blob (stmt, 1, ctx->blob, ctx->blob_size, SQLITE_STATIC); - sqlite3_bind_int64 (stmt, 2, rowid); - 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 (sqlite3_column_type (stmt, 0) == SQLITE_FLOAT) - dist = sqlite3_column_double (stmt, 0); - } - else - { - dist = DBL_MAX; - break; - } - } - return dist; -} - -static double -vknn_rect_distance (VKnnContextPtr ctx, double minx, double miny, double maxx, - double maxy) -{ -/* computing the distance between the geometry and an R*Tree BBOX */ - double dist = DBL_MAX; - int ret; - sqlite3_stmt *stmt; - if (ctx == NULL) - return DBL_MAX; - if (ctx->blob == NULL) - return DBL_MAX; - if (ctx->stmt_rect == NULL) - return DBL_MAX; - stmt = ctx->stmt_rect; - sqlite3_reset (stmt); - sqlite3_clear_bindings (stmt); - sqlite3_bind_blob (stmt, 1, ctx->blob, ctx->blob_size, SQLITE_STATIC); - sqlite3_bind_double (stmt, 2, minx); - sqlite3_bind_double (stmt, 3, miny); - sqlite3_bind_double (stmt, 4, maxx); - sqlite3_bind_double (stmt, 5, maxy); - 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 (sqlite3_column_type (stmt, 0) == SQLITE_FLOAT) - dist = sqlite3_column_double (stmt, 0); - } - else - { - dist = DBL_MAX; - break; - } - } - return dist; -} - -int -vknn_query_callback (sqlite3_rtree_query_info * info) -{ -/* R*Tree Query Callback function */ - double rtree_minx; - double rtree_maxx; - double rtree_miny; - double rtree_maxy; - VKnnLevelPtr pL; - VKnnBBoxPtr pB; - VKnnContextPtr ctx = (VKnnContextPtr) (info->pContext); - if (info->nCoord != 4) - { - /* invalid RTree */ - info->eWithin = NOT_WITHIN; - return SQLITE_OK; - } - -/* fetching the node's BBOX */ - rtree_minx = info->aCoord[0]; - rtree_maxx = info->aCoord[1]; - rtree_miny = info->aCoord[2]; - rtree_maxy = info->aCoord[3]; - - if (info->iLevel > ctx->max_level) - ctx->max_level = info->iLevel; - - if (info->iLevel == 0 && info->iRowid > 0) - { - /* found a terminal leaf RTree entry - evaluating the relative distance */ - double dist = vknn_compute_distance (ctx, info->iRowid); - vknn_update_items (ctx, info->iRowid, dist, rtree_minx, rtree_miny, - rtree_maxx, rtree_maxy); - info->eWithin = NOT_WITHIN; /* not to be further expanded */ - return SQLITE_OK; - } - -/* handling RTree upper levels */ - pL = vknn_find_level (ctx, info->iLevel); - pB = vknn_find_bbox (pL, rtree_minx, rtree_miny, rtree_maxx, rtree_maxy); - - if (pB == NULL) - { - /* this BBOX Node was never visited until now */ - int mode = vknn_check_mbr (ctx, rtree_minx, rtree_miny, rtree_maxx, - rtree_maxy); - if (mode == FULLY_WITHIN || mode == PARTLY_WITHIN) - { - /* overlaps the currenct reference frame; to be further expanded */ - vknn_add_bbox (pL, rtree_minx, rtree_miny, rtree_maxx, - rtree_maxy); - ctx->changed = 1; - } - else - { - /* searching any BBOX nearest to the current reference frame */ - double dist = - vknn_rect_distance (ctx, rtree_minx, rtree_miny, rtree_maxx, - rtree_maxy); - if (vknn_add_nearest_bbox - (pL, rtree_minx, rtree_miny, rtree_maxx, rtree_maxy, dist)) - ctx->changed = 1; - } - info->eWithin = NOT_WITHIN; - } - else - { - /* handling a BBOX node already inserted into the list */ - if (pL->level == 1) - { - /* - * this is the Tree Level immediately preceding Terminal Nodes - * (aka Leaves): i.e. it's the direct parent of candidate - * features to be evaluated by the KNN search - */ - if (pB->visited != 0) - info->eWithin = NOT_WITHIN; /* ignoring - already visited */ - else - { - /* to be further expanded so to get all Leave Children */ - pB->visited = 1; - info->eWithin = FULLY_WITHIN; - } - } - else - { - /* unconditionally expanding higher level parent nodes */ - info->eWithin = FULLY_WITHIN; - } - } - return SQLITE_OK; -} - static int vknn_check_view_rtree (sqlite3 * sqlite, const char *table_name, const char *geom_column, char **real_table, char **real_geom, int *is_geographic) { @@ -925,11 +478,11 @@ if (db_prefix == NULL) { sql_statement = sqlite3_mprintf ("SELECT f_table_name, f_geometry_column, SridIsGeographic(srid) " - "FROM geometry_columns WHERE Upper(f_table_name) = Upper(%Q) AND " + "FROM main.geometry_columns WHERE Upper(f_table_name) = Upper(%Q) AND " "Upper(f_geometry_column) = Upper(%Q) AND spatial_index_enabled = 1", table_name, geom_column); } else { @@ -1000,12 +553,13 @@ int is_longlat = 0; /* testing if views_geometry_columns exists */ if (db_prefix == NULL) { - sql_statement = sqlite3_mprintf ("SELECT tbl_name FROM sqlite_master " - "WHERE type = 'table' AND tbl_name = 'views_geometry_columns'"); + sql_statement = + sqlite3_mprintf ("SELECT tbl_name FROM main.sqlite_master " + "WHERE type = 'table' AND tbl_name = 'views_geometry_columns'"); } else { char *quoted_db = gaiaDoubleQuotedSql (db_prefix); sql_statement = @@ -1038,12 +592,12 @@ if (db_prefix == NULL) { sql_statement = sqlite3_mprintf ("SELECT a.f_table_name, a.f_geometry_column, SridIsGeographic(b.srid) " - "FROM views_geometry_columns AS a " - "JOIN geometry_columns AS b ON (" + "FROM main.views_geometry_columns AS a " + "JOIN main.geometry_columns AS b ON (" "Upper(a.f_table_name) = Upper(b.f_table_name) AND " "Upper(a.f_geometry_column) = Upper(b.f_geometry_column)) " "WHERE Upper(a.view_name) = Upper(%Q) AND b.spatial_index_enabled = 1", table_name); } @@ -1117,11 +671,11 @@ if (db_prefix == NULL) { sql_statement = sqlite3_mprintf ("SELECT f_table_name, f_geometry_column, SridIsGeographic(srid) " - " FROM geometry_columns WHERE Upper(f_table_name) = Upper(%Q) " + " FROM main.geometry_columns WHERE Upper(f_table_name) = Upper(%Q) " "AND spatial_index_enabled = 1", table_name); } else { char *quoted_db = gaiaDoubleQuotedSql (db_prefix); @@ -1272,11 +826,10 @@ static int vknn_best_index (sqlite3_vtab * pVTab, sqlite3_index_info * pIdxInfo) { /* best index selection */ int i; - int errors = 0; int err = 1; int table = 0; int geom_col = 0; int ref_geom = 0; int max_items = 0; @@ -1294,16 +847,14 @@ geom_col++; else if (p->iColumn == 2 && p->op == SQLITE_INDEX_CONSTRAINT_EQ) ref_geom++; else if (p->iColumn == 3 && p->op == SQLITE_INDEX_CONSTRAINT_EQ) max_items++; - else - errors++; } } if (table == 1 && (geom_col == 0 || geom_col == 1) && ref_geom == 1 - && (max_items == 0 || max_items == 1) && errors == 0) + && (max_items == 0 || max_items == 1)) { /* this one is a valid KNN query */ if (geom_col == 1) { if (max_items == 1) @@ -1374,10 +925,335 @@ { /* closing the cursor */ sqlite3_free (pCursor); return SQLITE_OK; } + +static void +vknn_shift_items (VKnnContextPtr ctx, int index) +{ +/* shifting down the Features sorted array */ + int i; + for (i = ctx->max_items - 1; i > index; i--) + { + VKnnItemPtr item1 = ctx->knn_array + i - 1; + VKnnItemPtr item2 = ctx->knn_array + i; + item2->rowid = item1->rowid; + item2->dist = item1->dist; + if ((i == ctx->max_items - 1) && item2->dist != DBL_MAX) + ctx->max_dist = item2->dist; + } +} + +static void +vknn_update_items (VKnnContextPtr ctx, sqlite3_int64 rowid, double dist) +{ +/* updating the Features sorted array */ + int i; + if (ctx->curr_items == ctx->max_items) + { + if (dist >= ctx->max_dist) + return; + } + for (i = 0; i < ctx->max_items; i++) + { + VKnnItemPtr item = ctx->knn_array + i; + if (rowid == item->rowid) + return; + if (dist < item->dist) + { + vknn_shift_items (ctx, i); + item->rowid = rowid; + item->dist = dist; + break; + } + } + if (dist > ctx->max_dist) + ctx->max_dist = dist; + if (ctx->curr_items < ctx->max_items) + ctx->curr_items += 1; +} + +static int +vknn_check_mbr (VKnnContextPtr ctx, double rtree_minx, double rtree_miny, + double rtree_maxx, double rtree_maxy) +{ +/* comparing two MBRs */ + if (rtree_minx >= ctx->bbox_minx && rtree_maxx <= ctx->bbox_maxx + && rtree_miny >= ctx->bbox_miny && rtree_maxy <= ctx->bbox_maxy) + return FULLY_WITHIN; + if (rtree_maxx < ctx->bbox_minx) + return NOT_WITHIN; + if (rtree_minx > ctx->bbox_maxx) + return NOT_WITHIN; + if (rtree_maxy < ctx->bbox_miny) + return NOT_WITHIN; + if (rtree_miny > ctx->bbox_maxy) + return NOT_WITHIN; + return PARTLY_WITHIN; +} + +static double +vknn_compute_distance (VKnnContextPtr ctx, sqlite3_int64 rowid) +{ +/* computing the distance between two geometries (in meters) */ + double dist = DBL_MAX; + int ret; + sqlite3_stmt *stmt; + if (ctx == NULL) + return DBL_MAX; + if (ctx->blob == NULL) + return DBL_MAX; + if (ctx->stmt_dist == NULL) + return DBL_MAX; + stmt = ctx->stmt_dist; + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_blob (stmt, 1, ctx->blob, ctx->blob_size, SQLITE_STATIC); + sqlite3_bind_int64 (stmt, 2, rowid); + 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 (sqlite3_column_type (stmt, 0) == SQLITE_FLOAT) + dist = sqlite3_column_double (stmt, 0); + } + else + { + dist = DBL_MAX; + break; + } + } + return dist; +} + +static double +vknn_rect_distance (VKnnContextPtr ctx, double minx, double miny, double maxx, + double maxy) +{ +/* computing the distance between the geometry and an R*Tree BBOX */ + double dist = DBL_MAX; + int ret; + sqlite3_stmt *stmt; + if (ctx == NULL) + return DBL_MAX; + if (ctx->blob == NULL) + return DBL_MAX; + if (ctx->stmt_rect_dist == NULL) + return DBL_MAX; + stmt = ctx->stmt_rect_dist; + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_blob (stmt, 1, ctx->blob, ctx->blob_size, SQLITE_STATIC); + sqlite3_bind_double (stmt, 2, minx); + sqlite3_bind_double (stmt, 3, miny); + sqlite3_bind_double (stmt, 4, maxx); + sqlite3_bind_double (stmt, 5, maxy); + 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 (sqlite3_column_type (stmt, 0) == SQLITE_FLOAT) + dist = sqlite3_column_double (stmt, 0); + } + else + { + dist = DBL_MAX; + break; + } + } + return dist; +} + +static double +vknn_pt_distance (VKnnContextPtr ctx, double x, double y) +{ +/* computing the distance between the geometry and a point */ + double dist = DBL_MAX; + int ret; + sqlite3_stmt *stmt; + if (ctx == NULL) + return DBL_MAX; + if (ctx->blob == NULL) + return DBL_MAX; + if (ctx->stmt_pt_dist == NULL) + return DBL_MAX; + stmt = ctx->stmt_pt_dist; + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_blob (stmt, 1, ctx->blob, ctx->blob_size, SQLITE_STATIC); + sqlite3_bind_double (stmt, 2, x); + sqlite3_bind_double (stmt, 3, y); + 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 (sqlite3_column_type (stmt, 0) == SQLITE_FLOAT) + dist = sqlite3_column_double (stmt, 0); + } + else + { + dist = DBL_MAX; + break; + } + } + return dist; +} + +static int +vknn_bufferize (VKnnContextPtr ctx, double radius) +{ +/* computing the frame for an R*Tree query */ + int ret; + sqlite3_stmt *stmt; + if (ctx == NULL) + return 0; + if (ctx->blob == NULL) + return 0; + if (ctx->stmt_buffer == NULL) + return 0; + stmt = ctx->stmt_buffer; + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_blob (stmt, 1, ctx->blob, ctx->blob_size, SQLITE_STATIC); + sqlite3_bind_double (stmt, 2, radius); + 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 (sqlite3_column_type (stmt, 0) == SQLITE_FLOAT) + ctx->rtree_minx = sqlite3_column_double (stmt, 0); + if (sqlite3_column_type (stmt, 1) == SQLITE_FLOAT) + ctx->rtree_miny = sqlite3_column_double (stmt, 1); + if (sqlite3_column_type (stmt, 2) == SQLITE_FLOAT) + ctx->rtree_maxx = sqlite3_column_double (stmt, 2); + if (sqlite3_column_type (stmt, 3) == SQLITE_FLOAT) + ctx->rtree_maxy = sqlite3_column_double (stmt, 3); + } + else + { + return 0; + break; + } + } + return 1; +} + +static int +vknn_rtree_query (VKnnContextPtr ctx) +{ +/* Querying the RTree - Intersections */ + int err = 0; + int count = 0; + int ret; + sqlite3_stmt *stmt; + if (ctx == NULL) + return 0; + if (ctx->stmt_rtree == NULL) + return 0; + stmt = ctx->stmt_rtree; + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, ctx->rtree_maxx); + sqlite3_bind_double (stmt, 2, ctx->rtree_minx); + sqlite3_bind_double (stmt, 3, ctx->rtree_maxy); + sqlite3_bind_double (stmt, 4, ctx->rtree_miny); + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + double dist; + sqlite3_int64 rowid = sqlite3_column_int64 (stmt, 0); + dist = vknn_compute_distance (ctx, rowid); + vknn_update_items (ctx, rowid, dist); + count++; + } + else + { + err = 1; + break; + } + } + if (err) + return -1; + return count; +} + +static int +vknn_query_callback (sqlite3_rtree_query_info * info) +{ +/* R*Tree Query Callback function */ + double rtree_minx; + double rtree_maxx; + double rtree_miny; + double rtree_maxy; + double dist; + int mode; + VKnnContextPtr ctx = (VKnnContextPtr) (info->pContext); + if (info->nCoord != 4) + { + /* invalid RTree */ + info->eWithin = NOT_WITHIN; + return SQLITE_OK; + } + +/* fetching the node's BBOX */ + rtree_minx = info->aCoord[0]; + rtree_maxx = info->aCoord[1]; + rtree_miny = info->aCoord[2]; + rtree_maxy = info->aCoord[3]; + if (info->iLevel > ctx->current_level) + { + mode = + vknn_check_mbr (ctx, rtree_minx, rtree_miny, rtree_maxx, + rtree_maxy); + if (mode == FULLY_WITHIN || mode == PARTLY_WITHIN) + { + /* overlaps the current reference frame; to be further expanded */ + info->eWithin = FULLY_WITHIN; + } + else + info->eWithin = NOT_WITHIN; + } + else + { + dist = + vknn_rect_distance (ctx, rtree_minx, rtree_miny, rtree_maxx, + rtree_maxy); + if (dist < ctx->min_dist) + { + ctx->minx = rtree_minx; + ctx->miny = rtree_miny; + ctx->maxx = rtree_maxx; + ctx->maxy = rtree_maxy; + ctx->min_dist = dist; + ctx->level = info->iLevel; + } + info->eWithin = NOT_WITHIN; + } + return SQLITE_OK; +} static int vknn_filter (sqlite3_vtab_cursor * pCursor, int idxNum, const char *idxStr, int argc, sqlite3_value ** argv) { @@ -1400,13 +1276,20 @@ int is_geographic; const unsigned char *blob; int size; int exists; int ret; + double radius; + double dist; sqlite3_stmt *stmt = NULL; sqlite3_stmt *stmt_dist = NULL; - sqlite3_stmt *stmt_rect = NULL; + sqlite3_stmt *stmt_map_dist = NULL; + sqlite3_stmt *stmt_rect_dist = NULL; + sqlite3_stmt *stmt_pt_dist = NULL; + sqlite3_stmt *stmt_buffer = NULL; + sqlite3_stmt *stmt_rtree = NULL; + sqlite3_stmt *stmt_rtree_count = NULL; VirtualKnnCursorPtr cursor = (VirtualKnnCursorPtr) pCursor; VirtualKnnPtr knn = (VirtualKnnPtr) cursor->pVtab; VKnnContextPtr vknn_context = knn->knn_ctx; if (idxStr) idxStr = idxStr; /* unused arg warning suppression */ @@ -1567,37 +1450,128 @@ &stmt_dist, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto stop; -/* building the RTree MBR Distance query */ +/* building the Distance query - map units */ + xgeomQ = gaiaDoubleQuotedSql (xgeom); + xtableQ = gaiaDoubleQuotedSql (xtable); + sql_statement = + sqlite3_mprintf + ("SELECT ST_Distance(?, \"%s\") FROM \"%s\" WHERE rowid = ?", + xgeomQ, xtableQ); + free (xgeomQ); + free (xtableQ); + ret = + sqlite3_prepare_v2 (knn->db, sql_statement, strlen (sql_statement), + &stmt_map_dist, NULL); + sqlite3_free (sql_statement); + if (ret != SQLITE_OK) + goto stop; + +/* building the Distance query - RTree MBR */ sql_statement = "SELECT ST_Distance(?, BuildMbr(?, ?, ?, ?))"; ret = sqlite3_prepare_v2 (knn->db, sql_statement, strlen (sql_statement), - &stmt_rect, NULL); + &stmt_rect_dist, NULL); + if (ret != SQLITE_OK) + goto stop; + +/* building the Distance query - Point */ + sql_statement = "SELECT ST_Distance(?, MakePoint(?, ?))"; + ret = + sqlite3_prepare_v2 (knn->db, sql_statement, strlen (sql_statement), + &stmt_pt_dist, NULL); + if (ret != SQLITE_OK) + goto stop; + +/* building the Buffer query */ + sql_statement = + "SELECT MbrMinX(x.g), MbrMinY(x.g), MbrMaxX(x.g), MbrMaxY(x.g) " + "FROM (SELECT ST_Buffer(?, ?) AS g) AS x"; + ret = + sqlite3_prepare_v2 (knn->db, sql_statement, strlen (sql_statement), + &stmt_buffer, NULL); + if (ret != SQLITE_OK) + goto stop; + +/* building the RTree query - Intersects */ + idx_name = sqlite3_mprintf ("idx_%s_%s", xtable, xgeom); + idx_nameQ = gaiaDoubleQuotedSql (idx_name); + if (db_prefix == NULL) + { + sql_statement = + sqlite3_mprintf + ("SELECT pkid FROM main.\"%s\" WHERE xmin <= ? AND xmax >= ? AND ymin <= ? AND ymax >= ?", + idx_nameQ); + } + else + { + char *quoted_db = gaiaDoubleQuotedSql (db_prefix); + sql_statement = + sqlite3_mprintf + ("SELECT pkid FROM \"%s\".\"%s\" WHERE xmin <= ? AND xmax >= ? AND ymin <= ? AND ymax >= ?", + quoted_db, idx_nameQ); + free (quoted_db); + } + free (idx_nameQ); + sqlite3_free (idx_name); + ret = + sqlite3_prepare_v2 (knn->db, sql_statement, strlen (sql_statement), + &stmt_rtree, NULL); + sqlite3_free (sql_statement); + if (ret != SQLITE_OK) + goto stop; + +/* building the RTree query - count items */ + idx_name = sqlite3_mprintf ("idx_%s_%s", xtable, xgeom); + idx_nameQ = gaiaDoubleQuotedSql (idx_name); + if (db_prefix == NULL) + { + sql_statement = + sqlite3_mprintf ("SELECT pkid FROM \"%s\" LIMIT 1024", idx_nameQ); + } + else + { + char *quoted_db = gaiaDoubleQuotedSql (db_prefix); + sql_statement = + sqlite3_mprintf ("SELECT pkid FROM \"%s\".\"%s\" LIMIT 1024", + quoted_db, idx_nameQ); + free (quoted_db); + } + ret = + sqlite3_prepare_v2 (knn->db, sql_statement, strlen (sql_statement), + &stmt_rtree_count, NULL); + sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto stop; /* installing the R*Tree query callback */ gaiaMbrGeometry (geom); - vknn_init_context (vknn_context, xtable, xgeom, geom, max_items, stmt_dist, - stmt_rect); + vknn_init_context (vknn_context, xtable, xgeom, geom, max_items, + stmt_dist, stmt_map_dist, stmt_rect_dist, stmt_pt_dist, + stmt_buffer, stmt_rtree, stmt_rtree_count); gaiaFreeGeomColl (geom); geom = NULL; /* releasing ownership on geom */ stmt_dist = NULL; /* releasing ownership on stmt_dist */ - stmt_rect = NULL; /* releasing ownership on stmt_rect */ + stmt_map_dist = NULL; /* releasing ownership on stmt_map_dist */ + stmt_rect_dist = NULL; /* releasing ownership on stmt_rect */ + stmt_pt_dist = NULL; /* releasing ownership on stmt_point */ + stmt_buffer = NULL; /* releasing ownership on stmt_buffer */ + stmt_rtree = NULL; /* releasing ownership on stmt_rtree */ + stmt_rtree_count = NULL; /* releasing ownership on stmt_rtree_count */ sqlite3_rtree_query_callback (knn->db, "knn_position", vknn_query_callback, vknn_context, NULL); -/* building the RTree query */ +/* building the RTree query - callback */ idx_name = sqlite3_mprintf ("idx_%s_%s", xtable, xgeom); idx_nameQ = gaiaDoubleQuotedSql (idx_name); if (db_prefix == NULL) { sql_statement = sqlite3_mprintf - ("SELECT pkid FROM \"%s\" WHERE pkid MATCH knn_position(1)", + ("SELECT pkid FROM main.\"%s\" WHERE pkid MATCH knn_position(1)", idx_nameQ); } else { char *quoted_db = gaiaDoubleQuotedSql (db_prefix); @@ -1614,32 +1588,59 @@ &stmt, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) goto stop; -/* - * this is the real core of the KNN implementation - * we'll loop untill we've explored a reasonable portion - * of the R*Tree - */ + vknn_context->bbox_minx = -DBL_MAX; + vknn_context->bbox_miny = -DBL_MAX; + vknn_context->bbox_maxx = DBL_MAX; + vknn_context->bbox_maxy = DBL_MAX; + vknn_context->current_level = 1024; + while (1) + { + /* repeatedly querying the R*Tree until finding the nearest BBOX */ + vknn_context->minx = DBL_MAX; + vknn_context->miny = DBL_MAX; + vknn_context->maxx = -DBL_MAX; + vknn_context->maxy = -DBL_MAX; + vknn_context->min_dist = DBL_MAX; + sqlite3_step (stmt); + vknn_context->bbox_minx = vknn_context->minx; + vknn_context->bbox_miny = vknn_context->miny; + vknn_context->bbox_maxx = vknn_context->maxx; + vknn_context->bbox_maxy = vknn_context->maxy; + if (vknn_context->level <= 1) + break; + vknn_context->current_level = vknn_context->level - 1; + } + radius = + vknn_pt_distance (vknn_context, vknn_context->bbox_minx, + vknn_context->bbox_miny); + dist = + vknn_pt_distance (vknn_context, vknn_context->bbox_minx, + vknn_context->bbox_maxy); + if (dist > radius) + radius = dist; + dist = + vknn_pt_distance (vknn_context, vknn_context->bbox_maxx, + vknn_context->bbox_miny); + if (dist > radius) + radius = dist; + dist = + vknn_pt_distance (vknn_context, vknn_context->bbox_maxx, + vknn_context->bbox_maxy); + if (dist > radius) + radius = dist; + while (1) { - /* main R*Tree loop - managing an expanding reference BBOX */ - while (1) - { - /* repeatedly querying the R*Tree until exploring all the current reference BBOX */ - vknn_context->changed = 0; - sqlite3_step (stmt); - if (vknn_context->changed == 0) - break; - } - /* recovering the non-overlapping nearest BBOXes */ - if (vknn_recover_nearest (vknn_context)) - continue; - /* expanding the reference BBOX and staring a new full cycle */ - if (!vknn_expand_bbox (vknn_context)) + if (!vknn_bufferize (vknn_context, radius)) + break; + ret = vknn_rtree_query (vknn_context); + if (ret <= 0 || ret >= max_items || ret >= vknn_context->rtree_count) break; + radius *= 1.05; } if (vknn_context->curr_items == 0) cursor->eof = 1; else @@ -1658,12 +1659,22 @@ free (table_name); if (stmt != NULL) sqlite3_finalize (stmt); if (stmt_dist != NULL) sqlite3_finalize (stmt_dist); - if (stmt_rect != NULL) - sqlite3_finalize (stmt_rect); + if (stmt_map_dist != NULL) + sqlite3_finalize (stmt_map_dist); + if (stmt_rect_dist != NULL) + sqlite3_finalize (stmt_rect_dist); + if (stmt_pt_dist != NULL) + sqlite3_finalize (stmt_pt_dist); + if (stmt_buffer != NULL) + sqlite3_finalize (stmt_buffer); + if (stmt_rtree != NULL) + sqlite3_finalize (stmt_rtree); + if (stmt_rtree_count != NULL) + sqlite3_finalize (stmt_rtree_count); return SQLITE_OK; } static int vknn_next (sqlite3_vtab_cursor * pCursor) Index: src/spatialite/virtualnetwork.c ================================================================== --- src/spatialite/virtualnetwork.c +++ src/spatialite/virtualnetwork.c @@ -1445,11 +1445,11 @@ sql = sqlite3_mprintf ("SELECT srid FROM geometry_columns WHERE " "Lower(f_table_name) = Lower(%Q) AND Lower(f_geometry_column) = Lower(%Q)", graph->TableName, graph->GeometryColumn); ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); - sqlite3_free(sql); + sqlite3_free (sql); if (ret != SQLITE_OK) return srid; while (1) { ret = sqlite3_step (stmt); Index: src/spatialite/virtualrouting.c ================================================================== --- src/spatialite/virtualrouting.c +++ src/spatialite/virtualrouting.c @@ -58,36 +58,49 @@ #include "config.h" #endif #include +#include #include #include #include static struct sqlite3_module my_route_module; #define VROUTE_DIJKSTRA_ALGORITHM 1 #define VROUTE_A_STAR_ALGORITHM 2 -#define VROUTE_ROUTING_SOLUTION 0xdd -#define VROUTE_RANGE_SOLUTION 0xbb -#define VROUTE_TSP_SOLUTION 0xee +#define VROUTE_ROUTING_SOLUTION 0xdd +#define VROUTE_POINT2POINT_SOLUTION 0xcc +#define VROUTE_POINT2POINT_ERROR 0xca +#define VROUTE_RANGE_SOLUTION 0xbb +#define VROUTE_TSP_SOLUTION 0xee #define VROUTE_SHORTEST_PATH_FULL 0x70 -#define VROUTE_SHORTEST_PATH_NO_ARCS 0x71 +#define VROUTE_SHORTEST_PATH_NO_LINKS 0x71 #define VROUTE_SHORTEST_PATH_NO_GEOMS 0x72 #define VROUTE_SHORTEST_PATH_SIMPLE 0x73 +#define VROUTE_SHORTEST_PATH_QUICK 0x74 #define VROUTE_SHORTEST_PATH 0x91 #define VROUTE_TSP_NN 0x92 #define VROUTE_TSP_GA 0x93 #define VROUTE_INVALID_SRID -1234 #define VROUTE_TSP_GA_MAX_ITERATIONS 512 +#define VROUTE_POINT2POINT_FROM 1 +#define VROUTE_POINT2POINT_TO 2 + +#define VROUTE_POINT2POINT_NONE 0 +#define VROUTE_POINT2POINT_INGRESS 1 +#define VROUTE_POINT2POINT_START 2 +#define VROUTE_POINT2POINT_END 3 +#define VROUTE_POINT2POINT_EGRESS 4 + #ifdef _WIN32 #define strcasecmp _stricmp #endif /* not WIN32 */ /****************************************************************************** @@ -120,30 +133,30 @@ / / virtualrouting structs / ******************************************************************************/ -typedef struct RouteArcStruct +typedef struct RouteLinkStruct { -/* an ARC */ +/* a LINK */ const struct RouteNodeStruct *NodeFrom; const struct RouteNodeStruct *NodeTo; - sqlite3_int64 ArcRowid; + sqlite3_int64 LinkRowid; double Cost; -} RouteArc; -typedef RouteArc *RouteArcPtr; +} RouteLink; +typedef RouteLink *RouteLinkPtr; typedef struct RouteNodeStruct { /* a NODE */ int InternalIndex; sqlite3_int64 Id; char *Code; double CoordX; double CoordY; - int NumArcs; - RouteArcPtr Arcs; + int NumLinks; + RouteLinkPtr Links; } RouteNode; typedef RouteNode *RouteNodePtr; typedef struct RoutingStruct { @@ -159,35 +172,37 @@ char *FromColumn; char *ToColumn; char *GeometryColumn; char *NameColumn; double AStarHeuristicCoeff; + int Srid; RouteNodePtr Nodes; } Routing; typedef Routing *RoutingPtr; -typedef struct ArcSolutionStruct +typedef struct LinkSolutionStruct { -/* Geometry corresponding to an Arc used by Dijkstra shortest path solution */ - sqlite3_int64 ArcRowid; +/* Geometry corresponding to a Link used by Dijkstra shortest path solution */ + sqlite3_int64 LinkRowid; char *FromCode; char *ToCode; sqlite3_int64 FromId; sqlite3_int64 ToId; int Points; double *Coords; + int HasZ; int Srid; char *Name; - struct ArcSolutionStruct *Next; + struct LinkSolutionStruct *Next; -} ArcSolution; -typedef ArcSolution *ArcSolutionPtr; +} LinkSolution; +typedef LinkSolution *LinkSolutionPtr; typedef struct RowSolutionStruct { /* a row into the shortest path solution */ - RouteArcPtr Arc; + RouteLinkPtr Link; char *Name; struct RowSolutionStruct *Next; } RowSolution; typedef RowSolution *RowSolutionPtr; @@ -206,15 +221,16 @@ typedef RowNodeSolution *RowNodeSolutionPtr; typedef struct ShortestPathSolutionStruct { /* a shortest path solution */ - ArcSolutionPtr FirstArc; - ArcSolutionPtr LastArc; + LinkSolutionPtr FirstLink; + LinkSolutionPtr LastLink; RouteNodePtr From; RouteNodePtr To; char *Undefined; + sqlite3_int64 UndefinedId; RowSolutionPtr First; RowSolutionPtr Last; RowNodeSolutionPtr FirstNode; RowNodeSolutionPtr LastNode; RowNodeSolutionPtr CurrentNodeRow; @@ -227,13 +243,15 @@ typedef struct ResultsetRowStruct { /* a row into the resultset */ int RouteNum; int RouteRow; + int Point2PointRole; RouteNodePtr From; RouteNodePtr To; char *Undefined; + sqlite3_int64 UndefinedId; RowSolutionPtr linkRef; double TotalCost; gaiaGeomCollPtr Geometry; struct ResultsetRowStruct *Next; @@ -265,19 +283,81 @@ ResultsetRowPtr CurrentRow; ShortestPathSolutionPtr First; ShortestPathSolutionPtr Last; RowNodeSolutionPtr FirstNode; RowNodeSolutionPtr LastNode; - RowSolutionPtr FirstArc; - RowSolutionPtr LastArc; + RowSolutionPtr FirstLink; + RowSolutionPtr LastLink; gaiaGeomCollPtr FirstGeom; gaiaGeomCollPtr LastGeom; RowNodeSolutionPtr CurrentNodeRow; sqlite3_int64 CurrentRowId; + int RouteNum; } MultiSolution; typedef MultiSolution *MultiSolutionPtr; +typedef struct Point2PointCandidateStruct +{ +/* wrapping a Point2Point candidate */ + sqlite3_int64 linkRowid; + char *codNodeFrom; + char *codNodeTo; + sqlite3_int64 idNodeFrom; + sqlite3_int64 idNodeTo; + int reverse; + int valid; + gaiaGeomCollPtr path; + double pathLen; + double extraLen; + double percent; + struct Point2PointCandidateStruct *next; +} Point2PointCandidate; +typedef Point2PointCandidate *Point2PointCandidatePtr; + +typedef struct Point2PointNodeStruct +{ +/* wrapping a Point2Point Node */ + char *codNode; + sqlite3_int64 idNode; + Point2PointCandidatePtr parent; + struct Point2PointNodeStruct *next; +} Point2PointNode; +typedef Point2PointNode *Point2PointNodePtr; + +typedef struct Point2PointSolutionStruct +{ +/* shortest path solution - Point2Point */ + unsigned char Mode; + int validFrom; + double xFrom; + double yFrom; + double zFrom; + int validTo; + double xTo; + double yTo; + double zTo; + int srid; + Point2PointCandidatePtr firstFromCandidate; + Point2PointCandidatePtr lastFromCandidate; + Point2PointCandidatePtr firstToCandidate; + Point2PointCandidatePtr lastToCandidate; + Point2PointNodePtr firstFromNode; + Point2PointNodePtr lastFromNode; + Point2PointNodePtr firstToNode; + Point2PointNodePtr lastToNode; + double totalCost; + Point2PointCandidatePtr fromCandidate; + Point2PointCandidatePtr toCandidate; + gaiaDynamicLinePtr dynLine; + int hasZ; + ResultsetRowPtr FirstRow; + ResultsetRowPtr LastRow; + ResultsetRowPtr CurrentRow; + sqlite3_int64 CurrentRowId; +} Point2PointSolution; +typedef Point2PointSolution *Point2PointSolutionPtr; + /****************************************************************************** / / TSP structs / ******************************************************************************/ @@ -347,25 +427,25 @@ typedef struct RoutingNode { int Id; struct RoutingNode **To; - RouteArcPtr *Link; + RouteLinkPtr *Link; int DimTo; struct RoutingNode *PreviousNode; RouteNodePtr Node; - RouteArcPtr Arc; + RouteLinkPtr xLink; double Distance; double HeuristicDistance; int Inspected; } RoutingNode; typedef RoutingNode *RoutingNodePtr; typedef struct RoutingNodes { RoutingNodePtr Nodes; - RouteArcPtr *ArcsBuffer; + RouteLinkPtr *LinksBuffer; RoutingNodePtr *NodesBuffer; int Dim; int DimLink; } RoutingNodes; typedef RoutingNodes *RoutingNodesPtr; @@ -401,11 +481,13 @@ RoutingNodesPtr routing; /* the ROUTING structure */ int currentAlgorithm; /* the currently selected Shortest Path Algorithm */ int currentRequest; /* the currently selected Shortest Path Request */ int currentOptions; /* the currently selected Shortest Path Options */ char currentDelimiter; /* the currently set delimiter char */ + double Tolerance; /* the currently set Tolerance value [Point2Point] */ MultiSolutionPtr multiSolution; /* the current multiple solution */ + Point2PointSolutionPtr point2PointSolution; /* the current Point2Point solution */ int eof; /* the EOF marker */ } virtualrouting; typedef virtualrouting *virtualroutingPtr; typedef struct virtualroutingCursortStruct @@ -440,45 +522,44 @@ nd = malloc (sizeof (RoutingNodes)); /* allocating and initializing Nodes array */ nd->Nodes = malloc (sizeof (RoutingNode) * graph->NumNodes); nd->Dim = graph->NumNodes; nd->DimLink = 0; - /* pre-alloc buffer strategy - GENSCHER 2010-01-05 */ - for (i = 0; i < graph->NumNodes; cnt += graph->Nodes[i].NumArcs, i++); + for (i = 0; i < graph->NumNodes; cnt += graph->Nodes[i].NumLinks, i++); nd->NodesBuffer = malloc (sizeof (RoutingNodePtr) * cnt); - nd->ArcsBuffer = malloc (sizeof (RouteArcPtr) * cnt); + nd->LinksBuffer = malloc (sizeof (RouteLinkPtr) * cnt); cnt = 0; for (i = 0; i < graph->NumNodes; i++) { /* initializing the Nodes array */ nn = graph->Nodes + i; ndn = nd->Nodes + i; ndn->Id = nn->InternalIndex; - ndn->DimTo = nn->NumArcs; + ndn->DimTo = nn->NumLinks; ndn->Node = nn; ndn->To = &(nd->NodesBuffer[cnt]); - ndn->Link = &(nd->ArcsBuffer[cnt]); - cnt += nn->NumArcs; + ndn->Link = &(nd->LinksBuffer[cnt]); + cnt += nn->NumLinks; - for (j = 0; j < nn->NumArcs; j++) + for (j = 0; j < nn->NumLinks; j++) { - /* setting the outcoming Arcs for the current Node */ + /* setting the outcoming Links for the current Node */ nd->DimLink++; - ndn->To[j] = nd->Nodes + nn->Arcs[j].NodeTo->InternalIndex; - ndn->Link[j] = nn->Arcs + j; + ndn->To[j] = nd->Nodes + nn->Links[j].NodeTo->InternalIndex; + ndn->Link[j] = nn->Links + j; } } return (nd); } static void routing_free (RoutingNodes * e) { /* memory cleanup; freeing the ROUTING struct */ - free (e->ArcsBuffer); + free (e->LinksBuffer); free (e->NodesBuffer); free (e->Nodes); free (e); } @@ -593,19 +674,19 @@ static void delete_solution (ShortestPathSolutionPtr solution) { /* deleting the current solution */ - ArcSolutionPtr pA; - ArcSolutionPtr pAn; + LinkSolutionPtr pA; + LinkSolutionPtr pAn; RowSolutionPtr pR; RowSolutionPtr pRn; RowNodeSolutionPtr pN; RowNodeSolutionPtr pNn; if (!solution) return; - pA = solution->FirstArc; + pA = solution->FirstLink; while (pA) { pAn = pA->Next; if (pA->FromCode) free (pA->FromCode); @@ -644,15 +725,16 @@ static ShortestPathSolutionPtr alloc_solution (void) { /* allocates and initializes the current solution */ ShortestPathSolutionPtr p = malloc (sizeof (ShortestPathSolution)); - p->FirstArc = NULL; - p->LastArc = NULL; + p->FirstLink = NULL; + p->LastLink = NULL; p->From = NULL; p->To = NULL; p->Undefined = NULL; + p->UndefinedId = 0; p->First = NULL; p->Last = NULL; p->FirstNode = NULL; p->LastNode = NULL; p->CurrentNodeRow = NULL; @@ -661,18 +743,18 @@ p->Next = NULL; return p; } static void -add_arc_to_solution (ShortestPathSolutionPtr solution, RouteArcPtr arc) +add_link_to_solution (ShortestPathSolutionPtr solution, RouteLinkPtr link) { -/* inserts an Arc into the Shortest Path solution */ +/* inserts a Link into the Shortest Path solution */ RowSolutionPtr p = malloc (sizeof (RowSolution)); - p->Arc = arc; + p->Link = link; p->Name = NULL; p->Next = NULL; - solution->TotalCost += arc->Cost; + solution->TotalCost += link->Cost; if (!(solution->First)) solution->First = p; if (solution->Last) solution->Last->Next = p; solution->Last = p; @@ -696,18 +778,18 @@ multiSolution->LastNode->Next = p; multiSolution->LastNode = p; } static void -set_arc_name_into_solution (ShortestPathSolutionPtr solution, - sqlite3_int64 arc_id, const char *name) +set_link_name_into_solution (ShortestPathSolutionPtr solution, + sqlite3_int64 link_id, const char *name) { -/* sets the Name identifyin an Arc into the Solution */ +/* sets the Name identifyin a Link into the Solution */ RowSolutionPtr row = solution->First; while (row != NULL) { - if (row->Arc->ArcRowid == arc_id) + if (row->Link->LinkRowid == link_id) { int len = strlen (name); if (row->Name != NULL) free (row->Name); row->Name = malloc (len + 1); @@ -717,20 +799,24 @@ row = row->Next; } } static void -add_arc_geometry_to_solution (ShortestPathSolutionPtr solution, - sqlite3_int64 arc_id, const char *from_code, - const char *to_code, sqlite3_int64 from_id, - sqlite3_int64 to_id, int points, double *coords, - int srid, const char *name) +add_link_geometry_to_solution (ShortestPathSolutionPtr solution, + sqlite3_int64 link_id, const char *from_code, + const char *to_code, sqlite3_int64 from_id, + sqlite3_int64 to_id, gaiaGeomCollPtr geom, + const char *name) { -/* inserts an Arc Geometry into the Shortest Path solution */ +/* inserts a Link Geometry into the Shortest Path solution */ + int iv; + int points; + double *coords; + int has_z; int len; - ArcSolutionPtr p = malloc (sizeof (ArcSolution)); - p->ArcRowid = arc_id; + LinkSolutionPtr p = malloc (sizeof (LinkSolution)); + p->LinkRowid = link_id; p->FromCode = NULL; len = strlen (from_code); if (len > 0) { p->FromCode = malloc (len + 1); @@ -743,41 +829,214 @@ p->ToCode = malloc (len + 1); strcpy (p->ToCode, to_code); } p->FromId = from_id; p->ToId = to_id; + +/* preparing the Link's Geometry */ + points = geom->FirstLinestring->Points; + if (geom->DimensionModel == GAIA_XY_Z + || geom->DimensionModel == GAIA_XY_Z_M) + { + has_z = 1; + coords = malloc (sizeof (double) * (points * 3)); + } + else + { + has_z = 0; + coords = malloc (sizeof (double) * (points * 2)); + } + for (iv = 0; iv < points; iv++) + { + double x; + double y; + double z; + double m; + if (geom->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (geom->FirstLinestring->Coords, iv, &x, &y, &z); + } + else if (geom->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (geom->FirstLinestring->Coords, iv, &x, &y, &m); + } + else if (geom->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM + (geom->FirstLinestring->Coords, iv, &x, &y, &z, &m); + } + else + { + gaiaGetPoint (geom->FirstLinestring->Coords, iv, &x, &y); + } + if (has_z) + { + *(coords + ((iv * 3) + 0)) = x; + *(coords + ((iv * 3) + 1)) = y; + *(coords + ((iv * 3) + 2)) = z; + } + else + { + *(coords + ((iv * 2) + 0)) = x; + *(coords + ((iv * 2) + 1)) = y; + } + } p->Points = points; p->Coords = coords; - p->Srid = srid; + p->HasZ = has_z; + p->Srid = geom->Srid; if (name == NULL) p->Name = NULL; else { len = strlen (name); p->Name = malloc (len + 1); strcpy (p->Name, name); } p->Next = NULL; - if (!(solution->FirstArc)) - solution->FirstArc = p; - if (solution->LastArc) - solution->LastArc->Next = p; - solution->LastArc = p; + if (!(solution->FirstLink)) + solution->FirstLink = p; + if (solution->LastLink) + solution->LastLink->Next = p; + solution->LastLink = p; +} + +static void +normalizeCoords (LinkSolutionPtr pA) +{ +/* inverting the Link's direction */ + int iv; + int pt = 0; + double x; + double y; + double z; + double *coords; + + if (pA->HasZ) + coords = malloc (sizeof (double) * (pA->Points * 3)); + else + coords = malloc (sizeof (double) * (pA->Points * 2)); +/* copying Link's vertices in reverse order */ + for (iv = pA->Points - 1; iv >= 0; iv--) + { + if (pA->HasZ) + { + x = *(pA->Coords + ((iv * 3) + 0)); + y = *(pA->Coords + ((iv * 3) + 1)); + z = *(pA->Coords + ((iv * 3) + 2)); + *(coords + ((pt * 3) + 0)) = x; + *(coords + ((pt * 3) + 1)) = y; + *(coords + ((pt * 3) + 2)) = z; + pt++; + } + else + { + x = *(pA->Coords + ((iv * 2) + 0)); + y = *(pA->Coords + ((iv * 2) + 1)); + *(coords + ((pt * 2) + 0)) = x; + *(coords + ((pt * 2) + 1)) = y; + pt++; + } + } + free (pA->Coords); + pA->Coords = coords; +} + +static void +addLinkPoints2DynLine (gaiaDynamicLinePtr dyn, LinkSolutionPtr pA, double cost) +{ +/* adding Link's points to the final solution Geometry */ + int iv; + double x; + double y; + double z = 0.0; + double m = 0.0; + double base_m = 0.0; + gaiaGeomCollPtr geom; + gaiaGeomCollPtr geo2; + gaiaLinestringPtr ln; + + if (pA->HasZ) + geom = gaiaAllocGeomCollXYZ (); + else + geom = gaiaAllocGeomColl (); + ln = gaiaAddLinestringToGeomColl (geom, pA->Points); + + for (iv = 0; iv < pA->Points; iv++) + { + if (pA->HasZ) + { + x = *(pA->Coords + ((iv * 3) + 0)); + y = *(pA->Coords + ((iv * 3) + 1)); + z = *(pA->Coords + ((iv * 3) + 2)); + gaiaSetPointXYZ (ln->Coords, iv, x, y, z); + } + else + { + x = *(pA->Coords + ((iv * 2) + 0)); + y = *(pA->Coords + ((iv * 2) + 1)); + gaiaSetPoint (ln->Coords, iv, x, y); + } + } + geo2 = gaiaAddMeasure (geom, 0.0, cost); + ln = geo2->FirstLinestring; + gaiaFreeGeomColl (geom); + if (dyn->Last != NULL) + base_m = dyn->Last->M; + + for (iv = 0; iv < ln->Points; iv++) + { + z = 0.0; + if (pA->HasZ) + { + gaiaGetPointXYZM (ln->Coords, iv, &x, &y, &z, &m); + } + else + { + gaiaGetPointXYM (ln->Coords, iv, &x, &y, &m); + } + if (dyn->Last != NULL) + { + double prev_x = dyn->Last->X; + double prev_y = dyn->Last->Y; + if (x == prev_x && y == prev_y) + continue; /* skipping repeated points */ + } + gaiaAppendPointZMToDynamicLine (dyn, x, y, z, base_m + m); + } + gaiaFreeGeomColl (geo2); +} + +static double +findLinkCost (sqlite3_int64 linkRowid, ShortestPathSolutionPtr solution) +{ +/* searching for the Cost of the given Link */ + RowSolutionPtr row = solution->First; + while (row != NULL) + { + if (row->Link != NULL) + { + if (row->Link->LinkRowid == linkRowid) + return row->Link->Cost; + } + row = row->Next; + } + return -1.5; } static void build_solution (sqlite3 * handle, int options, RoutingPtr graph, - ShortestPathSolutionPtr solution, RouteArcPtr * shortest_path, + ShortestPathSolutionPtr solution, RouteLinkPtr * shortest_path, int cnt) { /* formatting the Shortest Path solution */ int i; char *sql; int err; int error = 0; int ret; - sqlite3_int64 arc_id; + sqlite3_int64 link_id; const unsigned char *blob; int size; sqlite3_int64 from_id; sqlite3_int64 to_id; char *from_code; @@ -799,15 +1058,24 @@ { /* building the solution */ for (i = 0; i < cnt; i++) solution->TotalCost += shortest_path[i]->Cost; } + else if (options == VROUTE_SHORTEST_PATH_QUICK) + { + /* only for internal usage: Point2Point */ + for (i = 0; i < cnt; i++) + add_link_to_solution (solution, shortest_path[i]); + if (shortest_path) + free (shortest_path); + return; + } else { /* building the solution */ for (i = 0; i < cnt; i++) - add_arc_to_solution (solution, shortest_path[i]); + add_link_to_solution (solution, shortest_path[i]); } if (options == VROUTE_SHORTEST_PATH_SIMPLE) { if (shortest_path) free (shortest_path); @@ -827,16 +1095,16 @@ } tbd = cnt; while (tbd > 0) { - /* requesting max 128 arcs at each time */ + /* requesting max 128 links at each time */ if (tbd < block) how_many = tbd; else how_many = block; -/* preparing the Geometry representing this solution [reading arcs] */ +/* preparing the Geometry representing this solution [reading links] */ gaiaOutBufferInitialize (&sql_statement); if (graph->NameColumn) { /* a Name column is defined */ if (graph->GeometryColumn == NULL @@ -900,14 +1168,16 @@ else gaiaAppendToOutBuffer (&sql_statement, ",?"); } gaiaAppendToOutBuffer (&sql_statement, ")"); if (sql_statement.Error == 0 && sql_statement.Buffer != NULL) - ret = - sqlite3_prepare_v2 (handle, sql_statement.Buffer, - strlen (sql_statement.Buffer), &stmt, - NULL); + { + ret = + sqlite3_prepare_v2 (handle, sql_statement.Buffer, + strlen (sql_statement.Buffer), &stmt, + NULL); + } else ret = SQLITE_ERROR; gaiaOutBufferReset (&sql_statement); if (ret != SQLITE_OK) { @@ -921,31 +1191,31 @@ { if (i < base) continue; if (i >= (base + how_many)) break; - sqlite3_bind_int64 (stmt, ind, shortest_path[i]->ArcRowid); + sqlite3_bind_int64 (stmt, ind, shortest_path[i]->LinkRowid); ind++; } while (1) { ret = sqlite3_step (stmt); if (ret == SQLITE_DONE) break; if (ret == SQLITE_ROW) { - arc_id = -1; + link_id = -1; from_id = -1; to_id = -1; from_code = NULL; to_code = NULL; blob = NULL; size = 0; name = NULL; err = 0; if (sqlite3_column_type (stmt, 0) == SQLITE_INTEGER) - arc_id = sqlite3_column_int64 (stmt, 0); + link_id = sqlite3_column_int64 (stmt, 0); else err = 1; if (graph->NodeCode) { /* nodes are identified by TEXT codes */ @@ -993,11 +1263,11 @@ if (err) error = 1; else if (graph->GeometryColumn != NULL && options != VROUTE_SHORTEST_PATH_NO_GEOMS) { - /* saving the Arc geometry into the temporary struct */ + /* saving the Link's geometry into the temporary struct */ gaiaGeomCollPtr geom = gaiaFromSpatiaLiteBlobWkb (blob, size); if (geom) { /* OK, we have fetched a valid Geometry */ @@ -1006,51 +1276,33 @@ && geom->FirstLinestring != NULL && geom->FirstLinestring == geom->LastLinestring) { /* Geometry is LINESTRING as expected */ - int iv; - int points = - geom->FirstLinestring->Points; - double *coords = - malloc (sizeof (double) * - (points * 2)); - for (iv = 0; iv < points; iv++) - { - double x; - double y; - gaiaGetPoint - (geom->FirstLinestring-> - Coords, iv, &x, &y); - *(coords + ((iv * 2) + 0)) = x; - *(coords + ((iv * 2) + 1)) = y; - } + if (from_code == NULL) from_code = ""; if (to_code == NULL) to_code = ""; - add_arc_geometry_to_solution (solution, - arc_id, - from_code, - to_code, - from_id, - to_id, - points, - coords, - geom-> - Srid, - name); + add_link_geometry_to_solution (solution, + link_id, + from_code, + to_code, + from_id, + to_id, + geom, + name); } else error = 1; gaiaFreeGeomColl (geom); } else error = 1; } else if (name != NULL) - set_arc_name_into_solution (solution, arc_id, name); + set_link_name_into_solution (solution, link_id, name); } } sqlite3_finalize (stmt); tbd -= how_many; base += how_many; @@ -1061,114 +1313,58 @@ if (!error && graph->GeometryColumn != NULL && options != VROUTE_SHORTEST_PATH_NO_GEOMS) { /* building the Geometry representing the Shortest Path Solution */ gaiaLinestringPtr ln; + int iv = 0; int tot_pts = 0; RowSolutionPtr pR; - ArcSolutionPtr pA; + LinkSolutionPtr pA; int srid = -1; - if (solution->FirstArc) - srid = (solution->FirstArc)->Srid; + int has_z = 0; + gaiaGeomCollPtr geom; + gaiaPointPtr pt; + gaiaDynamicLinePtr dyn = gaiaAllocDynamicLine (); + if (solution->FirstLink) + { + srid = solution->FirstLink->Srid; + has_z = solution->FirstLink->HasZ; + } pR = solution->First; while (pR) { - pA = solution->FirstArc; + /* building the Solution as a Dynamic Line */ + pA = solution->FirstLink; while (pA) { - /* computing how many vertices do we need to build the LINESTRING */ - if (pR->Arc->ArcRowid == pA->ArcRowid) + if (pR->Link->LinkRowid == pA->LinkRowid) { - if (pR == solution->First) - tot_pts += pA->Points; - else - tot_pts += (pA->Points - 1); - if (pA->Srid != srid) - srid = -1; - } - pA = pA->Next; - } - pR = pR->Next; - } - /* creating the Shortest Path Geometry - LINESTRING */ - if (tot_pts <= 2) - return; - ln = gaiaAllocLinestring (tot_pts); - solution->Geometry = gaiaAllocGeomColl (); - solution->Geometry->Srid = srid; - gaiaInsertLinestringInGeomColl (solution->Geometry, ln); - tot_pts = 0; - pR = solution->First; - while (pR) - { - /* building the LINESTRING */ - int skip; - if (pR == solution->First) - skip = 0; /* for first arc we must copy any vertex */ - else - skip = 1; /* for subsequent arcs we must skip first vertex [already inserted from previous arc] */ - pA = solution->FirstArc; - while (pA) - { - if (pR->Arc->ArcRowid == pA->ArcRowid) - { - /* copying vertices from correspoinding Arc Geometry */ - int ini; - int iv; - int rev; - double x; - double y; + /* copying vertices from corresponding Link's Geometry */ + int reverse; + double cost; if (graph->NodeCode) { /* nodes are identified by TEXT codes */ if (strcmp - (pR->Arc->NodeFrom->Code, + (pR->Link->NodeFrom->Code, pA->ToCode) == 0) - rev = 1; + reverse = 1; else - rev = 0; + reverse = 0; } else { /* nodes are identified by INTEGER ids */ - if (pR->Arc->NodeFrom->Id == pA->ToId) - rev = 1; + if (pR->Link->NodeFrom->Id == pA->ToId) + reverse = 1; else - rev = 0; + reverse = 0; } - if (rev) - { - /* copying Arc vertices in reverse order */ - if (skip) - ini = pA->Points - 2; - else - ini = pA->Points - 1; - for (iv = ini; iv >= 0; iv--) - { - x = *(pA->Coords + ((iv * 2) + 0)); - y = *(pA->Coords + ((iv * 2) + 1)); - gaiaSetPoint (ln->Coords, tot_pts, x, - y); - tot_pts++; - } - } - else - { - /* copying Arc vertices in normal order */ - if (skip) - ini = 1; - else - ini = 0; - for (iv = ini; iv < pA->Points; iv++) - { - x = *(pA->Coords + ((iv * 2) + 0)); - y = *(pA->Coords + ((iv * 2) + 1)); - gaiaSetPoint (ln->Coords, tot_pts, x, - y); - tot_pts++; - } - } + if (reverse) + normalizeCoords (pA); + cost = findLinkCost (pA->LinkRowid, solution); + addLinkPoints2DynLine (dyn, pA, cost); if (pA->Name) { int len = strlen (pA->Name); pR->Name = malloc (len + 1); strcpy (pR->Name, pA->Name); @@ -1177,21 +1373,54 @@ } pA = pA->Next; } pR = pR->Next; } + /* building the result path Geometry */ + if (has_z) + geom = gaiaAllocGeomCollXYZM (); + else + geom = gaiaAllocGeomCollXYM (); + geom->Srid = srid; + pt = dyn->First; + while (pt != NULL) + { + /* counting how many points are there */ + tot_pts++; + pt = pt->Next; + } + ln = gaiaAddLinestringToGeomColl (geom, tot_pts); + iv = 0; + pt = dyn->First; + while (pt != NULL) + { + /* copying points from Dynamic Line to Linestring */ + if (has_z) + { + gaiaSetPointXYZM (ln->Coords, iv, pt->X, pt->Y, + pt->Z, pt->M); + } + else + { + gaiaSetPointXYM (ln->Coords, iv, pt->X, pt->Y, pt->M); + } + iv++; + pt = pt->Next; + } + solution->Geometry = geom; + gaiaFreeDynamicLine (dyn); } else { RowSolutionPtr pR; - ArcSolutionPtr pA; + LinkSolutionPtr pA; if (graph->NameColumn != NULL) { pR = solution->First; while (pR) { - pA = solution->FirstArc; + pA = solution->FirstLink; while (pA) { if (pA->Name) { int len = strlen (pA->Name); @@ -1203,13 +1432,13 @@ pR = pR->Next; } } } - if (options == VROUTE_SHORTEST_PATH_NO_ARCS) + if (options == VROUTE_SHORTEST_PATH_NO_LINKS) { - /* deleting arcs */ + /* deleting Links */ RowSolutionPtr pR; RowSolutionPtr pRn; pR = solution->First; while (pR) { @@ -1235,16 +1464,19 @@ { /* inserting the Route Header */ int route_row = 0; RowSolutionPtr pA; ResultsetRowPtr row = malloc (sizeof (ResultsetRow)); + route_num = multiSolution->RouteNum++; row->RouteNum = route_num; row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; row->From = pS->From; row->To = pS->To; row->Undefined = pS->Undefined; pS->Undefined = NULL; + row->UndefinedId = pS->UndefinedId; row->linkRef = NULL; row->TotalCost = pS->TotalCost; row->Geometry = pS->Geometry; row->Next = NULL; if (multiSolution->FirstRow == NULL) @@ -1254,14 +1486,15 @@ multiSolution->LastRow = row; pA = pS->First; while (pA != NULL) { - /* inserting Route's traversed Arcs */ + /* inserting Route's traversed Links */ row = malloc (sizeof (ResultsetRow)); row->RouteNum = route_num; row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; row->From = NULL; row->To = NULL; row->Undefined = NULL; row->linkRef = pA; row->TotalCost = 0.0; @@ -1272,19 +1505,58 @@ if (multiSolution->LastRow != NULL) multiSolution->LastRow->Next = row; multiSolution->LastRow = row; pA = pA->Next; } - route_num++; pS = pS->Next; } } + +static int +addPoint2DynLine (const double *coords, int dimensionModel, int iv, + gaiaDynamicLinePtr dyn, double base_m) +{ +/* adding a Point from Linestring to Dynamic Line */ + double x; + double y; + double z = 0.0; + double m = 0.0; + int has_z = 0; + if (dimensionModel == GAIA_XY_Z) + { + has_z = 1; + gaiaGetPointXYZ (coords, iv, &x, &y, &z); + } + else if (dimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (coords, iv, &x, &y, &m); + } + else if (dimensionModel == GAIA_XY_Z_M) + { + has_z = 1; + gaiaGetPointXYZM (coords, iv, &x, &y, &z, &m); + } + else + { + gaiaGetPoint (coords, iv, &x, &y); + } + if (dyn->Last != NULL) + { + double prev_x = dyn->Last->X; + double prev_y = dyn->Last->Y; + if (x == prev_x && y == prev_y) + return has_z; /* skipping repeated points */ + } + m += base_m; + gaiaAppendPointZMToDynamicLine (dyn, x, y, z, m); + return has_z; +} static void aux_tsp_add_solution (MultiSolutionPtr multiSolution, ShortestPathSolutionPtr pS, int *route_num, - gaiaLinestringPtr tsp_path, int *point_index, int mode) + gaiaDynamicLinePtr dyn) { /* helper function: adding a solutiont into the TSP resultset */ RowSolutionPtr pA; ResultsetRowPtr row; int route_row = 0; @@ -1292,10 +1564,11 @@ /* inserting the Route Header */ row = malloc (sizeof (ResultsetRow)); row->RouteNum = *route_num; *route_num += 1; row->RouteRow = route_row; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; route_row += 1; row->From = pS->From; row->To = pS->To; row->Undefined = NULL; row->linkRef = NULL; @@ -1314,41 +1587,34 @@ multiSolution->LastGeom->Next = pS->Geometry; multiSolution->LastGeom = pS->Geometry; /* removing Geometry ownership form Solution */ pS->Geometry = NULL; - /* copying points into the TSP geometry */ - if (tsp_path != NULL && row->Geometry != NULL) + /* copying points into the Dynamic Line - TSP Geometry */ + if (row->Geometry != NULL) { gaiaLinestringPtr ln = row->Geometry->FirstLinestring; if (ln != NULL) { - int base; int iv; - if (!mode) - base = 0; - else - base = 1; - for (iv = base; iv < ln->Points; iv++) - { - double x; - double y; - int pt = *point_index; - *point_index += 1; - gaiaGetPoint (ln->Coords, iv, &x, &y); - gaiaSetPoint (tsp_path->Coords, pt, x, y); - } + double base_m = 0.0; + if (dyn->Last != NULL) + base_m = dyn->Last->M; + for (iv = 0; iv < ln->Points; iv++) + addPoint2DynLine (ln->Coords, ln->DimensionModel, iv, dyn, + base_m); } } pA = pS->First; while (pA != NULL) { - /* inserting Route's traversed Arcs */ + /* inserting Route's traversed Links */ row = malloc (sizeof (ResultsetRow)); row->RouteNum = *route_num; row->RouteRow = route_row; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; route_row += 1; row->From = NULL; row->To = NULL; row->Undefined = NULL; row->linkRef = pA; @@ -1358,46 +1624,83 @@ if (multiSolution->FirstRow == NULL) multiSolution->FirstRow = row; if (multiSolution->LastRow != NULL) multiSolution->LastRow->Next = row; multiSolution->LastRow = row; - /* adding the Arc to the multiSolution list */ - if (multiSolution->FirstArc == NULL) - multiSolution->FirstArc = pA; - if (multiSolution->LastArc != NULL) - multiSolution->LastArc->Next = pA; - multiSolution->LastArc = pA; + /* adding the Link to the multiSolution list */ + if (multiSolution->FirstLink == NULL) + multiSolution->FirstLink = pA; + if (multiSolution->LastLink != NULL) + multiSolution->LastLink->Next = pA; + multiSolution->LastLink = pA; pA = pA->Next; } route_num += 1; - /* removing Arcs ownership form Solution */ + /* removing Links ownership from Solution */ pS->First = NULL; pS->Last = NULL; } -static void +static gaiaGeomCollPtr aux_build_tsp (MultiSolutionPtr multiSolution, TspTargetsPtr targets, - int route_num, gaiaLinestringPtr tsp_path) + int route_num, int srid) { /* helper function: formatting the TSP resultset */ - int point_index = 0; + int has_z = 0; + gaiaGeomCollPtr geom = NULL; + gaiaLinestringPtr ln; int i; + int pts = 0; + gaiaPointPtr pt; + gaiaDynamicLinePtr dyn = gaiaAllocDynamicLine (); for (i = 0; i < targets->Count; i++) { /* adding all City to City solutions */ ShortestPathSolutionPtr pS = *(targets->Solutions + i); - aux_tsp_add_solution (multiSolution, pS, &route_num, tsp_path, - &point_index, i); + aux_tsp_add_solution (multiSolution, pS, &route_num, dyn); } /* adding the final trip closing the circular path */ aux_tsp_add_solution (multiSolution, targets->LastSolution, &route_num, - tsp_path, &point_index, targets->Count); + dyn); + /* building the TSP solution as a genuine Geometry */ + if (has_z) + geom = gaiaAllocGeomCollXYZM (); + else + geom = gaiaAllocGeomCollXYM (); + geom->Srid = srid; + pt = dyn->First; + while (pt != NULL) + { + /* counting how many points are there */ + pts++; + pt = pt->Next; + } + ln = gaiaAddLinestringToGeomColl (geom, pts); + pt = dyn->First; + i = 0; + while (pt != NULL) + { + /* copying points from Dynamic Line to Linestring */ + if (has_z) + { + gaiaSetPointXYZM (ln->Coords, i, pt->X, pt->Y, pt->Z, pt->M); + } + else + { + gaiaSetPointXYM (ln->Coords, i, pt->X, pt->Y, pt->M); + } + i++; + pt = pt->Next; + } + gaiaFreeDynamicLine (dyn); + return geom; } static void -build_tsp_solution (MultiSolutionPtr multiSolution, TspTargetsPtr targets) +build_tsp_solution (MultiSolutionPtr multiSolution, TspTargetsPtr targets, + int srid) { /* formatting the TSP resultset */ ShortestPathSolutionPtr *oldS; ShortestPathSolutionPtr pS; ResultsetRowPtr row; @@ -1405,13 +1708,10 @@ int i; int k; int unreachable = 0; int route_row = 0; int route_num = 0; - int points = 0; - gaiaLinestringPtr tsp_path = NULL; - int srid = -1; int found; /* checking for undefined or unreacheable targets */ for (i = 0; i < targets->Count; i++) { @@ -1424,10 +1724,11 @@ /* inserting the TSP Header */ row = malloc (sizeof (ResultsetRow)); row->RouteNum = route_num++; row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; row->From = multiSolution->From; row->To = multiSolution->From; row->Undefined = NULL; row->linkRef = NULL; if (unreachable) @@ -1454,10 +1755,11 @@ { /* unreacheable target */ row = malloc (sizeof (ResultsetRow)); row->RouteNum = route_num++; row->RouteRow = 0; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; row->From = to; row->To = to; row->Undefined = NULL; row->linkRef = NULL; row->TotalCost = 0.0; @@ -1471,53 +1773,10 @@ } } return; } -/* creating the TSP geometry */ - for (i = 0; i < targets->Count; i++) - { - pS = *(targets->Solutions + i); - gaiaGeomCollPtr geom = pS->Geometry; - if (geom != NULL) - { - srid = geom->Srid; - gaiaLinestringPtr ln = geom->FirstLinestring; - if (ln != NULL) - { - if (i == 0) - points += ln->Points; - else - points += ln->Points - 1; - } - } - } - if (targets->LastSolution != NULL) - { - gaiaGeomCollPtr geom = targets->LastSolution->Geometry; - if (geom != NULL) - { - gaiaLinestringPtr ln = geom->FirstLinestring; - if (ln != NULL) - { - points += ln->Points - 1; - } - } - } - if (points >= 2) - { - row->Geometry = gaiaAllocGeomColl (); - row->Geometry->Srid = srid; - tsp_path = gaiaAddLinestringToGeomColl (row->Geometry, points); - /* adding the Geometry to the multiSolution list */ - if (multiSolution->FirstGeom == NULL) - multiSolution->FirstGeom = row->Geometry; - if (multiSolution->LastGeom != NULL) - multiSolution->LastGeom->Next = row->Geometry; - multiSolution->LastGeom = row->Geometry; - } - /* reordering the TSP solution */ oldS = targets->Solutions; targets->Solutions = malloc (sizeof (ShortestPathSolutionPtr) * targets->Count); from = multiSolution->From; @@ -1554,11 +1813,19 @@ targets->LastSolution = pS; break; } } free (oldS); - aux_build_tsp (multiSolution, targets, route_num, tsp_path); + row->Geometry = aux_build_tsp (multiSolution, targets, route_num, srid); + if (row->Geometry != NULL) + { + if (multiSolution->FirstGeom == NULL) + multiSolution->FirstGeom = row->Geometry; + if (multiSolution->LastGeom != NULL) + multiSolution->LastGeom->Next = row->Geometry; + multiSolution->LastGeom = row->Geometry; + } } static void build_tsp_illegal_solution (MultiSolutionPtr multiSolution, TspTargetsPtr targets) @@ -1570,10 +1837,11 @@ /* inserting the TSP Header */ row = malloc (sizeof (ResultsetRow)); row->RouteNum = route_num++; row->RouteRow = 0; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; row->From = multiSolution->From; row->To = multiSolution->From; row->Undefined = NULL; row->linkRef = NULL; row->TotalCost = 0.0; @@ -1585,19 +1853,28 @@ multiSolution->LastRow->Next = row; multiSolution->LastRow = row; for (i = 0; i < targets->Count; i++) { + char xid[128]; + const char *code = "unknown"; RouteNodePtr to = *(targets->To + i); - const char *code = *(multiSolution->MultiTo->Codes + i); + if (multiSolution->MultiTo->CodeNode) + code = *(multiSolution->MultiTo->Codes + i); + else + { + sprintf (xid, "%lld", *(multiSolution->MultiTo->Ids + 1)); + code = xid; + } if (to == NULL) { /* unknown target */ int len; row = malloc (sizeof (ResultsetRow)); row->RouteNum = route_num++; row->RouteRow = 0; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; row->From = to; row->To = to; len = strlen (code); row->Undefined = malloc (len + 1); strcpy (row->Undefined, code); @@ -1615,10 +1892,11 @@ { /* unreachable target */ row = malloc (sizeof (ResultsetRow)); row->RouteNum = route_num++; row->RouteRow = 0; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; row->From = to; row->To = to; row->Undefined = NULL; row->linkRef = NULL; row->TotalCost = 0.0; @@ -1727,11 +2005,11 @@ int k; ShortestPathSolutionPtr solution; RouteNodePtr destination; RoutingNodePtr n; RoutingNodePtr p_to; - RouteArcPtr p_link; + RouteLinkPtr p_link; RoutingHeapPtr heap; /* setting From */ from = multiSolution->From->InternalIndex; /* initializing the heap */ heap = routing_heap_init (e->DimLink); @@ -1738,11 +2016,11 @@ /* initializing the graph */ for (i = 0; i < e->Dim; i++) { n = e->Nodes + i; n->PreviousNode = NULL; - n->Arc = NULL; + n->xLink = NULL; n->Inspected = 0; n->Distance = DBL_MAX; } /* queuing the From node into the heap */ e->Nodes[from].Distance = 0.0; @@ -1753,28 +2031,28 @@ n = routing_dequeue (heap); destination = check_multiTo (n, multiSolution->MultiTo); if (destination != NULL) { /* reached one of the multiple destinations */ - RouteArcPtr *result; + RouteLinkPtr *result; int cnt = 0; int to = destination->InternalIndex; n = e->Nodes + to; while (n->PreviousNode != NULL) { - /* counting how many Arcs are into the Shortest Path solution */ + /* counting how many Links are into the Shortest Path solution */ cnt++; n = n->PreviousNode; } /* allocating the solution */ - result = malloc (sizeof (RouteArcPtr) * cnt); + result = malloc (sizeof (RouteLinkPtr) * cnt); k = cnt - 1; n = e->Nodes + to; while (n->PreviousNode != NULL) { - /* inserting an Arc into the solution */ - result[k] = n->Arc; + /* inserting a Link into the solution */ + result[k] = n->xLink; n = n->PreviousNode; k--; } solution = add2multiSolution (multiSolution, multiSolution->From, @@ -1794,19 +2072,19 @@ if (p_to->Distance == DBL_MAX) { /* queuing a new node into the heap */ p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; dijkstra_enqueue (heap, p_to); } else if (p_to->Distance > n->Distance + p_link->Cost) { /* updating an already inserted node */ p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; } } } } routing_heap_free (heap); @@ -1861,11 +2139,11 @@ int from; int i; RouteNodePtr destination; RoutingNodePtr n; RoutingNodePtr p_to; - RouteArcPtr p_link; + RouteLinkPtr p_link; RoutingHeapPtr heap; /* setting From */ from = targets->From->InternalIndex; /* initializing the heap */ heap = routing_heap_init (e->DimLink); @@ -1872,11 +2150,11 @@ /* initializing the graph */ for (i = 0; i < e->Dim; i++) { n = e->Nodes + i; n->PreviousNode = NULL; - n->Arc = NULL; + n->xLink = NULL; n->Inspected = 0; n->Distance = DBL_MAX; } /* queuing the From node into the heap */ e->Nodes[from].Distance = 0.0; @@ -1894,11 +2172,11 @@ int to = destination->InternalIndex; n = e->Nodes + to; while (n->PreviousNode != NULL) { /* computing the total Cost */ - totalCost += n->Arc->Cost; + totalCost += n->xLink->Cost; n = n->PreviousNode; } /* updating targets */ update_targets (targets, destination, totalCost, &stop); if (stop) @@ -1914,19 +2192,19 @@ if (p_to->Distance == DBL_MAX) { /* queuing a new node into the heap */ p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; dijkstra_enqueue (heap, p_to); } else if (p_to->Distance > n->Distance + p_link->Cost) { /* updating an already inserted node */ p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; } } } } routing_heap_free (heap); @@ -2134,11 +2412,11 @@ ShortestPathSolutionPtr solution; RouteNodePtr origin; RouteNodePtr destination; RoutingNodePtr n; RoutingNodePtr p_to; - RouteArcPtr p_link; + RouteLinkPtr p_link; RoutingHeapPtr heap; /* setting From */ from = targets->From->InternalIndex; origin = targets->From; @@ -2147,11 +2425,11 @@ /* initializing the graph */ for (i = 0; i < e->Dim; i++) { n = e->Nodes + i; n->PreviousNode = NULL; - n->Arc = NULL; + n->xLink = NULL; n->Inspected = 0; n->Distance = DBL_MAX; } /* queuing the From node into the heap */ e->Nodes[from].Distance = 0.0; @@ -2165,28 +2443,28 @@ else destination = check_TspTo (n, targets); if (destination != NULL) { /* reached one of the target destinations */ - RouteArcPtr *result; + RouteLinkPtr *result; int cnt = 0; int to = destination->InternalIndex; n = e->Nodes + to; while (n->PreviousNode != NULL) { - /* counting how many Arcs are into the Shortest Path solution */ + /* counting how many Links are into the Shortest Path solution */ cnt++; n = n->PreviousNode; } /* allocating the solution */ - result = malloc (sizeof (RouteArcPtr) * cnt); + result = malloc (sizeof (RouteLinkPtr) * cnt); k = cnt - 1; n = e->Nodes + to; while (n->PreviousNode != NULL) { - /* inserting an Arc into the solution */ - result[k] = n->Arc; + /* inserting a Link into the solution */ + result[k] = n->xLink; n = n->PreviousNode; k--; } if (last_route) solution = @@ -2209,11 +2487,11 @@ from = to; for (i = 0; i < e->Dim; i++) { n = e->Nodes + i; n->PreviousNode = NULL; - n->Arc = NULL; + n->xLink = NULL; n->Inspected = 0; n->Distance = DBL_MAX; } e->Nodes[from].Distance = 0.0; routing_heap_reset (heap); @@ -2231,19 +2509,19 @@ if (p_to->Distance == DBL_MAX) { /* queuing a new node into the heap */ p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; dijkstra_enqueue (heap, p_to); } else if (p_to->Distance > n->Distance + p_link->Cost) { /* updating an already inserted node */ p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; } } } } routing_heap_free (heap); @@ -2256,11 +2534,11 @@ /* identifying all Nodes within a given Cost range - Dijkstra's algorithm */ int from; int i; RoutingNodePtr p_to; RoutingNodePtr n; - RouteArcPtr p_link; + RouteLinkPtr p_link; int cnt; RoutingNodePtr *result; RoutingHeapPtr heap; /* setting From */ from = pfrom->InternalIndex; @@ -2269,11 +2547,11 @@ /* initializing the graph */ for (i = 0; i < e->Dim; i++) { n = e->Nodes + i; n->PreviousNode = NULL; - n->Arc = NULL; + n->xLink = NULL; n->Inspected = 0; n->Distance = DBL_MAX; } /* queuing the From node into the heap */ e->Nodes[from].Distance = 0.0; @@ -2294,20 +2572,20 @@ /* queuing a new node into the heap */ if (n->Distance + p_link->Cost <= max_cost) { p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; dijkstra_enqueue (heap, p_to); } } else if (p_to->Distance > n->Distance + p_link->Cost) { /* updating an already inserted node */ p_to->Distance = n->Distance + p_link->Cost; p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; } } } } routing_heap_free (heap); @@ -2314,10 +2592,12 @@ cnt = 0; for (i = 0; i < e->Dim; i++) { /* counting how many traversed Nodes */ n = e->Nodes + i; + if (n->Node->InternalIndex == from) + continue; if (n->Inspected) cnt++; } /* allocating the solution */ result = malloc (sizeof (RouteNodePtr) * cnt); @@ -2324,10 +2604,12 @@ cnt = 0; for (i = 0; i < e->Dim; i++) { /* populating the resultset */ n = e->Nodes + i; + if (n->Node->InternalIndex == from) + continue; if (n->Inspected) result[cnt++] = n; } *ll = cnt; return (result); @@ -2377,11 +2659,11 @@ double dy = n1->CoordY - n2->CoordY; double dist = sqrt ((dx * dx) + (dy * dy)) * coeff; return dist; } -static RouteArcPtr * +static RouteLinkPtr * astar_shortest_path (RoutingNodesPtr e, RouteNodePtr nodes, RouteNodePtr pfrom, RouteNodePtr pto, double heuristic_coeff, int *ll) { /* identifying the Shortest Path - A* algorithm */ @@ -2392,13 +2674,13 @@ RoutingNodePtr pAux; RoutingNodePtr n; RoutingNodePtr p_to; RouteNodePtr pOrg; RouteNodePtr pDest; - RouteArcPtr p_link; + RouteLinkPtr p_link; int cnt; - RouteArcPtr *result; + RouteLinkPtr *result; RoutingHeapPtr heap; /* setting From/To */ from = pfrom->InternalIndex; to = pto->InternalIndex; pAux = e->Nodes + from; @@ -2410,11 +2692,11 @@ /* initializing the graph */ for (i = 0; i < e->Dim; i++) { n = e->Nodes + i; n->PreviousNode = NULL; - n->Arc = NULL; + n->xLink = NULL; n->Inspected = 0; n->Distance = DBL_MAX; n->HeuristicDistance = DBL_MAX; } /* queuing the From node into the heap */ @@ -2446,11 +2728,11 @@ p_to->HeuristicDistance = p_to->Distance + astar_heuristic_distance (pOrg, pDest, heuristic_coeff); p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; astar_enqueue (heap, p_to); } else if (p_to->Distance > n->Distance + p_link->Cost) { /* updating an already inserted node */ @@ -2459,32 +2741,32 @@ p_to->HeuristicDistance = p_to->Distance + astar_heuristic_distance (pOrg, pDest, heuristic_coeff); p_to->PreviousNode = n; - p_to->Arc = p_link; + p_to->xLink = p_link; } } } } routing_heap_free (heap); cnt = 0; n = e->Nodes + to; while (n->PreviousNode != NULL) { - /* counting how many Arcs are into the Shortest Path solution */ + /* counting how many Links are into the Shortest Path solution */ cnt++; n = n->PreviousNode; } /* allocating the solution */ - result = malloc (sizeof (RouteArcPtr) * cnt); + result = malloc (sizeof (RouteLinkPtr) * cnt); k = cnt - 1; n = e->Nodes + to; while (n->PreviousNode != NULL) { - /* inserting an Arc into the solution */ - result[k] = n->Arc; + /* inserting a Link into the solution */ + result[k] = n->xLink; n = n->PreviousNode; k--; } *ll = cnt; return (result); @@ -2882,11 +3164,11 @@ if (pR->Undefined != NULL) free (pR->Undefined); free (pR); pR = pRn; } - pA = multiSolution->FirstArc; + pA = multiSolution->FirstLink; while (pA != NULL) { pAn = pA->Next; if (pA->Name) free (pA->Name); @@ -2940,11 +3222,11 @@ { pRn = pR->Next; free (pR); pR = pRn; } - pA = multiSolution->FirstArc; + pA = multiSolution->FirstLink; while (pA != NULL) { pAn = pA->Next; if (pA->Name) free (pA->Name); @@ -2967,12 +3249,12 @@ multiSolution->FirstNode = NULL; multiSolution->LastNode = NULL; multiSolution->CurrentRow = NULL; multiSolution->CurrentNodeRow = NULL; multiSolution->CurrentRowId = 0; - multiSolution->FirstArc = NULL; - multiSolution->LastArc = NULL; + multiSolution->FirstLink = NULL; + multiSolution->LastLink = NULL; multiSolution->FirstGeom = NULL; multiSolution->LastGeom = NULL; } static MultiSolutionPtr @@ -2989,14 +3271,228 @@ p->CurrentRow = NULL; p->FirstNode = NULL; p->LastNode = NULL; p->CurrentNodeRow = NULL; p->CurrentRowId = 0; - p->FirstArc = NULL; - p->LastArc = NULL; + p->FirstLink = NULL; + p->LastLink = NULL; p->FirstGeom = NULL; p->LastGeom = NULL; + p->RouteNum = 0; + return p; +} + +static void +delete_point2PointNode (Point2PointNodePtr p) +{ +/* deleting a Point2Point Node */ + if (p->codNode != NULL) + free (p->codNode); + free (p); +} + +static void +delete_point2PointCandidate (Point2PointCandidatePtr p) +{ +/* deleting a Point2Point candidate */ + if (p->codNodeFrom != NULL) + free (p->codNodeFrom); + if (p->codNodeTo != NULL) + free (p->codNodeTo); + if (p->path != NULL) + gaiaFreeGeomColl (p->path); + free (p); +} + +static void +delete_point2PointSolution (Point2PointSolutionPtr p2pSolution) +{ +/* deleting the current Point2Point solution */ + Point2PointCandidatePtr pC; + Point2PointCandidatePtr pCn; + Point2PointNodePtr pN; + Point2PointNodePtr pNn; + ResultsetRowPtr pR; + ResultsetRowPtr pRn; + pC = p2pSolution->firstFromCandidate; + while (pC != NULL) + { + pCn = pC->next; + delete_point2PointCandidate (pC); + pC = pCn; + } + pC = p2pSolution->firstToCandidate; + while (pC != NULL) + { + pCn = pC->next; + delete_point2PointCandidate (pC); + pC = pCn; + } + pN = p2pSolution->firstFromNode; + while (pN != NULL) + { + pNn = pN->next; + delete_point2PointNode (pN); + pN = pNn; + } + pN = p2pSolution->firstToNode; + while (pN != NULL) + { + pNn = pN->next; + delete_point2PointNode (pN); + pN = pNn; + } + pR = p2pSolution->FirstRow; + while (pR != NULL) + { + pRn = pR->Next; + if (pR->Point2PointRole == VROUTE_POINT2POINT_START + || pR->Point2PointRole == VROUTE_POINT2POINT_END) + { + /* deleting partial Links */ + if (pR->linkRef != NULL) + { + if (pR->linkRef->Link != NULL) + free (pR->linkRef->Link); + if (pR->linkRef->Name != NULL) + free (pR->linkRef->Name); + free (pR->linkRef); + } + } + if (pR->Geometry != NULL) + gaiaFreeGeomColl (pR->Geometry); + free (pR); + pR = pRn; + } + if (p2pSolution->dynLine != NULL) + gaiaFreeDynamicLine (p2pSolution->dynLine); + free (p2pSolution); +} + +static void +reset_point2PointSolution (Point2PointSolutionPtr p2pSolution) +{ +/* resetting the current solution [Point2Point] */ + Point2PointCandidatePtr pC; + Point2PointCandidatePtr pCn; + Point2PointNodePtr pN; + Point2PointNodePtr pNn; + ResultsetRowPtr pR; + ResultsetRowPtr pRn; + p2pSolution->validFrom = 0; + p2pSolution->xFrom = 0.0; + p2pSolution->yFrom = 0.0; + p2pSolution->zFrom = 0.0; + p2pSolution->validTo = 0; + p2pSolution->xTo = 0.0; + p2pSolution->yTo = 0.0; + p2pSolution->zTo = 0.0; + p2pSolution->srid = -1; + pC = p2pSolution->firstFromCandidate; + while (pC != NULL) + { + pCn = pC->next; + delete_point2PointCandidate (pC); + pC = pCn; + } + pC = p2pSolution->firstToCandidate; + while (pC != NULL) + { + pCn = pC->next; + delete_point2PointCandidate (pC); + pC = pCn; + } + p2pSolution->firstFromCandidate = NULL; + p2pSolution->lastFromCandidate = NULL; + p2pSolution->firstToCandidate = NULL; + p2pSolution->lastToCandidate = NULL; + pN = p2pSolution->firstFromNode; + while (pN != NULL) + { + pNn = pN->next; + delete_point2PointNode (pN); + pN = pNn; + } + pN = p2pSolution->firstToNode; + while (pN != NULL) + { + pNn = pN->next; + delete_point2PointNode (pN); + pN = pNn; + } + p2pSolution->firstFromNode = NULL; + p2pSolution->lastFromNode = NULL; + p2pSolution->firstToNode = NULL; + p2pSolution->lastToNode = NULL; + pR = p2pSolution->FirstRow; + while (pR != NULL) + { + pRn = pR->Next; + if (pR->Point2PointRole == VROUTE_POINT2POINT_START + || pR->Point2PointRole == VROUTE_POINT2POINT_END) + { + /* deleting partial Links */ + if (pR->linkRef != NULL) + { + if (pR->linkRef->Link != NULL) + free (pR->linkRef->Link); + if (pR->linkRef->Name != NULL) + free (pR->linkRef->Name); + free (pR->linkRef); + } + } + if (pR->Geometry != NULL) + gaiaFreeGeomColl (pR->Geometry); + free (pR); + pR = pRn; + } + p2pSolution->FirstRow = NULL; + p2pSolution->LastRow = NULL; + p2pSolution->CurrentRow = NULL; + p2pSolution->CurrentRowId = 0; + p2pSolution->totalCost = DBL_MAX; + p2pSolution->fromCandidate = NULL; + p2pSolution->toCandidate = NULL; + if (p2pSolution->dynLine != NULL) + gaiaFreeDynamicLine (p2pSolution->dynLine); + p2pSolution->dynLine = NULL; + p2pSolution->hasZ = 0; + p2pSolution->Mode = VROUTE_POINT2POINT_ERROR; +} + +static Point2PointSolutionPtr +alloc_point2PointSolution (void) +{ +/* allocates and initializes the current Point2Point solution */ + Point2PointSolutionPtr p = malloc (sizeof (Point2PointSolution)); + p->validFrom = 0; + p->xFrom = 0.0; + p->yFrom = 0.0; + p->zFrom = 0.0; + p->validTo = 0; + p->xTo = 0.0; + p->yTo = 0.0; + p->zTo = 0.0; + p->srid = -1; + p->firstFromCandidate = NULL; + p->lastFromCandidate = NULL; + p->firstToCandidate = NULL; + p->lastToCandidate = NULL; + p->firstFromNode = NULL; + p->lastFromNode = NULL; + p->firstToNode = NULL; + p->lastToNode = NULL; + p->FirstRow = NULL; + p->LastRow = NULL; + p->CurrentRow = NULL; + p->CurrentRowId = 0; + p->totalCost = DBL_MAX; + p->fromCandidate = NULL; + p->toCandidate = NULL; + p->dynLine = NULL; + p->hasZ = 0; + p->Mode = VROUTE_POINT2POINT_ERROR; return p; } static int find_srid (sqlite3 * handle, RoutingPtr graph) @@ -3071,11 +3567,11 @@ astar_solve (sqlite3 * handle, int options, RoutingPtr graph, RoutingNodesPtr routing, MultiSolutionPtr multiSolution) { /* computing an A* Shortest Path solution */ int cnt; - RouteArcPtr *shortest_path; + RouteLinkPtr *shortest_path; ShortestPathSolutionPtr solution; RouteNodePtr to = findSingleTo (multiSolution->MultiTo); if (to == NULL) return; shortest_path = @@ -3091,37 +3587,67 @@ RoutingNodesPtr routing, MultiSolutionPtr multiSolution) { /* computing a Dijkstra Shortest Path multiSolution */ int i; RoutingMultiDestPtr multiple = multiSolution->MultiTo; + int node_code = graph->NodeCode; dijkstra_multi_shortest_path (handle, options, graph, routing, multiSolution); /* testing if there are undefined or unresolved destinations */ for (i = 0; i < multiple->Items; i++) { - int len; ShortestPathSolutionPtr row; RouteNodePtr to = *(multiple->To + i); - const char *code = *(multiple->Codes + i); - if (to == NULL) - { - row = - add2multiSolution (multiSolution, multiSolution->From, - NULL); - len = strlen (code); - row->Undefined = malloc (len + 1); - strcpy (row->Undefined, code); - continue; - } - if (*(multiple->Found + i) != 'Y') - { - row = - add2multiSolution (multiSolution, multiSolution->From, to); - len = strlen (code); - row->Undefined = malloc (len + 1); - strcpy (row->Undefined, code); + if (node_code) + { + /* Nodes are identified by Codes */ + int len; + const char *code = *(multiple->Codes + i); + if (to == NULL) + { + row = + add2multiSolution (multiSolution, multiSolution->From, + NULL); + len = strlen (code); + row->Undefined = malloc (len + 1); + strcpy (row->Undefined, code); + continue; + } + if (*(multiple->Found + i) != 'Y') + { + row = + add2multiSolution (multiSolution, multiSolution->From, + to); + len = strlen (code); + row->Undefined = malloc (len + 1); + strcpy (row->Undefined, code); + } + } + else + { + /* Nodes are identified by Ids */ + sqlite3_int64 id = *(multiple->Ids + i); + if (to == NULL) + { + row = + add2multiSolution (multiSolution, multiSolution->From, + NULL); + row->Undefined = malloc (4); + strcpy (row->Undefined, "???"); + row->UndefinedId = id; + continue; + } + if (*(multiple->Found + i) != 'Y') + { + row = + add2multiSolution (multiSolution, multiSolution->From, + to); + row->Undefined = malloc (4); + strcpy (row->Undefined, "???"); + row->UndefinedId = id; + } } } build_multi_solution (multiSolution); } @@ -3150,11 +3676,11 @@ /* checking for undefined targets */ if (*(targets->To + i) == NULL) goto illegal; } dijkstra_tsp_nn (handle, options, graph, routing, targets); - build_tsp_solution (multiSolution, targets); + build_tsp_solution (multiSolution, targets, graph->Srid); destroy_tsp_targets (targets); return; illegal: build_tsp_illegal_solution (multiSolution, targets); @@ -3781,13 +4307,13 @@ else *(targets->Solutions + j) = newSolution; old = solution->First; while (old != NULL) { - /* inserts an Arc into the Shortest Path solution */ + /* inserts a Link into the Shortest Path solution */ RowSolutionPtr p = malloc (sizeof (RowSolution)); - p->Arc = old->Arc; + p->Link = old->Link; p->Name = old->Name; old->Name = NULL; p->Next = NULL; if (!(newSolution->First)) newSolution->First = p; @@ -4224,11 +4750,11 @@ targets = build_tsp_ga_solution_targets (multiSolution->MultiTo->Items, multiSolution->From); set_tsp_ga_targets (handle, options, graph, routing, bestSolution, targets); - build_tsp_solution (multiSolution, targets); + build_tsp_solution (multiSolution, targets, graph->Srid); destroy_tsp_targets (targets); } destroy_tsp_ga_population (ga); return; @@ -4247,12 +4773,12 @@ for (i = 0; i < p->NumNodes; i++) { pN = p->Nodes + i; if (pN->Code) free (pN->Code); - if (pN->Arcs) - free (pN->Arcs); + if (pN->Links) + free (pN->Links); } if (p->Nodes) free (p->Nodes); if (p->TableName) free (p->TableName); @@ -4283,10 +4809,11 @@ const char *to; const char *geom; const char *name = NULL; double a_star_coeff = 1.0; int len; + int i; const unsigned char *ptr; if (size < 9) return NULL; if (*(blob + 0) == GAIA_NET_START) /* signature - legacy format using 32bit ints */ net64 = 0; @@ -4366,10 +4893,16 @@ graph->CurrentIndex = 0; graph->NodeCode = node_code; graph->MaxCodeLength = max_code_length; graph->NumNodes = nodes; graph->Nodes = malloc (sizeof (RouteNode) * nodes); + for (i = 0; i < nodes; i++) + { + graph->Nodes[i].Code = NULL; + graph->Nodes[i].NumLinks = 0; + graph->Nodes[i].Links = NULL; + } len = strlen (table); graph->TableName = malloc (len + 1); strcpy (graph->TableName, table); len = strlen (from); graph->FromColumn = malloc (len + 1); @@ -4412,27 +4945,28 @@ const unsigned char *in = blob; int nodes; int i; int ia; int index; - char code[256]; + char *code = NULL; double x; double y; sqlite3_int64 nodeId = -1; - int arcs; + int links; RouteNodePtr pN; - RouteArcPtr pA; + RouteLinkPtr pA; int len; - sqlite3_int64 arcId; + sqlite3_int64 linkId; int nodeToIdx; double cost; if (size < 3) goto error; if (*in++ != GAIA_NET_BLOCK) /* signature */ goto error; nodes = gaiaImport16 (in, 1, graph->EndianArch); /* # Nodes */ in += 2; + code = malloc (graph->MaxCodeLength + 1); for (i = 0; i < nodes; i++) { /* parsing each node */ if ((size - (in - blob)) < 5) goto error; @@ -4446,10 +4980,11 @@ { /* Nodes are identified by a TEXT Code */ if ((size - (in - blob)) < graph->MaxCodeLength) goto error; memcpy (code, in, graph->MaxCodeLength); + *(code + graph->MaxCodeLength) = '\0'; in += graph->MaxCodeLength; } else { /* Nodes are identified by an INTEGER Id */ @@ -4485,13 +5020,13 @@ x = DBL_MAX; y = DBL_MAX; } if ((size - (in - blob)) < 2) goto error; - arcs = gaiaImport16 (in, 1, graph->EndianArch); /* # Arcs */ + links = gaiaImport16 (in, 1, graph->EndianArch); /* # Links */ in += 2; - if (arcs < 0) + if (links < 0) goto error; /* initializing the Node */ pN = graph->Nodes + index; pN->InternalIndex = index; if (graph->NodeCode) @@ -4508,18 +5043,18 @@ pN->Id = nodeId; pN->Code = NULL; } pN->CoordX = x; pN->CoordY = y; - pN->NumArcs = arcs; - if (arcs) + pN->NumLinks = links; + if (links) { - /* parsing the Arcs */ - pN->Arcs = malloc (sizeof (RouteArc) * arcs); - for (ia = 0; ia < arcs; ia++) + /* parsing the Links */ + pN->Links = malloc (sizeof (RouteLink) * links); + for (ia = 0; ia < links; ia++) { - /* parsing each Arc */ + /* parsing each Link */ if (graph->Net64) { if ((size - (in - blob)) < 22) goto error; } @@ -4530,43 +5065,46 @@ } if (*in++ != GAIA_NET_ARC) /* signature */ goto error; if (graph->Net64) { - arcId = gaiaImportI64 (in, 1, graph->EndianArch); /* # Arc ROWID: 64bit */ + linkId = gaiaImportI64 (in, 1, graph->EndianArch); /* # Link ROWID: 64bit */ in += 8; } else { - arcId = gaiaImport32 (in, 1, graph->EndianArch); /* # Arc ROWID: 32bit */ + linkId = gaiaImport32 (in, 1, graph->EndianArch); /* # Link ROWID: 32bit */ in += 4; } nodeToIdx = gaiaImport32 (in, 1, graph->EndianArch); /* # NodeTo internal index */ in += 4; cost = gaiaImport64 (in, 1, graph->EndianArch); /* # Cost */ in += 8; if (*in++ != GAIA_NET_END) /* signature */ goto error; - pA = pN->Arcs + ia; - /* initializing the Arc */ + pA = pN->Links + ia; + /* initializing the Link */ if (nodeToIdx < 0 || nodeToIdx >= graph->NumNodes) goto error; pA->NodeFrom = pN; pA->NodeTo = graph->Nodes + nodeToIdx; - pA->ArcRowid = arcId; + pA->LinkRowid = linkId; pA->Cost = cost; } } else - pN->Arcs = NULL; + pN->Links = NULL; if ((size - (in - blob)) < 1) goto error; if (*in++ != GAIA_NET_END) /* signature */ goto error; } + free (code); return 1; error: + if (code != NULL) + free (code); return 0; } static RoutingPtr load_network (sqlite3 * handle, const char *table) @@ -4578,10 +5116,11 @@ int ret; int header = 1; const unsigned char *blob; int size; char *xname; + int srid; xname = gaiaDoubleQuotedSql (table); sql = sqlite3_mprintf ("SELECT NetworkData FROM \"%s\" ORDER BY Id", xname); free (xname); ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); sqlite3_free (sql); @@ -4631,15 +5170,1752 @@ sqlite3_finalize (stmt); goto abort; } } sqlite3_finalize (stmt); + srid = find_srid (handle, graph); + graph->Srid = srid; return graph; abort: network_free (graph); return NULL; } + +static void +set_multi_by_id (RoutingMultiDestPtr multiple, RoutingPtr graph) +{ +// setting Node pointers to multiple destinations */ + int i; + for (i = 0; i < multiple->Items; i++) + { + sqlite3_int64 id = *(multiple->Ids + i); + if (id >= 1) + *(multiple->To + i) = find_node_by_id (graph, id); + } +} + +static void +set_multi_by_code (RoutingMultiDestPtr multiple, RoutingPtr graph) +{ +// setting Node pointers to multiple destinations */ + int i; + for (i = 0; i < multiple->Items; i++) + { + const char *code = *(multiple->Codes + i); + if (code != NULL) + *(multiple->To + i) = find_node_by_code (graph, code); + } +} + +static int +do_check_valid_point (gaiaGeomCollPtr geom, int srid) +{ +/* checking for a valid Point geometry */ + if (geom == NULL) + return 0; + if (geom->FirstLinestring != NULL) + return 0; + if (geom->FirstPolygon != NULL) + return 0; + if (geom->FirstPoint == NULL) + return 0; + if (geom->FirstPoint != geom->LastPoint) + return 0; + if (geom->Srid != srid) + return 0; + return 1; +} + +static void +add_by_code_to_point2point (virtualroutingPtr net, sqlite3_int64 rowid, + const char *node_from, const char *node_to, + int reverse, int mode) +{ +/* adding to the Point2Point list a new candidate */ + int len; + Point2PointSolutionPtr p2p = net->point2PointSolution; + Point2PointCandidatePtr p = malloc (sizeof (Point2PointCandidate)); + p->linkRowid = rowid; + len = strlen (node_from); + p->codNodeFrom = malloc (len + 1); + strcpy (p->codNodeFrom, node_from); + len = strlen (node_to); + p->codNodeTo = malloc (len + 1); + strcpy (p->codNodeTo, node_to); + p->reverse = reverse; + p->valid = 0; + p->path = NULL; + p->pathLen = 0.0; + p->extraLen = 0.0; + p->percent = 0.0; + p->next = NULL; +/* adding to the list */ + if (mode == VROUTE_POINT2POINT_FROM) + { + if (p2p->firstFromCandidate == NULL) + p2p->firstFromCandidate = p; + if (p2p->lastFromCandidate != NULL) + p2p->lastFromCandidate->next = p; + p2p->lastFromCandidate = p; + } + else + { + if (p2p->firstToCandidate == NULL) + p2p->firstToCandidate = p; + if (p2p->lastToCandidate != NULL) + p2p->lastToCandidate->next = p; + p2p->lastToCandidate = p; + } +} + +static int +do_check_by_code_point2point_oneway (RoutingPtr graph, sqlite3_int64 rowid, + const char *node_from, const char *node_to) +{ +/* checking if the Link do really joins the two nodes */ + int j; + RouteNodePtr node = find_node_by_code (graph, node_from); + if (node == NULL) + return 0; + for (j = 0; j < node->NumLinks; j++) + { + RouteLinkPtr link = &(node->Links[j]); + if (strcmp (link->NodeFrom->Code, node_from) == 0 + && strcmp (link->NodeTo->Code, node_to) == 0 + && link->LinkRowid == rowid) + return 1; + } + return 0; +} + +static int +do_check_by_id_point2point_oneway (RoutingPtr graph, sqlite3_int64 rowid, + sqlite3_int64 node_from, + sqlite3_int64 node_to) +{ +/* checking if the Link do really joins the two nodes */ + int j; + RouteNodePtr node = find_node_by_id (graph, node_from); + if (node == NULL) + return 0; + for (j = 0; j < node->NumLinks; j++) + { + RouteLinkPtr link = &(node->Links[j]); + if (link->NodeFrom->Id == node_from && link->NodeTo->Id == node_to + && link->LinkRowid == rowid) + return 1; + } + return 0; +} + +static void +add_by_id_to_point2point (virtualroutingPtr net, sqlite3_int64 rowid, + sqlite_int64 node_from, sqlite3_int64 node_to, + int reverse, int mode) +{ +/* adding to the Point2Point list a new candidate */ + Point2PointSolutionPtr p2p = net->point2PointSolution; + Point2PointCandidatePtr p = malloc (sizeof (Point2PointCandidate)); + p->linkRowid = rowid; + p->codNodeFrom = NULL; + p->codNodeTo = NULL; + p->idNodeFrom = node_from; + p->idNodeTo = node_to; + p->reverse = reverse; + p->valid = 0; + p->path = NULL; + p->pathLen = 0.0; + p->extraLen = 0.0; + p->percent = 0.0; + p->next = NULL; +/* adding to the list */ + if (mode == VROUTE_POINT2POINT_FROM) + { + if (p2p->firstFromCandidate == NULL) + p2p->firstFromCandidate = p; + if (p2p->lastFromCandidate != NULL) + p2p->lastFromCandidate->next = p; + p2p->lastFromCandidate = p; + } + else + { + if (p2p->firstToCandidate == NULL) + p2p->firstToCandidate = p; + if (p2p->lastToCandidate != NULL) + p2p->lastToCandidate->next = p; + p2p->lastToCandidate = p; + } +} + +static int +do_prepare_point (virtualroutingPtr net, int mode) +{ +/* preparing a Point for Point2Point */ + RoutingPtr graph = net->graph; + Point2PointSolutionPtr p2p = net->point2PointSolution; + char *xfrom; + char *xto; + char *xtable; + char *xgeom; + char *sql; + int ret; + int ok = 0; + sqlite3 *sqlite = net->db; + sqlite3_stmt *stmt = NULL; + + xfrom = gaiaDoubleQuotedSql (graph->FromColumn); + xto = gaiaDoubleQuotedSql (graph->ToColumn); + xtable = gaiaDoubleQuotedSql (graph->TableName); + xgeom = gaiaDoubleQuotedSql (graph->GeometryColumn); + sql = sqlite3_mprintf ("SELECT r.rowid, r.\"%s\", r.\"%s\", " + "ST_Distance(p.geom, r.\"%s\") AS dist " + "FROM \"%s\" AS r, (SELECT MakePoint(?, ?) AS geom) AS p " + "WHERE dist <= ? AND r.rowid IN " + "(SELECT rowid FROM SpatialIndex WHERE f_table_name = %Q AND " + "f_geometry_column = %Q AND search_frame = BuildCircleMBR(?, ?, ?)) " + "ORDER BY dist LIMIT 4", xfrom, xto, xgeom, xtable, + graph->TableName, graph->GeometryColumn); + free (xfrom); + free (xto); + free (xtable); + free (xgeom); + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + if (mode == VROUTE_POINT2POINT_FROM) + { + sqlite3_bind_double (stmt, 1, p2p->xFrom); + sqlite3_bind_double (stmt, 2, p2p->yFrom); + sqlite3_bind_double (stmt, 3, net->Tolerance); + sqlite3_bind_double (stmt, 4, p2p->xFrom); + sqlite3_bind_double (stmt, 5, p2p->yFrom); + sqlite3_bind_double (stmt, 6, net->Tolerance); + } + else + { + sqlite3_bind_double (stmt, 1, p2p->xTo); + sqlite3_bind_double (stmt, 2, p2p->yTo); + sqlite3_bind_double (stmt, 3, net->Tolerance); + sqlite3_bind_double (stmt, 4, p2p->xTo); + sqlite3_bind_double (stmt, 5, p2p->yTo); + sqlite3_bind_double (stmt, 6, net->Tolerance); + } + 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 ok_node_from = 0; + int ok_node_to = 0; + const char *cod_node_from; + const char *cod_node_to; + sqlite3_int64 id_node_from; + sqlite3_int64 id_node_to; + + sqlite3_int64 rowid = sqlite3_column_int64 (stmt, 0); + if (graph->NodeCode) + { + if (sqlite3_column_type (stmt, 1) == SQLITE_TEXT) + { + ok_node_from = 1; + cod_node_from = + (const char *) sqlite3_column_text (stmt, 1); + } + if (sqlite3_column_type (stmt, 2) == SQLITE_TEXT) + { + ok_node_to = 1; + cod_node_to = + (const char *) sqlite3_column_text (stmt, 2); + } + } + else + { + if (sqlite3_column_type (stmt, 1) == SQLITE_INTEGER) + { + ok_node_from = 1; + id_node_from = sqlite3_column_int64 (stmt, 1); + } + if (sqlite3_column_type (stmt, 2) == SQLITE_INTEGER) + { + ok_node_to = 1; + id_node_to = sqlite3_column_int64 (stmt, 2); + } + } + if (ok_node_from && ok_node_to) + { + if (graph->NodeCode) + { + /* direct connection */ + if (do_check_by_code_point2point_oneway + (graph, rowid, cod_node_from, cod_node_to)) + { + add_by_code_to_point2point (net, rowid, + cod_node_from, + cod_node_to, 0, + mode); + ok = 1; + } + /* reverse connection */ + if (do_check_by_code_point2point_oneway + (graph, rowid, cod_node_to, cod_node_from)) + { + add_by_code_to_point2point (net, rowid, + cod_node_to, + cod_node_from, 1, + mode); + ok = 1; + } + } + else + { + /* direct connection */ + if (do_check_by_id_point2point_oneway + (graph, rowid, id_node_from, id_node_to)) + { + add_by_id_to_point2point (net, rowid, + id_node_from, + id_node_to, 0, + mode); + ok = 1; + } + /* reverse connection */ + if (do_check_by_id_point2point_oneway + (graph, rowid, id_node_to, id_node_from)) + { + add_by_id_to_point2point (net, rowid, + id_node_to, + id_node_from, 1, + mode); + ok = 1; + } + } + } + } + } + sqlite3_finalize (stmt); + return ok; +} + +static int +build_ingress_path (virtualroutingPtr net, double xFrom, double yFrom, + Point2PointCandidatePtr ptr, int srid) +{ +/* Point2Point - attempting to build an Ingress Path */ + RoutingPtr graph = net->graph; + char *sql; + char *xtable; + char *xgeom; + sqlite3 *sqlite = net->db; + sqlite3_stmt *stmt = NULL; + int ret; + int ok = 0; + double percent; + double length; + gaiaGeomCollPtr geom = NULL; + int is_geographic = 0; + + if (!srid_is_geographic (sqlite, srid, &is_geographic)) + return 0; + +/* locating the insertion point */ + xtable = gaiaDoubleQuotedSql (graph->TableName); + xgeom = gaiaDoubleQuotedSql (graph->GeometryColumn); + if (ptr->reverse) + sql = + sqlite3_mprintf ("SELECT ST_Line_Locate_Point(ST_Reverse(\"%s\"), " + "MakePoint(?, ?)) FROM \"%s\" WHERE rowid = ?", + xgeom, xtable); + else + sql = sqlite3_mprintf ("SELECT ST_Line_Locate_Point(\"%s\", " + "MakePoint(?, ?)) FROM \"%s\" WHERE rowid = ?", + xgeom, xtable); + free (xgeom); + free (xtable); + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, xFrom); + sqlite3_bind_double (stmt, 2, yFrom); + sqlite3_bind_int64 (stmt, 3, ptr->linkRowid); + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + percent = sqlite3_column_double (stmt, 0); + ok = 1; + } + } + sqlite3_finalize (stmt); + if (!ok) + return 0; + if (percent >= 1.0) + { + /* special case: the insertion point is the End Node */ + ptr->valid = 1; + return 1; + } + +/* determining the ingress path */ + xtable = gaiaDoubleQuotedSql (graph->TableName); + xgeom = gaiaDoubleQuotedSql (graph->GeometryColumn); + if (is_geographic) + { + if (ptr->reverse) + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom, 1) FROM " + "(SELECT ST_Line_Substring(ST_Reverse(\"%s\"), ?, 100.0) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + else + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom, 1) FROM " + "(SELECT ST_Line_Substring(\"%s\", ?, 100.0) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + } + else + { + if (ptr->reverse) + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom) FROM " + "(SELECT ST_Line_Substring(ST_Reverse(\"%s\"), ?, 100.0) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + else + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom) FROM " + "(SELECT ST_Line_Substring(\"%s\", ?, 100.0) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + } + free (xgeom); + free (xtable); + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, percent); + sqlite3_bind_int64 (stmt, 2, ptr->linkRowid); + 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 (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) + { + const unsigned char *blob = sqlite3_column_blob (stmt, 0); + int size = sqlite3_column_bytes (stmt, 0); + geom = gaiaFromSpatiaLiteBlobWkb (blob, size); + if (geom != NULL) + { + gaiaLinestringPtr ln = geom->FirstLinestring; + double x; + double y; + double z; + double m; + if (ln->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln->Coords, 0, &x, &y, &z); + } + else if (ln->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln->Coords, 0, &x, &y, &m); + } + else if (ln->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln->Coords, 0, &x, &y, + &z, &m); + } + else + { + gaiaGetPoint (ln->Coords, 0, &x, &y); + } + length = sqlite3_column_double (stmt, 1); + ptr->path = geom; + ptr->pathLen = length; + if (x == xFrom && y == yFrom) + ; + else + { + length = + sqrt (((x - xFrom) * (x - xFrom)) + + ((y - yFrom) * (y - yFrom))); + ptr->extraLen = length; + } + ptr->valid = 1; + } + } + } + } + sqlite3_finalize (stmt); + + return 1; +} + +static int +build_egress_path (virtualroutingPtr net, double xTo, double yTo, + Point2PointCandidatePtr ptr, int srid) +{ +/* Point2Point - attempting to build an Egress Path */ + RoutingPtr graph = net->graph; + char *sql; + char *xtable; + char *xgeom; + sqlite3 *sqlite = net->db; + sqlite3_stmt *stmt = NULL; + int ret; + int ok = 0; + double percent; + double length; + gaiaGeomCollPtr geom = NULL; + int is_geographic = 0; + + if (!srid_is_geographic (sqlite, srid, &is_geographic)) + return 0; + +/* locating the insertion point */ + xtable = gaiaDoubleQuotedSql (graph->TableName); + xgeom = gaiaDoubleQuotedSql (graph->GeometryColumn); + if (ptr->reverse) + sql = + sqlite3_mprintf ("SELECT ST_Line_Locate_Point(ST_Reverse(\"%s\"), " + "MakePoint(?, ?)) FROM \"%s\" WHERE rowid = ?", + xgeom, xtable); + else + sql = sqlite3_mprintf ("SELECT ST_Line_Locate_Point(\"%s\", " + "MakePoint(?, ?)) FROM \"%s\" WHERE rowid = ?", + xgeom, xtable); + free (xgeom); + free (xtable); + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, xTo); + sqlite3_bind_double (stmt, 2, yTo); + sqlite3_bind_int64 (stmt, 3, ptr->linkRowid); + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + percent = sqlite3_column_double (stmt, 0); + ok = 1; + } + } + sqlite3_finalize (stmt); + if (!ok) + return 0; + if (percent >= 1.0) + { + /* special case: the insertion point is the End Node */ + ptr->valid = 1; + return 1; + } + +/* determining the egress path */ + xtable = gaiaDoubleQuotedSql (graph->TableName); + xgeom = gaiaDoubleQuotedSql (graph->GeometryColumn); + if (is_geographic) + { + if (ptr->reverse) + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom, 1) FROM " + "(SELECT ST_Line_Substring(ST_Reverse(\"%s\"), 0.0, ?) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + else + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom, 1) FROM " + "(SELECT ST_Line_Substring(\"%s\", 0.0, ?) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + } + else + { + if (ptr->reverse) + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom) FROM " + "(SELECT ST_Line_Substring(ST_Reverse(\"%s\"), 0.0, ?) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + else + sql = sqlite3_mprintf ("SELECT g.geom, ST_Length(g.geom) FROM " + "(SELECT ST_Line_Substring(\"%s\", 0.0, ?) AS geom " + "FROM \"%s\" WHERE rowid = ?) AS g", xgeom, + xtable); + } + free (xgeom); + free (xtable); + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_double (stmt, 1, percent); + sqlite3_bind_int64 (stmt, 2, ptr->linkRowid); + 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 (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) + { + const unsigned char *blob = sqlite3_column_blob (stmt, 0); + int size = sqlite3_column_bytes (stmt, 0); + geom = gaiaFromSpatiaLiteBlobWkb (blob, size); + if (geom != NULL) + { + gaiaLinestringPtr ln = geom->FirstLinestring; + double x; + double y; + double z; + double m; + int last_pt = ln->Points - 1; + if (ln->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln->Coords, last_pt, &x, &y, + &z); + } + else if (ln->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln->Coords, last_pt, &x, &y, + &m); + } + else if (ln->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln->Coords, last_pt, &x, &y, + &z, &m); + } + else + { + gaiaGetPoint (ln->Coords, last_pt, &x, &y); + } + length = sqlite3_column_double (stmt, 1); + ptr->path = geom; + ptr->pathLen = length; + if (x == xTo && y == yTo) + ; + else + { + length = + sqrt (((x - xTo) * (x - xTo)) + + ((y - yTo) * (y - yTo))); + ptr->extraLen = length; + } + ptr->valid = 1; + } + } + } + } + sqlite3_finalize (stmt); + + return 1; +} + +static int +do_define_ingress_paths (virtualroutingPtr net) +{ +/* Point2Point - defining all Ingress Paths */ + Point2PointSolutionPtr p2p = net->point2PointSolution; + Point2PointCandidatePtr ptr; + + ptr = p2p->firstFromCandidate; + while (ptr != NULL) + { + if (!build_ingress_path (net, p2p->xFrom, p2p->yFrom, ptr, p2p->srid)) + return 0; + ptr = ptr->next; + } + return 1; +} + +static int +do_define_egress_paths (virtualroutingPtr net) +{ +/* Point2Point - defining all Egress Paths */ + Point2PointSolutionPtr p2p = net->point2PointSolution; + Point2PointCandidatePtr ptr; + + ptr = p2p->firstToCandidate; + while (ptr != NULL) + { + if (!build_egress_path (net, p2p->xTo, p2p->yTo, ptr, p2p->srid)) + return 0; + ptr = ptr->next; + } + return 1; +} + +static void +add_point2point_node_from_by_code (Point2PointSolutionPtr p2p, const char *node, + Point2PointCandidatePtr parent) +{ +/* adding to the Point2Point FromNodes list (if not already defined) */ + int len; + Point2PointNodePtr p = p2p->firstFromNode; + while (p != NULL) + { + if (strcmp (p->codNode, node) == 0) + { + /* already defined */ + return; + } + p = p->next; + } + +/* adding the Node */ + p = malloc (sizeof (Point2PointNode)); + len = strlen (node); + p->codNode = malloc (len + 1); + strcpy (p->codNode, node); + p->parent = parent; + p->next = NULL; + if (p2p->firstFromNode == NULL) + p2p->firstFromNode = p; + if (p2p->lastFromNode != NULL) + p2p->lastFromNode->next = p; + p2p->lastFromNode = p; +} + +static void +add_point2point_node_from_by_id (Point2PointSolutionPtr p2p, sqlite3_int64 id, + Point2PointCandidatePtr parent) +{ +/* adding to the Point2Point FromNodes list (if not already defined) */ + Point2PointNodePtr p = p2p->firstFromNode; + while (p != NULL) + { + if (p->idNode == id) + { + /* already defined */ + return; + } + p = p->next; + } + +/* adding the Node */ + p = malloc (sizeof (Point2PointNode)); + p->idNode = id; + p->codNode = NULL; + p->parent = parent; + p->next = NULL; + if (p2p->firstFromNode == NULL) + p2p->firstFromNode = p; + if (p2p->lastFromNode != NULL) + p2p->lastFromNode->next = p; + p2p->lastFromNode = p; +} + +static void +add_point2point_node_to_by_code (Point2PointSolutionPtr p2p, const char *node, + Point2PointCandidatePtr parent) +{ +/* adding to the Point2Point ToNodes list (if not already defined) */ + int len; + Point2PointNodePtr p = p2p->firstToNode; + while (p != NULL) + { + if (strcmp (p->codNode, node) == 0) + { + /* already defined */ + return; + } + p = p->next; + } + +/* adding the Node */ + p = malloc (sizeof (Point2PointNode)); + len = strlen (node); + p->codNode = malloc (len + 1); + strcpy (p->codNode, node); + p->parent = parent; + p->next = NULL; + if (p2p->firstToNode == NULL) + p2p->firstToNode = p; + if (p2p->lastToNode != NULL) + p2p->lastToNode->next = p; + p2p->lastToNode = p; +} + +static void +add_point2point_node_to_by_id (Point2PointSolutionPtr p2p, sqlite3_int64 id, + Point2PointCandidatePtr parent) +{ +/* adding to the Point2Point ToNodes list (if not already defined) */ + Point2PointNodePtr p = p2p->firstToNode; + while (p != NULL) + { + if (p->idNode == id) + { + /* already defined */ + return; + } + p = p->next; + } + +/* adding the Node */ + p = malloc (sizeof (Point2PointNode)); + p->idNode = id; + p->codNode = NULL; + p->parent = parent; + p->next = NULL; + if (p2p->firstToNode == NULL) + p2p->firstToNode = p; + if (p2p->lastToNode != NULL) + p2p->lastToNode->next = p; + p2p->lastToNode = p; +} + +static void +point2point_eval_solution (Point2PointSolutionPtr p2p, + ShortestPathSolutionPtr solution, int nodeCode) +{ +/* attempting to identify the optimal Point2Point solution */ + Point2PointCandidatePtr p_from = p2p->firstFromCandidate; + while (p_from != NULL) + { + /* searching FROM candidates */ + int ok = 0; + if (nodeCode) + { + if (strcmp (solution->From->Code, p_from->codNodeTo) == 0) + ok = 1; + } + else + { + if (solution->From->Id == p_from->idNodeTo) + ok = 1; + } + if (ok) + { + Point2PointCandidatePtr p_to = p2p->firstToCandidate; + while (p_to != NULL) + { + /* searching TO candidates */ + int ok2 = 0; + if (nodeCode) + { + if (strcmp (solution->To->Code, p_to->codNodeFrom) + == 0) + ok2 = 1; + } + else + { + if (solution->To->Id == p_to->idNodeFrom) + ok2 = 1; + } + if (ok2) + { + double tot = + solution->TotalCost + p_from->pathLen + + p_from->extraLen + p_to->pathLen + + p_to->extraLen; + if (tot < p2p->totalCost) + { + /* saving a better solution */ + p2p->totalCost = tot; + p2p->fromCandidate = p_from; + p2p->toCandidate = p_to; + return; + } + } + p_to = p_to->next; + } + } + p_from = p_from->next; + } +} + +static RouteLinkPtr +find_link (sqlite3 * sqlite, RoutingPtr graph, sqlite3_int64 linkRowid) +{ +/* attempting to create a partial Link object */ + int ret; + char *sql; + char *xfrom; + char *xto; + char *xtable; + sqlite3_stmt *stmt = NULL; + RouteLinkPtr ptr = NULL; + + xfrom = gaiaDoubleQuotedSql (graph->FromColumn); + xto = gaiaDoubleQuotedSql (graph->ToColumn); + xtable = gaiaDoubleQuotedSql (graph->TableName); + sql = + sqlite3_mprintf ("SELECT \"%s\", \"%s\" FROM \"%s\" WHERE ROWID = ?", + xfrom, xto, xtable); + free (xfrom); + free (xto); + free (xtable); + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + goto stop; + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_int64 (stmt, 1, linkRowid); + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + RouteNodePtr from = NULL; + RouteNodePtr to = NULL; + if (graph->NodeCode) + { + /* nodes are identified by TEXT codes */ + char *code; + if (sqlite3_column_type (stmt, 0) == SQLITE_TEXT) + { + code = (char *) sqlite3_column_text (stmt, 0); + from = find_node_by_code (graph, code); + } + if (sqlite3_column_type (stmt, 1) == SQLITE_TEXT) + { + code = (char *) sqlite3_column_text (stmt, 1); + to = find_node_by_code (graph, code); + } + } + else + { + sqlite3_int64 id; + /* nodes are identified by INTEGER ids */ + if (sqlite3_column_type (stmt, 0) == SQLITE_INTEGER) + { + id = sqlite3_column_int64 (stmt, 0); + from = find_node_by_id (graph, id); + } + if (sqlite3_column_type (stmt, 1) == SQLITE_INTEGER) + { + id = sqlite3_column_int64 (stmt, 1); + to = find_node_by_id (graph, id); + } + } + if (from != NULL && to != NULL) + { + if (ptr != NULL) + free (ptr); + ptr = malloc (sizeof (RouteLink)); + ptr->NodeFrom = from; + ptr->NodeTo = to; + ptr->LinkRowid = linkRowid; + ptr->Cost = 0.0; + } + } + } + sqlite3_finalize (stmt); + return ptr; + + stop: + if (stmt != NULL) + sqlite3_finalize (stmt); + return ptr; +} + +static int +add2DynLine (gaiaDynamicLinePtr dyn, gaiaGeomCollPtr geom, int reverse, + double extra, double cost) +{ +/* adding points from Linestring to Dynamic line */ + int iv; + int has_z = 0; + double startCost; + double endCost; + gaiaGeomCollPtr geo2; + + /* interpolating M-Values */ + if (dyn->Last == NULL) + startCost = 0.0; + else + startCost = dyn->Last->M + extra; + endCost = startCost + cost; + if (reverse) + geo2 = gaiaAddMeasure (geom, endCost, startCost); + else + geo2 = gaiaAddMeasure (geom, startCost, endCost); + + gaiaLinestringPtr line = geo2->FirstLinestring; + if (reverse) + { + /* reverse direction */ + for (iv = line->Points - 1; iv >= 0; iv--) + if (addPoint2DynLine + (line->Coords, line->DimensionModel, iv, dyn, 0.0)) + has_z = 1; + } + else + { + /* natural direction */ + for (iv = 0; iv < line->Points; iv++) + if (addPoint2DynLine + (line->Coords, line->DimensionModel, iv, dyn, 0.0)) + has_z = 1; + } + gaiaFreeGeomColl (geo2); + return has_z; +} + +static void +build_point2point_solution (sqlite3 * sqlite, int options, RoutingPtr graph, + Point2PointSolutionPtr p2p) +{ +/* fully completing a Point2Point Solution */ + ResultsetRowPtr row; + int error = 0; + + if (options == VROUTE_SHORTEST_PATH_SIMPLE) + return; + if (graph->GeometryColumn == NULL && graph->NameColumn == NULL) + return; + if (options == VROUTE_SHORTEST_PATH_NO_GEOMS && graph->NameColumn == NULL) + return; + + if (options == VROUTE_SHORTEST_PATH_NO_GEOMS + || graph->GeometryColumn == NULL) + ; + else + { + /* preparing the Dynamic Line - result path */ + p2p->dynLine = gaiaAllocDynamicLine (); + } + + row = p2p->FirstRow; + while (row != NULL) + { + /* looping on rows */ + char *sql; + char *xfrom; + char *xto; + char *xname; + char *xgeom; + char *xtable; + int no_geom = 0; + int ask_geom = 1; + int ask_name = 1; + int ret; + sqlite3_stmt *stmt = NULL; + + if (options == VROUTE_SHORTEST_PATH_NO_LINKS) + ask_name = 0; + if (graph->NameColumn == NULL) + ask_name = 0; + if (row->Point2PointRole == VROUTE_POINT2POINT_START + || row->Point2PointRole == VROUTE_POINT2POINT_END) + ask_geom = 0; + if (options == VROUTE_SHORTEST_PATH_NO_GEOMS + || graph->GeometryColumn == NULL) + { + no_geom = 1; + ask_geom = 0; + } + + if (!no_geom) + { + if (row->Point2PointRole == VROUTE_POINT2POINT_INGRESS) + gaiaAppendPointZMToDynamicLine (p2p->dynLine, p2p->xFrom, + p2p->yFrom, p2p->zFrom, + 0.0); + if (row->Point2PointRole == VROUTE_POINT2POINT_START) + if (add2DynLine + (p2p->dynLine, p2p->fromCandidate->path, + p2p->fromCandidate->reverse, + p2p->fromCandidate->extraLen, + p2p->fromCandidate->pathLen)) + p2p->hasZ = 1; + if (row->Point2PointRole == VROUTE_POINT2POINT_END) + if (add2DynLine + (p2p->dynLine, p2p->toCandidate->path, + p2p->toCandidate->reverse, 0.0, + p2p->toCandidate->pathLen)) + p2p->hasZ = 1; + if (row->Point2PointRole == VROUTE_POINT2POINT_EGRESS) + gaiaAppendPointZMToDynamicLine (p2p->dynLine, p2p->xTo, + p2p->yTo, p2p->zTo, + p2p->totalCost); + } + if (row->linkRef == NULL) + goto next_row; + + if (ask_geom && ask_name) + { + xname = gaiaDoubleQuotedSql (graph->NameColumn); + xfrom = gaiaDoubleQuotedSql (graph->FromColumn); + xto = gaiaDoubleQuotedSql (graph->ToColumn); + xgeom = gaiaDoubleQuotedSql (graph->GeometryColumn); + xtable = gaiaDoubleQuotedSql (graph->TableName); + sql = + sqlite3_mprintf + ("SELECT \"%s\", \"%s\", \"%s\", \"%s\" FROM \"%s\" WHERE ROWID = ?", + xname, xfrom, xto, xgeom, xtable); + free (xname); + free (xfrom); + free (xto); + free (xgeom); + free (xtable); + } + else if (ask_geom) + { + xfrom = gaiaDoubleQuotedSql (graph->FromColumn); + xto = gaiaDoubleQuotedSql (graph->ToColumn); + xgeom = gaiaDoubleQuotedSql (graph->GeometryColumn); + xtable = gaiaDoubleQuotedSql (graph->TableName); + sql = + sqlite3_mprintf + ("SELECT \"%s\", \"%s\", \"%s\" FROM \"%s\" WHERE ROWID = ?", + xfrom, xto, xgeom, xtable); + free (xfrom); + free (xto); + free (xgeom); + free (xtable); + } + else if (ask_name) + { + xname = gaiaDoubleQuotedSql (graph->NameColumn); + xtable = gaiaDoubleQuotedSql (graph->TableName); + sql = + sqlite3_mprintf + ("SELECT \"%s\" FROM \"%s\" WHERE ROWID = ?", xname, + xtable); + free (xname); + free (xtable); + } + else + goto next_row; + ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + goto next_row; + + /* querying the resultset */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_int64 (stmt, 1, row->linkRef->Link->LinkRowid); + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + const char *from_code; + const char *to_code; + sqlite3_int64 from_id; + sqlite3_int64 to_id; + const unsigned char *blob = NULL; + int blob_sz; + int err = 0; + + if (ask_name) + { + /* the Name column */ + char *name; + const char *xname = + (const char *) sqlite3_column_text (stmt, 0); + int len = sqlite3_column_bytes (stmt, 0); + name = malloc (len + 1); + strcpy (name, xname); + row->linkRef->Name = name; + if (ask_geom) + { + if (graph->NodeCode) + { + /* nodes are identified by TEXT codes */ + if (sqlite3_column_type (stmt, 1) == + SQLITE_TEXT) + from_code = + (const char *) + sqlite3_column_text (stmt, 1); + else + err = 1; + if (sqlite3_column_type (stmt, 2) == + SQLITE_TEXT) + to_code = + (const char *) + sqlite3_column_text (stmt, 2); + else + err = 1; + } + else + { + /* nodes are identified by INTEGER ids */ + if (sqlite3_column_type (stmt, 1) == + SQLITE_INTEGER) + from_id = + sqlite3_column_int64 (stmt, 1); + else + err = 1; + if (sqlite3_column_type (stmt, 2) == + SQLITE_INTEGER) + to_id = + sqlite3_column_int64 (stmt, 2); + else + err = 1; + } + if (sqlite3_column_type (stmt, 3) == + SQLITE_BLOB) + { + blob = + (const unsigned char *) + sqlite3_column_blob (stmt, 3); + blob_sz = + sqlite3_column_bytes (stmt, 3); + } + } + } + else if (ask_geom) + { + if (graph->NodeCode) + { + /* nodes are identified by TEXT codes */ + if (sqlite3_column_type (stmt, 0) == + SQLITE_TEXT) + from_code = + (const char *) + sqlite3_column_text (stmt, 0); + else + err = 1; + if (sqlite3_column_type (stmt, 1) == + SQLITE_TEXT) + to_code = + (const char *) + sqlite3_column_text (stmt, 1); + else + err = 1; + } + else + { + /* nodes are identified by INTEGER ids */ + if (sqlite3_column_type (stmt, 0) == + SQLITE_INTEGER) + from_id = sqlite3_column_int64 (stmt, 0); + else + err = 1; + if (sqlite3_column_type (stmt, 1) == + SQLITE_INTEGER) + to_id = sqlite3_column_int64 (stmt, 1); + else + err = 1; + } + if (sqlite3_column_type (stmt, 2) == SQLITE_BLOB) + { + blob = + (const unsigned char *) + sqlite3_column_blob (stmt, 2); + blob_sz = sqlite3_column_bytes (stmt, 2); + } + } + if (ask_geom) + { + if (blob != NULL && !err) + { + /* adding the Link's geometry to the Solution geometry */ + gaiaGeomCollPtr geom = + gaiaFromSpatiaLiteBlobWkb (blob, blob_sz); + if (geom) + { + /* OK, we have fetched a valid Geometry */ + if (geom->FirstPoint == NULL + && geom->FirstPolygon == NULL + && geom->FirstLinestring != NULL + && geom->FirstLinestring == + geom->LastLinestring) + { + /* Geometry is LINESTRING as expected */ + int reverse = 1; + if (graph->NodeCode) + { + /* nodes are identified by TEXT codes */ + const char *from = + row->linkRef-> + Link->NodeFrom->Code; + const char *to = + row->linkRef-> + Link->NodeTo->Code; + if (strcmp (from_code, from) + == 0 + && strcmp (to_code, + to) == 0) + reverse = 0; + } + else + { + /* nodes are identified by INTEGER ids */ + sqlite3_int64 from = + row->linkRef-> + Link->NodeFrom->Id; + sqlite3_int64 to = + row->linkRef-> + Link->NodeTo->Id; + if (from_id == from + && to_id == to) + reverse = 0; + } + if (add2DynLine + (p2p->dynLine, geom, reverse, + 0.0, + row->linkRef->Link->Cost)) + p2p->hasZ = 1; + } + else + error = 1; + gaiaFreeGeomColl (geom); + } + else + error = 1; + } + else + error = 1; + } + } + else + error = 1; + } + + next_row: + if (stmt != NULL) + sqlite3_finalize (stmt); + row = row->Next; + } + + if (error) + { + if (p2p->dynLine != NULL) + gaiaFreeDynamicLine (p2p->dynLine); + p2p->dynLine = NULL; + } + + if (p2p->dynLine != NULL) + { + /* building the result path Geometry */ + gaiaGeomCollPtr geom; + gaiaLinestringPtr ln; + gaiaPointPtr pt; + int points = 0; + int iv; + + row = p2p->FirstRow; + if (row->Geometry != NULL) + gaiaFreeGeomColl (row->Geometry); + if (p2p->hasZ) + geom = gaiaAllocGeomCollXYZM (); + else + geom = gaiaAllocGeomCollXYM (); + geom->Srid = p2p->srid; + pt = p2p->dynLine->First; + while (pt != NULL) + { + /* counting how many points are there */ + points++; + pt = pt->Next; + } + ln = gaiaAddLinestringToGeomColl (geom, points); + iv = 0; + pt = p2p->dynLine->First; + while (pt != NULL) + { + /* copying points from Dynamic Line to Linestring */ + if (p2p->hasZ) + { + gaiaSetPointXYZM (ln->Coords, iv, pt->X, pt->Y, pt->Z, + pt->M); + } + else + { + gaiaSetPointXYM (ln->Coords, iv, pt->X, pt->Y, pt->M); + } + iv++; + pt = pt->Next; + } + row->Geometry = geom; + + gaiaFreeDynamicLine (p2p->dynLine); + p2p->dynLine = NULL; + } + + if (options == VROUTE_SHORTEST_PATH_NO_LINKS) + { + /* deleting Links */ + ResultsetRowPtr pR; + ResultsetRowPtr pRn; + pR = p2p->FirstRow; + while (pR != NULL) + { + pRn = pR->Next; + if (pR == p2p->FirstRow) + { + /* skipping the first row */ + pR->Next = NULL; + pR = pRn; + continue; + } + if (pR->Point2PointRole == VROUTE_POINT2POINT_START + || pR->Point2PointRole == VROUTE_POINT2POINT_END) + { + /* deleting partial Links */ + if (pR->linkRef != NULL) + { + if (pR->linkRef->Link != NULL) + free (pR->linkRef->Link); + if (pR->linkRef->Name != NULL) + free (pR->linkRef->Name); + free (pR->linkRef); + } + } + if (pR->Geometry != NULL) + gaiaFreeGeomColl (pR->Geometry); + free (pR); + pR = pRn; + } + p2p->LastRow = p2p->FirstRow; + } +} + +static void +point2point_resolve (virtualroutingCursorPtr cursor) +{ +/* resolving a Point2Point Shortest Path */ + virtualroutingPtr net = (virtualroutingPtr) cursor->pVtab; + RoutingPtr graph = cursor->pVtab->graph; + RoutingMultiDestPtr multiple = NULL; + Point2PointNodePtr p_node_from; + Point2PointNodePtr p_node_to; + ShortestPathSolutionPtr solution; + Point2PointSolutionPtr p2p = cursor->pVtab->point2PointSolution; + Point2PointCandidatePtr p_from = p2p->firstFromCandidate; + Point2PointCandidatePtr p_to = p2p->firstToCandidate; + int route_row; + RowSolutionPtr pA; + ResultsetRowPtr row; + RouteLinkPtr link; + while (p_from != NULL) + { + /* extracting all FROM candidates */ + if (graph->NodeCode) + add_point2point_node_from_by_code (p2p, p_from->codNodeTo, + p_from); + else + add_point2point_node_from_by_id (p2p, p_from->idNodeTo, p_from); + p_from = p_from->next; + } + while (p_to != NULL) + { + /* extracting all TO candidates */ + if (graph->NodeCode) + add_point2point_node_to_by_code (p2p, p_to->codNodeFrom, p_to); + else + add_point2point_node_to_by_id (p2p, p_to->idNodeFrom, p_to); + p_to = p_to->next; + } + p_node_from = p2p->firstFromNode; + while (p_node_from != NULL) + { + /* exploring all FROM Nodes */ + int i; + int items = 0; + RoutingMultiDestPtr multiple; + reset_multiSolution (cursor->pVtab->multiSolution); + cursor->pVtab->multiSolution->Mode = VROUTE_ROUTING_SOLUTION; + p_node_to = p2p->firstToNode; + while (p_node_to != NULL) + { + /* counting how many destinations */ + items++; + p_node_to = p_node_to->next; + } + /* allocating the helper struct */ + multiple = malloc (sizeof (RoutingMultiDest)); + cursor->pVtab->multiSolution->MultiTo = multiple; + multiple->CodeNode = graph->NodeCode; + multiple->Found = malloc (sizeof (char) * items); + multiple->To = malloc (sizeof (RouteNodePtr) * items); + for (i = 0; i < items; i++) + { + *(multiple->Found + i) = 'N'; + *(multiple->To + i) = NULL; + } + multiple->Items = items; + multiple->Next = 0; + if (multiple->CodeNode) + { + multiple->Ids = NULL; + multiple->Codes = malloc (sizeof (char *) * items); + } + else + { + multiple->Ids = malloc (sizeof (sqlite3_int64) * items); + multiple->Codes = NULL; + } + if (graph->NodeCode) + cursor->pVtab->multiSolution->From = + find_node_by_code (graph, p_node_from->codNode); + else + cursor->pVtab->multiSolution->From = + find_node_by_id (graph, p_node_from->idNode); + p_node_to = p2p->firstToNode; + while (p_node_to != NULL) + { + /* exploring all TO Nodes */ + if (graph->NodeCode) + { + int l = strlen (p_node_to->codNode); + char *code = malloc (l + 1); + strcpy (code, p_node_to->codNode); + vroute_add_multiple_code (multiple, code); + } + else + vroute_add_multiple_id (multiple, p_node_to->idNode); + p_node_to = p_node_to->next; + } + if (graph->NodeCode) + set_multi_by_code (multiple, graph); + else + set_multi_by_id (multiple, graph); + if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) + astar_solve (cursor->pVtab->db, + VROUTE_SHORTEST_PATH_SIMPLE, graph, + cursor->pVtab->routing, + cursor->pVtab->multiSolution); + else + dijkstra_multi_solve (cursor->pVtab->db, + VROUTE_SHORTEST_PATH_SIMPLE, graph, + cursor->pVtab->routing, + cursor->pVtab->multiSolution); + solution = cursor->pVtab->multiSolution->First; + while (solution != NULL) + { + point2point_eval_solution (p2p, solution, graph->NodeCode); + solution = solution->Next; + } + p_node_from = p_node_from->next; + } + + if (p2p->fromCandidate == NULL || p2p->toCandidate == NULL) + return; /* invalid solution */ + +/* fully building the optimal Point2Point solution */ + reset_multiSolution (cursor->pVtab->multiSolution); + cursor->pVtab->multiSolution->Mode = VROUTE_ROUTING_SOLUTION; + if (graph->NodeCode) + cursor->pVtab->multiSolution->From = + find_node_by_code (graph, p2p->fromCandidate->codNodeTo); + else + cursor->pVtab->multiSolution->From = + find_node_by_id (graph, p2p->fromCandidate->idNodeTo); +/* allocating the helper struct */ + multiple = malloc (sizeof (RoutingMultiDest)); + cursor->pVtab->multiSolution->MultiTo = multiple; + multiple->CodeNode = graph->NodeCode; + multiple->Found = malloc (sizeof (char)); + multiple->To = malloc (sizeof (RouteNodePtr)); + *(multiple->Found + 0) = 'N'; + *(multiple->To + 0) = NULL; + multiple->Items = 1; + multiple->Next = 0; + if (multiple->CodeNode) + { + int l = strlen (p2p->toCandidate->codNodeFrom); + multiple->Ids = NULL; + multiple->Codes = malloc (sizeof (char *)); + char *code = malloc (l + 1); + strcpy (code, p2p->toCandidate->codNodeFrom); + vroute_add_multiple_code (multiple, code); + set_multi_by_code (multiple, graph); + } + else + { + multiple->Ids = malloc (sizeof (sqlite3_int64)); + multiple->Codes = NULL; + vroute_add_multiple_id (multiple, p2p->toCandidate->idNodeFrom); + set_multi_by_id (multiple, graph); + } + if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) + astar_solve (cursor->pVtab->db, VROUTE_SHORTEST_PATH_QUICK, graph, + cursor->pVtab->routing, cursor->pVtab->multiSolution); + else + dijkstra_multi_solve (cursor->pVtab->db, VROUTE_SHORTEST_PATH_QUICK, + graph, cursor->pVtab->routing, + cursor->pVtab->multiSolution); + solution = cursor->pVtab->multiSolution->First; + +/* building the solution rows */ + p2p->totalCost = + solution->TotalCost + p2p->fromCandidate->pathLen + + p2p->fromCandidate->extraLen + p2p->toCandidate->pathLen + + p2p->toCandidate->extraLen; +/* inserting the Route Header */ + route_row = 0; + row = malloc (sizeof (ResultsetRow)); + row->RouteNum = 0; + row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; + row->From = NULL; + row->To = NULL; + row->Undefined = solution->Undefined; + solution->Undefined = NULL; + row->UndefinedId = solution->UndefinedId; + row->linkRef = NULL; + row->TotalCost = p2p->totalCost; + row->Geometry = NULL; + row->Next = NULL; + if (p2p->FirstRow == NULL) + p2p->FirstRow = row; + if (p2p->LastRow != NULL) + p2p->LastRow->Next = row; + p2p->LastRow = row; +/* inserting the Route Ingress */ + row = malloc (sizeof (ResultsetRow)); + row->RouteNum = 0; + row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_INGRESS; + row->From = NULL; + row->To = NULL; + row->Undefined = solution->Undefined; + solution->Undefined = NULL; + row->UndefinedId = solution->UndefinedId; + row->linkRef = NULL; + row->TotalCost = p2p->fromCandidate->extraLen; + row->Geometry = NULL; + row->Next = NULL; + if (p2p->FirstRow == NULL) + p2p->FirstRow = row; + if (p2p->LastRow != NULL) + p2p->LastRow->Next = row; + p2p->LastRow = row; +/* inserting the Start partial Link */ + row = malloc (sizeof (ResultsetRow)); + row->RouteNum = 0; + row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_START; + row->From = NULL; + row->To = NULL; + row->Undefined = solution->Undefined; + solution->Undefined = NULL; + row->UndefinedId = solution->UndefinedId; + /* creating a RowSolution object */ + link = + find_link (cursor->pVtab->db, cursor->pVtab->graph, + p2p->fromCandidate->linkRowid); + row->linkRef = malloc (sizeof (RowSolution)); + row->linkRef->Link = link; + row->linkRef->Name = NULL; + row->linkRef->Next = NULL; + row->TotalCost = p2p->fromCandidate->pathLen; + row->Geometry = NULL; + row->Next = NULL; + if (p2p->FirstRow == NULL) + p2p->FirstRow = row; + if (p2p->LastRow != NULL) + p2p->LastRow->Next = row; + p2p->LastRow = row; + + pA = solution->First; + while (pA != NULL) + { + /* inserting Route's traversed Links */ + row = malloc (sizeof (ResultsetRow)); + row->RouteNum = 0; + row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_NONE; + row->From = NULL; + row->To = NULL; + row->Undefined = NULL; + row->linkRef = pA; + row->TotalCost = 0.0; + row->Geometry = NULL; + row->Next = NULL; + if (p2p->FirstRow == NULL) + p2p->FirstRow = row; + if (p2p->LastRow != NULL) + p2p->LastRow->Next = row; + p2p->LastRow = row; + pA = pA->Next; + } +/* inserting the End partial Link */ + row = malloc (sizeof (ResultsetRow)); + row->RouteNum = 0; + row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_END; + row->From = NULL; + row->To = NULL; + row->Undefined = solution->Undefined; + solution->Undefined = NULL; + row->UndefinedId = solution->UndefinedId; + /* creating a RowSolution object */ + link = + find_link (cursor->pVtab->db, cursor->pVtab->graph, + p2p->toCandidate->linkRowid); + row->linkRef = malloc (sizeof (RowSolution)); + row->linkRef->Link = link; + row->linkRef->Name = NULL; + row->linkRef->Next = NULL; + row->TotalCost = p2p->toCandidate->pathLen; + row->Geometry = NULL; + row->Next = NULL; + if (p2p->FirstRow == NULL) + p2p->FirstRow = row; + if (p2p->LastRow != NULL) + p2p->LastRow->Next = row; + p2p->LastRow = row; +/* inserting the Route Egress */ + row = malloc (sizeof (ResultsetRow)); + row->RouteNum = 0; + row->RouteRow = route_row++; + row->Point2PointRole = VROUTE_POINT2POINT_EGRESS; + row->From = NULL; + row->To = NULL; + row->Undefined = solution->Undefined; + solution->Undefined = NULL; + row->UndefinedId = solution->UndefinedId; + row->linkRef = NULL; + row->TotalCost = p2p->toCandidate->extraLen; + row->Geometry = NULL; + row->Next = NULL; + if (p2p->FirstRow == NULL) + p2p->FirstRow = row; + if (p2p->LastRow != NULL) + p2p->LastRow->Next = row; + p2p->LastRow = row; + + build_point2point_solution (cursor->pVtab->db, + cursor->pVtab->currentOptions, + cursor->pVtab->graph, p2p); + cursor->pVtab->multiSolution->Mode = VROUTE_POINT2POINT_SOLUTION; +} static int vroute_create (sqlite3 * db, void *pAux, int argc, const char *const *argv, sqlite3_vtab ** ppVTab, char **pzErr) { @@ -4732,10 +7008,11 @@ p_vt->graph = graph; p_vt->currentAlgorithm = VROUTE_DIJKSTRA_ALGORITHM; p_vt->currentRequest = VROUTE_SHORTEST_PATH; p_vt->currentOptions = VROUTE_SHORTEST_PATH_FULL; p_vt->currentDelimiter = ','; + p_vt->Tolerance = 20.0; p_vt->routing = NULL; p_vt->pModule = &my_route_module; p_vt->nRef = 0; p_vt->zErrMsg = NULL; /* preparing the COLUMNs for this VIRTUAL TABLE */ @@ -4745,41 +7022,45 @@ if (p_vt->graph->NameColumn) { sql = sqlite3_mprintf ("CREATE TABLE \"%s\" (Algorithm TEXT, " "Request TEXT, Options TEXT, Delimiter TEXT, " "RouteId INTEGER, RouteRow INTEGER, Role TEXT, " - "ArcRowid INTEGER, NodeFrom TEXT, NodeTo TEXT," - " Cost DOUBLE, Geometry BLOB, Name TEXT)", + "LinkRowid INTEGER, NodeFrom TEXT, NodeTo TEXT," + "PointFrom BLOB, PointTo BLOB, Tolerance DOUBLE, " + "Cost DOUBLE, Geometry BLOB, Name TEXT)", xname); } else { sql = sqlite3_mprintf ("CREATE TABLE \"%s\" (Algorithm TEXT, " "Request TEXT, Options TEXT, Delimiter TEXT, " "RouteId INTEGER, RouteRow INTEGER, Role TEXT, " - "ArcRowid INTEGER, NodeFrom TEXT, NodeTo TEXT," - " Cost DOUBLE, Geometry BLOB)", xname); + "LinkRowid INTEGER, NodeFrom TEXT, NodeTo TEXT," + "PointFrom BLOB, PointTo BLOB, Tolerance DOUBLE, " + "Cost DOUBLE, Geometry BLOB)", xname); } } else { if (p_vt->graph->NameColumn) { sql = sqlite3_mprintf ("CREATE TABLE \"%s\" (Algorithm TEXT, " "Request TEXT, Options TEXT, Delimiter TEXT, " "RouteId INTEGER, RouteRow INTEGER, Role TEXT, " - "ArcRowid INTEGER, NodeFrom INTEGER, NodeTo INTEGER," - " Cost DOUBLE, Geometry BLOB, Name TEXT)", + "LinkRowid INTEGER, NodeFrom INTEGER, NodeTo INTEGER, " + "PointFrom BLOB, PointTo BLOB, Tolerance Double, " + "Cost DOUBLE, Geometry BLOB, Name TEXT)", xname); } else { sql = sqlite3_mprintf ("CREATE TABLE \"%s\" (Algorithm TEXT, " "Request TEXT, Options TEXT, Delimiter TEXT, " "RouteId INTEGER, RouteRow INTEGER, Role TEXT, " - "ArcRowid INTEGER, NodeFrom INTEGER, NodeTo INTEGER," - " Cost DOUBLE, Geometry BLOB)", xname); + "LinkRowid INTEGER, NodeFrom INTEGER, NodeTo INTEGER, " + "PointFrom BLOB, PointTo BLOB, Tolerance DOUBLE, " + "Cost DOUBLE, Geometry BLOB)", xname); } } free (xname); if (sqlite3_declare_vtab (db, sql) != SQLITE_OK) { @@ -4819,13 +7100,17 @@ int i; int errors = 0; int err = 1; int from = 0; int to = 0; + int fromPoint = 0; + int toPoint = 0; int cost = 0; int i_from = -1; int i_to = -1; + int i_fromPoint = -1; + int i_toPoint = -1; int i_cost = -1; if (pVTab) pVTab = pVTab; /* unused arg warning suppression */ for (i = 0; i < pIdxInfo->nConstraint; i++) { @@ -4842,10 +7127,22 @@ { to++; i_to = i; } else if (p->iColumn == 10 + && p->op == SQLITE_INDEX_CONSTRAINT_EQ) + { + fromPoint++; + i_fromPoint = i; + } + else if (p->iColumn == 11 + && p->op == SQLITE_INDEX_CONSTRAINT_EQ) + { + toPoint++; + i_toPoint = i; + } + else if (p->iColumn == 13 && p->op == SQLITE_INDEX_CONSTRAINT_LE) { cost++; i_cost = i; } @@ -4862,10 +7159,28 @@ pIdxInfo->idxNum = 2; /* first arg is TO */ pIdxInfo->estimatedCost = 1.0; for (i = 0; i < pIdxInfo->nConstraint; i++) { if (pIdxInfo->aConstraint[i].usable) + { + pIdxInfo->aConstraintUsage[i].argvIndex = i + 1; + pIdxInfo->aConstraintUsage[i].omit = 1; + } + } + err = 0; + } + if (fromPoint == 1 && toPoint == 1 && errors == 0) + { + /* this one is a valid Shortest Path [Point2Point] query */ + if (i_fromPoint < i_toPoint) + pIdxInfo->idxNum = 5; /* first arg is FROM */ + else + pIdxInfo->idxNum = 6; /* first arg is TO */ + pIdxInfo->estimatedCost = 1.0; + for (i = 0; i < pIdxInfo->nConstraint; i++) + { + if (pIdxInfo->aConstraint[i].usable) { pIdxInfo->aConstraintUsage[i].argvIndex = i + 1; pIdxInfo->aConstraintUsage[i].omit = 1; } } @@ -4935,10 +7250,21 @@ else cursor->pVtab->eof = 0; } return; } + +static void +vroute_read_row_p2p (virtualroutingCursorPtr cursor) +{ +/* trying to read a "row" from Point2Point solution */ + if (cursor->pVtab->point2PointSolution->CurrentRow == NULL) + cursor->pVtab->eof = 1; + else + cursor->pVtab->eof = 0; + return; +} static int vroute_open (sqlite3_vtab * pVTab, sqlite3_vtab_cursor ** ppCursor) { /* opening a new cursor */ @@ -4947,10 +7273,11 @@ sqlite3_malloc (sizeof (virtualroutingCursor)); if (cursor == NULL) return SQLITE_ERROR; cursor->pVtab = (virtualroutingPtr) pVTab; cursor->pVtab->multiSolution = alloc_multiSolution (); + cursor->pVtab->point2PointSolution = alloc_point2PointSolution (); cursor->pVtab->eof = 0; *ppCursor = (sqlite3_vtab_cursor *) cursor; return SQLITE_OK; } @@ -4958,65 +7285,47 @@ vroute_close (sqlite3_vtab_cursor * pCursor) { /* closing the cursor */ virtualroutingCursorPtr cursor = (virtualroutingCursorPtr) pCursor; delete_multiSolution (cursor->pVtab->multiSolution); + delete_point2PointSolution (cursor->pVtab->point2PointSolution); sqlite3_free (pCursor); return SQLITE_OK; } -static void -set_multi_by_id (RoutingMultiDestPtr multiple, RoutingPtr graph) -{ -// setting Node pointers to multiple destinations */ - int i; - for (i = 0; i < multiple->Items; i++) - { - sqlite3_int64 id = *(multiple->Ids + i); - if (id >= 1) - *(multiple->To + i) = find_node_by_id (graph, id); - } -} - -static void -set_multi_by_code (RoutingMultiDestPtr multiple, RoutingPtr graph) -{ -// setting Node pointers to multiple destinations */ - int i; - for (i = 0; i < multiple->Items; i++) - { - const char *code = *(multiple->Codes + i); - if (code != NULL) - *(multiple->To + i) = find_node_by_code (graph, code); - } -} - static int vroute_filter (sqlite3_vtab_cursor * pCursor, int idxNum, const char *idxStr, int argc, sqlite3_value ** argv) { /* setting up a cursor filter */ + gaiaGeomCollPtr point = NULL; + gaiaPointPtr pt; + unsigned char *p_blob = NULL; + int n_bytes = 0; int node_code = 0; virtualroutingCursorPtr cursor = (virtualroutingCursorPtr) pCursor; virtualroutingPtr net = (virtualroutingPtr) cursor->pVtab; RoutingMultiDestPtr multiple = NULL; + MultiSolutionPtr multiSolution = cursor->pVtab->multiSolution; + Point2PointSolutionPtr p2p = cursor->pVtab->point2PointSolution; if (idxStr) idxStr = idxStr; /* unused arg warning suppression */ node_code = net->graph->NodeCode; - reset_multiSolution (cursor->pVtab->multiSolution); + reset_multiSolution (multiSolution); + reset_point2PointSolution (p2p); cursor->pVtab->eof = 0; if (idxNum == 1 && argc == 2) { /* retrieving the Shortest Path From/To params */ if (node_code) { /* Nodes are identified by TEXT Codes */ if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) - cursor->pVtab->multiSolution->From = - find_node_by_code (net->graph, - (char *) - sqlite3_value_text (argv[0])); + multiSolution->From = find_node_by_code (net->graph, + (char *) + sqlite3_value_text + (argv[0])); if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) { multiple = vroute_get_multiple_destinations (1, cursor->pVtab-> @@ -5025,21 +7334,21 @@ sqlite3_value_text (argv[1])); if (multiple != NULL) { set_multi_by_code (multiple, net->graph); - cursor->pVtab->multiSolution->MultiTo = multiple; + multiSolution->MultiTo = multiple; } } } else { /* Nodes are identified by INT Ids */ if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) - cursor->pVtab->multiSolution->From = - find_node_by_id (net->graph, - sqlite3_value_int (argv[0])); + multiSolution->From = find_node_by_id (net->graph, + sqlite3_value_int + (argv[0])); if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) { multiple = vroute_get_multiple_destinations (0, cursor->pVtab-> @@ -5048,11 +7357,11 @@ sqlite3_value_text (argv[1])); if (multiple != NULL) { set_multi_by_id (multiple, net->graph); - cursor->pVtab->multiSolution->MultiTo = multiple; + multiSolution->MultiTo = multiple; } } else if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) { multiple = @@ -5059,11 +7368,11 @@ vroute_as_multiple_destinations (sqlite3_value_int (argv[1])); if (multiple != NULL) { set_multi_by_id (multiple, net->graph); - cursor->pVtab->multiSolution->MultiTo = multiple; + multiSolution->MultiTo = multiple; } } } } if (idxNum == 2 && argc == 2) @@ -5082,19 +7391,19 @@ sqlite3_value_text (argv[0])); if (multiple != NULL) { set_multi_by_code (multiple, net->graph); - cursor->pVtab->multiSolution->MultiTo = multiple; + multiSolution->MultiTo = multiple; } } if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) { - cursor->pVtab->multiSolution->From = - find_node_by_code (net->graph, - (char *) - sqlite3_value_text (argv[1])); + multiSolution->From = find_node_by_code (net->graph, + (char *) + sqlite3_value_text + (argv[1])); } } else { /* Nodes are identified by INT Ids */ @@ -5108,11 +7417,11 @@ sqlite3_value_text (argv[0])); if (multiple != NULL) { set_multi_by_id (multiple, net->graph); - cursor->pVtab->multiSolution->MultiTo = multiple; + multiSolution->MultiTo = multiple; } } else if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { multiple = @@ -5119,183 +7428,343 @@ vroute_as_multiple_destinations (sqlite3_value_int (argv[0])); if (multiple != NULL) { set_multi_by_id (multiple, net->graph); - cursor->pVtab->multiSolution->MultiTo = multiple; + multiSolution->MultiTo = multiple; } } if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) - cursor->pVtab->multiSolution->From = - find_node_by_id (net->graph, - sqlite3_value_int (argv[1])); + multiSolution->From = find_node_by_id (net->graph, + sqlite3_value_int + (argv[1])); } } if (idxNum == 3 && argc == 2) { /* retrieving the From and Cost param */ if (node_code) { /* Nodes are identified by TEXT Codes */ if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) - cursor->pVtab->multiSolution->From = - find_node_by_code (net->graph, - (char *) - sqlite3_value_text (argv[0])); + multiSolution->From = find_node_by_code (net->graph, + (char *) + sqlite3_value_text + (argv[0])); } else { /* Nodes are identified by INT Ids */ if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) - cursor->pVtab->multiSolution->From = - find_node_by_id (net->graph, - sqlite3_value_int (argv[0])); + multiSolution->From = find_node_by_id (net->graph, + sqlite3_value_int + (argv[0])); } if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) { int cost = sqlite3_value_int (argv[1]); - cursor->pVtab->multiSolution->MaxCost = cost; + multiSolution->MaxCost = cost; } else if (sqlite3_value_type (argv[1]) == SQLITE_FLOAT) - cursor->pVtab->multiSolution->MaxCost = - sqlite3_value_double (argv[1]); + multiSolution->MaxCost = sqlite3_value_double (argv[1]); } if (idxNum == 4 && argc == 2) { /* retrieving the From and Cost param */ if (node_code) { /* Nodes are identified by TEXT Codes */ if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) - cursor->pVtab->multiSolution->From = - find_node_by_code (net->graph, - (char *) - sqlite3_value_text (argv[1])); + multiSolution->From = find_node_by_code (net->graph, + (char *) + sqlite3_value_text + (argv[1])); } else { /* Nodes are identified by INT Ids */ if (sqlite3_value_type (argv[1]) == SQLITE_INTEGER) - cursor->pVtab->multiSolution->From = - find_node_by_id (net->graph, - sqlite3_value_int (argv[1])); + multiSolution->From = find_node_by_id (net->graph, + sqlite3_value_int + (argv[1])); } if (sqlite3_value_type (argv[0]) == SQLITE_INTEGER) { int cost = sqlite3_value_int (argv[0]); - cursor->pVtab->multiSolution->MaxCost = cost; - } - else if (sqlite3_value_type (argv[0]) == SQLITE_FLOAT) - cursor->pVtab->multiSolution->MaxCost = - sqlite3_value_double (argv[0]); - } - if (cursor->pVtab->multiSolution == NULL) + multiSolution->MaxCost = cost; + } + else if (sqlite3_value_type (argv[0]) == SQLITE_FLOAT) + multiSolution->MaxCost = sqlite3_value_double (argv[0]); + } + if (idxNum == 5 && argc == 2) + { + /* retrieving the Shortest Path FromPoint / ToPoint params */ + if (net->graph->GeometryColumn == NULL) + ; /* skipping Point2Point if No-Geometry */ + else + { + if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) + { + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + point = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); + if (point != NULL) + { + if (do_check_valid_point (point, net->graph->Srid)) + { + /* ok, it's a valid Point */ + pt = point->FirstPoint; + p2p->validFrom = 1; + p2p->xFrom = pt->X; + p2p->yFrom = pt->Y; + if (point->DimensionModel == GAIA_XY_Z + || point->DimensionModel == GAIA_XY_Z_M) + p2p->zFrom = pt->Z; + else + p2p->zFrom = 0.0; + p2p->srid = point->Srid; + } + gaiaFreeGeomColl (point); + } + } + if (sqlite3_value_type (argv[1]) == SQLITE_BLOB) + { + p_blob = (unsigned char *) sqlite3_value_blob (argv[1]); + n_bytes = sqlite3_value_bytes (argv[1]); + point = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); + if (point != NULL) + { + if (do_check_valid_point (point, net->graph->Srid)) + { + /* ok, it's a valid Point */ + pt = point->FirstPoint; + p2p->validTo = 1; + p2p->xTo = pt->X; + p2p->yTo = pt->Y; + if (point->DimensionModel == GAIA_XY_Z + || point->DimensionModel == GAIA_XY_Z_M) + p2p->zTo = pt->Z; + else + p2p->zTo = 0.0; + } + gaiaFreeGeomColl (point); + } + } + } + } + if (idxNum == 6 && argc == 2) + { + /* retrieving the Shortest Path ToPoint / FromPoint [Point2Point] params */ + if (net->graph->GeometryColumn == NULL) + ; /* skipping Point2Point if No-Geometry */ + else + { + if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) + { + p_blob = (unsigned char *) sqlite3_value_blob (argv[0]); + n_bytes = sqlite3_value_bytes (argv[0]); + point = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); + if (point != NULL) + { + if (do_check_valid_point (point, net->graph->Srid)) + { + /* ok, it's a valid Point */ + pt = point->FirstPoint; + p2p->validTo = 1; + p2p->xTo = pt->X; + p2p->yTo = pt->Y; + if (point->DimensionModel == GAIA_XY_Z + || point->DimensionModel == GAIA_XY_Z_M) + p2p->zFrom = pt->Z; + else + p2p->zFrom = 0.0; + } + gaiaFreeGeomColl (point); + } + } + if (sqlite3_value_type (argv[1]) == SQLITE_BLOB) + { + p_blob = (unsigned char *) sqlite3_value_blob (argv[1]); + n_bytes = sqlite3_value_bytes (argv[1]); + point = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes); + if (point != NULL) + { + if (do_check_valid_point (point, net->graph->Srid)) + { + /* ok, it's a valid Point */ + pt = point->FirstPoint; + p2p->validFrom = 1; + p2p->xFrom = pt->X; + p2p->yFrom = pt->Y; + if (point->DimensionModel == GAIA_XY_Z + || point->DimensionModel == GAIA_XY_Z_M) + p2p->zTo = pt->Z; + else + p2p->zTo = 0.0; + } + gaiaFreeGeomColl (point); + } + } + } + } + if (p2p->validFrom && p2p->validTo) + { + /* preparing a Point2Point request */ + cursor->pVtab->eof = 0; + p2p->CurrentRow = NULL; + p2p->CurrentRowId = 0; + p2p->Mode = VROUTE_POINT2POINT_SOLUTION; + /* searching candidates links (From) */ + if (!do_prepare_point (cursor->pVtab, VROUTE_POINT2POINT_FROM)) + p2p->Mode = VROUTE_POINT2POINT_ERROR; + else + { + /* searching candidates links (To) */ + if (!do_prepare_point (cursor->pVtab, VROUTE_POINT2POINT_TO)) + p2p->Mode = VROUTE_POINT2POINT_ERROR; + else + { + /* defining Ingress paths */ + if (!do_define_ingress_paths (cursor->pVtab)) + p2p->Mode = VROUTE_POINT2POINT_ERROR; + else + { + /* defining Egress paths */ + if (!do_define_egress_paths (cursor->pVtab)) + p2p->Mode = VROUTE_POINT2POINT_ERROR; + } + } + } + if (p2p->Mode == VROUTE_POINT2POINT_SOLUTION) + { + point2point_resolve (cursor); + p2p->CurrentRowId = 0; + p2p->CurrentRow = p2p->FirstRow; + } + return SQLITE_OK; + } + if (multiSolution == NULL) { cursor->pVtab->eof = 0; - cursor->pVtab->multiSolution->CurrentRow = NULL; - cursor->pVtab->multiSolution->CurrentRowId = 0; - cursor->pVtab->multiSolution->Mode = VROUTE_ROUTING_SOLUTION; return SQLITE_OK; } - if (cursor->pVtab->multiSolution->From - && cursor->pVtab->multiSolution->MultiTo) + if (multiSolution->From && multiSolution->MultiTo) { cursor->pVtab->eof = 0; if (net->currentRequest == VROUTE_TSP_NN) { - cursor->pVtab->multiSolution->Mode = VROUTE_TSP_SOLUTION; + multiSolution->Mode = VROUTE_TSP_SOLUTION; if (net->currentAlgorithm == VROUTE_DIJKSTRA_ALGORITHM) { tsp_nn_solve (net->db, net->currentOptions, net->graph, - net->routing, cursor->pVtab->multiSolution); - cursor->pVtab->multiSolution->CurrentRowId = 0; - cursor->pVtab->multiSolution->CurrentRow = - cursor->pVtab->multiSolution->FirstRow; + net->routing, multiSolution); + multiSolution->CurrentRowId = 0; + multiSolution->CurrentRow = multiSolution->FirstRow; } } else if (net->currentRequest == VROUTE_TSP_GA) { - cursor->pVtab->multiSolution->Mode = VROUTE_TSP_SOLUTION; + multiSolution->Mode = VROUTE_TSP_SOLUTION; if (net->currentAlgorithm == VROUTE_DIJKSTRA_ALGORITHM) { tsp_ga_solve (net->db, net->currentOptions, net->graph, - net->routing, cursor->pVtab->multiSolution); - cursor->pVtab->multiSolution->CurrentRowId = 0; - cursor->pVtab->multiSolution->CurrentRow = - cursor->pVtab->multiSolution->FirstRow; + net->routing, multiSolution); + multiSolution->CurrentRowId = 0; + multiSolution->CurrentRow = multiSolution->FirstRow; } } else { - cursor->pVtab->multiSolution->Mode = VROUTE_ROUTING_SOLUTION; + multiSolution->Mode = VROUTE_ROUTING_SOLUTION; if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) astar_solve (net->db, net->currentOptions, net->graph, - net->routing, cursor->pVtab->multiSolution); + net->routing, multiSolution); else dijkstra_multi_solve (net->db, net->currentOptions, net->graph, net->routing, - cursor->pVtab->multiSolution); - cursor->pVtab->multiSolution->CurrentRowId = 0; - cursor->pVtab->multiSolution->CurrentRow = - cursor->pVtab->multiSolution->FirstRow; + multiSolution); + multiSolution->CurrentRowId = 0; + multiSolution->CurrentRow = multiSolution->FirstRow; } return SQLITE_OK; } - if (cursor->pVtab->multiSolution->From - && cursor->pVtab->multiSolution->MaxCost > 0.0) + if (multiSolution->From && multiSolution->MaxCost > 0.0) { int srid = find_srid (net->db, net->graph); cursor->pVtab->eof = 0; - cursor->pVtab->multiSolution->Mode = VROUTE_RANGE_SOLUTION; + multiSolution->Mode = VROUTE_RANGE_SOLUTION; if (net->currentAlgorithm == VROUTE_DIJKSTRA_ALGORITHM) { - dijkstra_within_cost_range (net->routing, - cursor->pVtab->multiSolution, srid); - cursor->pVtab->multiSolution->CurrentRowId = 0; - cursor->pVtab->multiSolution->CurrentNodeRow = - cursor->pVtab->multiSolution->FirstNode; + dijkstra_within_cost_range (net->routing, multiSolution, srid); + multiSolution->CurrentRowId = 0; + multiSolution->CurrentNodeRow = multiSolution->FirstNode; } return SQLITE_OK; } cursor->pVtab->eof = 0; - cursor->pVtab->multiSolution->CurrentRow = NULL; - cursor->pVtab->multiSolution->CurrentRowId = 0; - cursor->pVtab->multiSolution->Mode = VROUTE_ROUTING_SOLUTION; + multiSolution->CurrentRow = NULL; + multiSolution->CurrentRowId = 0; + multiSolution->Mode = VROUTE_ROUTING_SOLUTION; return SQLITE_OK; } static int vroute_next (sqlite3_vtab_cursor * pCursor) { /* fetching a next row from cursor */ virtualroutingCursorPtr cursor = (virtualroutingCursorPtr) pCursor; - if (cursor->pVtab->multiSolution->Mode == VROUTE_RANGE_SOLUTION) + MultiSolutionPtr multiSolution = cursor->pVtab->multiSolution; + Point2PointSolutionPtr p2p = cursor->pVtab->point2PointSolution; + if (p2p != NULL) { - cursor->pVtab->multiSolution->CurrentNodeRow = - cursor->pVtab->multiSolution->CurrentNodeRow->Next; - if (!(cursor->pVtab->multiSolution->CurrentNodeRow)) + if (p2p->Mode == VROUTE_POINT2POINT_SOLUTION) + { + if (p2p->CurrentRow == NULL) + { + cursor->pVtab->eof = 1; + return SQLITE_OK; + } + p2p->CurrentRow = p2p->CurrentRow->Next; + if (!(p2p->CurrentRow)) + { + cursor->pVtab->eof = 1; + return SQLITE_OK; + } + (p2p->CurrentRowId)++; + vroute_read_row_p2p (cursor); + return SQLITE_OK; + } + } + if (multiSolution->Mode == VROUTE_RANGE_SOLUTION) + { + if (multiSolution->CurrentNodeRow == NULL) + { + cursor->pVtab->eof = 1; + return SQLITE_OK; + } + multiSolution->CurrentNodeRow = multiSolution->CurrentNodeRow->Next; + if (!(multiSolution->CurrentNodeRow)) { cursor->pVtab->eof = 1; return SQLITE_OK; } } else { - if (cursor->pVtab->multiSolution->CurrentRow == NULL) + if (multiSolution->CurrentRow == NULL) { cursor->pVtab->eof = 1; return SQLITE_OK; } - cursor->pVtab->multiSolution->CurrentRow = - cursor->pVtab->multiSolution->CurrentRow->Next; - if (!(cursor->pVtab->multiSolution->CurrentRow)) + multiSolution->CurrentRow = multiSolution->CurrentRow->Next; + if (!(multiSolution->CurrentRow)) { cursor->pVtab->eof = 1; return SQLITE_OK; } } - (cursor->pVtab->multiSolution->CurrentRowId)++; + (multiSolution->CurrentRowId)++; vroute_read_row (cursor); return SQLITE_OK; } static int @@ -5304,119 +7773,147 @@ /* cursor EOF */ virtualroutingCursorPtr cursor = (virtualroutingCursorPtr) pCursor; return cursor->pVtab->eof; } -static int -vroute_column (sqlite3_vtab_cursor * pCursor, sqlite3_context * pContext, - int column) +static void +do_cost_range_column (virtualroutingCursorPtr cursor, + sqlite3_context * pContext, int node_code, + RowNodeSolutionPtr row_node, int column) { -/* fetching value for the Nth column */ - ResultsetRowPtr row; - RowNodeSolutionPtr row_node; - int node_code = 0; +/* processing a "within Cost range" solution row */ const char *algorithm; char delimiter[128]; const char *role; - virtualroutingCursorPtr cursor = (virtualroutingCursorPtr) pCursor; - virtualroutingPtr net = (virtualroutingPtr) cursor->pVtab; - node_code = net->graph->NodeCode; - if (cursor->pVtab->multiSolution->Mode == VROUTE_RANGE_SOLUTION) - { - /* processing "within Cost range" solution */ - row_node = cursor->pVtab->multiSolution->CurrentNodeRow; - if (column == 0) - { - /* the currently used Algorithm */ - algorithm = "Dijkstra"; - sqlite3_result_text (pContext, algorithm, strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 1) - { - /* the current Request type */ - algorithm = "Isochrone"; - sqlite3_result_text (pContext, algorithm, strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 2) - { - /* the currently set Options */ - algorithm = "Full"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), SQLITE_TRANSIENT); - } - if (column == 3) - { - /* the currently set delimiter char */ - if (isprint (cursor->pVtab->currentDelimiter)) - sprintf (delimiter, "%c [dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - else - sprintf (delimiter, "[dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - sqlite3_result_text (pContext, delimiter, strlen (delimiter), - SQLITE_TRANSIENT); - } - if (column == 4) - { - /* the RouteNum column */ - sqlite3_result_int (pContext, 0); - } - if (column == 5) - { - /* the RouteRow column */ - sqlite3_result_int (pContext, 0); - } - if (column == 6) - { - /* role of this row */ - role = "Solution"; - sqlite3_result_text (pContext, role, strlen (role), - SQLITE_TRANSIENT); - } - if (column == 7) - { - /* the ArcRowId column */ - sqlite3_result_null (pContext); - } - if (column == 8) - { - /* the NodeFrom column */ - if (node_code) - sqlite3_result_text (pContext, - cursor->pVtab->multiSolution-> - From->Code, - strlen (cursor->pVtab-> - multiSolution->From->Code), - SQLITE_STATIC); - else - sqlite3_result_int64 (pContext, - cursor->pVtab->multiSolution-> - From->Id); - } - if (column == 9) - { - /* the NodeTo column */ + RowNodeSolutionPtr first = cursor->pVtab->multiSolution->FirstNode; + + if (column == 0) + { + /* the currently used Algorithm */ + algorithm = "Dijkstra"; + if (row_node != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, strlen (algorithm), + SQLITE_TRANSIENT); + } + if (column == 1) + { + /* the current Request type */ + algorithm = "Isochrone"; + if (row_node != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, strlen (algorithm), + SQLITE_TRANSIENT); + } + if (column == 2) + { + /* the currently set Options */ + algorithm = "Full"; + if (row_node != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 3) + { + /* the currently set delimiter char */ + if (isprint (cursor->pVtab->currentDelimiter)) + sprintf (delimiter, "%c [dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + else + sprintf (delimiter, "[dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + if (row_node != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, delimiter, strlen (delimiter), + SQLITE_TRANSIENT); + } + if (column == 4) + { + /* the RouteNum column */ + sqlite3_result_null (pContext); + } + if (column == 5) + { + /* the RouteRow column */ + sqlite3_result_null (pContext); + } + if (column == 6) + { + /* role of this row */ + role = "Solution"; + sqlite3_result_text (pContext, role, strlen (role), SQLITE_TRANSIENT); + } + if (column == 7) + { + /* the LinkRowId column */ + sqlite3_result_null (pContext); + } + if (column == 8) + { + /* the NodeFrom column */ + if (node_code) + sqlite3_result_text (pContext, + cursor->pVtab->multiSolution->From->Code, + strlen (cursor->pVtab->multiSolution-> + From->Code), SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, + cursor->pVtab->multiSolution->From->Id); + } + if (column == 9) + { + /* the NodeTo column */ + if (row_node == NULL) + sqlite3_result_null (pContext); + else + { if (node_code) sqlite3_result_text (pContext, row_node->Node->Code, strlen (row_node->Node->Code), SQLITE_STATIC); else sqlite3_result_int64 (pContext, row_node->Node->Id); } - if (column == 10) + } + if (column == 10) + { + /* the PointFrom column */ + sqlite3_result_null (pContext); + } + if (column == 11) + { + /* the PointTo column */ + sqlite3_result_null (pContext); + } + if (column == 12) + { + /* the Tolerance column */ + sqlite3_result_null (pContext); + } + if (column == 13) + { + /* the Cost column */ + if (row_node == NULL) + sqlite3_result_null (pContext); + else + sqlite3_result_double (pContext, row_node->Cost); + } + if (column == 14) + { + /* the Geometry column */ + if (row_node == NULL) + sqlite3_result_null (pContext); + else { - /* the Cost column */ - sqlite3_result_double (pContext, row_node->Cost); - } - if (column == 11) - { - /* the Geometry column */ if (row_node->Srid == VROUTE_INVALID_SRID) sqlite3_result_null (pContext); else { int len; @@ -5428,495 +7925,905 @@ gaiaToSpatiaLiteBlobWkb (geom, &p_result, &len); sqlite3_result_blob (pContext, p_result, len, free); gaiaFreeGeomColl (geom); } } - if (column == 12) - { - /* the [optional] Name column */ - sqlite3_result_null (pContext); - } + } + if (column == 15) + { + /* the [optional] Name column */ + sqlite3_result_null (pContext); + } +} + +static void +do_common_column (virtualroutingCursorPtr cursor, virtualroutingPtr net, + sqlite3_context * pContext, int node_code, + ResultsetRowPtr row, int column) +{ +/* processing an ordinary Routing (Shortest Path or TSP) solution row */ + const char *algorithm; + char delimiter[128]; + const char *role; + ResultsetRowPtr first = cursor->pVtab->multiSolution->FirstRow; + + if (row == NULL) + { + /* empty resultset */ + if (column == 0) + { + /* the currently used Algorithm */ + if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) + algorithm = "A*"; + else + algorithm = "Dijkstra"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + else if (column == 1) + { + /* the current Request type */ + if (net->currentRequest == VROUTE_TSP_NN) + algorithm = "TSP NN"; + else if (net->currentRequest == VROUTE_TSP_GA) + algorithm = "TSP GA"; + else + algorithm = "Shortest Path"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + else if (column == 2) + { + /* the currently set Options */ + if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) + algorithm = "Simple"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_LINKS) + algorithm = "No Links"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_GEOMS) + algorithm = "No Geometries"; + else + algorithm = "Full"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + else if (column == 3) + { + /* the currently set delimiter char */ + if (isprint (cursor->pVtab->currentDelimiter)) + sprintf (delimiter, "%c [dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + else + sprintf (delimiter, "[dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, delimiter, + strlen (delimiter), SQLITE_TRANSIENT); + } + else + sqlite3_result_null (pContext); + return; } - else + if (row->Undefined != NULL) { - /* processing an ordinary Routing (Shortest Path or TSP) solution */ - row = cursor->pVtab->multiSolution->CurrentRow; - if (row == NULL) - { - /* empty resultset */ - if (column == 0) - { - /* the currently used Algorithm */ - if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) - algorithm = "A*"; - else - algorithm = "Dijkstra"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - else if (column == 1) - { - /* the current Request type */ - if (net->currentRequest == VROUTE_TSP_NN) - algorithm = "TSP NN"; - else if (net->currentRequest == VROUTE_TSP_GA) - algorithm = "TSP GA"; - else - algorithm = "Shortest Path"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - else if (column == 2) + /* special case: there is an undefined destination */ + if (column == 0) + { + /* the currently used Algorithm */ + if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) + algorithm = "A*"; + else + algorithm = "Dijkstra"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 1) + { + /* the current Request type */ + if (net->currentRequest == VROUTE_TSP_NN) + algorithm = "TSP NN"; + else if (net->currentRequest == VROUTE_TSP_GA) + algorithm = "TSP GA"; + else + algorithm = "Shortest Path"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 2) + { + /* the currently set Options */ + if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) + algorithm = "Simple"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_LINKS) + algorithm = "No Links"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_GEOMS) + algorithm = "No Geometries"; + else + algorithm = "Full"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 3) + { + /* the currently set delimiter char */ + if (isprint (cursor->pVtab->currentDelimiter)) + sprintf (delimiter, "%c [dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + else + sprintf (delimiter, "[dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, delimiter, + strlen (delimiter), SQLITE_TRANSIENT); + } + if (column == 4) + { + /* the RouteNum column */ + sqlite3_result_null (pContext); + } + if (column == 5) + { + /* the RouteRow column */ + sqlite3_result_null (pContext); + } + if (column == 6) + { + /* role of this row */ + if (row->To != NULL) + role = "Unreachable NodeTo"; + else + role = "Undefined NodeTo"; + sqlite3_result_text (pContext, role, strlen (role), + SQLITE_TRANSIENT); + } + if (column == 7) + { + /* the LinkRowId column */ + sqlite3_result_null (pContext); + } + if (column == 8) + { + /* the NodeFrom column */ + if (row->From == NULL) { - /* the currently set Options */ - if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) - algorithm = "Simple"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_ARCS) - algorithm = "No Arcs"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_GEOMS) - algorithm = "No Geometries"; + if (node_code) + sqlite3_result_text (pContext, + row->Undefined, + strlen (row->Undefined), + SQLITE_STATIC); else - algorithm = "Full"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - else if (column == 3) - { - /* the currently set delimiter char */ - if (isprint (cursor->pVtab->currentDelimiter)) - sprintf (delimiter, "%c [dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - else - sprintf (delimiter, "[dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - sqlite3_result_text (pContext, delimiter, - strlen (delimiter), - SQLITE_TRANSIENT); + sqlite3_result_int64 (pContext, row->UndefinedId); } else - sqlite3_result_null (pContext); - return SQLITE_OK; - } - if (row->Undefined != NULL) - { - /* special case: there is an undefined destination */ - if (column == 0) { - /* the currently used Algorithm */ - if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) - algorithm = "A*"; - else - algorithm = "Dijkstra"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 1) - { - /* the current Request type */ - if (net->currentRequest == VROUTE_TSP_NN) - algorithm = "TSP NN"; - else if (net->currentRequest == VROUTE_TSP_GA) - algorithm = "TSP GA"; - else - algorithm = "Shortest Path"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 2) - { - /* the currently set Options */ - if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) - algorithm = "Simple"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_ARCS) - algorithm = "No Arcs"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_GEOMS) - algorithm = "No Geometries"; - else - algorithm = "Full"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 3) - { - /* the currently set delimiter char */ - if (isprint (cursor->pVtab->currentDelimiter)) - sprintf (delimiter, "%c [dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - else - sprintf (delimiter, "[dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - sqlite3_result_text (pContext, delimiter, - strlen (delimiter), - SQLITE_TRANSIENT); - } - if (column == 4) - { - /* the RouteNum column */ - sqlite3_result_int (pContext, row->RouteNum); - } - if (column == 5) - { - /* the RouteRow column */ - sqlite3_result_int (pContext, row->RouteRow); - } - if (column == 6) - { - /* role of this row */ - if (row->To != NULL) - role = "Unreachable NodeTo"; - else - role = "Undefined NodeTo"; - sqlite3_result_text (pContext, role, strlen (role), - SQLITE_TRANSIENT); - } - if (column == 7) - { - /* the ArcRowId column */ - sqlite3_result_null (pContext); - } - if (column == 8) - { - /* the NodeFrom column */ - if (row->From == NULL) - { - sqlite3_result_text (pContext, - row->Undefined, - strlen (row->Undefined), - SQLITE_STATIC); - } - else - { - if (node_code) - sqlite3_result_text (pContext, - row->From->Code, - strlen (row->From->Code), - SQLITE_STATIC); - else - sqlite3_result_int64 (pContext, row->From->Id); - } - } - if (column == 9) - { - /* the NodeTo column */ - sqlite3_result_text (pContext, - row->Undefined, - strlen (row->Undefined), - SQLITE_STATIC); - } - if (column == 10) - { - /* the Cost column */ - sqlite3_result_null (pContext); - } - if (column == 11) - { - /* the Geometry column */ - sqlite3_result_null (pContext); - } - if (column == 12) - { - /* the [optional] Name column */ - sqlite3_result_null (pContext); - } - return SQLITE_OK; - } - if (row->linkRef == NULL) - { - /* special case: this one is the solution summary */ - if (column == 0) - { - /* the currently used Algorithm */ - if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) - algorithm = "A*"; - else - algorithm = "Dijkstra"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 1) - { - /* the current Request type */ - if (net->currentRequest == VROUTE_TSP_NN) - algorithm = "TSP NN"; - else if (net->currentRequest == VROUTE_TSP_GA) - algorithm = "TSP GA"; - else - algorithm = "Shortest Path"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 2) - { - /* the currently set Options */ - if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) - algorithm = "Simple"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_ARCS) - algorithm = "No Arcs"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_GEOMS) - algorithm = "No Geometries"; - else - algorithm = "Full"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 3) - { - /* the currently set delimiter char */ - if (isprint (cursor->pVtab->currentDelimiter)) - sprintf (delimiter, "%c [dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - else - sprintf (delimiter, "[dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - sqlite3_result_text (pContext, delimiter, - strlen (delimiter), - SQLITE_TRANSIENT); - } - if (column == 4) - { - /* the RouteNum column */ - sqlite3_result_int (pContext, row->RouteNum); - } - if (column == 5) - { - /* the RouteRow column */ - sqlite3_result_int (pContext, row->RouteRow); - } - if (column == 6) - { - /* role of this row */ - if (cursor->pVtab->multiSolution->Mode == - VROUTE_TSP_SOLUTION && row->RouteNum == 0) - role = "TSP Solution"; - else - { - if (row->From == row->To) - role = "Unreachable NodeTo"; - else - role = "Route"; - } - sqlite3_result_text (pContext, role, strlen (role), - SQLITE_TRANSIENT); - } - if (row->From == NULL || row->To == NULL) - { - /* empty [uninitialized] solution */ - if (column > 0) - sqlite3_result_null (pContext); - return SQLITE_OK; - } - if (column == 7) - { - /* the ArcRowId column */ - sqlite3_result_null (pContext); - } - if (column == 8) - { - /* the NodeFrom column */ if (node_code) sqlite3_result_text (pContext, row->From->Code, strlen (row->From->Code), SQLITE_STATIC); else sqlite3_result_int64 (pContext, row->From->Id); } - if (column == 9) - { - /* the NodeTo column */ - if (node_code) - sqlite3_result_text (pContext, - row->To->Code, - strlen (row->To->Code), - SQLITE_STATIC); - else - sqlite3_result_int64 (pContext, row->To->Id); - } - if (column == 10) + } + if (column == 9) + { + /* the NodeTo column */ + if (node_code) + sqlite3_result_text (pContext, + row->Undefined, + strlen (row->Undefined), + SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, row->UndefinedId); + } + if (column == 10) + { + /* the PointFrom column */ + sqlite3_result_null (pContext); + } + if (column == 11) + { + /* the PointTo column */ + sqlite3_result_null (pContext); + } + if (column == 12) + { + /* the Tolerance column */ + sqlite3_result_null (pContext); + } + if (column == 13) + { + /* the Cost column */ + sqlite3_result_null (pContext); + } + if (column == 14) + { + /* the Geometry column */ + sqlite3_result_null (pContext); + } + if (column == 15) + { + /* the [optional] Name column */ + sqlite3_result_null (pContext); + } + return; + } + if (row->linkRef == NULL) + { + /* special case: this one is the solution summary */ + if (column == 0) + { + /* the currently used Algorithm */ + if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) + algorithm = "A*"; + else + algorithm = "Dijkstra"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 1) + { + /* the current Request type */ + if (net->currentRequest == VROUTE_TSP_NN) + algorithm = "TSP NN"; + else if (net->currentRequest == VROUTE_TSP_GA) + algorithm = "TSP GA"; + else + algorithm = "Shortest Path"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 2) + { + /* the currently set Options */ + if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) + algorithm = "Simple"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_LINKS) + algorithm = "No Links"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_GEOMS) + algorithm = "No Geometries"; + else + algorithm = "Full"; + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 3) + { + /* the currently set delimiter char */ + if (isprint (cursor->pVtab->currentDelimiter)) + sprintf (delimiter, "%c [dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + else + sprintf (delimiter, "[dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + if (row != first) + sqlite3_result_null (pContext); + else + sqlite3_result_text (pContext, delimiter, + strlen (delimiter), SQLITE_TRANSIENT); + } + if (column == 4) + { + /* the RouteNum column */ + sqlite3_result_int (pContext, row->RouteNum); + } + if (column == 5) + { + /* the RouteRow column */ + sqlite3_result_int (pContext, row->RouteRow); + } + if (column == 6) + { + /* role of this row */ + if (cursor->pVtab->multiSolution->Mode == + VROUTE_TSP_SOLUTION && row->RouteNum == 0) + role = "TSP Solution"; + else { - /* the Cost column */ - if (row->RouteNum != 0 && (row->From == row->To)) - sqlite3_result_null (pContext); - else - sqlite3_result_double (pContext, row->TotalCost); - } - if (column == 11) - { - /* the Geometry column */ - if (!(row->Geometry)) - sqlite3_result_null (pContext); + if (row->From == row->To) + role = "Unreachable NodeTo"; else - { - /* builds the BLOB geometry to be returned */ - int len; - unsigned char *p_result = NULL; - gaiaToSpatiaLiteBlobWkb (row->Geometry, - &p_result, &len); - sqlite3_result_blob (pContext, p_result, len, free); - } + role = "Route"; } - if (column == 12) + sqlite3_result_text (pContext, role, strlen (role), + SQLITE_TRANSIENT); + } + if (row->From == NULL || row->To == NULL) + { + /* empty [uninitialized] solution */ + if (column > 0) + sqlite3_result_null (pContext); + return; + } + if (column == 7) + { + /* the LinkRowId column */ + sqlite3_result_null (pContext); + } + if (column == 8) + { + /* the NodeFrom column */ + if (node_code) + sqlite3_result_text (pContext, + row->From->Code, + strlen (row->From->Code), + SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, row->From->Id); + } + if (column == 9) + { + /* the NodeTo column */ + if (node_code) + sqlite3_result_text (pContext, + row->To->Code, + strlen (row->To->Code), SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, row->To->Id); + } + if (column == 10) + { + /* the PointFrom column */ + sqlite3_result_null (pContext); + } + if (column == 11) + { + /* the PointTo column */ + sqlite3_result_null (pContext); + } + if (column == 12) + { + /* the Tolerance column */ + sqlite3_result_null (pContext); + } + if (column == 13) + { + /* the Cost column */ + if (row->RouteNum != 0 && (row->From == row->To)) + sqlite3_result_null (pContext); + else + sqlite3_result_double (pContext, row->TotalCost); + } + if (column == 14) + { + /* the Geometry column */ + if (!(row->Geometry)) + sqlite3_result_null (pContext); + else { - /* the [optional] Name column */ - sqlite3_result_null (pContext); + /* builds the BLOB geometry to be returned */ + int len; + unsigned char *p_result = NULL; + gaiaToSpatiaLiteBlobWkb (row->Geometry, &p_result, &len); + sqlite3_result_blob (pContext, p_result, len, free); } } - else - { - /* ordinary case: this one is an Arc used by the solution */ - if (column == 0) - { - /* the currently used Algorithm */ - if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) - algorithm = "A*"; - else - algorithm = "Dijkstra"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 1) - { - /* the current Request type */ - if (net->currentRequest == VROUTE_TSP_NN) - algorithm = "TSP NN"; - else if (net->currentRequest == VROUTE_TSP_GA) - algorithm = "TSP GA"; - else - algorithm = "Shortest Path"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 2) - { - /* the currently set Options */ - if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) - algorithm = "Simple"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_ARCS) - algorithm = "No Arcs"; - else if (net->currentOptions == - VROUTE_SHORTEST_PATH_NO_GEOMS) - algorithm = "No Geometries"; - else - algorithm = "Full"; - sqlite3_result_text (pContext, algorithm, - strlen (algorithm), - SQLITE_TRANSIENT); - } - if (column == 3) - { - /* the currently set delimiter char */ - if (isprint (cursor->pVtab->currentDelimiter)) - sprintf (delimiter, "%c [dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - else - sprintf (delimiter, "[dec=%d, hex=%02x]", - cursor->pVtab->currentDelimiter, - cursor->pVtab->currentDelimiter); - sqlite3_result_text (pContext, delimiter, - strlen (delimiter), - SQLITE_TRANSIENT); - } - if (column == 4) - { - /* the RouteNum column */ - sqlite3_result_int (pContext, row->RouteNum); - } - if (column == 5) - { - /* the RouteRow column */ - sqlite3_result_int (pContext, row->RouteRow); - } - if (column == 6) - { - /* role of this row */ - role = "Link"; - sqlite3_result_text (pContext, role, strlen (role), - SQLITE_TRANSIENT); - } - if (column == 7) - { - /* the ArcRowId column */ - sqlite3_result_int64 (pContext, - row->linkRef->Arc->ArcRowid); - } - if (column == 8) - { - /* the NodeFrom column */ + if (column == 15) + { + /* the [optional] Name column */ + sqlite3_result_null (pContext); + } + } + else + { + /* ordinary case: this one is a Link used by the solution */ + if (column == 0) + { + /* the currently used Algorithm - alwasy NULL */ + sqlite3_result_null (pContext); + } + if (column == 1) + { + /* the current Request type - always NULL */ + sqlite3_result_null (pContext); + } + if (column == 2) + { + /* the currently set Options- always NULL */ + sqlite3_result_null (pContext); + } + if (column == 3) + { + /* the currently set delimiter char- always NULL */ + sqlite3_result_null (pContext); + } + if (column == 4) + { + /* the RouteNum column */ + sqlite3_result_int (pContext, row->RouteNum); + } + if (column == 5) + { + /* the RouteRow column */ + sqlite3_result_int (pContext, row->RouteRow); + } + if (column == 6) + { + /* role of this row */ + role = "Link"; + sqlite3_result_text (pContext, role, strlen (role), + SQLITE_TRANSIENT); + } + if (column == 7) + { + /* the LinkRowId column */ + sqlite3_result_int64 (pContext, row->linkRef->Link->LinkRowid); + } + if (column == 8) + { + /* the NodeFrom column */ + if (node_code) + sqlite3_result_text (pContext, + row->linkRef->Link->NodeFrom->Code, + strlen (row->linkRef->Link-> + NodeFrom->Code), + SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, + row->linkRef->Link->NodeFrom->Id); + } + if (column == 9) + { + /* the NodeTo column */ + if (node_code) + sqlite3_result_text (pContext, + row->linkRef->Link->NodeTo->Code, + strlen (row->linkRef->Link-> + NodeTo->Code), SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, + row->linkRef->Link->NodeTo->Id); + } + if (column == 10) + { + /* the PointFrom column */ + sqlite3_result_null (pContext); + } + if (column == 11) + { + /* the PointTo column */ + sqlite3_result_null (pContext); + } + if (column == 12) + { + /* the Tolerance column */ + sqlite3_result_null (pContext); + } + if (column == 13) + { + /* the Cost column */ + sqlite3_result_double (pContext, row->linkRef->Link->Cost); + } + if (column == 14) + { + /* the Geometry column */ + sqlite3_result_null (pContext); + } + if (column == 15) + { + /* the [optional] Name column */ + if (row->linkRef->Name) + sqlite3_result_text (pContext, row->linkRef->Name, + strlen (row->linkRef->Name), + SQLITE_STATIC); + else + sqlite3_result_null (pContext); + } + } +} + +static void +do_point2point_column (virtualroutingCursorPtr cursor, virtualroutingPtr net, + sqlite3_context * pContext, int node_code, + ResultsetRowPtr row, int column) +{ +/* processing a Point2Point solution row */ + const char *algorithm; + char delimiter[128]; + const char *role; + Point2PointSolutionPtr p2p = cursor->pVtab->point2PointSolution; + if (row->linkRef == NULL || row->Point2PointRole == VROUTE_POINT2POINT_START + || row->Point2PointRole == VROUTE_POINT2POINT_END) + { + /* special case: this one is the solution summary */ + if (column == 0) + { + /* the currently used Algorithm */ + if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) + algorithm = "A*"; + else + algorithm = "Dijkstra"; + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 1) + { + /* the current Request type */ + algorithm = "Point2Point Path"; + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 2) + { + /* the currently set Options */ + if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) + algorithm = "Simple"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_LINKS) + algorithm = "No Links"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_GEOMS) + algorithm = "No Geometries"; + else + algorithm = "Full"; + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 3) + { + /* the currently set delimiter char */ + if (isprint (cursor->pVtab->currentDelimiter)) + sprintf (delimiter, "%c [dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + else + sprintf (delimiter, "[dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + sqlite3_result_text (pContext, delimiter, + strlen (delimiter), SQLITE_TRANSIENT); + } + if (column == 4) + { + /* the RouteNum column */ + sqlite3_result_int (pContext, row->RouteNum); + } + if (column == 5) + { + /* the RouteRow column */ + sqlite3_result_int (pContext, row->RouteRow); + } + if (column == 6) + { + /* role of this row */ + if (row->Point2PointRole == VROUTE_POINT2POINT_INGRESS) + role = "Ingress Path"; + else if (row->Point2PointRole == VROUTE_POINT2POINT_START) + role = "Partial Link (Start)"; + else if (row->Point2PointRole == VROUTE_POINT2POINT_END) + role = "Partial Link (End)"; + else if (row->Point2PointRole == VROUTE_POINT2POINT_EGRESS) + role = "Egress Path"; + else + role = "Point2Point Solution"; + sqlite3_result_text (pContext, role, strlen (role), + SQLITE_TRANSIENT); + } + if (column == 7) + { + /* the LinkRowId column */ + if (row->Point2PointRole == VROUTE_POINT2POINT_START + || row->Point2PointRole == VROUTE_POINT2POINT_END) + sqlite3_result_int64 (pContext, + row->linkRef->Link->LinkRowid); + else + sqlite3_result_null (pContext); + } + if (column == 8) + { + /* the NodeFrom column */ + if (row->Point2PointRole == VROUTE_POINT2POINT_END) + { if (node_code) sqlite3_result_text (pContext, - row->linkRef->Arc->NodeFrom-> - Code, - strlen (row->linkRef->Arc-> + row->linkRef->Link-> + NodeFrom->Code, + strlen (row->linkRef->Link-> NodeFrom->Code), SQLITE_STATIC); else sqlite3_result_int64 (pContext, - row->linkRef->Arc->NodeFrom-> - Id); + row->linkRef->Link-> + NodeFrom->Id); } - if (column == 9) + else + sqlite3_result_null (pContext); + } + if (column == 9) + { + /* the NodeTo column */ + if (row->Point2PointRole == VROUTE_POINT2POINT_START) { - /* the NodeTo column */ if (node_code) sqlite3_result_text (pContext, - row->linkRef->Arc->NodeTo->Code, - strlen (row->linkRef->Arc-> + row->linkRef->Link->NodeTo->Code, + strlen (row->linkRef->Link-> NodeTo->Code), SQLITE_STATIC); else sqlite3_result_int64 (pContext, - row->linkRef->Arc->NodeTo->Id); + row->linkRef->Link->NodeTo->Id); + } + else + sqlite3_result_null (pContext); + } + if (column == 10) + { + /* the PointFrom column */ + if (row->Point2PointRole == VROUTE_POINT2POINT_NONE) + { + unsigned char *blob; + int blob_size; + if (p2p->hasZ) + gaiaMakePointZ (p2p->xFrom, p2p->yFrom, p2p->zFrom, + p2p->srid, &blob, &blob_size); + else + gaiaMakePoint (p2p->xFrom, p2p->yFrom, p2p->srid, + &blob, &blob_size); + sqlite3_result_blob (pContext, blob, blob_size, free); } - if (column == 10) + else + sqlite3_result_null (pContext); + } + if (column == 11) + { + /* the PointTo column */ + if (row->Point2PointRole == VROUTE_POINT2POINT_NONE) { - /* the Cost column */ - sqlite3_result_double (pContext, row->linkRef->Arc->Cost); + unsigned char *blob; + int blob_size; + if (p2p->hasZ) + gaiaMakePointZ (p2p->xTo, p2p->yTo, p2p->zTo, + p2p->srid, &blob, &blob_size); + else + gaiaMakePoint (p2p->xTo, p2p->yTo, p2p->srid, &blob, + &blob_size); + sqlite3_result_blob (pContext, blob, blob_size, free); } - if (column == 11) + else + sqlite3_result_null (pContext); + } + if (column == 12) + { + /* the Tolerance column */ + sqlite3_result_double (pContext, cursor->pVtab->Tolerance); + } + if (column == 13) + { + /* the Cost column */ + sqlite3_result_double (pContext, row->TotalCost); + } + if (column == 14) + { + /* the Geometry column */ + if (!(row->Geometry)) + sqlite3_result_null (pContext); + else { - /* the Geometry column */ - sqlite3_result_null (pContext); + /* builds the BLOB geometry to be returned */ + int len; + unsigned char *p_result = NULL; + gaiaToSpatiaLiteBlobWkb (row->Geometry, &p_result, &len); + sqlite3_result_blob (pContext, p_result, len, free); } - if (column == 12) + } + if (column == 15) + { + /* the [optional] Name column */ + if (row->Point2PointRole == VROUTE_POINT2POINT_START + || row->Point2PointRole == VROUTE_POINT2POINT_END) { - /* the [optional] Name column */ if (row->linkRef->Name) sqlite3_result_text (pContext, row->linkRef->Name, strlen (row->linkRef->Name), SQLITE_STATIC); else sqlite3_result_null (pContext); } + else + sqlite3_result_null (pContext); + } + } + else + { + /* ordinary case: this one is a Link used by the solution */ + if (column == 0) + { + /* the currently used Algorithm */ + if (net->currentAlgorithm == VROUTE_A_STAR_ALGORITHM) + algorithm = "A*"; + else + algorithm = "Dijkstra"; + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 1) + { + /* the current Request type */ + algorithm = "Point2Point Path"; + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 2) + { + /* the currently set Options */ + if (net->currentOptions == VROUTE_SHORTEST_PATH_SIMPLE) + algorithm = "Simple"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_LINKS) + algorithm = "No Links"; + else if (net->currentOptions == VROUTE_SHORTEST_PATH_NO_GEOMS) + algorithm = "No Geometries"; + else + algorithm = "Full"; + sqlite3_result_text (pContext, algorithm, + strlen (algorithm), SQLITE_TRANSIENT); + } + if (column == 3) + { + /* the currently set delimiter char */ + if (isprint (cursor->pVtab->currentDelimiter)) + sprintf (delimiter, "%c [dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + else + sprintf (delimiter, "[dec=%d, hex=%02x]", + cursor->pVtab->currentDelimiter, + cursor->pVtab->currentDelimiter); + sqlite3_result_text (pContext, delimiter, + strlen (delimiter), SQLITE_TRANSIENT); + } + if (column == 4) + { + /* the RouteNum column */ + sqlite3_result_int (pContext, row->RouteNum); + } + if (column == 5) + { + /* the RouteRow column */ + sqlite3_result_int (pContext, row->RouteRow); + } + if (column == 6) + { + /* role of this row */ + role = "Link"; + sqlite3_result_text (pContext, role, strlen (role), + SQLITE_TRANSIENT); + } + if (column == 7) + { + /* the LinkRowId column */ + sqlite3_result_int64 (pContext, row->linkRef->Link->LinkRowid); + } + if (column == 8) + { + /* the NodeFrom column */ + if (node_code) + sqlite3_result_text (pContext, + row->linkRef->Link->NodeFrom->Code, + strlen (row->linkRef->Link-> + NodeFrom->Code), + SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, + row->linkRef->Link->NodeFrom->Id); + } + if (column == 9) + { + /* the NodeTo column */ + if (node_code) + sqlite3_result_text (pContext, + row->linkRef->Link->NodeTo->Code, + strlen (row->linkRef->Link-> + NodeTo->Code), SQLITE_STATIC); + else + sqlite3_result_int64 (pContext, + row->linkRef->Link->NodeTo->Id); + } + if (column == 12) + { + /* the Tolerance column */ + sqlite3_result_double (pContext, cursor->pVtab->Tolerance); + } + if (column == 13) + { + /* the Cost column */ + sqlite3_result_double (pContext, row->linkRef->Link->Cost); + } + if (column == 14) + { + /* the Geometry column */ + sqlite3_result_null (pContext); + } + if (column == 15) + { + /* the [optional] Name column */ + if (row->linkRef->Name) + sqlite3_result_text (pContext, row->linkRef->Name, + strlen (row->linkRef->Name), + SQLITE_STATIC); + else + sqlite3_result_null (pContext); + } + } +} + +static int +vroute_column (sqlite3_vtab_cursor * pCursor, sqlite3_context * pContext, + int column) +{ +/* fetching value for the Nth column */ + ResultsetRowPtr row; + RowNodeSolutionPtr row_node; + int node_code = 0; + virtualroutingCursorPtr cursor = (virtualroutingCursorPtr) pCursor; + virtualroutingPtr net = (virtualroutingPtr) cursor->pVtab; + node_code = net->graph->NodeCode; + if (cursor->pVtab->multiSolution->Mode == VROUTE_RANGE_SOLUTION) + { + /* processing "within Cost range" solution */ + row_node = cursor->pVtab->multiSolution->CurrentNodeRow; + do_cost_range_column (cursor, pContext, node_code, row_node, column); + return SQLITE_OK; + } + else if (cursor->pVtab->multiSolution->Mode == VROUTE_ROUTING_SOLUTION + || cursor->pVtab->multiSolution->Mode == VROUTE_TSP_SOLUTION) + { + /* processing an ordinary Routing (Shortest Path or TSP) solution */ + row = cursor->pVtab->multiSolution->CurrentRow; + do_common_column (cursor, net, pContext, node_code, row, column); + return SQLITE_OK; + } + + if (cursor->pVtab->point2PointSolution != NULL) + { + if (cursor->pVtab->point2PointSolution->Mode == + VROUTE_POINT2POINT_SOLUTION) + { + /* processing a Point2Point solution */ + row = cursor->pVtab->point2PointSolution->CurrentRow; + do_point2point_column (cursor, net, pContext, node_code, row, + column); + return SQLITE_OK; } } return SQLITE_OK; } @@ -5950,11 +8857,11 @@ return SQLITE_READONLY; } else { /* performing an UPDATE */ - if (argc == 15) + if (argc == 18) { p_vtab->currentAlgorithm = VROUTE_DIJKSTRA_ALGORITHM; p_vtab->currentDelimiter = ','; if (sqlite3_value_type (argv[2]) == SQLITE_TEXT) { @@ -5984,13 +8891,13 @@ } if (sqlite3_value_type (argv[4]) == SQLITE_TEXT) { const unsigned char *options = sqlite3_value_text (argv[4]); - if (strcasecmp ((char *) options, "NO ARCS") == 0) + if (strcasecmp ((char *) options, "NO LINKS") == 0) p_vtab->currentOptions = - VROUTE_SHORTEST_PATH_NO_ARCS; + VROUTE_SHORTEST_PATH_NO_LINKS; else if (strcasecmp ((char *) options, "NO GEOMETRIES") == 0) p_vtab->currentOptions = VROUTE_SHORTEST_PATH_NO_GEOMS; else if (strcasecmp ((char *) options, "SIMPLE") == @@ -6005,10 +8912,12 @@ { const unsigned char *delimiter = sqlite3_value_text (argv[5]); p_vtab->currentDelimiter = *delimiter; } + if (sqlite3_value_type (argv[14]) == SQLITE_FLOAT) + p_vtab->Tolerance = sqlite3_value_double (argv[14]); } return SQLITE_OK; } } } Index: src/spatialite/virtualshape.c ================================================================== --- src/spatialite/virtualshape.c +++ src/spatialite/virtualshape.c @@ -45,10 +45,11 @@ #include #include #include #include +#include #if defined(_WIN32) && !defined(__MINGW32__) #include "config-msvc.h" #else #include "config.h" @@ -78,10 +79,15 @@ char *zErrMsg; /* error message: USE INTERNALLY BY SQLITE */ sqlite3 *db; /* the sqlite db holding the virtual table */ gaiaShapefilePtr Shp; /* the Shapefile struct */ int Srid; /* the Shapefile SRID */ int text_dates; + char *TableName; /* the VirtualTable name */ + double MinX; /* the Shapefile Full Extent */ + double MinY; + double MaxX; + double MaxY; } VirtualShape; typedef VirtualShape *VirtualShapePtr; typedef struct VirtualShapeConstraintStruct { @@ -212,10 +218,12 @@ int colname_case = GAIA_DBF_COLNAME_LOWERCASE; char *xname; char **col_name = NULL; int geotype; gaiaOutBuffer sql_statement; + int ret; + sqlite3_stmt *stmt = NULL; if (pAux) pAux = pAux; /* unused arg warning suppression */ /* checking for shapefile PATH */ if (argc == 6 || argc == 7 || argc == 8) { @@ -288,10 +296,17 @@ p_vt->nRef = 0; p_vt->zErrMsg = NULL; p_vt->db = db; p_vt->Shp = gaiaAllocShapefile (); p_vt->Srid = srid; + len = strlen (argv[2]); + p_vt->TableName = malloc (len + 1); + strcpy (p_vt->TableName, argv[2]); + p_vt->MinX = DBL_MAX; + p_vt->MinY = DBL_MAX; + p_vt->MaxX = -DBL_MAX; + p_vt->MaxY = -DBL_MAX; p_vt->text_dates = text_dates; /* trying to open files etc in order to ensure we actually have a genuine shapefile */ gaiaOpenShpRead (p_vt->Shp, path, encoding, "UTF-8"); if (!(p_vt->Shp->Valid)) { @@ -318,10 +333,14 @@ p_vt->Shp->Shape == 15 || p_vt->Shp->Shape == 25) { /* fixing anyway the Geometry type for LINESTRING/MULTILINESTRING or POLYGON/MULTIPOLYGON */ gaiaShpAnalyze (p_vt->Shp); } + p_vt->MinX = p_vt->Shp->MinX; + p_vt->MinY = p_vt->Shp->MinY; + p_vt->MaxX = p_vt->Shp->MaxX; + p_vt->MaxY = p_vt->Shp->MaxY; /* preparing the COLUMNs for this VIRTUAL TABLE */ gaiaOutBufferInitialize (&sql_statement); xname = gaiaDoubleQuotedSql (argv[2]); if (colname_case == GAIA_DBF_COLNAME_LOWERCASE) sql = @@ -619,10 +638,27 @@ "VALUES (Lower(%Q), 'geometry')", argv[2]); sqlite3_exec (db, sql, NULL, NULL, NULL); sqlite3_free (sql); } +/* inserting into the connection cache: SHP Extent */ + sql = "SELECT \"*Add-Shapefile+Extent\"(?, ?, ?, ?, ?, ?)"; + ret = sqlite3_prepare_v2 (db, sql, strlen (sql), &stmt, NULL); + if (ret == SQLITE_OK) + { + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, argv[2], strlen (argv[2]), SQLITE_STATIC); + sqlite3_bind_double (stmt, 2, p_vt->MinX); + sqlite3_bind_double (stmt, 3, p_vt->MinY); + sqlite3_bind_double (stmt, 4, p_vt->MaxX); + sqlite3_bind_double (stmt, 5, p_vt->MaxY); + sqlite3_bind_int (stmt, 6, p_vt->Srid); + ret = sqlite3_step (stmt); + } + sqlite3_finalize (stmt); + return SQLITE_OK; } static int vshp_connect (sqlite3 * db, void *pAux, int argc, const char *const *argv, @@ -668,14 +704,34 @@ static int vshp_disconnect (sqlite3_vtab * pVTab) { /* disconnects the virtual table */ + int ret; + sqlite3_stmt *stmt; + const char *sql; VirtualShapePtr p_vt = (VirtualShapePtr) pVTab; if (p_vt->Shp) gaiaFreeShapefile (p_vt->Shp); + +/* removing from the connection cache: SHP Extent */ + sql = "SELECT \"*Remove-Shapefile+Extent\"(?)"; + ret = sqlite3_prepare_v2 (p_vt->db, sql, strlen (sql), &stmt, NULL); + if (ret == SQLITE_OK) + { + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, p_vt->TableName, strlen (p_vt->TableName), + SQLITE_STATIC); + ret = sqlite3_step (stmt); + } + sqlite3_finalize (stmt); + + if (p_vt->TableName != NULL) + free (p_vt->TableName); sqlite3_free (p_vt); + return SQLITE_OK; } static int vshp_destroy (sqlite3_vtab * pVTab) Index: src/spatialite/virtualspatialindex.c ================================================================== --- src/spatialite/virtualspatialindex.c +++ src/spatialite/virtualspatialindex.c @@ -92,10 +92,48 @@ int eof; /* the EOF marker */ sqlite3_stmt *stmt; sqlite3_int64 CurrentRowId; } VirtualSpatialIndexCursor; typedef VirtualSpatialIndexCursor *VirtualSpatialIndexCursorPtr; + +static int +vspidx_validate_view_rowid (void *p_sqlite, const char *table, + const char *column) +{ +/* checks if a table does really contains a given column */ + sqlite3 *sqlite = (sqlite3 *) p_sqlite; + int rowid = 0; + char *sql; + int ret; + const char *name; + int i; + 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, column) == 0) + rowid = 1; + } + } + sqlite3_free_table (results); + if (rowid == 0) + return 0; + return 1; +} static int vspidx_check_view_rtree (sqlite3 * sqlite, const char *table_name, const char *geom_column, char **real_table, char **real_geom) @@ -105,10 +143,11 @@ char *sql_statement; int ret; int count = 0; char *rt = NULL; char *rg = NULL; + char *rowid = NULL; /* testing if views_geometry_columns exists */ sql_statement = sqlite3_mprintf ("SELECT tbl_name FROM sqlite_master " "WHERE type = 'table' AND tbl_name = 'views_geometry_columns'"); ret = @@ -131,18 +170,18 @@ return 0; count = 0; /* attempting to find the RTree Geometry Column */ sql_statement = - sqlite3_mprintf ("SELECT a.f_table_name, a.f_geometry_column " - "FROM views_geometry_columns AS a " - "JOIN geometry_columns AS b ON (" - "Upper(a.f_table_name) = Upper(b.f_table_name) AND " - "Upper(a.f_geometry_column) = Upper(b.f_geometry_column)) " - "WHERE Upper(a.view_name) = Upper(%Q) " - "AND Upper(a.view_geometry) = Upper(%Q) AND b.spatial_index_enabled = 1", - table_name, geom_column); + sqlite3_mprintf + ("SELECT a.f_table_name, a.f_geometry_column, a.view_rowid " + "FROM views_geometry_columns AS a " "JOIN geometry_columns AS b ON (" + "Upper(a.f_table_name) = Upper(b.f_table_name) AND " + "Upper(a.f_geometry_column) = Upper(b.f_geometry_column)) " + "WHERE Upper(a.view_name) = Upper(%Q) " + "AND Upper(a.view_geometry) = Upper(%Q) AND b.spatial_index_enabled = 1", + table_name, geom_column); ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement), &stmt, NULL); sqlite3_free (sql_statement); if (ret != SQLITE_OK) @@ -165,22 +204,30 @@ len = sqlite3_column_bytes (stmt, 1); if (rg) free (rg); rg = malloc (len + 1); strcpy (rg, v); + v = (const char *) sqlite3_column_text (stmt, 2); + len = sqlite3_column_bytes (stmt, 2); + if (rowid) + free (rowid); + rowid = malloc (len + 1); + strcpy (rowid, v); count++; } } sqlite3_finalize (stmt); if (count != 1) return 0; - if (validateRowid (sqlite, table_name)) + if (!vspidx_validate_view_rowid (sqlite, table_name, rowid)) { free (rt); free (rg); + free (rowid); return 0; } + free (rowid); *real_table = rt; *real_geom = rg; return 1; } @@ -246,12 +293,18 @@ count++; } } sqlite3_finalize (stmt); if (count != 1) - return vspidx_check_view_rtree (sqlite, table_name, geom_column, - real_table, real_geom); + { + if (rg != NULL) + free (rg); + if (rt != NULL) + free (rt); + return vspidx_check_view_rtree (sqlite, table_name, geom_column, + real_table, real_geom); + } else { *real_table = rt; *real_geom = rg; } @@ -268,10 +321,11 @@ char *sql_statement; int ret; int count = 0; char *rt = NULL; char *rg = NULL; + char *rowid = NULL; /* testing if views_geometry_columns exists */ if (db_prefix == NULL) { sql_statement = sqlite3_mprintf ("SELECT tbl_name FROM sqlite_master " @@ -308,29 +362,31 @@ /* attempting to find the RTree Geometry Column */ if (db_prefix == NULL) { sql_statement = - sqlite3_mprintf ("SELECT a.f_table_name, a.f_geometry_column " - "FROM views_geometry_columns AS a " - "JOIN geometry_columns AS b ON (" - "Upper(a.f_table_name) = Upper(b.f_table_name) AND " - "Upper(a.f_geometry_column) = Upper(b.f_geometry_column)) " - "WHERE Upper(a.view_name) = Upper(%Q) AND b.spatial_index_enabled = 1", - table_name); + sqlite3_mprintf + ("SELECT a.f_table_name, a.f_geometry_column, a.view_rowid " + "FROM views_geometry_columns AS a " + "JOIN geometry_columns AS b ON (" + "Upper(a.f_table_name) = Upper(b.f_table_name) AND " + "Upper(a.f_geometry_column) = Upper(b.f_geometry_column)) " + "WHERE Upper(a.view_name) = Upper(%Q) AND b.spatial_index_enabled = 1", + table_name); } else { char *quoted_db = gaiaDoubleQuotedSql (db_prefix); sql_statement = - sqlite3_mprintf ("SELECT a.f_table_name, a.f_geometry_column " - "FROM \"%s\".views_geometry_columns AS a " - "JOIN \"%s\".geometry_columns AS b ON (" - "Upper(a.f_table_name) = Upper(b.f_table_name) AND " - "Upper(a.f_geometry_column) = Upper(b.f_geometry_column)) " - "WHERE Upper(a.view_name) = Upper(%Q) AND b.spatial_index_enabled = 1", - quoted_db, quoted_db, table_name); + sqlite3_mprintf + ("SELECT a.f_table_name, a.f_geometry_column, a.view_rowid " + "FROM \"%s\".views_geometry_columns AS a " + "JOIN \"%s\".geometry_columns AS b ON (" + "Upper(a.f_table_name) = Upper(b.f_table_name) AND " + "Upper(a.f_geometry_column) = Upper(b.f_geometry_column)) " + "WHERE Upper(a.view_name) = Upper(%Q) AND b.spatial_index_enabled = 1", + quoted_db, quoted_db, table_name); free (quoted_db); } ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement), &stmt, NULL); @@ -355,16 +411,30 @@ len = sqlite3_column_bytes (stmt, 1); if (rg) free (rg); rg = malloc (len + 1); strcpy (rg, v); + v = (const char *) sqlite3_column_text (stmt, 2); + len = sqlite3_column_bytes (stmt, 2); + if (rowid) + free (rowid); + rowid = malloc (len + 1); + strcpy (rowid, v); count++; } } sqlite3_finalize (stmt); if (count != 1) return 0; + if (!vspidx_validate_view_rowid (sqlite, table_name, rowid)) + { + free (rt); + free (rg); + free (rowid); + return 0; + } + free (rowid); *real_table = rt; *real_geom = rg; return 1; } @@ -427,12 +497,18 @@ count++; } } sqlite3_finalize (stmt); if (count != 1) - return vspidx_find_view_rtree (sqlite, db_prefix, table_name, - real_table, real_geom); + { + if (rg != NULL) + free (rg); + if (rt != NULL) + free (rt); + return vspidx_find_view_rtree (sqlite, db_prefix, table_name, + real_table, real_geom); + } else { *real_table = rt; *real_geom = rg; } Index: src/srsinit/Makefile.am ================================================================== --- src/srsinit/Makefile.am +++ src/srsinit/Makefile.am @@ -1,9 +1,9 @@ SUBDIRS = epsg_update -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libsrsinit.la srsinit.la SRSINIT_COMMON_SOURCES = srs_init.c \ @@ -63,15 +63,15 @@ libsrsinit_la_CFLAGS = -fvisibility=hidden srsinit_la_SOURCES = $(SRSINIT_COMMON_SOURCES) -srsinit_la_CPPFLAGS = @CFLAGS@ +srsinit_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ srsinit_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. srsinit_la_CPPFLAGS += -DLOADABLE_EXTENSION srsinit_la_CPPFLAGS += -fvisibility=hidden srsinit_la_LDFLAGS = -module srsinit_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/srsinit/Makefile.in ================================================================== --- src/srsinit/Makefile.in +++ src/srsinit/Makefile.in @@ -430,11 +430,11 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = epsg_update -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libsrsinit.la srsinit.la SRSINIT_COMMON_SOURCES = srs_init.c \ epsg_inlined_00.c \ epsg_inlined_01.c \ epsg_inlined_02.c \ @@ -488,12 +488,12 @@ epsg_inlined_extra.c libsrsinit_la_SOURCES = $(SRSINIT_COMMON_SOURCES) libsrsinit_la_CFLAGS = -fvisibility=hidden srsinit_la_SOURCES = $(SRSINIT_COMMON_SOURCES) -srsinit_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION -fvisibility=hidden +srsinit_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers \ + -I. -DLOADABLE_EXTENSION -fvisibility=hidden srsinit_la_LDFLAGS = -module srsinit_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-recursive ADDED src/stored_procedures/Makefile.am Index: src/stored_procedures/Makefile.am ================================================================== --- src/stored_procedures/Makefile.am +++ src/stored_procedures/Makefile.am @@ -0,0 +1,17 @@ + +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ +AM_CPPFLAGS += -I$(top_srcdir)/src/headers + +noinst_LTLIBRARIES = libstored_procedures.la stored_procedures.la + +libstored_procedures_la_SOURCES = stored_procedures.c + +stored_procedures_la_SOURCES = stored_procedures.c + +stored_procedures_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ +stored_procedures_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. +stored_procedures_la_CPPFLAGS += -DLOADABLE_EXTENSION +stored_procedures_la_LDFLAGS = -module +stored_procedures_la_LIBTOOLFLAGS = --tag=disable-static + +MOSTLYCLEANFILES = *.gcna *.gcno *.gcda ADDED src/stored_procedures/Makefile.in Index: src/stored_procedures/Makefile.in ================================================================== --- src/stored_procedures/Makefile.in +++ src/stored_procedures/Makefile.in @@ -0,0 +1,626 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/stored_procedures +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libstored_procedures_la_LIBADD = +am_libstored_procedures_la_OBJECTS = stored_procedures.lo +libstored_procedures_la_OBJECTS = \ + $(am_libstored_procedures_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +stored_procedures_la_LIBADD = +am_stored_procedures_la_OBJECTS = \ + stored_procedures_la-stored_procedures.lo +stored_procedures_la_OBJECTS = $(am_stored_procedures_la_OBJECTS) +stored_procedures_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(stored_procedures_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(stored_procedures_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libstored_procedures_la_SOURCES) \ + $(stored_procedures_la_SOURCES) +DIST_SOURCES = $(libstored_procedures_la_SOURCES) \ + $(stored_procedures_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GEOSCONFIG = @GEOSCONFIG@ +GEOS_CFLAGS = @GEOS_CFLAGS@ +GEOS_LDFLAGS = @GEOS_LDFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers +noinst_LTLIBRARIES = libstored_procedures.la stored_procedures.la +libstored_procedures_la_SOURCES = stored_procedures.c +stored_procedures_la_SOURCES = stored_procedures.c +stored_procedures_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ \ + -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION +stored_procedures_la_LDFLAGS = -module +stored_procedures_la_LIBTOOLFLAGS = --tag=disable-static +MOSTLYCLEANFILES = *.gcna *.gcno *.gcda +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/stored_procedures/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/stored_procedures/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libstored_procedures.la: $(libstored_procedures_la_OBJECTS) $(libstored_procedures_la_DEPENDENCIES) $(EXTRA_libstored_procedures_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libstored_procedures_la_OBJECTS) $(libstored_procedures_la_LIBADD) $(LIBS) + +stored_procedures.la: $(stored_procedures_la_OBJECTS) $(stored_procedures_la_DEPENDENCIES) $(EXTRA_stored_procedures_la_DEPENDENCIES) + $(AM_V_CCLD)$(stored_procedures_la_LINK) $(stored_procedures_la_OBJECTS) $(stored_procedures_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stored_procedures.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stored_procedures_la-stored_procedures.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +stored_procedures_la-stored_procedures.lo: stored_procedures.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(stored_procedures_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stored_procedures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT stored_procedures_la-stored_procedures.lo -MD -MP -MF $(DEPDIR)/stored_procedures_la-stored_procedures.Tpo -c -o stored_procedures_la-stored_procedures.lo `test -f 'stored_procedures.c' || echo '$(srcdir)/'`stored_procedures.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stored_procedures_la-stored_procedures.Tpo $(DEPDIR)/stored_procedures_la-stored_procedures.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='stored_procedures.c' object='stored_procedures_la-stored_procedures.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(stored_procedures_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stored_procedures_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o stored_procedures_la-stored_procedures.lo `test -f 'stored_procedures.c' || echo '$(srcdir)/'`stored_procedures.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: ADDED src/stored_procedures/stored_procedures.c Index: src/stored_procedures/stored_procedures.c ================================================================== --- src/stored_procedures/stored_procedures.c +++ src/stored_procedures/stored_procedures.c @@ -0,0 +1,2243 @@ +/* + + stored_procedures.c -- SpatiaLite Stored Procedures support + + version 4.5, 2017 October 22 + + 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) 2017 +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 +#include +#include + +#if defined(_WIN32) && !defined(__MINGW32__) +#include "config-msvc.h" +#else +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#define strcasecmp _stricmp +#endif /* not WIN32 */ + +/* 64 bit integer: portable format for printf() */ +#if defined(_WIN32) && !defined(__MINGW32__) +#define FRMT64 "%I64d" +#else +#define FRMT64 "%lld" +#endif + +struct sp_var_item +{ +/* a variable Argument item */ + char *varname; + short count; + struct sp_var_item *next; +}; + +struct sp_var_list +{ +/* a list of Variable Arguments */ + struct sp_var_item *first; + struct sp_var_item *last; +}; + +static void +stored_proc_reset_error (const void *ctx) +{ +/* resetting the Stored Procedures Last Error Message */ + struct splite_internal_cache *cache = (struct splite_internal_cache *) ctx; + if (cache != NULL) + { + if (cache->storedProcError != NULL) + { + free (cache->storedProcError); + cache->storedProcError = NULL; + } + } +} + +SPATIALITE_PRIVATE void +gaia_sql_proc_set_error (const void *ctx, const char *errmsg) +{ +/* setting the Stored Procedures Last Error Message */ + struct splite_internal_cache *cache = (struct splite_internal_cache *) ctx; + if (cache != NULL) + { + int len; + if (cache->storedProcError != NULL) + { + free (cache->storedProcError); + cache->storedProcError = NULL; + } + if (errmsg == NULL) + return; + + len = strlen (errmsg); + cache->storedProcError = malloc (len + 1); + strcpy (cache->storedProcError, errmsg); + } +} + +SQLPROC_DECLARE char * +gaia_sql_proc_get_last_error (const void *p_cache) +{ +/* return the last Stored Procedures Error Message (if any) */ + struct splite_internal_cache *cache = + (struct splite_internal_cache *) p_cache; + + if (cache == NULL) + return NULL; + return cache->storedProcError; +} + +SQLPROC_DECLARE SqlProc_VarListPtr +gaia_sql_proc_create_variables () +{ +/* allocating an empty list of Variables with Values */ + SqlProc_VarListPtr list = malloc (sizeof (SqlProc_VarList)); + if (list == NULL) + return NULL; + + list->Error = 0; + list->ErrMessage = NULL; + list->First = NULL; + list->Last = NULL; + return list; +} + +SQLPROC_DECLARE void +gaia_sql_proc_destroy_variables (SqlProc_VarListPtr list) +{ +/* destroying a List of Variables with Values */ + SqlProc_VariablePtr var; + SqlProc_VariablePtr n_var; + if (list == NULL) + return; + + var = list->First; + while (var != NULL) + { + n_var = var->Next; + if (var->Name != NULL) + free (var->Name); + if (var->Value != NULL) + free (var->Value); + free (var); + var = n_var; + } + if (list->ErrMessage != NULL) + sqlite3_free (list->ErrMessage); + free (list); +} + +static int +parse_variable_name_value (const char *str, char **name, char **value) +{ +/* attempting to parse a Variable with Value definition */ + char marker = '\0'; + int end = 0; + int start; + int name_len; + int value_len; + char *nm; + char *val; + int i; + + *name = NULL; + *value = NULL; + if (*str == '@') + marker = '@'; + if (*str == '$') + marker = '$'; + if (marker == '\0') + return 0; + +/* searching the closing marker - variable name */ + for (i = 1; i < (int) strlen (str); i++) + { + if (str[i] == marker) + { + end = i; + break; + } + } + if (end == 0) + return 0; + +/* searching the start position of Value */ + if (end + 1 >= (int) strlen (str)) + return 0; + if (str[end + 1] != '=') + return 0; + start = end + 2; + + name_len = end - 1; + value_len = strlen (str + start); + if (name_len == 0 || value_len == 0) + return 0; + nm = malloc (name_len + 1); + memcpy (nm, str + 1, end - 1); + *(nm + name_len) = '\0'; + val = malloc (value_len + 1); + strcpy (val, str + start); + + *name = nm; + *value = val; + return 1; +} + +SQLPROC_DECLARE int +gaia_sql_proc_add_variable (SqlProc_VarListPtr list, const char *str) +{ +/* adding a Variable with Values to the List */ + char *name; + char *value; + SqlProc_VariablePtr var; + if (list == NULL) + return 0; + + if (!parse_variable_name_value (str, &name, &value)) + { + list->ErrMessage = + sqlite3_mprintf ("Illegal Variable with Value definition: %s", + str); + return 0; + } + + var = list->First; + while (var != NULL) + { + /* checking for redefined variables */ + if (strcasecmp (name, var->Name) == 0) + { + list->ErrMessage = + sqlite3_mprintf + ("Duplicated Variable: @%s@ is already defined.", name); + return 0; + } + var = var->Next; + } + +/* adding the Variable with Value */ + var = malloc (sizeof (SqlProc_Variable)); + var->Name = name; + var->Value = value; + var->Next = NULL; + if (list->First == NULL) + list->First = var; + if (list->Last != NULL) + list->Last->Next = var; + list->Last = var; + return 1; +} + +SQLPROC_DECLARE int +gaia_sql_proc_is_valid_var_value (const char *str) +{ +/* checking a Variable with Values for validity */ + char *name; + char *value; + + if (!parse_variable_name_value (str, &name, &value)) + return 0; + free (name); + free (value); + return 1; +} + + +static struct sp_var_list * +alloc_var_list () +{ +/* allocating an empty list of Variables */ + struct sp_var_list *list = malloc (sizeof (struct sp_var_list)); + list->first = NULL; + list->last = NULL; + return list; +} + +static void +free_var_list (struct sp_var_list *list) +{ +/* destroying a list of Variables */ + struct sp_var_item *item; + struct sp_var_item *nitem; + + if (list == NULL) + return; + item = list->first; + while (item != NULL) + { + nitem = item->next; + if (item->varname != NULL) + free (item->varname); + free (item); + item = nitem; + } + free (list); +} + +static void +add_variable_ex (struct sp_var_list *list, char *varname, short ref_count) +{ +/* adding a Variable to the List */ + struct sp_var_item *item; + + if (list == NULL) + return; + if (varname == NULL) + return; + +/* inserting a new variable */ + item = malloc (sizeof (struct sp_var_item)); + item->varname = varname; + item->count = ref_count; + item->next = NULL; + if (list->first == NULL) + list->first = item; + if (list->last != NULL) + list->last->next = item; + list->last = item; +} + +#ifndef OMIT_ICONV /* ICONV is supported */ + +static void +add_variable (struct sp_var_list *list, char *varname) +{ +/* adding a Variable to the List */ + struct sp_var_item *item; + + if (list == NULL) + return; + if (varname == NULL) + return; + +/* checking for already defined variables */ + item = list->first; + while (item != NULL) + { + if (strcasecmp (item->varname, varname) == 0) + { + /* already defined */ + item->count += 1; /* increasing the reference count */ + free (varname); + return; + } + item = item->next; + } + +/* inserting a new variable */ + item = malloc (sizeof (struct sp_var_item)); + item->varname = varname; + item->count = 1; + item->next = NULL; + if (list->first == NULL) + list->first = item; + if (list->last != NULL) + list->last->next = item; + list->last = item; +} + +static int +var_list_required_size (struct sp_var_list *list) +{ +/* computing the size required to store the List into the BLOB */ + struct sp_var_item *item; + int size = 0; +/* checking for already defined variables */ + item = list->first; + while (item != NULL) + { + size += strlen (item->varname) + 7; + item = item->next; + } + return size; +} + +static short +var_list_count_items (struct sp_var_list *list) +{ +/* counting how many variables are there */ + struct sp_var_item *item; + short count = 0; +/* checking for already defined variables */ + item = list->first; + while (item != NULL) + { + count++; + item = item->next; + } + return count; +} + +#endif + +SQLPROC_DECLARE int +gaia_sql_proc_parse (const void *cache, const char *xsql, + const char *charset, unsigned char **blob, int *blob_sz) +{ +/* attempting to parse a Stored Procedure from Text */ +#ifndef OMIT_ICONV /* ICONV is supported */ + int len; + int i; + char *sql = NULL; + int start_line; + int macro; + int comment; + int variable; + char varMark; + int varStart; + struct sp_var_list *list = NULL; + struct sp_var_item *item; + unsigned char *stored_proc = NULL; + unsigned char *p_out; + int stored_proc_sz; + short num_vars; + int sql_len; + int endian_arch = gaiaEndianArch (); + stored_proc_reset_error (cache); + + if (xsql == NULL) + { + const char *errmsg = "NULL SQL body\n"; + gaia_sql_proc_set_error (cache, errmsg); + goto err; + } + len = strlen (xsql); + if (len == 0) + { + const char *errmsg = "Empty SQL body\n"; + gaia_sql_proc_set_error (cache, errmsg); + goto err; + } + sql = sqlite3_malloc (len + 1); + strcpy (sql, xsql); + +/* converting the SQL body to UTF-8 */ + if (!gaiaConvertCharset (&sql, charset, "UTF-8")) + { + char *errmsg = + sqlite3_mprintf + ("Unable to convert the SQL body from %s to UTF-8\n", charset); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + goto err; + } + +/* parsing the SQL body */ + len = strlen (sql); + start_line = 1; + macro = 0; + comment = 0; + variable = 0; + list = alloc_var_list (); + for (i = 0; i < len; i++) + { + if (sql[i] == '\n') + { + /* EndOfLine found */ + macro = 0; + comment = 0; + variable = 0; + start_line = 1; + continue; + } + if (start_line && (sql[i] == ' ' || sql[i] == '\t')) + { + /* skipping leading blanks */ + continue; + } + if (start_line && sql[i] == '.') + macro = 1; + if (start_line && sql[i] == '-') + { + if (i < len - 1) + { + if (sql[i + 1] == '-') + comment = 1; + } + } + start_line = 0; + if (macro || comment) + continue; + if (sql[i] == '@' || sql[i] == '$') + { + if (variable && sql[i] == varMark) + { + /* a variable name ends here */ + int sz = i - varStart; + int j; + int k; + char *varname = malloc (sz); + for (k = 0, j = varStart + 1; j < i; j++, k++) + *(varname + k) = sql[j]; + *(varname + k) = '\0'; + add_variable (list, varname); + variable = 0; + } + else + { + /* a variable name may start here */ + variable = 1; + varMark = sql[i]; + varStart = i; + } + } + } + +/* computing the BLOB size */ + stored_proc_sz = 13; + sql_len = strlen (sql); + stored_proc_sz += sql_len; + stored_proc_sz += var_list_required_size (list); + +/* allocating the Stored Procedure BLOB object */ + stored_proc = malloc (stored_proc_sz); + p_out = stored_proc; + +/* preparing the Stored Procedure BLOB object */ + *p_out++ = '\0'; + *p_out++ = SQLPROC_START; /* START signature */ + *p_out++ = GAIA_LITTLE_ENDIAN; /* byte ordering */ + *p_out++ = SQLPROC_DELIM; /* DELIMITER signature */ + num_vars = var_list_count_items (list); + gaiaExport16 (p_out, num_vars, 1, endian_arch); /* Number of Variables */ + p_out += 2; + *p_out++ = SQLPROC_DELIM; /* DELIMITER signature */ + item = list->first; + while (item != NULL) + { + len = strlen (item->varname); + gaiaExport16 (p_out, len, 1, endian_arch); /* Variable Name length */ + p_out += 2; + *p_out++ = SQLPROC_DELIM; /* DELIMITER signature */ + memcpy (p_out, item->varname, len); + p_out += len; + *p_out++ = SQLPROC_DELIM; /* DELIMITER signature */ + gaiaExport16 (p_out, item->count, 1, endian_arch); /* Variable reference count */ + p_out += 2; + *p_out++ = SQLPROC_DELIM; /* DELIMITER signature */ + item = item->next; + } + gaiaExport32 (p_out, sql_len, 1, endian_arch); /* SQL Body Length */ + p_out += 4; + *p_out++ = SQLPROC_DELIM; /* DELIMITER signature */ + memcpy (p_out, sql, sql_len); + p_out += sql_len; + *p_out = SQLPROC_STOP; /* STOP signature */ + + sqlite3_free (sql); + free_var_list (list); + *blob = stored_proc; + *blob_sz = stored_proc_sz; + return 1; + + err: + if (sql != NULL) + sqlite3_free (sql); + if (list != NULL) + free_var_list (list); + *blob = NULL; + *blob_sz = 0; + return 0; + +#endif /* ICONV conditional */ + + if (cache == NULL && xsql == NULL && charset == NULL) + cache = NULL; /* silencing stupid compiler warnings */ + + spatialite_e + ("gaia_sql_proc_parse: ICONV support was disabled in this build !!!\n"); + + *blob = NULL; + *blob_sz = 0; + return 0; +} + +SQLPROC_DECLARE int +gaia_sql_proc_import (const void *cache, const char *filepath, + const char *charset, unsigned char **blob, int *blob_sz) +{ +/* attempting to import a Stored Procedure from an external File */ + FILE *in = NULL; + size_t size; + char *sql = NULL; + stored_proc_reset_error (cache); + +/* opening the input file */ + in = fopen (filepath, "rb"); + if (in == NULL) + { + char *errmsg = sqlite3_mprintf ("Unable to open: %s\n", filepath); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + goto err; + } + +/* determining the file size */ + if (fseek (in, 0, SEEK_END) != 0) + { + char *errmsg = + sqlite3_mprintf ("Unable to read from: %s\n", filepath); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + goto err; + } + size = ftell (in); + rewind (in); + +/* allocating and feeding the SQL body */ + sql = malloc (size + 1); + if (fread (sql, 1, size, in) != size) + { + char *errmsg = + sqlite3_mprintf ("Unable to read from: %s\n", filepath); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + goto err; + } + *(sql + size) = '\0'; + +/* attempting to parse the SQL body */ + if (!gaia_sql_proc_parse (cache, sql, charset, blob, blob_sz)) + goto err; + + free (sql); + fclose (in); + return 1; + + err: + if (in != NULL) + fclose (in); + if (sql != NULL) + free (sql); + return 0; +} + +SQLPROC_DECLARE int +gaia_sql_proc_is_valid (const unsigned char *blob, int blob_sz) +{ +/* checking for a valid Stored Procedure BLOB Object */ + const unsigned char *p_out = blob; + int endian; + int endian_arch = gaiaEndianArch (); + short size; + short num_vars; + short i_vars; + int len; + if (blob == NULL) + return 0; + if (blob_sz < 9) + return 0; + + if (*p_out++ != '\0') /* first byte should alway be null */ + return 0; + if (*p_out++ != SQLPROC_START) /* start marker */ + return 0; + endian = *p_out++; + if (endian != GAIA_LITTLE_ENDIAN && endian != GAIA_BIG_ENDIAN) /* endianness */ + return 0; + if (*p_out++ != SQLPROC_DELIM) /* delimiter marker */ + return 0; + if ((p_out - blob) >= blob_sz) + return 0; + num_vars = gaiaImport16 (p_out, endian, endian_arch); /* Variables Count */ + p_out += 2; + if ((p_out - blob) >= blob_sz) + return 0; + if (*p_out++ != SQLPROC_DELIM) + return 0; + for (i_vars = 0; i_vars < num_vars; i_vars++) + { + if ((p_out - blob) >= blob_sz) + return 0; + size = gaiaImport16 (p_out, endian, endian_arch); /* Variable Name Length */ + p_out += 2; + if ((p_out - blob) >= blob_sz) + return 0; + if (*p_out++ != SQLPROC_DELIM) + return 0; + p_out += size; /* skipping the variable name */ + if ((p_out - blob) >= blob_sz) + return 0; + if (*p_out++ != SQLPROC_DELIM) + return 0; + if ((p_out - blob) >= blob_sz) + return 0; + p_out += 2; /* Variable Name Length */ + if ((p_out - blob) >= blob_sz) + return 0; + if (*p_out++ != SQLPROC_DELIM) + return 0; + } + if ((p_out - blob) >= blob_sz) + return 0; + len = gaiaImport32 (p_out, endian, endian_arch); /* SQL Body Length */ + p_out += 4; + if ((p_out - blob) >= blob_sz) + return 0; + if (*p_out++ != SQLPROC_DELIM) + return 0; + p_out += len; /* skipping the SQL body */ + if ((p_out - blob) >= blob_sz) + return 0; + if (*p_out != SQLPROC_STOP) + return 0; + + return 1; +} + +SQLPROC_DECLARE int +gaia_sql_proc_var_count (const unsigned char *blob, int blob_sz) +{ +/* return the total count of Variabiles from a Stored Procedure BLOB Object */ + const unsigned char *p_out = blob; + int endian; + int endian_arch = gaiaEndianArch (); + short num_vars; + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + return 0; + + p_out += 2; + endian = *p_out++; + p_out++; + num_vars = gaiaImport16 (p_out, endian, endian_arch); /* Variables Count */ + return num_vars; +} + +SQLPROC_DECLARE char * +gaia_sql_proc_variable (const unsigned char *blob, int blob_sz, int index) +{ +/* return the Name of the Nth Variabile from a Stored Procedure BLOB Object */ + const unsigned char *p_out = blob; + int endian; + int endian_arch = gaiaEndianArch (); + short size; + short num_vars; + short i_vars; + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + return NULL; + if (index < 0) + return NULL; + + p_out += 2; + endian = *p_out++; + p_out++; + num_vars = gaiaImport16 (p_out, endian, endian_arch); /* Variables Count */ + p_out += 3; + for (i_vars = 0; i_vars < num_vars; i_vars++) + { + size = gaiaImport16 (p_out, endian, endian_arch); /* Variable Name Length */ + p_out += 3; + if (i_vars == index) + { + char *varname = malloc (size + 3); + *varname = '@'; + memcpy (varname + 1, p_out, size); + *(varname + size + 1) = '@'; + *(varname + size + 2) = '\0'; + return varname; + } + p_out += size; /* skipping the variable name */ + p_out++; + p_out += 3; /* skipping the reference count */ + } + return NULL; +} + +SQLPROC_DECLARE char * +gaia_sql_proc_all_variables (const unsigned char *blob, int blob_sz) +{ +/* return a comma separated list of Variable Names from a Stored Procedure BLOB Object */ + const unsigned char *p_out = blob; + int endian; + int endian_arch = gaiaEndianArch (); + short size; + short num_vars; + short i_vars; + char *varname; + char *varlist = NULL; + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + return NULL; + + p_out += 2; + endian = *p_out++; + p_out++; + num_vars = gaiaImport16 (p_out, endian, endian_arch); /* Variables Count */ + p_out += 3; + for (i_vars = 0; i_vars < num_vars; i_vars++) + { + size = gaiaImport16 (p_out, endian, endian_arch); /* Variable Name Length */ + p_out += 3; + varname = malloc (size + 3); + *varname = '@'; + memcpy (varname + 1, p_out, size); + *(varname + size + 1) = '@'; + *(varname + size + 2) = '\0'; + if (varlist == NULL) + varlist = sqlite3_mprintf ("%s", varname); + else + { + char *prev = varlist; + varlist = sqlite3_mprintf ("%s %s", prev, varname); + sqlite3_free (prev); + } + free (varname); + p_out += size; /* skipping the variable name */ + p_out++; + p_out += 3; /* skipping the reference count */ + } + return varlist; +} + +SQLPROC_DECLARE char * +gaia_sql_proc_raw_sql (const unsigned char *blob, int blob_sz) +{ +/* return the raw SQL body from a Stored Procedure BLOB Object */ + const unsigned char *p_out = blob; + int endian; + int endian_arch = gaiaEndianArch (); + short size; + int len; + short num_vars; + short i_vars; + char *sql = NULL; + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + return NULL; + + p_out += 2; + endian = *p_out++; + p_out++; + num_vars = gaiaImport16 (p_out, endian, endian_arch); /* Variables Count */ + p_out += 3; + for (i_vars = 0; i_vars < num_vars; i_vars++) + { + size = gaiaImport16 (p_out, endian, endian_arch); /* Variable Name Length */ + p_out += 3; + p_out += size; /* skipping the variable name */ + p_out++; + p_out += 3; /* skipping the reference count */ + } + len = gaiaImport32 (p_out, endian, endian_arch); /* SQL Body Length */ + p_out += 5; + sql = malloc (len + 1); + memcpy (sql, p_out, len); + *(sql + len) = '\0'; + return sql; +} + +static struct sp_var_list * +build_var_list (const unsigned char *blob, int blob_sz) +{ +/* building a list of Variables with Values and reference count */ + const unsigned char *p_out = blob; + int endian; + int endian_arch = gaiaEndianArch (); + short size; + short ref_count; + short num_vars; + short i_vars; + char *varname; + struct sp_var_list *list = NULL; + if (!gaia_sql_proc_is_valid (blob, blob_sz)) + return NULL; + + list = alloc_var_list (); + p_out += 2; + endian = *p_out++; + p_out++; + num_vars = gaiaImport16 (p_out, endian, endian_arch); /* Variables Count */ + p_out += 3; + for (i_vars = 0; i_vars < num_vars; i_vars++) + { + size = gaiaImport16 (p_out, endian, endian_arch); /* Variable Name Length */ + p_out += 3; + varname = malloc (size + 1); + memcpy (varname, p_out, size); + *(varname + size) = '\0'; + p_out += size; /* skipping the variable name */ + p_out++; + ref_count = gaiaImport16 (p_out, endian, endian_arch); /* Variable reference count */ + p_out += 3; /* skipping the reference count */ + add_variable_ex (list, varname, ref_count); + } + return list; +} + +static const char * +search_replacement_value (SqlProc_VarListPtr variables, const char *varname) +{ +/* searching a Variable replacement value (if any) */ + SqlProc_VariablePtr var = variables->First; + while (var != NULL) + { + if (strcasecmp (var->Name, varname) == 0) + { + /* found a replacement value */ + return var->Value; + } + var = var->Next; + } + return NULL; +} + +static char * +search_stored_var (sqlite3 * handle, const char *varname) +{ +/* searching a Stored Variable */ + const char *sql; + sqlite3_stmt *stmt = NULL; + int ret; + char *var_with_value = NULL; + + sql = "SELECT value FROM stored_variables WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + return NULL; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, varname, strlen (varname), 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 (sqlite3_column_type (stmt, 0) == SQLITE_TEXT) + { + const char *data = + (const char *) sqlite3_column_text (stmt, 0); + var_with_value = sqlite3_mprintf ("%s", data); + } + } + } + sqlite3_finalize (stmt); + return var_with_value; +} + +static int +get_value_length (sqlite3 * handle, SqlProc_VarListPtr variables, + const char *varname) +{ +/* retieving a Variable replacement Value length */ + char *stored_var; + SqlProc_VariablePtr var = variables->First; + while (var != NULL) + { + if (strcasecmp (var->Name, varname) == 0) + { + /* found a replacement value */ + return strlen (var->Value); + } + var = var->Next; + } + +/* attempting to get a Stored Variable */ + stored_var = search_stored_var (handle, varname); + if (stored_var != NULL) + { + int len = strlen (stored_var); + sqlite3_free (stored_var); + return len; + } + return 4; /* undefined; defaults to NULL */ +} + +SQLPROC_DECLARE int +gaia_sql_proc_cooked_sql (sqlite3 * handle, const void *cache, + const unsigned char *blob, int blob_sz, + SqlProc_VarListPtr variables, char **sql) +{ +/* return the cooked SQL body from a raw SQL body by replacing Variable Values */ + int len; + int i; + int start_line; + int macro; + int comment; + int variable; + char varMark; + int varStart; + char *raw = NULL; + char *cooked = NULL; + char *p_out; + int buf_size; + struct sp_var_list *list = NULL; + struct sp_var_item *item; + stored_proc_reset_error (cache); + + *sql = NULL; + if (variables == NULL) + { + const char *errmsg = "NULL Variables List (Arguments)\n"; + gaia_sql_proc_set_error (cache, errmsg); + goto err; + } + +/* retrieving the Raw SQL Body */ + raw = gaia_sql_proc_raw_sql (blob, blob_sz); + if (raw == NULL) + { + const char *errmsg = "NULL Raw SQL body\n"; + gaia_sql_proc_set_error (cache, errmsg); + goto err; + } + len = strlen (raw); + if (len == 0) + { + const char *errmsg = "Empty Raw SQL body\n"; + gaia_sql_proc_set_error (cache, errmsg); + goto err; + } + +/* building the Variables List from the BLOB */ + list = build_var_list (blob, blob_sz); + if (list == NULL) + { + const char *errmsg = "NULL Variables List (Raw SQL)\n"; + gaia_sql_proc_set_error (cache, errmsg); + goto err; + } + +/* allocating the Cooked buffer */ + buf_size = strlen (raw); + item = list->first; + while (item != NULL) + { + int value_len = get_value_length (handle, variables, item->varname); + buf_size -= (strlen (item->varname) + 2) * item->count; + buf_size += value_len * item->count; + item = item->next; + } + cooked = malloc (buf_size + 1); + p_out = cooked; + +/* parsing the Raw SQL body */ + start_line = 1; + macro = 0; + comment = 0; + variable = 0; + for (i = 0; i < len; i++) + { + if (raw[i] == '\n') + { + /* EndOfLine found */ + macro = 0; + comment = 0; + variable = 0; + start_line = 1; + *p_out++ = raw[i]; + continue; + } + if (start_line && (raw[i] == ' ' || raw[i] == '\t')) + { + /* skipping leading blanks */ + *p_out++ = raw[i]; + continue; + } + if (start_line && raw[i] == '.') + macro = 1; + if (start_line && raw[i] == '-') + { + if (i < len - 1) + { + if (raw[i + 1] == '-') + comment = 1; + } + } + start_line = 0; + if (macro || comment) + { + *p_out++ = raw[i]; + continue; + } + if (raw[i] == '@' || raw[i] == '$') + { + if (variable && raw[i] == varMark) + { + /* a variable name ends here */ + int sz = i - varStart; + int j; + int k; + char *stored_var = NULL; + const char *replacement_value; + char *varname = malloc (sz); + for (k = 0, j = varStart + 1; j < i; j++, k++) + *(varname + k) = raw[j]; + *(varname + k) = '\0'; + replacement_value = + search_replacement_value (variables, varname); + if (replacement_value == NULL) + { + /* attempting to get a Stored Variable */ + stored_var = search_stored_var (handle, varname); + replacement_value = stored_var; + } + free (varname); + if (replacement_value == NULL) + replacement_value = "NULL"; + for (k = 0; k < (int) strlen (replacement_value); k++) + *p_out++ = replacement_value[k]; + if (stored_var != NULL) + sqlite3_free (stored_var); + variable = 0; + } + else + { + /* a variable name may start here */ + variable = 1; + varMark = raw[i]; + varStart = i; + } + continue; + } + if (!variable) + *p_out++ = raw[i]; + } + *p_out = '\0'; + + free (raw); + free_var_list (list); + *sql = cooked; + return 1; + + err: + if (raw != NULL) + free (raw); + if (cooked != NULL) + free (cooked); + if (list != NULL) + free_var_list (list); + return 0; +} + +static int +test_stored_proc_tables (sqlite3 * handle) +{ +/* testing if the Stored Procedures Tables are already defined */ + int ok_name = 0; + int ok_title = 0; + int ok_sql_proc = 0; + int ok_var_value = 0; + char sql[1024]; + int ret; + const char *name; + int i; + char **results; + int rows; + int columns; + +/* checking the STORED_PROCEDURES table */ + strcpy (sql, "PRAGMA table_info(stored_procedures)"); + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, NULL); + if (ret != SQLITE_OK) + return 0; + if (rows < 1) + ; + else + { + for (i = 1; i <= rows; i++) + { + name = results[(i * columns) + 1]; + if (strcasecmp (name, "name") == 0) + ok_name = 1; + if (strcasecmp (name, "title") == 0) + ok_title = 1; + if (strcasecmp (name, "sql_proc") == 0) + ok_sql_proc = 1; + } + } + sqlite3_free_table (results); + if (ok_name && ok_title && ok_sql_proc) + ; + else + return 0; + +/* checking the STORED_PROCEDURES table */ + ok_name = 0; + ok_title = 0; + strcpy (sql, "PRAGMA table_info(stored_variables)"); + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, NULL); + if (ret != SQLITE_OK) + return 0; + if (rows < 1) + ; + else + { + for (i = 1; i <= rows; i++) + { + name = results[(i * columns) + 1]; + if (strcasecmp (name, "name") == 0) + ok_name = 1; + if (strcasecmp (name, "title") == 0) + ok_title = 1; + if (strcasecmp (name, "value") == 0) + ok_var_value = 1; + } + } + sqlite3_free_table (results); + if (ok_name && ok_title && ok_var_value) + return 1; + return 0; +} + +SQLPROC_DECLARE int +gaia_stored_proc_create_tables (sqlite3 * handle, const void *cache) +{ +/* attempts to create the Stored Procedures Tables */ + char sql[4192]; + char *errMsg = NULL; + int ret; + + if (test_stored_proc_tables (handle)) + return 1; + stored_proc_reset_error (cache); + +/* creating the STORED_PROCEDURES table */ + strcpy (sql, "CREATE TABLE IF NOT EXISTS "); + strcat (sql, "stored_procedures (\n"); + strcat (sql, "name TEXT NOT NULL PRIMARY KEY,\n"); + strcat (sql, "title TEXT NOT NULL,\n"); + strcat (sql, "sql_proc BLOB NOT NULL)"); + ret = sqlite3_exec (handle, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + char *errmsg = + sqlite3_mprintf ("gaia_stored_create \"stored_procedures\": %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + +/* creating Triggers supporting STORED_PROCEDURES */ + sprintf (sql, + "CREATE TRIGGER storproc_ins BEFORE INSERT ON stored_procedures\n" + "FOR EACH ROW BEGIN\n" + "SELECT RAISE(ROLLBACK, 'Invalid \"sql_proc\": not a BLOB of the SQL Procedure type')\n" + "WHERE SqlProc_IsValid(NEW.sql_proc) <> 1;\nEND"); + ret = sqlite3_exec (handle, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + char *errmsg = + sqlite3_mprintf ("gaia_stored_create \"storproc_ins\": %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + sprintf (sql, + "CREATE TRIGGER storproc_upd BEFORE UPDATE OF sql_proc ON stored_procedures\n" + "FOR EACH ROW BEGIN\n" + "SELECT RAISE(ROLLBACK, 'Invalid \"sql_proc\": not a BLOB of the SQL Procedure type')\n" + "WHERE SqlProc_IsValid(NEW.sql_proc) <> 1;\nEND"); + ret = sqlite3_exec (handle, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + char *errmsg = + sqlite3_mprintf ("gaia_stored_create \"storproc_upd\": %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + +/* creating the STORED_VALUES table */ + strcpy (sql, "CREATE TABLE IF NOT EXISTS "); + strcat (sql, "stored_variables (\n"); + strcat (sql, "name TEXT NOT NULL PRIMARY KEY,\n"); + strcat (sql, "title TEXT NOT NULL,\n"); + strcat (sql, "value TEXT NOT NULL)"); + ret = sqlite3_exec (handle, sql, NULL, NULL, &errMsg); + if (ret != SQLITE_OK) + { + char *errmsg = + sqlite3_mprintf ("gaia_stored_create \"stored_variables\": %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + if (test_stored_proc_tables (handle)) + return 1; + return 0; +} + +SQLPROC_DECLARE int +gaia_stored_proc_store (sqlite3 * handle, const void *cache, const char *name, + const char *title, const unsigned char *blob, + int blob_sz) +{ +/* permanently registering a Stored Procedure */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = + "INSERT INTO stored_procedures(name, title, sql_proc) VALUES (?, ?, ?)"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_store: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, name, strlen (name), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_blob (stmt, 3, blob, blob_sz, SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_store: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_proc_fetch (sqlite3 * handle, const void *cache, const char *name, + unsigned char **blob, int *blob_sz) +{ +/* will return the SQL Procedure BLOB from a given Stored Procedure */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + unsigned char *p_blob = NULL; + int p_blob_sz = 0; + stored_proc_reset_error (cache); + + sql = "SELECT sql_proc FROM stored_procedures WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_fetch: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, name, strlen (name), 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 (sqlite3_column_type (stmt, 0) == SQLITE_BLOB) + { + const unsigned char *data = sqlite3_column_blob (stmt, 0); + p_blob_sz = sqlite3_column_bytes (stmt, 0); + p_blob = malloc (p_blob_sz); + memcpy (p_blob, data, p_blob_sz); + } + } + } + sqlite3_finalize (stmt); + + *blob = p_blob; + *blob_sz = p_blob_sz; + if (p_blob == NULL) + return 0; + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_proc_delete (sqlite3 * handle, const void *cache, const char *name) +{ +/* removing a permanently registered Stored Procedure */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = "DELETE FROM stored_procedures WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_delete: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, name, strlen (name), SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_delete: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + if (sqlite3_changes (handle) == 0) + return 0; + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_proc_update_title (sqlite3 * handle, const void *cache, + const char *name, const char *title) +{ +/* updating a permanently registered Stored Procedure - Title */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = "UPDATE stored_procedures SET title = ? WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_update_title: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, name, strlen (name), SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_update_title: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + if (sqlite3_changes (handle) == 0) + return 0; + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_proc_update_sql (sqlite3 * handle, const void *cache, + const char *name, const unsigned char *blob, + int blob_sz) +{ +/* updating a permanently registered Stored Procedure - SQL body */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = "UPDATE stored_procedures SET sql_proc = ? WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_update_sql: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_blob (stmt, 1, blob, blob_sz, SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, name, strlen (name), SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_proc_update_sql: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + if (sqlite3_changes (handle) == 0) + return 0; + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_var_store (sqlite3 * handle, const void *cache, const char *name, + const char *title, const char *value) +{ +/* permanently registering a Stored Variable */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = "INSERT INTO stored_variables(name, title, value) VALUES (?, ?, ?)"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_store: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, name, strlen (name), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_text (stmt, 3, value, strlen (value), SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_store: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_var_fetch (sqlite3 * handle, const void *cache, const char *name, + int variable_with_value, char **value) +{ +/* will return a Variable with Value string from a given Stored Variable */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + char *p_value = NULL; + stored_proc_reset_error (cache); + + sql = "SELECT value FROM stored_variables WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_fetch: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, name, strlen (name), 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 (sqlite3_column_type (stmt, 0) == SQLITE_TEXT) + { + const char *data = + (const char *) sqlite3_column_text (stmt, 0); + char *var_with_val; + if (variable_with_value) + { + /* returning a Variable with Value string */ + var_with_val = + sqlite3_mprintf ("@%s@=%s", name, data); + } + else + { + /* just returning the bare Value alone */ + var_with_val = sqlite3_mprintf ("%s", data); + } + p_value = malloc (strlen (var_with_val) + 1); + strcpy (p_value, var_with_val); + sqlite3_free (var_with_val); + } + } + } + sqlite3_finalize (stmt); + + *value = p_value;; + if (p_value == NULL) + return 0; + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_var_delete (sqlite3 * handle, const void *cache, const char *name) +{ +/* removing a permanently registered Stored Variable */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = "DELETE FROM stored_variables WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_delete: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, name, strlen (name), SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_delete: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + if (sqlite3_changes (handle) == 0) + return 0; + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_var_update_title (sqlite3 * handle, const void *cache, + const char *name, const char *title) +{ +/* updating a permanently registered Stored Variable - Title */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = "UPDATE stored_variables SET title = ? WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_update_title: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, title, strlen (title), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, name, strlen (name), SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_update_title: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + if (sqlite3_changes (handle) == 0) + return 0; + return 1; +} + +SQLPROC_DECLARE int +gaia_stored_var_update_value (sqlite3 * handle, const void *cache, + const char *name, const char *value) +{ +/* updating a permanently registered Stored Variable - Variable with Value */ + const char *sql; + sqlite3_stmt *stmt; + int ret; + stored_proc_reset_error (cache); + + sql = "UPDATE stored_variables SET value = ? WHERE name = ?"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_update_value: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + return 0; + } + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, value, strlen (value), SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, name, strlen (name), SQLITE_STATIC); + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *errmsg = sqlite3_mprintf ("gaia_stored_var_update_value: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + return 0; + } + sqlite3_finalize (stmt); + if (sqlite3_changes (handle) == 0) + return 0; + return 1; +} + +static const char * +consume_empty_sql (const char *ptr) +{ +/* testing for an empty SQL string */ + int comment_marker = 0; + const char *p = ptr; + while (1) + { + char c = *p; + if (c == '\0') + break; + if (c == ' ' || c == '\0' || c == '\t' || c == '\r' || c == '\n') + { + p++; + continue; /* ignoring leading blanks */ + } + if (c == '.') + { + while (1) + { + /* consuming a dot-macro until the end of the line */ + c = *p; + if (c == '\n' || c == '\0') + break; + p++; + } + if (c != '\0') + p++; + continue; + } + if (c == '-') + { + if (comment_marker) + { + while (1) + { + /* consuming a comment until the end of the line */ + c = *p; + if (c == '\n' || c == '\0') + break; + p++; + } + comment_marker = 0; + if (c != '\0') + p++; + continue; + } + comment_marker = 1; + p++; + continue; + } + break; + } + return p; +} + +static void +do_clean_double (char *buffer) +{ +/* cleans unneeded trailing zeros */ + int i; + for (i = strlen (buffer) - 1; i > 0; i--) + { + if (buffer[i] == '0') + buffer[i] = '\0'; + else + break; + } + if (buffer[i] == '.') + buffer[i] = '\0'; + if (strcmp (buffer, "-0") == 0) + { + /* avoiding to return embarassing NEGATIVE ZEROes */ + strcpy (buffer, "0"); + } + + if (strcmp (buffer, "-1.#QNAN") == 0 || strcmp (buffer, "NaN") == 0 + || strcmp (buffer, "1.#QNAN") == 0 + || strcmp (buffer, "-1.#IND") == 0 || strcmp (buffer, "1.#IND") == 0) + { + /* on Windows a NaN could be represented in "odd" ways */ + /* this is intended to restore a consistent behaviour */ + strcpy (buffer, "nan"); + } +} + +static void +do_log_double (FILE * log, double value, int precision) +{ +/* printing a well-formatted DOUBLE into the Logfile */ + char *buf; + if (precision < 0) + buf = sqlite3_mprintf ("%1.6f", value); + else + buf = sqlite3_mprintf ("%.*f", precision, value); + do_clean_double (buf); + fprintf (log, "%s", buf); + sqlite3_free (buf); +} + +static char * +do_title_bar (int len) +{ +/* building a bar line */ + int i; + char *line = sqlite3_malloc (len + 1); + for (i = 0; i < len; i++) + *(line + i) = '-'; + *(line + len) = '\0'; + return line; +} + +static void +print_elapsed_time (FILE * log, double seconds) +{ +/* well formatting elapsed time */ + int int_time = (int) seconds; + int millis = (int) ((seconds - (double) int_time) * 1000.0); + int secs = int_time % 60; + int_time /= 60; + int mins = int_time % 60; + int_time /= 60; + int hh = int_time; + if (hh == 0 && mins == 0) + fprintf (log, "Execution time: %d.%03d\n", secs, millis); + else if (hh == 0) + fprintf (log, "Execution time: %d:%02d.%03d\n", mins, secs, millis); + else + fprintf (log, "Execution time: %d:%02d:%02d.%03d\n", hh, mins, secs, + millis); +} + +static char * +get_timestamp (sqlite3 * sqlite) +{ +/* retrieving the current timestamp */ + char *now; + const char *sql; + int ret; + int i; + char **results; + int rows; + int columns; + + sql = "SELECT DateTime('now')"; + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); + if (ret != SQLITE_OK) + goto error; + for (i = 1; i <= rows; i++) + { + const char *timestamp = results[(i * columns) + 0]; + now = sqlite3_mprintf ("%s", timestamp); + } + sqlite3_free_table (results); + return now; + + error: + now = sqlite3_mprintf ("unknown"); + return now; +} + +static char * +do_clean_failing_sql (const char *pSql) +{ +/* attempting to insulate the failing SQL statement */ + int max = 0; + const char *in = pSql; + char *fail = NULL; + char *out; + + while (1) + { + if (*in == '\0') + break; + if (*in == ';') + { + max++; + break; + } + max++; + in++; + } + fail = malloc (max + 1); + out = fail; + in = pSql; + while (max > 0) + { + *out++ = *in++; + max--; + } + *out = '\0'; + return fail; +} + +SQLPROC_DECLARE int +gaia_sql_proc_execute (sqlite3 * handle, const void *ctx, const char *sql) +{ +/* executing an already cooked SQL Body */ + const char *pSql = sql; + sqlite3_stmt *stmt; + int retval = 0; + int n_stmts = 0; + FILE *log = NULL; + struct splite_internal_cache *cache = (struct splite_internal_cache *) ctx; + + if (cache != NULL) + { + cache->SqlProcContinue = 1; + log = cache->SqlProcLog; + } + + if (log != NULL) + { + /* printing a session header */ + char *now = get_timestamp (handle); + fprintf (log, + "=========================================================================================\n"); + fprintf (log, "== SQL session start = %s\n", now); + sqlite3_free (now); + fprintf (log, + "=========================================================================================\n"); + } + + while (1) + { + const char *sql_tail; + int ret; + int title; + clock_t clock_start; + clock_t clock_end; + double seconds; + int n_rows; + int rs; + + if (cache != NULL) + { + if (cache->SqlProcContinue == 0) + { + /* found a pending EXIT request */ + if (log != NULL) + fprintf (log, + "\n***** quitting ... found a pending EXIT request *************\n\n"); + break; + } + } + + pSql = consume_empty_sql (pSql); + if (strlen (pSql) == 0) + break; + clock_start = clock (); + ret = sqlite3_prepare_v2 (handle, pSql, strlen (pSql), &stmt, + &sql_tail); + if (ret != SQLITE_OK) + { + if (log != NULL) + { + char *failSql = do_clean_failing_sql (pSql); + fprintf (log, "=== SQL error: %s\n", + sqlite3_errmsg (handle)); + fprintf (log, "failing SQL statement was:\n%s\n\n", + failSql); + free (failSql); + } + goto stop; + } + pSql = sql_tail; + if (log != NULL) + fprintf (log, "%s\n", sqlite3_sql (stmt)); + title = 1; + n_rows = 0; + rs = 0; + n_stmts++; + while (1) + { + /* executing an SQL statement */ + int i; + int n_cols; + ret = sqlite3_step (stmt); + if (title && log != NULL + && (ret == SQLITE_DONE || ret == SQLITE_ROW)) + { + char *bar; + char *line; + char *names; + char *prev; + n_cols = sqlite3_column_count (stmt); + if (n_cols > 0) + { + /* printing column names */ + rs = 1; + for (i = 0; i < n_cols; i++) + { + const char *nm = + sqlite3_column_name (stmt, i); + if (i == 0) + { + line = do_title_bar (strlen (nm)); + bar = sqlite3_mprintf ("%s", line); + sqlite3_free (line); + names = sqlite3_mprintf ("%s", nm); + } + else + { + prev = bar; + line = do_title_bar (strlen (nm)); + bar = + sqlite3_mprintf ("%s+%s", prev, + line); + sqlite3_free (line); + sqlite3_free (prev); + prev = names; + names = + sqlite3_mprintf ("%s|%s", prev, nm); + sqlite3_free (prev); + } + } + fprintf (log, "%s\n", bar); + fprintf (log, "%s\n", names); + fprintf (log, "%s\n", bar); + sqlite3_free (names); + sqlite3_free (bar); + } + title = 0; + } + if (ret == SQLITE_DONE) + break; + else if (ret == SQLITE_ROW) + { + sqlite3_int64 int64; + double dbl; + int sz; + if (log == NULL) + continue; + n_rows++; + /* updating the Logfile */ + n_cols = sqlite3_column_count (stmt); + for (i = 0; i < n_cols; i++) + { + /* printing column values */ + if (i > 0) + fprintf (log, "|"); + switch (sqlite3_column_type (stmt, i)) + { + case SQLITE_INTEGER: + int64 = sqlite3_column_int64 (stmt, i); + fprintf (log, FRMT64, int64); + break; + case SQLITE_FLOAT: + dbl = sqlite3_column_double (stmt, i); + do_log_double (log, dbl, + cache->decimal_precision); + break; + case SQLITE_TEXT: + sz = sqlite3_column_bytes (stmt, i); + if (sz <= 128) + fprintf (log, "%s", + (const char *) + sqlite3_column_text (stmt, i)); + else + fprintf (log, "TEXT[%d bytes]", sz); + break; + case SQLITE_BLOB: + sz = sqlite3_column_bytes (stmt, i); + fprintf (log, "BLOB[%d bytes]", sz); + break; + case SQLITE_NULL: + default: + fprintf (log, "NULL"); + break; + }; + } + fprintf (log, "\n"); + } + else + { + char *errmsg = + sqlite3_mprintf ("gaia_sql_proc_execute: %s", + sqlite3_errmsg (handle)); + gaia_sql_proc_set_error (cache, errmsg); + if (log != NULL) + { + fprintf (log, "=== SQL error: %s\n", + sqlite3_errmsg (handle)); + } + sqlite3_free (errmsg); + sqlite3_finalize (stmt); + goto stop; + } + } + sqlite3_finalize (stmt); + clock_end = clock (); + seconds = + (double) (clock_end - clock_start) / (double) CLOCKS_PER_SEC; + if (log != NULL) + { + if (rs) + fprintf (log, "=== %d %s === ", n_rows, + (n_rows == 1) ? "row" : "rows"); + else + fprintf (log, "=== "); + print_elapsed_time (log, seconds); + fprintf (log, "\n"); + fflush (log); + } + } + retval = 1; + + stop: + if (log != NULL) + { + /* printing a session footer */ + char *now = get_timestamp (handle); + fprintf (log, + "=========================================================================================\n"); + fprintf (log, + "== SQL session end = %s = %d statement%s executed\n", + now, n_stmts, (n_stmts == 1) ? " was" : "s were"); + sqlite3_free (now); + fprintf (log, + "=========================================================================================\n\n\n"); + fflush (log); + } + return retval; +} + +SQLPROC_DECLARE int +gaia_sql_proc_logfile (const void *ctx, const char *filepath, int append) +{ +/* enabling/disabling the Logfile */ + FILE *log; + int len; + struct splite_internal_cache *cache = (struct splite_internal_cache *) ctx; + + if (cache == NULL) + return 0; + + if (filepath == NULL) + { + /* disabling the Logfile */ + if (cache->SqlProcLogfile != NULL) + { + free (cache->SqlProcLogfile); + cache->SqlProcLogfile = NULL; + } + if (cache->SqlProcLog != NULL) + fclose (cache->SqlProcLog); + cache->SqlProcLog = NULL; + return 1; + } + +/* attempting to enable the Logfile */ + if (append) + log = fopen (filepath, "ab"); + else + log = fopen (filepath, "wb"); + if (log == NULL) + return 0; + +/* closing the current Logfile (if any) */ + if (cache->SqlProcLogfile != NULL) + free (cache->SqlProcLogfile); + if (cache->SqlProcLog != NULL) + fclose (cache->SqlProcLog); + +/* resetting the current Logfile */ + len = strlen (filepath); + cache->SqlProcLogfile = malloc (len + 1); + strcpy (cache->SqlProcLogfile, filepath); + cache->SqlProcLog = log; + return 1; +} Index: src/topology/Makefile.am ================================================================== --- src/topology/Makefile.am +++ src/topology/Makefile.am @@ -1,7 +1,7 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers -I. noinst_HEADERS = topology_private.h \ network_private.h \ lwn_network.h \ @@ -28,12 +28,12 @@ gaia_network.c \ gaia_auxnet.c \ gaia_netstmts.c \ net_callbacks.c -topology_la_CPPFLAGS = @CFLAGS@ +topology_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ topology_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. topology_la_CPPFLAGS += -DLOADABLE_EXTENSION topology_la_LDFLAGS = -module topology_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/topology/Makefile.in ================================================================== --- src/topology/Makefile.in +++ src/topology/Makefile.in @@ -316,11 +316,11 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers -I. noinst_HEADERS = topology_private.h \ network_private.h \ lwn_network.h \ lwn_network_private.h @@ -345,12 +345,12 @@ gaia_network.c \ gaia_auxnet.c \ gaia_netstmts.c \ net_callbacks.c -topology_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +topology_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers \ + -I. -DLOADABLE_EXTENSION topology_la_LDFLAGS = -module topology_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/topology/gaia_auxnet.c ================================================================== --- src/topology/gaia_auxnet.c +++ src/topology/gaia_auxnet.c @@ -91,17 +91,18 @@ gaiaNetworkDestroy ((GaiaNetworkAccessorPtr) p_net); p_net = p_net_n; } } -static int -do_create_networks (sqlite3 * handle) +SPATIALITE_PRIVATE int +do_create_networks (void *sqlite_handle) { /* attempting to create the Networks table (if not already existing) */ const char *sql; char *err_msg = NULL; int ret; + sqlite3 *handle = (sqlite3 *) sqlite_handle; sql = "CREATE TABLE IF NOT EXISTS networks (\n" "\tnetwork_name TEXT NOT NULL PRIMARY KEY,\n" "\tspatial INTEGER NOT NULL,\n" "\tsrid INTEGER NOT NULL,\n" @@ -1449,15 +1450,10 @@ gaiaNetworkDrop (sqlite3 * handle, const char *network_name) { /* attempting to drop an already existing Network */ int ret; char *sql; - int i; - char **results; - int rows; - int columns; - int count = 1; /* creating the Networks table (just in case) */ if (!do_create_networks (handle)) return 0; @@ -1481,32 +1477,10 @@ ret = sqlite3_exec (handle, sql, NULL, NULL, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) goto error; -/* counting how many Networks are still there */ - sql = sqlite3_mprintf ("SELECT Count(*) FROM MAIN.networks"); - ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, NULL); - sqlite3_free (sql); - if (ret != SQLITE_OK) - return 1; - if (rows < 1) - ; - else - { - for (i = 1; i <= rows; i++) - count = atoi (results[(i * columns) + 0]); - } - sqlite3_free_table (results); - if (count == 0) - { - /* attempting to drop the master "networks" table */ - sql = sqlite3_mprintf ("DROP TABLE MAIN.networks"); - ret = sqlite3_exec (handle, sql, NULL, NULL, NULL); - sqlite3_free (sql); - } - return 1; error: return 0; } @@ -3174,10 +3148,222 @@ return 0; } return 1; } + +static gaiaGeomCollPtr +do_interpolate_middlepoint (gaiaGeomCollPtr geom) +{ +/* building a three-point segment */ + gaiaGeomCollPtr newg; + gaiaLinestringPtr old_ln; + gaiaLinestringPtr new_ln; + double x0; + double y0; + double z0; + double x1; + double y1; + double z1; + double mx; + double my; + double mz; + + if (geom == NULL) + return NULL; + if (geom->FirstPoint != NULL || geom->FirstPolygon != NULL) + return NULL; + if (geom->FirstLinestring != geom->LastLinestring) + return NULL; + old_ln = geom->FirstLinestring; + if (old_ln == NULL) + return NULL; + if (old_ln->Points != 2) + return NULL; + + if (geom->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (old_ln->Coords, 0, &x0, &y0, &z0); + gaiaGetPointXYZ (old_ln->Coords, 1, &x1, &y1, &z1); + newg = gaiaAllocGeomCollXYZ (); + } + else + { + gaiaGetPoint (old_ln->Coords, 0, &x0, &y0); + gaiaGetPoint (old_ln->Coords, 1, &x1, &y1); + newg = gaiaAllocGeomColl (); + } + newg->Srid = geom->Srid; + + if (x0 > x1) + mx = x1 + ((x0 - x1) / 2.0); + else + mx = x0 + ((x1 - x0) / 2.0); + if (y0 > y1) + my = y1 + ((y0 - y1) / 2.0); + else + my = y0 + ((y1 - y0) / 2.0); + if (geom->DimensionModel == GAIA_XY_Z) + { + if (z0 > z1) + mz = z1 + ((z0 - z1) / 2.0); + else + mz = z0 + ((z1 - z0) / 2.0); + } + + new_ln = gaiaAddLinestringToGeomColl (newg, 3); + if (newg->DimensionModel == GAIA_XY_Z) + { + gaiaSetPointXYZ (new_ln->Coords, 0, x0, y0, z0); + gaiaSetPointXYZ (new_ln->Coords, 1, mx, my, mz); + gaiaSetPointXYZ (new_ln->Coords, 2, x1, y1, z1); + } + else + { + gaiaSetPoint (new_ln->Coords, 0, x0, y0); + gaiaSetPoint (new_ln->Coords, 1, mx, my); + gaiaSetPoint (new_ln->Coords, 2, x1, y1); + } + + return newg; +} + +GAIANET_DECLARE int +gaiaTopoNet_DisambiguateSegmentLinks (GaiaNetworkAccessorPtr accessor) +{ +/* +/ Ensures that all Links on a Topology-Network will have not less +/ than three vertices; for all Links found beign simple two-points +/ segments a third intermediate point will be interpolated. +*/ + struct gaia_network *net = (struct gaia_network *) accessor; + int ret; + char *sql; + char *link; + char *xlink; + sqlite3_stmt *stmt_in = NULL; + sqlite3_stmt *stmt_out = NULL; + int count = 0; + if (net == NULL) + return -1; + +/* preparing the SQL query identifying all two-points Links */ + link = sqlite3_mprintf ("%s_link", net->network_name); + xlink = gaiaDoubleQuotedSql (link); + sqlite3_free (link); + sql = + sqlite3_mprintf + ("SELECT link_id, geometry FROM \"%s\" WHERE ST_NumPoints(geometry) = 2 " + "ORDER BY link_id", xlink); + free (xlink); + ret = + sqlite3_prepare_v2 (net->db_handle, sql, strlen (sql), &stmt_in, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("TopoNet_DisambiguateSegmentLinks error: \"%s\"", + sqlite3_errmsg (net->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* preparing the UPDATE SQL query */ + sql = + sqlite3_mprintf ("SELECT ST_ChangeLinkGeom(%Q, ?, ?)", + net->network_name); + ret = + sqlite3_prepare_v2 (net->db_handle, sql, strlen (sql), &stmt_out, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("TopoNet_DisambiguateSegmentLinks error: \"%s\"", + sqlite3_errmsg (net->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt_in); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 link_id = sqlite3_column_int64 (stmt_in, 0); + if (sqlite3_column_type (stmt_in, 1) == SQLITE_BLOB) + { + const unsigned char *blob = + sqlite3_column_blob (stmt_in, 1); + int blob_sz = sqlite3_column_bytes (stmt_in, 1); + gaiaGeomCollPtr geom = + gaiaFromSpatiaLiteBlobWkb (blob, blob_sz); + if (geom != NULL) + { + gaiaGeomCollPtr newg = + do_interpolate_middlepoint (geom); + gaiaFreeGeomColl (geom); + if (newg != NULL) + { + unsigned char *outblob = NULL; + int outblob_size = 0; + sqlite3_reset (stmt_out); + sqlite3_clear_bindings (stmt_out); + sqlite3_bind_int64 (stmt_out, 1, link_id); + gaiaToSpatiaLiteBlobWkb (newg, &outblob, + &outblob_size); + gaiaFreeGeomColl (newg); + if (blob == NULL) + continue; + else + sqlite3_bind_blob (stmt_out, 2, outblob, + outblob_size, free); + /* updating the Links table */ + ret = sqlite3_step (stmt_out); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + count++; + else + { + char *msg = + sqlite3_mprintf + ("TopoNet_DisambiguateSegmentLinks() error: \"%s\"", + sqlite3_errmsg (net->db_handle)); + gaianet_set_last_error_msg ((GaiaNetworkAccessorPtr) net, msg); + sqlite3_free (msg); + goto error; + } + } + } + } + } + else + { + char *msg = + sqlite3_mprintf + ("TopoNet_DisambiguateSegmentLinks error: \"%s\"", + sqlite3_errmsg (net->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + + sqlite3_finalize (stmt_in); + sqlite3_finalize (stmt_out); + return count; + + error: + if (stmt_out != NULL) + sqlite3_finalize (stmt_in); + if (stmt_out != NULL) + sqlite3_finalize (stmt_out); + return -1; +} static void do_eval_toponet_point (struct gaia_network *net, gaiaGeomCollPtr result, gaiaGeomCollPtr reference, sqlite3_stmt * stmt_node) { @@ -3456,16 +3642,18 @@ { gaiaGeomCollPtr result; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (net->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (net->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } result = do_eval_toponet_geom (net, geom, stmt_seed_link, stmt_node, @@ -3472,14 +3660,15 @@ stmt_link, out_type); gaiaFreeGeomColl (geom); if (result != NULL) { - gaiaToSpatiaLiteBlobWkbEx (result, - &p_blob, - &n_bytes, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, + &p_blob, + &n_bytes, + gpkg_mode, + tiny_point); gaiaFreeGeomColl (result); sqlite3_bind_blob (stmt_ins, icol + 1, p_blob, n_bytes, free); } @@ -3838,7 +4027,393 @@ /* attempting to create and populate a new GeoTable out from a Topology-Network */ return gaiaTopoNet_ToGeoTableGeneralize (accessor, db_prefix, ref_table, ref_column, out_table, -1.0, with_spatial_index); } + +static int +find_linelink_matches (struct gaia_network *network, + sqlite3_stmt * stmt_ref, sqlite3_stmt * stmt_ins, + sqlite3_int64 link_id, const unsigned char *blob, + int blob_sz) +{ +/* retrieving LineLink relationships */ + int ret; + int count = 0; + char direction[2]; + strcpy (direction, "?"); + + sqlite3_reset (stmt_ref); + sqlite3_clear_bindings (stmt_ref); + sqlite3_bind_int64 (stmt_ref, 1, link_id); + + while (1) + { + /* scrolling the result set rows - Spatial Relationships */ + ret = sqlite3_step (stmt_ref); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 rowid = sqlite3_column_int64 (stmt_ref, 0); + + if (sqlite3_column_type (stmt_ref, 1) == SQLITE_BLOB) + { + /* testing directions */ + gaiaGeomCollPtr geom_link = NULL; + gaiaGeomCollPtr geom_line = NULL; + const unsigned char *blob2 = + sqlite3_column_blob (stmt_ref, 1); + int blob2_sz = sqlite3_column_bytes (stmt_ref, 1); + geom_link = gaiaFromSpatiaLiteBlobWkb (blob, blob_sz); + geom_line = gaiaFromSpatiaLiteBlobWkb (blob2, blob2_sz); + if (geom_link != NULL && geom_line != NULL) + gaia_do_check_direction (geom_link, geom_line, + direction); + if (geom_link != NULL) + gaiaFreeGeomColl (geom_link); + if (geom_line != NULL) + gaiaFreeGeomColl (geom_line); + } + + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_int64 (stmt_ins, 1, link_id); + sqlite3_bind_int64 (stmt_ins, 2, rowid); + sqlite3_bind_text (stmt_ins, 3, direction, 1, SQLITE_STATIC); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + count++; + else + { + char *msg = + sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg ((GaiaNetworkAccessorPtr) + network, msg); + sqlite3_free (msg); + return 0; + } + } + else + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg + (network->db_handle)); + gaianet_set_last_error_msg ((GaiaNetworkAccessorPtr) network, + msg); + sqlite3_free (msg); + return 0; + } + } + + if (count == 0) + { + /* unrelated Link */ + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_int64 (stmt_ins, 1, link_id); + sqlite3_bind_null (stmt_ins, 2); + sqlite3_bind_null (stmt_ins, 3); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg + (network->db_handle)); + gaianet_set_last_error_msg ((GaiaNetworkAccessorPtr) network, + msg); + sqlite3_free (msg); + return 0; + } + } + return 1; +} + +static int +insert_linelink_reverse (struct gaia_network *network, sqlite3_stmt * stmt_ins, + sqlite3_int64 polygon_id) +{ +/* found a mismatching RefLinestring - inserting into the output table */ + int ret; + + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_null (stmt_ins, 1); + sqlite3_bind_int64 (stmt_ins, 2, polygon_id); + sqlite3_bind_null (stmt_ins, 3); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg ((GaiaNetworkAccessorPtr) network, msg); + sqlite3_free (msg); + return 0; + } + return 1; +} + +GAIANET_DECLARE int +gaiaTopoNet_LineLinksList (GaiaNetworkAccessorPtr accessor, + const char *db_prefix, const char *ref_table, + const char *ref_column, const char *out_table) +{ +/* creating and populating a new Table reporting about Links/Linestring correspondencies */ + struct gaia_network *network = (struct gaia_network *) accessor; + sqlite3_stmt *stmt_links = NULL; + sqlite3_stmt *stmt_ref = NULL; + sqlite3_stmt *stmt_rev = NULL; + sqlite3_stmt *stmt_ins = NULL; + int ret; + char *sql; + char *table; + char *idx_name; + char *xtable; + char *xprefix; + char *xcolumn; + char *xidx_name; + char *rtree_name; + char *seeds; + char *xseeds; + int ref_has_spatial_index = 0; + if (network == NULL) + return 0; + +/* attempting to build the output table */ + xtable = gaiaDoubleQuotedSql (out_table); + sql = sqlite3_mprintf ("CREATE TABLE main.\"%s\" (\n" + "\tid INTEGER PRIMARY KEY AUTOINCREMENT,\n" + "\tlink_id INTEGER,\n" + "\tref_rowid INTEGER,\n" + "\tdirection TEXT)", xtable); + free (xtable); + ret = sqlite3_exec (network->db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + idx_name = sqlite3_mprintf ("idx_%s_link_id", out_table); + xidx_name = gaiaDoubleQuotedSql (idx_name); + sqlite3_free (idx_name); + xtable = gaiaDoubleQuotedSql (out_table); + sql = + sqlite3_mprintf + ("CREATE INDEX main.\"%s\" ON \"%s\" (link_id, ref_rowid)", xidx_name, + xtable); + free (xidx_name); + free (xtable); + ret = sqlite3_exec (network->db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Links SQL statement */ + table = sqlite3_mprintf ("%s_link", network->network_name); + xtable = gaiaDoubleQuotedSql (table); + sqlite3_free (table); + sql = sqlite3_mprintf ("SELECT link_id, geometry FROM main.\"%s\"", xtable); + free (xtable); + ret = + sqlite3_prepare_v2 (network->db_handle, sql, strlen (sql), &stmt_links, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the RefTable SQL statement */ + seeds = sqlite3_mprintf ("%s_seeds", network->network_name); + rtree_name = sqlite3_mprintf ("DB=%s.%s", db_prefix, ref_table); + ref_has_spatial_index = + gaia_check_spatial_index (network->db_handle, db_prefix, ref_table, + ref_column); + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (ref_table); + xcolumn = gaiaDoubleQuotedSql (ref_column); + xseeds = gaiaDoubleQuotedSql (seeds); + if (ref_has_spatial_index) + sql = + sqlite3_mprintf + ("SELECT r.rowid, r.\"%s\" FROM MAIN.\"%s\" AS s, \"%s\".\"%s\" AS r " + "WHERE ST_Intersects(r.\"%s\", s.geometry) == 1 AND s.link_id = ? " + "AND r.rowid IN (SELECT rowid FROM SpatialIndex WHERE f_table_name = %Q " + "AND f_geometry_column = %Q AND search_frame = s.geometry)", + xcolumn, xseeds, xprefix, xtable, xcolumn, rtree_name, xcolumn); + else + sql = + sqlite3_mprintf + ("SELECT r.rowid, r.\"%s\" FROM MAIN.\"%s\" AS s, \"%s\".\"%s\" AS r " + "WHERE ST_Intersects(r.\"%s\", s.geometry) == 1 AND s.link_id = ?", + xcolumn, xseeds, xprefix, xtable, xcolumn); + free (xprefix); + free (xtable); + free (xcolumn); + free (xseeds); + sqlite3_free (rtree_name); + sqlite3_free (seeds); + ret = + sqlite3_prepare_v2 (network->db_handle, sql, strlen (sql), &stmt_ref, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Reverse RefTable SQL statement */ + seeds = sqlite3_mprintf ("%s_seeds", network->network_name); + rtree_name = sqlite3_mprintf ("DB=%s.%s", db_prefix, ref_table); + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (ref_table); + xcolumn = gaiaDoubleQuotedSql (ref_column); + xseeds = gaiaDoubleQuotedSql (seeds); + sql = sqlite3_mprintf ("SELECT r.rowid FROM \"%s\".\"%s\" AS r " + "LEFT JOIN MAIN.\"%s\" AS s ON (ST_Intersects(r.\"%s\", s.geometry) = 1 " + "AND s.link_id IS NOT NULL AND s.rowid IN (SELECT rowid FROM SpatialIndex " + "WHERE f_table_name = %Q AND search_frame = r.\"%s\")) " + "WHERE s.link_id IS NULL", xprefix, xtable, xseeds, + xcolumn, rtree_name, xcolumn); + free (xprefix); + free (xtable); + free (xcolumn); + free (xseeds); + sqlite3_free (rtree_name); + sqlite3_free (seeds); + ret = + sqlite3_prepare_v2 (network->db_handle, sql, strlen (sql), &stmt_rev, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Insert SQL statement */ + xtable = gaiaDoubleQuotedSql (out_table); + sql = sqlite3_mprintf ("INSERT INTO main.\"%s\" (id, link_id, ref_rowid, " + "direction) VALUES (NULL, ?, ?, ?)", xtable); + free (xtable); + ret = + sqlite3_prepare_v2 (network->db_handle, sql, strlen (sql), &stmt_ins, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + + while (1) + { + /* scrolling the result set rows - Links */ + ret = sqlite3_step (stmt_links); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 link_id = sqlite3_column_int64 (stmt_links, 0); + if (sqlite3_column_type (stmt_links, 1) == SQLITE_BLOB) + { + if (!find_linelink_matches + (network, stmt_ref, stmt_ins, link_id, + sqlite3_column_blob (stmt_links, 1), + sqlite3_column_bytes (stmt_links, 1))) + goto error; + } + else + { + char *msg = + sqlite3_mprintf + ("LineLinksList error: Link not a BLOB value"); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + else + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg + (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + + while (1) + { + /* scrolling the Reverse result set rows - Linestrings */ + ret = sqlite3_step (stmt_rev); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 line_id = sqlite3_column_int64 (stmt_rev, 0); + if (!insert_linelink_reverse (network, stmt_ins, line_id)) + goto error; + } + else + { + char *msg = sqlite3_mprintf ("LineLinksList error: \"%s\"", + sqlite3_errmsg + (network->db_handle)); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + + sqlite3_finalize (stmt_links); + sqlite3_finalize (stmt_ref); + sqlite3_finalize (stmt_rev); + sqlite3_finalize (stmt_ins); + return 1; + + error: + if (stmt_links != NULL) + sqlite3_finalize (stmt_links); + if (stmt_ref != NULL) + sqlite3_finalize (stmt_ref); + if (stmt_rev != NULL) + sqlite3_finalize (stmt_rev); + if (stmt_ins != NULL) + sqlite3_finalize (stmt_ins); + return 0; +} #endif /* end RTTOPO conditionals */ Index: src/topology/gaia_auxtopo.c ================================================================== --- src/topology/gaia_auxtopo.c +++ src/topology/gaia_auxtopo.c @@ -105,17 +105,18 @@ gaiaTopologyDestroy ((GaiaTopologyAccessorPtr) p_topo); p_topo = p_topo_n; } } -static int -do_create_topologies (sqlite3 * handle) +SPATIALITE_PRIVATE int +do_create_topologies (void *sqlite_handle) { /* attempting to create the Topologies table (if not already existing) */ const char *sql; char *err_msg = NULL; int ret; + sqlite3 *handle = (sqlite3 *) sqlite_handle; sql = "CREATE TABLE IF NOT EXISTS topologies (\n" "\ttopology_name TEXT NOT NULL PRIMARY KEY,\n" "\tsrid INTEGER NOT NULL,\n" "\ttolerance DOUBLE NOT NULL,\n" @@ -2250,10 +2251,11 @@ if (ptr->rtt_topology == NULL) { char *msg = sqlite3_mprintf ("Topology \"%s\" is undefined !!!", topo_name); gaiaSetRtTopoErrorMsg (p_cache, msg); + sqlite3_free(msg); goto invalid; } /* creating the SQL prepared statements */ create_topogeo_prepared_stmts ((GaiaTopologyAccessorPtr) ptr); @@ -2508,15 +2510,10 @@ gaiaTopologyDrop (sqlite3 * handle, const char *topo_name) { /* attempting to drop an already existing Topology */ int ret; char *sql; - int i; - char **results; - int rows; - int columns; - int count = 1; /* creating the Topologies table (just in case) */ if (!do_create_topologies (handle)) return 0; @@ -2556,32 +2553,10 @@ ret = sqlite3_exec (handle, sql, NULL, NULL, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) goto error; -/* counting how many Topologies are still there */ - sql = sqlite3_mprintf ("SELECT Count(*) FROM MAIN.topologies"); - ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, NULL); - sqlite3_free (sql); - if (ret != SQLITE_OK) - return 1; - if (rows < 1) - ; - else - { - for (i = 1; i <= rows; i++) - count = atoi (results[(i * columns) + 0]); - } - sqlite3_free_table (results); - if (count == 0) - { - /* attempting to drop the master "topologies" table */ - sql = sqlite3_mprintf ("DROP TABLE MAIN.topologies"); - ret = sqlite3_exec (handle, sql, NULL, NULL, NULL); - sqlite3_free (sql); - } - return 1; error: return 0; } @@ -5424,11 +5399,11 @@ return 0; } GAIATOPO_DECLARE gaiaGeomCollPtr gaiaTopoSnap (GaiaTopologyAccessorPtr accessor, gaiaGeomCollPtr geom, - double tolerance, int iterate, int remove_vertices) + double tolerance_snap, double tolerance_removal, int iterate) { /* RTT wrapper - TopoSnap */ const RTCTX *ctx = NULL; struct splite_internal_cache *cache = NULL; RTGEOM *input = NULL; @@ -5452,16 +5427,16 @@ input = toRTGeom (ctx, geom); if (!input) return NULL; - if (tolerance < 0.0) - tolerance = topo->tolerance; + if (tolerance_snap < 0.0) + tolerance_snap = topo->tolerance; result = - rtt_tpsnap ((RTT_TOPOLOGY *) (topo->rtt_topology), input, tolerance, - iterate, remove_vertices); + rtt_tpsnap ((RTT_TOPOLOGY *) (topo->rtt_topology), input, + tolerance_snap, tolerance_removal, iterate); rtgeom_free (ctx, input); if (result == NULL) return NULL; /* converting the result as a Gaia Geometry */ @@ -5770,11 +5745,11 @@ GAIATOPO_DECLARE gaiaGeomCollPtr gaiaTopoGeo_SubdivideLines (gaiaGeomCollPtr geom, int line_max_points, double max_length) { -/* subdividing a (multi)Linestring into collection of simpler Linestrings */ +/* subdividing a (multi)Linestring into a collection of simpler Linestrings */ gaiaLinestringPtr ln; gaiaGeomCollPtr result; if (geom == NULL) return NULL; @@ -5924,18 +5899,18 @@ else ret = gaiaTopoGeo_AddLineString (accessor, ln, tolerance, &ids, &ids_count); if (ret == 0) { + if (failing_geometry != NULL) + *failing_geometry = + do_build_failing_line (geom->Srid, geom->DimensionModel, + ln); if (ids != NULL) free (ids); if (split != NULL) gaiaFreeGeomColl (split); - if (failing_geometry != NULL) - *failing_geometry = - do_build_failing_line (geom->Srid, geom->DimensionModel, - ln); return 0; } if (ids != NULL) free (ids); ln = ln->Next; Index: src/topology/gaia_auxtopo_table.c ================================================================== --- src/topology/gaia_auxtopo_table.c +++ src/topology/gaia_auxtopo_table.c @@ -1694,10 +1694,11 @@ else gaiaAddPointToGeomColl (result, pt->X, pt->Y); pt = pt->Next; } + gaiaFreeGeomColl (geom); } } } else { @@ -2474,16 +2475,18 @@ { gaiaGeomCollPtr result; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (topo->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (topo->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } result = do_eval_topogeo_geom (topo, geom, stmt_seed_edge, stmt_seed_face, stmt_node, @@ -2492,14 +2495,15 @@ out_type, tolerance); gaiaFreeGeomColl (geom); if (result != NULL) { - gaiaToSpatiaLiteBlobWkbEx (result, - &p_blob, - &n_bytes, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, + &p_blob, + &n_bytes, + gpkg_mode, + tiny_point); gaiaFreeGeomColl (result); sqlite3_bind_blob (stmt_ins, icol + 1, p_blob, n_bytes, free); } @@ -3243,10 +3247,1170 @@ /* attempting to create and populate a new GeoTable out from a Topology-Geometry */ return gaiaTopoGeo_ToGeoTableGeneralize (accessor, db_prefix, ref_table, ref_column, out_table, -1.0, with_spatial_index); } + +SPATIALITE_PRIVATE int +gaia_do_eval_disjoint (const void *handle, const char *matrix) +{ +/* same as ST_Disjoint */ + sqlite3 *sqlite = (sqlite3 *) handle; + char **results; + int ret; + int rows; + int columns; + int i; + int value = 0; + char *sql = + sqlite3_mprintf ("SELECT ST_RelateMatch(%Q, 'FF*FF****')", matrix); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + value = atoi (results[(i * columns) + 0]); + sqlite3_free_table (results); + return value; +} + +SPATIALITE_PRIVATE int +gaia_do_eval_overlaps (const void *handle, const char *matrix) +{ +/* same as ST_Overlaps */ + sqlite3 *sqlite = (sqlite3 *) handle; + char **results; + int ret; + int rows; + int columns; + int i; + int value = 0; + char *sql = sqlite3_mprintf ("SELECT ST_RelateMatch(%Q, 'T*T***T**') " + "OR ST_RelateMatch(%Q, '1*T***T**')", matrix, + matrix); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + value = atoi (results[(i * columns) + 0]); + sqlite3_free_table (results); + return value; +} + +SPATIALITE_PRIVATE int +gaia_do_eval_covers (const void *handle, const char *matrix) +{ +/* same as ST_Covers */ + sqlite3 *sqlite = (sqlite3 *) handle; + char **results; + int ret; + int rows; + int columns; + int i; + int value = 0; + char *sql = sqlite3_mprintf ("SELECT ST_RelateMatch(%Q, 'T*****FF*') " + "OR ST_RelateMatch(%Q, '*T****FF*') OR ST_RelateMatch(%Q, '***T**FF*') " + "OR ST_RelateMatch(%Q, '****T*FF*')", matrix, + matrix, matrix, matrix); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + value = atoi (results[(i * columns) + 0]); + sqlite3_free_table (results); + return value; +} + +SPATIALITE_PRIVATE int +gaia_do_eval_covered_by (const void *handle, const char *matrix) +{ +/* same as ST_CoveredBy */ + sqlite3 *sqlite = (sqlite3 *) handle; + char **results; + int ret; + int rows; + int columns; + int i; + int value = 0; + char *sql = sqlite3_mprintf ("SELECT ST_RelateMatch(%Q, 'T*F**F***') " + "OR ST_RelateMatch(%Q, '*TF**F***') OR ST_RelateMatch(%Q, '**FT*F***') " + "OR ST_RelateMatch(%Q, '**F*TF***')", matrix, + matrix, matrix, matrix); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + value = atoi (results[(i * columns) + 0]); + sqlite3_free_table (results); + return value; +} + +static int +find_polyface_matches (struct gaia_topology *topo, sqlite3_stmt * stmt_ref, + sqlite3_stmt * stmt_ins, sqlite3_int64 face_id, + sqlite3_int64 containing_face) +{ +/* retrieving PolyFace matches */ + int ret; + int count = 0; + + sqlite3_reset (stmt_ref); + sqlite3_clear_bindings (stmt_ref); + sqlite3_bind_int64 (stmt_ref, 1, face_id); + + while (1) + { + /* scrolling the result set rows - Spatial Relationships */ + ret = sqlite3_step (stmt_ref); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 rowid = sqlite3_column_int64 (stmt_ref, 0); + + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_int64 (stmt_ins, 1, face_id); + if (containing_face <= 0) + { + sqlite3_bind_int (stmt_ins, 2, 0); + sqlite3_bind_null (stmt_ins, 3); + } + else + { + sqlite3_bind_int (stmt_ins, 2, 1); + sqlite3_bind_int64 (stmt_ins, 3, containing_face); + } + sqlite3_bind_int64 (stmt_ins, 4, rowid); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + count++; + else + { + char *msg = + sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) + topo, msg); + sqlite3_free (msg); + return 0; + } + } + else + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) topo, + msg); + sqlite3_free (msg); + return 0; + } + } + + if (count == 0) + { + /* unrelated Face */ + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_int64 (stmt_ins, 1, face_id); + if (containing_face <= 0) + { + sqlite3_bind_int (stmt_ins, 2, 0); + sqlite3_bind_null (stmt_ins, 3); + } + else + { + sqlite3_bind_int (stmt_ins, 2, 1); + sqlite3_bind_int64 (stmt_ins, 3, containing_face); + } + sqlite3_bind_null (stmt_ins, 4); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) topo, + msg); + sqlite3_free (msg); + return 0; + } + } + return 1; +} + +static int +insert_polyface_reverse (struct gaia_topology *topo, sqlite3_stmt * stmt_ins, + sqlite3_int64 polygon_id) +{ +/* found a mismatching RefPolygon - inserting into the output table */ + int ret; + + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_null (stmt_ins, 1); + sqlite3_bind_int (stmt_ins, 2, 0); + sqlite3_bind_null (stmt_ins, 3); + sqlite3_bind_int64 (stmt_ins, 4, polygon_id); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) topo, msg); + sqlite3_free (msg); + return 0; + } + return 1; +} + +static sqlite3_int64 +check_hole_face (struct gaia_topology *topo, sqlite3_stmt * stmt_holes, + sqlite3_int64 face_id) +{ +/* checking if some Face actually is an "hole" within another Face */ + int ret; + int count_edges = 0; + int count_valid = 0; + sqlite3_int64 containing_face = -1; + + sqlite3_reset (stmt_holes); + sqlite3_clear_bindings (stmt_holes); + sqlite3_bind_int64 (stmt_holes, 1, face_id); + + while (1) + { + /* scrolling the result set rows - containing face */ + ret = sqlite3_step (stmt_holes); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 other_face_id = + sqlite3_column_int64 (stmt_holes, 0); + count_edges++; + if (containing_face < 0) + containing_face = other_face_id; + if (containing_face == other_face_id) + count_valid++; + } + else + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) topo, + msg); + sqlite3_free (msg); + return -1; + } + } + if (count_edges == count_valid && count_edges > 0 && containing_face > 0) + ; + else + containing_face = -1; + + return containing_face; +} + +SPATIALITE_PRIVATE int +gaia_check_spatial_index (const void *handle, const char *db_prefix, + const char *ref_table, const char *ref_column) +{ +/* testing if the RefTable has an R*Tree Spatial Index */ + sqlite3 *sqlite = (sqlite3 *) handle; + char *sql; + char *xprefix; + int has_rtree = 0; + char **results; + int ret; + int rows; + int columns; + int i; + char *errMsg = NULL; + + xprefix = gaiaDoubleQuotedSql (db_prefix); + sql = + sqlite3_mprintf + ("SELECT spatial_index_enabled FROM \"%s\".geometry_columns " + "WHERE f_table_name = %Q AND f_geometry_column = %Q", xprefix, + ref_table, ref_column); + free (xprefix); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, &errMsg); + sqlite3_free (sql); + if (ret != SQLITE_OK) + return 0; + for (i = 1; i <= rows; i++) + { + has_rtree = atoi (results[(i * columns) + 0]); + } + sqlite3_free_table (results); + return has_rtree; +} + +GAIATOPO_DECLARE int +gaiaTopoGeo_PolyFacesList (GaiaTopologyAccessorPtr accessor, + const char *db_prefix, const char *ref_table, + const char *ref_column, const char *out_table) +{ +/* creating and populating a new Table reporting about Faces/Polygon correspondencies */ + struct gaia_topology *topo = (struct gaia_topology *) accessor; + sqlite3_stmt *stmt_faces = NULL; + sqlite3_stmt *stmt_holes = NULL; + sqlite3_stmt *stmt_ref = NULL; + sqlite3_stmt *stmt_rev = NULL; + sqlite3_stmt *stmt_ins = NULL; + int ret; + char *sql; + char *table; + char *idx_name; + char *xtable; + char *xprefix; + char *xcolumn; + char *xidx_name; + char *rtree_name; + char *seeds; + char *xseeds; + int ref_has_spatial_index = 0; + if (topo == NULL) + return 0; + +/* attempting to build the output table */ + xtable = gaiaDoubleQuotedSql (out_table); + sql = sqlite3_mprintf ("CREATE TABLE main.\"%s\" (\n" + "\tid INTEGER PRIMARY KEY AUTOINCREMENT,\n" + "\tface_id INTEGER,\n" + "\tis_hole INTEGER NOT NULL,\n" + "\tcontaining_face INTEGER,\n" + "\tref_rowid INTEGER)", xtable); + free (xtable); + ret = sqlite3_exec (topo->db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + idx_name = sqlite3_mprintf ("idx_%s_face_id", out_table); + xidx_name = gaiaDoubleQuotedSql (idx_name); + sqlite3_free (idx_name); + xtable = gaiaDoubleQuotedSql (out_table); + sql = + sqlite3_mprintf + ("CREATE INDEX main.\"%s\" ON \"%s\" (face_id, ref_rowid)", xidx_name, + xtable); + free (xidx_name); + free (xtable); + ret = sqlite3_exec (topo->db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + idx_name = sqlite3_mprintf ("idx_%s_holes", out_table); + xidx_name = gaiaDoubleQuotedSql (idx_name); + sqlite3_free (idx_name); + xtable = gaiaDoubleQuotedSql (out_table); + sql = + sqlite3_mprintf + ("CREATE INDEX main.\"%s\" ON \"%s\" (containing_face, face_id)", + xidx_name, xtable); + free (xidx_name); + free (xtable); + ret = sqlite3_exec (topo->db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Faces SQL statement */ + table = sqlite3_mprintf ("%s_face", topo->topology_name); + xtable = gaiaDoubleQuotedSql (table); + sqlite3_free (table); + sql = + sqlite3_mprintf ("SELECT face_id FROM main.\"%s\" WHERE face_id > 0", + xtable); + free (xtable); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_faces, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the IsHole SQL statement */ + table = sqlite3_mprintf ("%s_edge", topo->topology_name); + xtable = gaiaDoubleQuotedSql (table); + sql = sqlite3_mprintf ("SELECT left_face AS other_face FROM main.\"%s\" " + "WHERE right_face = ? UNION " + "SELECT right_face AS other_face FROM main.\"%s\" WHERE left_face = ?", + xtable, xtable); + free (xtable); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_holes, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the RefTable SQL statement */ + seeds = sqlite3_mprintf ("%s_seeds", topo->topology_name); + rtree_name = sqlite3_mprintf ("DB=%s.%s", db_prefix, ref_table); + ref_has_spatial_index = + gaia_check_spatial_index (topo->db_handle, db_prefix, ref_table, + ref_column); + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (ref_table); + xcolumn = gaiaDoubleQuotedSql (ref_column); + xseeds = gaiaDoubleQuotedSql (seeds); + if (ref_has_spatial_index) + sql = + sqlite3_mprintf + ("SELECT r.rowid FROM MAIN.\"%s\" AS s, \"%s\".\"%s\" AS r " + "WHERE ST_Intersects(r.\"%s\", s.geom) == 1 AND s.face_id = ? " + "AND r.rowid IN (SELECT rowid FROM SpatialIndex WHERE f_table_name = %Q " + "AND f_geometry_column = %Q AND search_frame = s.geom)", xseeds, + xprefix, xtable, xcolumn, rtree_name, xcolumn); + else + sql = + sqlite3_mprintf + ("SELECT r.rowid FROM MAIN.\"%s\" AS s, \"%s\".\"%s\" AS r " + "WHERE ST_Intersects(r.\"%s\", s.geom) == 1 AND s.face_id = ?", + xseeds, xprefix, xtable, xcolumn); + free (xprefix); + free (xtable); + free (xcolumn); + free (xseeds); + sqlite3_free (rtree_name); + sqlite3_free (seeds); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_ref, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Reverse RefTable SQL statement */ + seeds = sqlite3_mprintf ("%s_seeds", topo->topology_name); + rtree_name = + sqlite3_mprintf ("DB=%s.%s_seeds", db_prefix, topo->topology_name); + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (ref_table); + xcolumn = gaiaDoubleQuotedSql (ref_column); + xseeds = gaiaDoubleQuotedSql (seeds); + sql = sqlite3_mprintf ("SELECT r.rowid FROM \"%s\".\"%s\" AS r " + "LEFT JOIN MAIN.\"%s\" AS s ON (ST_Intersects(r.\"%s\", s.geom) = 1 " + "AND s.face_id IS NOT NULL AND s.rowid IN (SELECT rowid FROM SpatialIndex " + "WHERE f_table_name = %Q AND search_frame = r.\"%s\")) " + "WHERE s.face_id IS NULL", xprefix, xtable, xseeds, + xcolumn, rtree_name, xcolumn); + free (xprefix); + free (xtable); + free (xcolumn); + free (xseeds); + sqlite3_free (rtree_name); + sqlite3_free (seeds); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_rev, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Insert SQL statement */ + xtable = gaiaDoubleQuotedSql (out_table); + sql = sqlite3_mprintf ("INSERT INTO main.\"%s\" (id, face_id, is_hole, " + "containing_face, ref_rowid) " + "VALUES (NULL, ?, ?, ?, ?)", xtable); + free (xtable); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_ins, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + + while (1) + { + /* scrolling the result set rows - Faces */ + ret = sqlite3_step (stmt_faces); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 face_id = sqlite3_column_int64 (stmt_faces, 0); + sqlite3_int64 containing_face = + check_hole_face (topo, stmt_holes, face_id); + if (!find_polyface_matches + (topo, stmt_ref, stmt_ins, face_id, containing_face)) + goto error; + } + else + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + + while (1) + { + /* scrolling the Reverse result set rows - Polygons */ + ret = sqlite3_step (stmt_rev); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 polyg_id = sqlite3_column_int64 (stmt_rev, 0); + if (!insert_polyface_reverse (topo, stmt_ins, polyg_id)) + goto error; + } + else + { + char *msg = sqlite3_mprintf ("PolyFacesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + + sqlite3_finalize (stmt_faces); + sqlite3_finalize (stmt_holes); + sqlite3_finalize (stmt_ref); + sqlite3_finalize (stmt_rev); + sqlite3_finalize (stmt_ins); + return 1; + + error: + if (stmt_faces != NULL) + sqlite3_finalize (stmt_faces); + if (stmt_holes != NULL) + sqlite3_finalize (stmt_holes); + if (stmt_ref != NULL) + sqlite3_finalize (stmt_ref); + if (stmt_rev != NULL) + sqlite3_finalize (stmt_rev); + if (stmt_ins != NULL) + sqlite3_finalize (stmt_ins); + return 0; +} + +static int +do_find_matching_point (gaiaLinestringPtr ln1, int *idx1, gaiaLinestringPtr ln2, + int *idx2) +{ +/* searching for a common point in both Linestrings */ + int i1; + int i2; + double x1; + double y1; + double z1; + double m1; + double x2; + double y2; + double z2; + double m2; + for (i1 = 0; i1 < ln1->Points; i1++) + { + /* extracting a Vertex from the first Linestring */ + z1 = 0.0; + m1 = 0.0; + if (ln1->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln1->Coords, i1, &x1, &y1, &z1); + } + else if (ln1->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln1->Coords, i1, &x1, &y1, &m1); + } + else if (ln1->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln1->Coords, i1, &x1, &y1, &z1, &m1); + } + else + { + gaiaGetPoint (ln1->Coords, i1, &x1, &y1); + } + for (i2 = 0; i2 < ln2->Points; i2++) + { + /* extracting a Vertex from the second Linestring */ + z2 = 0.0; + m2 = 0.0; + if (ln2->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln2->Coords, i2, &x2, &y2, &z2); + } + else if (ln2->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln2->Coords, i2, &x2, &y2, &m2); + } + else if (ln2->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln2->Coords, i2, &x2, &y2, &z2, &m2); + } + else + { + gaiaGetPoint (ln2->Coords, i2, &x2, &y2); + } + if (x1 == x2 && y1 == y2 && z1 == z2 && m1 == m2) + { + *idx1 = i1; + *idx2 = i2; + return 1; + } + } + } + *idx1 = -1; + *idx2 = -1; + return 0; +} + +static int +do_check_forward (gaiaLinestringPtr ln1, int idx1, gaiaLinestringPtr ln2, + int idx2) +{ +/* testing for further matching Vertices (same directions) */ + int i1; + int i2; + double x1; + double y1; + double z1; + double m1; + double x2; + double y2; + double z2; + double m2; + int count = 0; + for (i1 = idx1; i1 < ln1->Points; i1++) + { + /* extracting a Vertex from the first Linestring */ + z1 = 0.0; + m1 = 0.0; + if (ln1->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln1->Coords, i1, &x1, &y1, &z1); + } + else if (ln1->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln1->Coords, i1, &x1, &y1, &m1); + } + else if (ln1->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln1->Coords, i1, &x1, &y1, &z1, &m1); + } + else + { + gaiaGetPoint (ln1->Coords, i1, &x1, &y1); + } + for (i2 = idx2; i2 < ln2->Points; i2++) + { + /* extracting a Vertex from the second Linestring */ + z2 = 0.0; + m2 = 0.0; + if (ln2->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln2->Coords, i2, &x2, &y2, &z2); + } + else if (ln2->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln2->Coords, i2, &x2, &y2, &m2); + } + else if (ln2->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln2->Coords, i2, &x2, &y2, &z2, &m2); + } + else + { + gaiaGetPoint (ln2->Coords, i2, &x2, &y2); + } + if (x1 == x2 && y1 == y2 && z1 == z2 && m1 == m2) + { + idx2++; + count++; + break; + } + } + } + if (count >= 2) + return 1; + return 0; +} + +static int +do_check_backward (gaiaLinestringPtr ln1, int idx1, gaiaLinestringPtr ln2, + int idx2) +{ +/* testing for further matching Vertices (opposite directions) */ + int i1; + int i2; + double x1; + double y1; + double z1; + double m1; + double x2; + double y2; + double z2; + double m2; + int count = 0; + for (i1 = idx1; i1 < ln1->Points; i1++) + { + /* extracting a Vertex from the first Linestring */ + z1 = 0.0; + m1 = 0.0; + if (ln1->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln1->Coords, i1, &x1, &y1, &z1); + } + else if (ln1->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln1->Coords, i1, &x1, &y1, &m1); + } + else if (ln1->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln1->Coords, i1, &x1, &y1, &z1, &m1); + } + else + { + gaiaGetPoint (ln1->Coords, i1, &x1, &y1); + } + for (i2 = idx2; i2 >= 0; i2--) + { + /* extracting a Vertex from the second Linestring */ + z2 = 0.0; + m2 = 0.0; + if (ln2->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (ln2->Coords, i2, &x2, &y2, &z2); + } + else if (ln2->DimensionModel == GAIA_XY_M) + { + gaiaGetPointXYM (ln2->Coords, i2, &x2, &y2, &m2); + } + else if (ln2->DimensionModel == GAIA_XY_Z_M) + { + gaiaGetPointXYZM (ln2->Coords, i2, &x2, &y2, &z2, &m2); + } + else + { + gaiaGetPoint (ln2->Coords, i2, &x2, &y2); + } + if (x1 == x2 && y1 == y2 && z1 == z2 && m1 == m2) + { + idx2--; + count++; + break; + } + } + } + if (count >= 2) + return 1; + return 0; +} + +SPATIALITE_PRIVATE void +gaia_do_check_direction (const void *x1, const void *x2, char *direction) +{ +/* checking if two Linestrings have the same direction */ + gaiaGeomCollPtr g1 = (gaiaGeomCollPtr) x1; + gaiaGeomCollPtr g2 = (gaiaGeomCollPtr) x2; + int idx1; + int idx2; + gaiaLinestringPtr ln1 = g1->FirstLinestring; + gaiaLinestringPtr ln2 = g2->FirstLinestring; + while (ln2 != NULL) + { + /* the second Geometry could be a MultiLinestring */ + if (do_find_matching_point (ln1, &idx1, ln2, &idx2)) + { + if (do_check_forward (ln1, idx1, ln2, idx2)) + { + /* ok, same directions */ + *direction = '+'; + return; + } + if (do_check_backward (ln1, idx1, ln2, idx2)) + { + /* ok, opposite directions */ + *direction = '-'; + return; + } + } + ln2 = ln2->Next; + } + *direction = '?'; +} + +static int +find_lineedge_relationships (struct gaia_topology *topo, + sqlite3_stmt * stmt_ref, sqlite3_stmt * stmt_ins, + sqlite3_int64 edge_id, const unsigned char *blob, + int blob_sz) +{ +/* retrieving LineEdge relationships */ + int ret; + int count = 0; + char direction[2]; + strcpy (direction, "?"); + + sqlite3_reset (stmt_ref); + sqlite3_clear_bindings (stmt_ref); + sqlite3_bind_blob (stmt_ref, 1, blob, blob_sz, SQLITE_STATIC); + sqlite3_bind_blob (stmt_ref, 2, blob, blob_sz, SQLITE_STATIC); + + while (1) + { + /* scrolling the result set rows - Spatial Relationships */ + ret = sqlite3_step (stmt_ref); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + int overlaps = 0; + int covers = 0; + int covered_by = 0; + sqlite3_int64 rowid = sqlite3_column_int64 (stmt_ref, 0); + const char *matrix = + (const char *) sqlite3_column_text (stmt_ref, 1); + if (gaia_do_eval_disjoint (topo->db_handle, matrix)) + continue; + overlaps = gaia_do_eval_overlaps (topo->db_handle, matrix); + covers = gaia_do_eval_covers (topo->db_handle, matrix); + covered_by = gaia_do_eval_covered_by (topo->db_handle, matrix); + if (!overlaps && !covers && !covered_by) + continue; + + if (sqlite3_column_type (stmt_ref, 2) == SQLITE_BLOB) + { + /* testing directions */ + gaiaGeomCollPtr geom_edge = NULL; + gaiaGeomCollPtr geom_line = NULL; + const unsigned char *blob2 = + sqlite3_column_blob (stmt_ref, 2); + int blob2_sz = sqlite3_column_bytes (stmt_ref, 2); + geom_edge = gaiaFromSpatiaLiteBlobWkb (blob, blob_sz); + geom_line = gaiaFromSpatiaLiteBlobWkb (blob2, blob2_sz); + if (geom_edge != NULL && geom_line != NULL) + gaia_do_check_direction (geom_edge, geom_line, + direction); + if (geom_edge != NULL) + gaiaFreeGeomColl (geom_edge); + if (geom_line != NULL) + gaiaFreeGeomColl (geom_line); + } + + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_int64 (stmt_ins, 1, edge_id); + sqlite3_bind_int64 (stmt_ins, 2, rowid); + sqlite3_bind_text (stmt_ins, 3, direction, 1, SQLITE_STATIC); + sqlite3_bind_text (stmt_ins, 4, matrix, strlen (matrix), + SQLITE_STATIC); + sqlite3_bind_int (stmt_ins, 5, overlaps); + sqlite3_bind_int (stmt_ins, 6, covers); + sqlite3_bind_int (stmt_ins, 7, covered_by); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + count++; + else + { + char *msg = + sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) + topo, msg); + sqlite3_free (msg); + return 0; + } + } + else + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) topo, + msg); + sqlite3_free (msg); + return 0; + } + } + + if (count == 0) + { + /* unrelated Edge */ + sqlite3_reset (stmt_ins); + sqlite3_clear_bindings (stmt_ins); + sqlite3_bind_int64 (stmt_ins, 1, edge_id); + sqlite3_bind_null (stmt_ins, 2); + sqlite3_bind_null (stmt_ins, 3); + sqlite3_bind_null (stmt_ins, 4); + sqlite3_bind_null (stmt_ins, 5); + sqlite3_bind_null (stmt_ins, 6); + sqlite3_bind_null (stmt_ins, 7); + /* inserting a row into the output table */ + ret = sqlite3_step (stmt_ins); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + ; + else + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) topo, + msg); + sqlite3_free (msg); + return 0; + } + } + return 1; +} + +GAIATOPO_DECLARE int +gaiaTopoGeo_LineEdgesList (GaiaTopologyAccessorPtr accessor, + const char *db_prefix, const char *ref_table, + const char *ref_column, const char *out_table) +{ +/* creating and populating a new Table reporting about Edges/Linestring correspondencies */ + struct gaia_topology *topo = (struct gaia_topology *) accessor; + sqlite3_stmt *stmt_edges = NULL; + sqlite3_stmt *stmt_ref = NULL; + sqlite3_stmt *stmt_ins = NULL; + int ret; + char *sql; + char *table; + char *idx_name; + char *xtable; + char *xprefix; + char *xcolumn; + char *xidx_name; + char *rtree_name; + int ref_has_spatial_index = 0; + if (topo == NULL) + return 0; + +/* attempting to build the output table */ + xtable = gaiaDoubleQuotedSql (out_table); + sql = sqlite3_mprintf ("CREATE TABLE main.\"%s\" (\n" + "\tid INTEGER PRIMARY KEY AUTOINCREMENT,\n" + "\tedge_id INTEGER NOT NULL,\n" + "\tref_rowid INTEGER,\n" + "\tdirection TEXT,\n" + "\tmatrix TEXT,\n" + "\toverlaps INTEGER,\n" + "\tcovers INTEGER,\n" + "\tcovered_by INTEGER)", xtable); + free (xtable); + ret = sqlite3_exec (topo->db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + idx_name = sqlite3_mprintf ("idx_%s_edge_id", out_table); + xidx_name = gaiaDoubleQuotedSql (idx_name); + sqlite3_free (idx_name); + xtable = gaiaDoubleQuotedSql (out_table); + sql = + sqlite3_mprintf + ("CREATE INDEX main.\"%s\" ON \"%s\" (edge_id, ref_rowid)", xidx_name, + xtable); + free (xidx_name); + free (xtable); + ret = sqlite3_exec (topo->db_handle, sql, NULL, NULL, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Edges SQL statement */ + table = sqlite3_mprintf ("%s_edge", topo->topology_name); + xtable = gaiaDoubleQuotedSql (table); + sqlite3_free (table); + sql = sqlite3_mprintf ("SELECT edge_id, geom FROM main.\"%s\"", xtable); + free (xtable); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_edges, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the RefTable SQL statement */ + rtree_name = sqlite3_mprintf ("DB=%s.%s", db_prefix, ref_table); + ref_has_spatial_index = + gaia_check_spatial_index (topo->db_handle, db_prefix, ref_table, + ref_column); + xprefix = gaiaDoubleQuotedSql (db_prefix); + xtable = gaiaDoubleQuotedSql (ref_table); + xcolumn = gaiaDoubleQuotedSql (ref_column); + if (ref_has_spatial_index) + sql = + sqlite3_mprintf + ("SELECT rowid, ST_Relate(?, \"%s\"), \"%s\" FROM \"%s\".\"%s\" " + "WHERE rowid IN (" + "SELECT rowid FROM SpatialIndex WHERE f_table_name = %Q AND " + "f_geometry_column = %Q AND search_frame = ?)", xcolumn, xcolumn, + xprefix, xtable, rtree_name, ref_column); + else + sql = + sqlite3_mprintf + ("SELECT rowid, ST_Relate(?, \"%s\"), \"%s\" FROM \"%s\".\"%s\" " + "WHERE MbrIntersects(?, \"%s\")", xcolumn, xcolumn, xprefix, + xtable, xcolumn); + free (xprefix); + free (xtable); + free (xcolumn); + sqlite3_free (rtree_name); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_ref, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* building the Insert SQL statement */ + xtable = gaiaDoubleQuotedSql (out_table); + sql = sqlite3_mprintf ("INSERT INTO main.\"%s\" (id, edge_id, ref_rowid, " + "direction, matrix, overlaps, covers, covered_by) " + "VALUES (NULL, ?, ?, ?, ?, ?, ?, ?)", xtable); + free (xtable); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_ins, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + + while (1) + { + /* scrolling the result set rows - Edges */ + ret = sqlite3_step (stmt_edges); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 edge_id = sqlite3_column_int64 (stmt_edges, 0); + if (sqlite3_column_type (stmt_edges, 1) == SQLITE_BLOB) + { + if (!find_lineedge_relationships + (topo, stmt_ref, stmt_ins, edge_id, + sqlite3_column_blob (stmt_edges, 1), + sqlite3_column_bytes (stmt_edges, 1))) + goto error; + } + else + { + char *msg = + sqlite3_mprintf + ("LineEdgesList error: Edge not a BLOB value"); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + else + { + char *msg = sqlite3_mprintf ("LineEdgesList error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + + sqlite3_finalize (stmt_edges); + sqlite3_finalize (stmt_ref); + sqlite3_finalize (stmt_ins); + return 1; + + error: + if (stmt_edges != NULL) + sqlite3_finalize (stmt_edges); + if (stmt_ref != NULL) + sqlite3_finalize (stmt_ref); + if (stmt_ins != NULL) + sqlite3_finalize (stmt_ins); + return 0; +} static struct face_item * create_face_item (sqlite3_int64 face_id) { /* creating a Face Item */ @@ -6473,11 +7637,11 @@ return 0; } static int do_topo_snap (struct gaia_topology *topo, int geom_col, int geo_type, - double tolerance, int iterate, int remove_vertices, + double tolerance_snap, double tolerance_removal, int iterate, sqlite3_stmt * stmt_in, sqlite3_stmt * stmt_out) { /* snapping geometries againt Topology */ int ret; @@ -6510,29 +7674,32 @@ { gaiaGeomCollPtr result; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (topo->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (topo->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } result = gaiaTopoSnap ((GaiaTopologyAccessorPtr) - topo, geom, tolerance, - iterate, remove_vertices); + topo, geom, tolerance_snap, + tolerance_removal, iterate); gaiaFreeGeomColl (geom); if (result != NULL) { result->DeclaredType = geo_type; - gaiaToSpatiaLiteBlobWkbEx (result, - &p_blob, - &n_bytes, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, + &p_blob, + &n_bytes, + gpkg_mode, + tiny_point); gaiaFreeGeomColl (result); sqlite3_bind_blob (stmt_out, icol + 1, p_blob, n_bytes, free); } @@ -6608,11 +7775,12 @@ GAIATOPO_DECLARE int gaiaTopoGeo_SnappedGeoTable (GaiaTopologyAccessorPtr accessor, const char *db_prefix, const char *table, const char *column, const char *out_table, - double tolerance, int iterate, int remove_vertices) + double tolerance_snap, double tolerance_removal, + int iterate) { /* / attempting to create and populate a new GeoTable by snapping all Geometries / contained into another GeoTable against a given Topology */ @@ -6756,12 +7924,12 @@ goto error; } /* snapping all Geometries against the Topology */ if (!do_topo_snap - (topo, geom_col, geo_type, tolerance, iterate, remove_vertices, stmt_in, - stmt_out)) + (topo, geom_col, geo_type, tolerance_snap, tolerance_removal, iterate, + stmt_in, stmt_out)) goto error; sqlite3_finalize (stmt_in); sqlite3_finalize (stmt_out); return 1; @@ -6848,13 +8016,12 @@ edge = sqlite3_mprintf ("%s_edge", topo->topology_name); xedge = gaiaDoubleQuotedSql (edge); sqlite3_free (edge); sql = sqlite3_mprintf ("SELECT n.node_id, Count(*) AS cnt FROM \"%s\" AS n " - "JOIN \"%s\" AS e ON ((n.node_id = e.start_node OR n.node_id = e.end_node) " - "AND (e.start_node <> e.end_node)) GROUP BY n.node_id HAVING cnt = 2", - xnode, xedge); + "JOIN \"%s\" AS e ON (n.node_id = e.start_node OR n.node_id = e.end_node) " + "GROUP BY n.node_id HAVING cnt = 2", xnode, xedge); free (xnode); free (xedge); ret = sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt1, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) @@ -6875,11 +8042,13 @@ xedge = gaiaDoubleQuotedSql (edge); sqlite3_free (edge); sql = sqlite3_mprintf ("SELECT e1.edge_id, e2.edge_id FROM \"%s\" AS n " "JOIN \"%s\" AS e1 ON (n.node_id = e1.end_node) " - "JOIN \"%s\" AS e2 ON (n.node_id = e2.start_node) WHERE n.node_id = ?", + "JOIN \"%s\" AS e2 ON (n.node_id = e2.start_node) " + "WHERE n.node_id = ? AND e1.start_node <> e1.end_node " + "AND e2.start_node <> e2.end_node", xnode, xedge, xedge); free (xnode); free (xedge); ret = sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt2, NULL); sqlite3_free (sql); @@ -7086,11 +8255,11 @@ return 0; } static int topoGeo_EdgeSplit_common (GaiaTopologyAccessorPtr accessor, int mode_new, - int line_max_points, double max_length) + int line_max_points, double max_length) { /* common implementation of GeoTable EdgeSplit */ struct gaia_topology *topo = (struct gaia_topology *) accessor; int ret; char *sql; @@ -7126,11 +8295,12 @@ } /* preparing the SQL query splitting an Edge in two halves */ sql = sqlite3_mprintf ("SELECT ST_%sSplit(%Q, ?, ?)", - mode_new ? "NewEdges" : "ModEdge", topo->topology_name); + mode_new ? "NewEdges" : "ModEdge", + topo->topology_name); ret = sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt2, NULL); sqlite3_free (sql); if (ret != SQLITE_OK) { char *msg = sqlite3_mprintf ("TopoGeo_%sSplit error: \"%s\"", @@ -7212,11 +8382,224 @@ return topoGeo_EdgeSplit_common (ptr, 1, line_max_points, max_length); } GAIATOPO_DECLARE int gaiaTopoGeo_ModEdgeSplit (GaiaTopologyAccessorPtr ptr, int line_max_points, - double max_length) + double max_length) { return topoGeo_EdgeSplit_common (ptr, 0, line_max_points, max_length); } + +static gaiaGeomCollPtr +do_interpolate_middlepoint (gaiaGeomCollPtr geom) +{ +/* building a three-point segment */ + gaiaGeomCollPtr newg; + gaiaLinestringPtr old_ln; + gaiaLinestringPtr new_ln; + double x0; + double y0; + double z0; + double x1; + double y1; + double z1; + double mx; + double my; + double mz; + + if (geom == NULL) + return NULL; + if (geom->FirstPoint != NULL || geom->FirstPolygon != NULL) + return NULL; + if (geom->FirstLinestring != geom->LastLinestring) + return NULL; + old_ln = geom->FirstLinestring; + if (old_ln == NULL) + return NULL; + if (old_ln->Points != 2) + return NULL; + + if (geom->DimensionModel == GAIA_XY_Z) + { + gaiaGetPointXYZ (old_ln->Coords, 0, &x0, &y0, &z0); + gaiaGetPointXYZ (old_ln->Coords, 1, &x1, &y1, &z1); + newg = gaiaAllocGeomCollXYZ (); + } + else + { + gaiaGetPoint (old_ln->Coords, 0, &x0, &y0); + gaiaGetPoint (old_ln->Coords, 1, &x1, &y1); + newg = gaiaAllocGeomColl (); + } + newg->Srid = geom->Srid; + + if (x0 > x1) + mx = x1 + ((x0 - x1) / 2.0); + else + mx = x0 + ((x1 - x0) / 2.0); + if (y0 > y1) + my = y1 + ((y0 - y1) / 2.0); + else + my = y0 + ((y1 - y0) / 2.0); + if (geom->DimensionModel == GAIA_XY_Z) + { + if (z0 > z1) + mz = z1 + ((z0 - z1) / 2.0); + else + mz = z0 + ((z1 - z0) / 2.0); + } + + new_ln = gaiaAddLinestringToGeomColl (newg, 3); + if (newg->DimensionModel == GAIA_XY_Z) + { + gaiaSetPointXYZ (new_ln->Coords, 0, x0, y0, z0); + gaiaSetPointXYZ (new_ln->Coords, 1, mx, my, mz); + gaiaSetPointXYZ (new_ln->Coords, 2, x1, y1, z1); + } + else + { + gaiaSetPoint (new_ln->Coords, 0, x0, y0); + gaiaSetPoint (new_ln->Coords, 1, mx, my); + gaiaSetPoint (new_ln->Coords, 2, x1, y1); + } + + return newg; +} + +GAIATOPO_DECLARE int +gaiaTopoGeo_DisambiguateSegmentEdges (GaiaTopologyAccessorPtr accessor) +{ +/* +/ Ensures that all Edges on a Topology-Geometry will have not less +/ than three vertices; for all Edges found beign simple two-points +/ segments a third intermediate point will be interpolated. +*/ + struct gaia_topology *topo = (struct gaia_topology *) accessor; + int ret; + char *sql; + char *edge; + char *xedge; + sqlite3_stmt *stmt_in = NULL; + sqlite3_stmt *stmt_out = NULL; + int count = 0; + if (topo == NULL) + return -1; + +/* preparing the SQL query identifying all two-points Edges */ + edge = sqlite3_mprintf ("%s_edge", topo->topology_name); + xedge = gaiaDoubleQuotedSql (edge); + sqlite3_free (edge); + sql = + sqlite3_mprintf + ("SELECT edge_id, geom FROM \"%s\" WHERE ST_NumPoints(geom) = 2 " + "ORDER BY edge_id", xedge); + free (xedge); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_in, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("TopoGeo_DisambiguateSegmentEdges error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + +/* preparing the UPDATE SQL query */ + sql = + sqlite3_mprintf ("SELECT ST_ChangeEdgeGeom(%Q, ?, ?)", + topo->topology_name); + ret = + sqlite3_prepare_v2 (topo->db_handle, sql, strlen (sql), &stmt_out, + NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + char *msg = + sqlite3_mprintf ("TopoGeo_DisambiguateSegmentEdges error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + + while (1) + { + /* scrolling the result set rows */ + ret = sqlite3_step (stmt_in); + if (ret == SQLITE_DONE) + break; /* end of result set */ + if (ret == SQLITE_ROW) + { + sqlite3_int64 edge_id = sqlite3_column_int64 (stmt_in, 0); + if (sqlite3_column_type (stmt_in, 1) == SQLITE_BLOB) + { + const unsigned char *blob = + sqlite3_column_blob (stmt_in, 1); + int blob_sz = sqlite3_column_bytes (stmt_in, 1); + gaiaGeomCollPtr geom = + gaiaFromSpatiaLiteBlobWkb (blob, blob_sz); + if (geom != NULL) + { + gaiaGeomCollPtr newg = + do_interpolate_middlepoint (geom); + gaiaFreeGeomColl (geom); + if (newg != NULL) + { + unsigned char *outblob = NULL; + int outblob_size = 0; + sqlite3_reset (stmt_out); + sqlite3_clear_bindings (stmt_out); + sqlite3_bind_int64 (stmt_out, 1, edge_id); + gaiaToSpatiaLiteBlobWkb (newg, &outblob, + &outblob_size); + gaiaFreeGeomColl (newg); + if (blob == NULL) + continue; + else + sqlite3_bind_blob (stmt_out, 2, outblob, + outblob_size, free); + /* updating the Edges table */ + ret = sqlite3_step (stmt_out); + if (ret == SQLITE_DONE || ret == SQLITE_ROW) + count++; + else + { + char *msg = + sqlite3_mprintf + ("TopoGeo_DisambiguateSegmentEdges() error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg ((GaiaTopologyAccessorPtr) topo, msg); + sqlite3_free (msg); + goto error; + } + } + } + } + } + else + { + char *msg = + sqlite3_mprintf + ("TopoGeo_DisambiguateSegmentEdges error: \"%s\"", + sqlite3_errmsg (topo->db_handle)); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_free (msg); + goto error; + } + } + + sqlite3_finalize (stmt_in); + sqlite3_finalize (stmt_out); + return count; + + error: + if (stmt_out != NULL) + sqlite3_finalize (stmt_in); + if (stmt_out != NULL) + sqlite3_finalize (stmt_out); + return -1; +} #endif /* end ENABLE_RTTOPO conditionals */ Index: src/topology/gaia_network.c ================================================================== --- src/topology/gaia_network.c +++ src/topology/gaia_network.c @@ -4082,18 +4082,22 @@ unsigned char *p_blob; int n_bytes; gaiaGeomCollPtr geom; GaiaNetworkAccessorPtr accessor; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); struct gaia_network *net; GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) network_name = (const char *) sqlite3_value_text (argv[0]); else @@ -4125,11 +4129,11 @@ return; } sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, tiny_point); gaiaFreeGeomColl (geom); if (p_blob == NULL) sqlite3_result_null (context); else sqlite3_result_blob (context, p_blob, n_bytes, free); @@ -4244,7 +4248,266 @@ sqlite3_result_error (context, "TopoNet_UpdateSeeds() cannot be applied to Logical Network.", -1); return; } + +SPATIALITE_PRIVATE void +fnctaux_TopoNet_DisambiguateSegmentLinks (const void *xcontext, int argc, + const void *xargv) +{ +/* SQL function: +/ TopoNet_DisambiguateSegmentLinks ( text network-name ) +/ +/ returns: the total number of changed Links. +/ raises an exception on failure +*/ + const char *network_name; + int changed_links = 0; + GaiaNetworkAccessorPtr accessor; + sqlite3_context *context = (sqlite3_context *) xcontext; + sqlite3_value **argv = (sqlite3_value **) xargv; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + struct gaia_network *net; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + network_name = (const char *) sqlite3_value_text (argv[0]); + else + goto invalid_arg; + +/* attempting to get a Network Accessor */ + accessor = gaiaGetNetwork (sqlite, cache, network_name); + if (accessor == NULL) + goto no_net; + net = (struct gaia_network *) accessor; + if (net->spatial == 0) + goto logical_err; + + gaianet_reset_last_error_msg (accessor); + start_net_savepoint (sqlite, cache); + changed_links = gaiaTopoNet_DisambiguateSegmentLinks (accessor); + if (changed_links < 0) + rollback_net_savepoint (sqlite, cache); + else + release_net_savepoint (sqlite, cache); + if (changed_links < 0) + { + const char *msg = lwn_GetErrorMsg (net->lwn_iface); + if (msg != NULL) + { + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + } + sqlite3_result_null (context); + return; + } + sqlite3_result_int (context, changed_links); + return; + + no_net: + sqlite3_result_error (context, + "SQL/MM Spatial exception - invalid network name.", + -1); + return; + + null_arg: + sqlite3_result_error (context, "SQL/MM Spatial exception - null argument.", + -1); + return; + + invalid_arg: + sqlite3_result_error (context, + "SQL/MM Spatial exception - invalid argument.", -1); + return; + + logical_err: + sqlite3_result_error (context, + "TopoNet_UpdateSeeds() cannot be applied to Logical Network.", + -1); + return; +} + +static int +check_matching_srid (GaiaNetworkAccessorPtr accessor, int srid) +{ +/* checking for matching SRID */ + struct gaia_network *network = (struct gaia_network *) accessor; + if (network->srid != srid) + return 0; + return 1; +} + +SPATIALITE_PRIVATE void +fnctaux_TopoNet_LineLinksList (const void *xcontext, int argc, + const void *xargv) +{ +/* SQL function: +/ TopoNet_LineLinksList ( text network-name, text db-prefix, text ref_table, +/ text ref_column, text out_table ) +/ +/ returns: 1 on success +/ raises an exception on failure +*/ + const char *msg; + int ret; + const char *network_name; + const char *db_prefix; + const char *ref_table; + const char *ref_column; + const char *out_table; + char *xreftable = NULL; + char *xrefcolumn = NULL; + int srid; + int family; + GaiaNetworkAccessorPtr accessor = NULL; + sqlite3_context *context = (sqlite3_context *) xcontext; + sqlite3_value **argv = (sqlite3_value **) xargv; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + network_name = (const char *) sqlite3_value_text (argv[0]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[1]) == SQLITE_NULL) + db_prefix = "main"; + else if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) + db_prefix = (const char *) sqlite3_value_text (argv[1]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[2]) == SQLITE_TEXT) + ref_table = (const char *) sqlite3_value_text (argv[2]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[3]) == SQLITE_NULL) + ref_column = NULL; + else if (sqlite3_value_type (argv[3]) == SQLITE_TEXT) + ref_column = (const char *) sqlite3_value_text (argv[3]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[4]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[4]) == SQLITE_TEXT) + out_table = (const char *) sqlite3_value_text (argv[4]); + else + goto invalid_arg; + +/* attempting to get a Network Accessor */ + accessor = gaiaGetNetwork (sqlite, cache, network_name); + if (accessor == NULL) + goto no_net; + gaianet_reset_last_error_msg (accessor); + +/* checking the reference GeoTable */ + if (!gaia_check_reference_geo_table + (sqlite, db_prefix, ref_table, ref_column, &xreftable, &xrefcolumn, + &srid, &family)) + goto no_reference; + if (!check_matching_srid (accessor, srid)) + goto invalid_geom; + if (family != GAIA_TYPE_LINESTRING) + goto not_linestring; + +/* checking the output Table */ + if (!gaia_check_output_table (sqlite, out_table)) + goto err_output; + + start_topo_savepoint (sqlite, cache); + ret = + gaiaTopoNet_LineLinksList (accessor, db_prefix, xreftable, xrefcolumn, + out_table); + if (!ret) + rollback_topo_savepoint (sqlite, cache); + else + release_topo_savepoint (sqlite, cache); + free (xreftable); + free (xrefcolumn); + if (!ret) + { + msg = gaiaGetRtTopoErrorMsg (cache); + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + } + sqlite3_result_int (context, 1); + return; + + no_net: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - invalid network name."; + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + no_reference: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "TopoGeo_LineLinksList: invalid reference GeoTable."; + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + err_output: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "TopoNet_LineLinksList: output GeoTable already exists."; + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + null_arg: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - null argument."; + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + invalid_arg: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - invalid argument."; + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + invalid_geom: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = + "SQL/MM Spatial exception - invalid reference GeoTable (mismatching SRID)."; + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + not_linestring: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = + "SQL/MM Spatial exception - invalid reference GeoTable (not of the [MULTI]LINESTRING type)."; + gaianet_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; +} #endif /* end RTTOPO conditionals */ Index: src/topology/gaia_topology.c ================================================================== --- src/topology/gaia_topology.c +++ src/topology/gaia_topology.c @@ -337,10 +337,35 @@ } sqlite3_result_text (context, gaiatopo_get_last_exception (accessor), -1, SQLITE_STATIC); } + +SPATIALITE_PRIVATE void +fnctaux_CreateTopoTables (const void *xcontext, int argc, const void *argv) +{ +/* SQL function: +/ CreateTopoTables() +/ +/ creates both TOPOLOGIES and NETWORKS tables +/ returns 1 on success +/ 0 on failure, -1 on invalid arguments +*/ + sqlite3_context *context = (sqlite3_context *) xcontext; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + int topogeo; + int toponet; + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + + topogeo = do_create_topologies (sqlite); + toponet = do_create_networks (sqlite); + if (topogeo || toponet) + sqlite3_result_int (context, 1); + else + sqlite3_result_int (context, 0); + return; +} SPATIALITE_PRIVATE void fnctaux_CreateTopology (const void *xcontext, int argc, const void *xargv) { /* SQL function: @@ -2083,17 +2108,21 @@ unsigned char *p_blob; int n_bytes; gaiaGeomCollPtr geom; GaiaTopologyAccessorPtr accessor = NULL; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) topo_name = (const char *) sqlite3_value_text (argv[0]); else @@ -2122,11 +2151,11 @@ return; } sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, tiny_point); gaiaFreeGeomColl (geom); if (p_blob == NULL) sqlite3_result_null (context); else sqlite3_result_blob (context, p_blob, n_bytes, free); @@ -3301,10 +3330,28 @@ { spatialite_e ("NoFace invalidate Edge/Face: %s\n", errMsg); sqlite3_free (errMsg); return 0; } + +/* invalidating all relationships between Nodes and Faces */ + table = sqlite3_mprintf ("%s_node", toponame); + xtable = gaiaDoubleQuotedSql (table); + sqlite3_free (table); + sql = + sqlite3_mprintf + ("UPDATE \"%s\" SET containing_face = NULL " + "WHERE containing_face IS NOT NULL", xtable); + free (xtable); + ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + spatialite_e ("NoFace invalidate Node/Face: %s\n", errMsg); + sqlite3_free (errMsg); + return 0; + } /* removing all Faces except the Universe */ table = sqlite3_mprintf ("%s_face", toponame); xtable = gaiaDoubleQuotedSql (table); sqlite3_free (table); @@ -3312,11 +3359,11 @@ free (xtable); ret = sqlite3_exec (sqlite, sql, NULL, NULL, &errMsg); sqlite3_free (sql); if (ret != SQLITE_OK) { - spatialite_e ("NoFace remove Faces: %s\n", errMsg); + spatialite_e ("cazzo NoFace remove Faces: %s\n", errMsg); sqlite3_free (errMsg); return 0; } return 1; } @@ -3623,14 +3670,13 @@ SPATIALITE_PRIVATE void fnctaux_TopoGeo_TopoSnap (const void *xcontext, int argc, const void *xargv) { /* SQL function: -/ TopoGeo_TopoSnap ( text topology-name, Geometry geom, int iterate, -/ int remove_vertices ) -/ TopoGeo_TopoSnap ( text topology-name, Geometry geom, int iterate, -/ int remove_vertices, double tolerance ) +/ TopoGeo_TopoSnap ( text topology-name, Geometry geom, int iterate ) +/ TopoGeo_TopoSnap ( text topology-name, Geometry geom, double tolerance_snap, +/ double tolerance_removal, int iterate ) / / returns: the snapped Geometry / raises an exception on failure */ const char *msg; @@ -3638,24 +3684,26 @@ unsigned char *p_blob; int n_bytes; gaiaGeomCollPtr geom = NULL; gaiaGeomCollPtr g2; int iterate; - int remove_vertices; - double tolerance = -1; + double tolerance_snap = -1; + double tolerance_removal = -1; GaiaTopologyAccessorPtr accessor = NULL; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) topo_name = (const char *) sqlite3_value_text (argv[0]); @@ -3668,37 +3716,54 @@ p_blob = (unsigned char *) sqlite3_value_blob (argv[1]); n_bytes = sqlite3_value_bytes (argv[1]); } else goto invalid_arg; - if (sqlite3_value_type (argv[2]) == SQLITE_NULL) - goto null_arg; - else if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) - iterate = sqlite3_value_int (argv[2]); - else - goto invalid_arg; - if (sqlite3_value_type (argv[3]) == SQLITE_NULL) - goto null_arg; - else if (sqlite3_value_type (argv[3]) == SQLITE_INTEGER) - remove_vertices = sqlite3_value_int (argv[3]); - else - goto invalid_arg; + if (argc == 3) + { + if (sqlite3_value_type (argv[2]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) + iterate = sqlite3_value_int (argv[2]); + else + goto invalid_arg; + } if (argc >= 5) { + if (sqlite3_value_type (argv[2]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[2]) == SQLITE_INTEGER) + { + int t = sqlite3_value_int (argv[2]); + tolerance_snap = t; + } + else if (sqlite3_value_type (argv[2]) == SQLITE_FLOAT) + tolerance_snap = sqlite3_value_double (argv[2]); + else + goto invalid_arg; + if (tolerance_snap < 0.0) + goto negative_tolerance; + if (sqlite3_value_type (argv[3]) == SQLITE_NULL) + goto skip_negative; + else if (sqlite3_value_type (argv[3]) == SQLITE_INTEGER) + { + int t = sqlite3_value_int (argv[3]); + tolerance_removal = t; + } + else if (sqlite3_value_type (argv[3]) == SQLITE_FLOAT) + tolerance_removal = sqlite3_value_double (argv[3]); + else + goto invalid_arg; + if (tolerance_removal < 0.0) + goto negative_tolerance; + skip_negative: if (sqlite3_value_type (argv[4]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[4]) == SQLITE_INTEGER) - { - int t = sqlite3_value_int (argv[4]); - tolerance = t; - } - else if (sqlite3_value_type (argv[4]) == SQLITE_FLOAT) - tolerance = sqlite3_value_double (argv[4]); + iterate = sqlite3_value_int (argv[4]); else goto invalid_arg; - if (tolerance < 0.0) - goto negative_tolerance; } /* attempting to get a Geometry */ geom = gaiaFromSpatiaLiteBlobWkbEx (p_blob, n_bytes, gpkg_mode, @@ -3710,11 +3775,12 @@ accessor = gaiaGetTopology (sqlite, cache, topo_name); if (accessor == NULL) goto no_topo; gaiatopo_reset_last_error_msg (accessor); - g2 = gaiaTopoSnap (accessor, geom, tolerance, iterate, remove_vertices); + g2 = gaiaTopoSnap (accessor, geom, tolerance_snap, tolerance_removal, + iterate); gaiaFreeGeomColl (geom); if (g2 == NULL) { msg = gaiaGetRtTopoErrorMsg (cache); if (msg != NULL) @@ -3724,11 +3790,11 @@ return; } sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (g2, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (g2, &p_blob, &n_bytes, gpkg_mode, tiny_point); gaiaFreeGeomColl (g2); if (p_blob == NULL) sqlite3_result_null (context); else sqlite3_result_blob (context, p_blob, n_bytes, free); @@ -3768,11 +3834,11 @@ } static int check_input_geo_table (sqlite3 * sqlite, const char *db_prefix, const char *table, const char *column, char **xtable, - char **xcolumn, int *srid, int *dims) + char **xcolumn, int *srid, int *family, int *dims) { /* checking if an input GeoTable do really exist */ int ret; int i; char **results; @@ -3785,10 +3851,11 @@ int count = 0; char *xx_table = NULL; char *xx_column = NULL; char *ztable; int xtype; + int xfamily; int xdims; int xsrid; *xtable = NULL; *xcolumn = NULL; @@ -3917,14 +3984,51 @@ case 3005: case 3006: case 3007: xdims = GAIA_XY_Z_M; break; + }; + switch (xtype) + { + case 1: + case 1001: + case 2001: + case 3001: + case 4: + case 1004: + case 2004: + case 3004: + xfamily = GAIA_TYPE_POINT; + break; + case 2: + case 1002: + case 2002: + case 3002: + case 5: + case 1005: + case 2005: + case 3005: + xfamily = GAIA_TYPE_LINESTRING; + break; + case 3: + case 1003: + case 2003: + case 3003: + case 6: + case 1006: + case 2006: + case 3006: + xfamily = GAIA_TYPE_POLYGON; + break; + default: + xfamily = GAIA_TYPE_NONE; + break; }; *xtable = xx_table; *xcolumn = xx_column; *srid = xsrid; + *family = xfamily; *dims = xdims; return 1; } static int @@ -3979,22 +4083,56 @@ if (count != 0) return 0; return 1; } + +SPATIALITE_PRIVATE int +gaia_check_output_table (const void *handle, const char *table) +{ +/* checking if an output Table do already exist */ + sqlite3 *sqlite = (sqlite3 *) handle; + int ret; + int i; + char **results; + int rows; + int columns; + char *errMsg = NULL; + char *sql; + int count = 0; + char *ztable; + +/* testing if the Table already exist */ + ztable = gaiaDoubleQuotedSql (table); + sql = sqlite3_mprintf ("PRAGMA MAIN.table_info(\"%s\")", ztable); + free (ztable); + ret = sqlite3_get_table (sqlite, sql, &results, &rows, &columns, &errMsg); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + sqlite3_free (errMsg); + return 0; + } + for (i = 1; i <= rows; i++) + count++; + sqlite3_free_table (results); + + if (count != 0) + return 0; + return 1; +} SPATIALITE_PRIVATE void fnctaux_TopoGeo_SnappedGeoTable (const void *xcontext, int argc, const void *xargv) { /* SQL function: / TopoGeo_SnappedGeoTable ( text topology-name, text db-prefix, text table, -/ text column, text outtable, int iterate, -/ int remove_vertices ) +/ text column, text outtable, int iterate ) / TopoGeo_SnappedGeoTable ( text topology-name, text db-prefix, text table, -/ text column, text outtable, int iterate, -/ int remove_vertices, double tolerance ) +/ text column, text outtable, double tolerance_snap, +/ double tolerance_removal, int iterate ) / / returns: 1 on success / raises an exception on failure */ int ret; @@ -4005,13 +4143,14 @@ const char *column; const char *outtable; char *xtable = NULL; char *xcolumn = NULL; int iterate; - int remove_vertices; - double tolerance = -1; + double tolerance_snap = -1; + double tolerance_removal = -1; int srid; + int family; int dims; GaiaTopologyAccessorPtr accessor = NULL; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); @@ -4045,37 +4184,54 @@ goto null_arg; else if (sqlite3_value_type (argv[4]) == SQLITE_TEXT) outtable = (const char *) sqlite3_value_text (argv[4]); else goto invalid_arg; - if (sqlite3_value_type (argv[5]) == SQLITE_NULL) - goto null_arg; - else if (sqlite3_value_type (argv[5]) == SQLITE_INTEGER) - iterate = sqlite3_value_int (argv[5]); - else - goto invalid_arg; - if (sqlite3_value_type (argv[6]) == SQLITE_NULL) - goto null_arg; - else if (sqlite3_value_type (argv[6]) == SQLITE_INTEGER) - remove_vertices = sqlite3_value_int (argv[6]); - else - goto invalid_arg; + if (argc == 6) + { + if (sqlite3_value_type (argv[5]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[5]) == SQLITE_INTEGER) + iterate = sqlite3_value_int (argv[5]); + else + goto invalid_arg; + } if (argc >= 8) { + if (sqlite3_value_type (argv[5]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[5]) == SQLITE_INTEGER) + { + int t = sqlite3_value_int (argv[5]); + tolerance_snap = t; + } + else if (sqlite3_value_type (argv[5]) == SQLITE_FLOAT) + tolerance_snap = sqlite3_value_double (argv[5]); + else + goto invalid_arg; + if (tolerance_snap < 0.0) + goto negative_tolerance; + if (sqlite3_value_type (argv[6]) == SQLITE_NULL) + goto negative_skip; + else if (sqlite3_value_type (argv[6]) == SQLITE_INTEGER) + { + int t = sqlite3_value_int (argv[6]); + tolerance_removal = t; + } + else if (sqlite3_value_type (argv[6]) == SQLITE_FLOAT) + tolerance_removal = sqlite3_value_double (argv[6]); + else + goto invalid_arg; + if (tolerance_removal < 0.0) + goto negative_tolerance; + negative_skip: if (sqlite3_value_type (argv[7]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[7]) == SQLITE_INTEGER) - { - int t = sqlite3_value_int (argv[7]); - tolerance = t; - } - else if (sqlite3_value_type (argv[7]) == SQLITE_FLOAT) - tolerance = sqlite3_value_double (argv[7]); + iterate = sqlite3_value_int (argv[7]); else goto invalid_arg; - if (tolerance < 0.0) - goto negative_tolerance; } /* attempting to get a Topology Accessor */ accessor = gaiaGetTopology (sqlite, cache, topo_name); if (accessor == NULL) @@ -4082,11 +4238,12 @@ goto no_topo; gaiatopo_reset_last_error_msg (accessor); /* checking the input GeoTable */ if (!check_input_geo_table - (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &dims)) + (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &family, + &dims)) goto no_input; if (!check_matching_srid_dims (accessor, srid, dims)) goto invalid_geom; /* checking the output GeoTable */ @@ -4094,12 +4251,12 @@ goto err_output; start_topo_savepoint (sqlite, cache); ret = gaiaTopoGeo_SnappedGeoTable (accessor, db_prefix, xtable, xcolumn, - outtable, tolerance, iterate, - remove_vertices); + outtable, tolerance_snap, + tolerance_removal, iterate); if (!ret) rollback_topo_savepoint (sqlite, cache); else release_topo_savepoint (sqlite, cache); free (xtable); @@ -4205,18 +4362,20 @@ gaiaGeomCollPtr result; int line_max_points = -1; double max_length = -1.0; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) { @@ -4265,11 +4424,12 @@ /* splitting the geometry */ result = gaiaTopoGeo_SubdivideLines (geom, line_max_points, max_length); gaiaFreeGeomColl (geom); if (result == NULL) goto invalid_geom; - gaiaToSpatiaLiteBlobWkbEx (result, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (result); if (p_blob == NULL) goto invalid_geom; else sqlite3_result_blob (context, p_blob, n_bytes, free); @@ -4325,10 +4485,11 @@ const char *table; const char *column; char *xtable = NULL; char *xcolumn = NULL; int srid; + int family; int dims; int line_max_points = -1; double max_length = -1.0; double tolerance = -1; GaiaTopologyAccessorPtr accessor = NULL; @@ -4416,11 +4577,12 @@ goto no_topo; gaiatopo_reset_last_error_msg (accessor); /* checking the input GeoTable */ if (!check_input_geo_table - (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &dims)) + (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &family, + &dims)) goto no_input; if (!check_matching_srid_dims (accessor, srid, dims)) goto invalid_geom; start_topo_savepoint (sqlite, cache); @@ -4550,10 +4712,11 @@ const char *table; const char *column; char *xtable = NULL; char *xcolumn = NULL; int srid; + int family; int dims; int line_max_points = -1; double max_length = -1.0; double tolerance = -1; struct gaia_topology *topo; @@ -4643,11 +4806,12 @@ topo = (struct gaia_topology *) accessor; gaiatopo_reset_last_error_msg (accessor); /* checking the input GeoTable */ if (!check_input_geo_table - (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &dims)) + (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &family, + &dims)) goto no_input; if (!check_matching_srid_dims (accessor, srid, dims)) goto invalid_geom; start_topo_savepoint (sqlite, cache); @@ -5208,10 +5372,11 @@ const char *table; const char *column; char *xtable = NULL; char *xcolumn = NULL; int srid; + int family; int dims; const char *dustbin_table; const char *dustbin_view; int line_max_points = -1; double max_length = -1.0; @@ -5316,11 +5481,12 @@ goto no_topo; gaiatopo_reset_last_error_msg (accessor); /* checking the input GeoTable */ if (!check_input_geo_table - (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &dims)) + (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &family, + &dims)) goto no_input; if (!check_matching_srid_dims (accessor, srid, dims)) goto invalid_geom; /* attempting to create the dustbin table and view */ @@ -5541,10 +5707,11 @@ const char *table; const char *column; char *xtable = NULL; char *xcolumn = NULL; int srid; + int family; int dims; const char *dustbin_table; const char *dustbin_view; int line_max_points = -1; double max_length = -1.0; @@ -5651,11 +5818,12 @@ topo = (struct gaia_topology *) accessor; gaiatopo_reset_last_error_msg (accessor); /* checking the input GeoTable */ if (!check_input_geo_table - (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &dims)) + (sqlite, db_prefix, table, column, &xtable, &xcolumn, &srid, &family, + &dims)) goto no_input; if (!check_matching_srid_dims (accessor, srid, dims)) goto invalid_geom; start_topo_savepoint (sqlite, cache); @@ -5865,25 +6033,28 @@ if (topo->srid != srid) return 0; return 1; } -static int -check_reference_geo_table (sqlite3 * sqlite, const char *db_prefix, - const char *table, const char *column, char **xtable, - char **xcolumn, int *srid) +SPATIALITE_PRIVATE int +gaia_check_reference_geo_table (const void *handle, const char *db_prefix, + const char *table, const char *column, + char **xtable, char **xcolumn, int *srid, + int *family) { + sqlite3 *sqlite = (sqlite3 *) handle; int dims; return check_input_geo_table (sqlite, db_prefix, table, column, xtable, - xcolumn, srid, &dims); + xcolumn, srid, family, &dims); } static int check_reference_table (sqlite3 * sqlite, const char *db_prefix, const char *table) { /* checking if an input GeoTable do really exist */ + int ret; int i; char **results; int rows; int columns; @@ -5936,10 +6107,11 @@ const char *out_table; int with_spatial_index = 0; char *xreftable = NULL; char *xrefcolumn = NULL; int srid; + int family; GaiaTopologyAccessorPtr accessor = NULL; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); @@ -5987,13 +6159,13 @@ if (accessor == NULL) goto no_topo; gaiatopo_reset_last_error_msg (accessor); /* checking the reference GeoTable */ - if (!check_reference_geo_table + if (!gaia_check_reference_geo_table (sqlite, db_prefix, ref_table, ref_column, &xreftable, &xrefcolumn, - &srid)) + &srid, &family)) goto no_reference; if (!check_matching_srid (accessor, srid)) goto invalid_geom; /* checking the output GeoTable */ @@ -6079,10 +6251,350 @@ "SQL/MM Spatial exception - invalid reference GeoTable (mismatching SRID)."; gaiatopo_set_last_error_msg (accessor, msg); sqlite3_result_error (context, msg, -1); return; } + +SPATIALITE_PRIVATE void +fnctaux_TopoGeo_PolyFacesList (const void *xcontext, int argc, + const void *xargv) +{ +/* SQL function: +/ TopoGeo_PolyFacesList ( text topology-name, text db-prefix, text ref_table, +/ text ref_column, text out_table ) +/ +/ returns: 1 on success +/ raises an exception on failure +*/ + const char *msg; + int ret; + const char *topo_name; + const char *db_prefix; + const char *ref_table; + const char *ref_column; + const char *out_table; + char *xreftable = NULL; + char *xrefcolumn = NULL; + int srid; + int family; + GaiaTopologyAccessorPtr accessor = NULL; + sqlite3_context *context = (sqlite3_context *) xcontext; + sqlite3_value **argv = (sqlite3_value **) xargv; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + topo_name = (const char *) sqlite3_value_text (argv[0]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[1]) == SQLITE_NULL) + db_prefix = "main"; + else if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) + db_prefix = (const char *) sqlite3_value_text (argv[1]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[2]) == SQLITE_TEXT) + ref_table = (const char *) sqlite3_value_text (argv[2]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[3]) == SQLITE_NULL) + ref_column = NULL; + else if (sqlite3_value_type (argv[3]) == SQLITE_TEXT) + ref_column = (const char *) sqlite3_value_text (argv[3]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[4]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[4]) == SQLITE_TEXT) + out_table = (const char *) sqlite3_value_text (argv[4]); + else + goto invalid_arg; + +/* attempting to get a Topology Accessor */ + accessor = gaiaGetTopology (sqlite, cache, topo_name); + if (accessor == NULL) + goto no_topo; + gaiatopo_reset_last_error_msg (accessor); + +/* checking the reference GeoTable */ + if (!gaia_check_reference_geo_table + (sqlite, db_prefix, ref_table, ref_column, &xreftable, &xrefcolumn, + &srid, &family)) + goto no_reference; + if (!check_matching_srid (accessor, srid)) + goto invalid_geom; + if (family != GAIA_TYPE_POLYGON) + goto not_polygon; + +/* checking the output Table */ + if (!gaia_check_output_table (sqlite, out_table)) + goto err_output; + + start_topo_savepoint (sqlite, cache); + ret = + gaiaTopoGeo_PolyFacesList (accessor, db_prefix, xreftable, xrefcolumn, + out_table); + if (!ret) + rollback_topo_savepoint (sqlite, cache); + else + release_topo_savepoint (sqlite, cache); + free (xreftable); + free (xrefcolumn); + if (!ret) + { + msg = gaiaGetRtTopoErrorMsg (cache); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + } + sqlite3_result_int (context, 1); + return; + + no_topo: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - invalid topology name."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + no_reference: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "TopoGeo_PolyFacesList: invalid reference GeoTable."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + err_output: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "TopoGeo_PolyFacesList: output GeoTable already exists."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + null_arg: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - null argument."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + invalid_arg: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - invalid argument."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + invalid_geom: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = + "SQL/MM Spatial exception - invalid reference GeoTable (mismatching SRID)."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + not_polygon: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = + "SQL/MM Spatial exception - invalid reference GeoTable (not of the [MULTI]POLYGON type)."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; +} + +SPATIALITE_PRIVATE void +fnctaux_TopoGeo_LineEdgesList (const void *xcontext, int argc, + const void *xargv) +{ +/* SQL function: +/ TopoGeo_LineEdgesList ( text topology-name, text db-prefix, text ref_table, +/ text ref_column, text out_table ) +/ +/ returns: 1 on success +/ raises an exception on failure +*/ + const char *msg; + int ret; + const char *topo_name; + const char *db_prefix; + const char *ref_table; + const char *ref_column; + const char *out_table; + char *xreftable = NULL; + char *xrefcolumn = NULL; + int srid; + int family; + GaiaTopologyAccessorPtr accessor = NULL; + sqlite3_context *context = (sqlite3_context *) xcontext; + sqlite3_value **argv = (sqlite3_value **) xargv; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + topo_name = (const char *) sqlite3_value_text (argv[0]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[1]) == SQLITE_NULL) + db_prefix = "main"; + else if (sqlite3_value_type (argv[1]) == SQLITE_TEXT) + db_prefix = (const char *) sqlite3_value_text (argv[1]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[2]) == SQLITE_TEXT) + ref_table = (const char *) sqlite3_value_text (argv[2]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[3]) == SQLITE_NULL) + ref_column = NULL; + else if (sqlite3_value_type (argv[3]) == SQLITE_TEXT) + ref_column = (const char *) sqlite3_value_text (argv[3]); + else + goto invalid_arg; + if (sqlite3_value_type (argv[4]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[4]) == SQLITE_TEXT) + out_table = (const char *) sqlite3_value_text (argv[4]); + else + goto invalid_arg; + +/* attempting to get a Topology Accessor */ + accessor = gaiaGetTopology (sqlite, cache, topo_name); + if (accessor == NULL) + goto no_topo; + gaiatopo_reset_last_error_msg (accessor); + +/* checking the reference GeoTable */ + if (!gaia_check_reference_geo_table + (sqlite, db_prefix, ref_table, ref_column, &xreftable, &xrefcolumn, + &srid, &family)) + goto no_reference; + if (!check_matching_srid (accessor, srid)) + goto invalid_geom; + if (family != GAIA_TYPE_LINESTRING) + goto not_linestring; + +/* checking the output Table */ + if (!gaia_check_output_table (sqlite, out_table)) + goto err_output; + + start_topo_savepoint (sqlite, cache); + ret = + gaiaTopoGeo_LineEdgesList (accessor, db_prefix, xreftable, xrefcolumn, + out_table); + if (!ret) + rollback_topo_savepoint (sqlite, cache); + else + release_topo_savepoint (sqlite, cache); + free (xreftable); + free (xrefcolumn); + if (!ret) + { + msg = gaiaGetRtTopoErrorMsg (cache); + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + } + sqlite3_result_int (context, 1); + return; + + no_topo: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - invalid topology name."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + no_reference: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "TopoGeo_LineEdgesList: invalid reference GeoTable."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + err_output: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "TopoGeo_LineEdgesList: output GeoTable already exists."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + null_arg: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - null argument."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + invalid_arg: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = "SQL/MM Spatial exception - invalid argument."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + invalid_geom: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = + "SQL/MM Spatial exception - invalid reference GeoTable (mismatching SRID)."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + not_linestring: + if (xreftable != NULL) + free (xreftable); + if (xrefcolumn != NULL) + free (xrefcolumn); + msg = + "SQL/MM Spatial exception - invalid reference GeoTable (not of the [MULTI]LINESTRING type)."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; +} SPATIALITE_PRIVATE void fnctaux_TopoGeo_ToGeoTableGeneralize (const void *xcontext, int argc, const void *xargv) { @@ -6108,10 +6620,11 @@ double tolerance = 0.0; int with_spatial_index = 0; char *xreftable = NULL; char *xrefcolumn = NULL; int srid; + int family; GaiaTopologyAccessorPtr accessor = NULL; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); @@ -6170,13 +6683,13 @@ if (accessor == NULL) goto no_topo; gaiatopo_reset_last_error_msg (accessor); /* checking the reference GeoTable */ - if (!check_reference_geo_table + if (!gaia_check_reference_geo_table (sqlite, db_prefix, ref_table, ref_column, &xreftable, &xrefcolumn, - &srid)) + &srid, &family)) goto no_reference; if (!check_matching_srid (accessor, srid)) goto invalid_geom; /* checking the output GeoTable */ @@ -6767,12 +7280,11 @@ sqlite3_result_error (context, msg, -1); return; } SPATIALITE_PRIVATE void -fnctaux_TopoGeo_ModEdgeSplit (const void *xcontext, int argc, - const void *xargv) +fnctaux_TopoGeo_ModEdgeSplit (const void *xcontext, int argc, const void *xargv) { /* SQL function: / TopoGeo_ModEdgeSplit ( text topology-name, int line_max_points ) / TopoGeo_ModEdgeSplit ( text topology-name, int line_max_points, / double max_length ) @@ -7517,17 +8029,21 @@ unsigned char *p_blob; int n_bytes; gaiaGeomCollPtr geom; GaiaTopologyAccessorPtr accessor = NULL; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) topo_name = (const char *) sqlite3_value_text (argv[0]); else @@ -7556,11 +8072,11 @@ return; } sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, tiny_point); gaiaFreeGeomColl (geom); if (p_blob == NULL) sqlite3_result_null (context); else sqlite3_result_blob (context, p_blob, n_bytes, free); @@ -7600,17 +8116,21 @@ unsigned char *p_blob; int n_bytes; gaiaGeomCollPtr geom; GaiaTopologyAccessorPtr accessor = NULL; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ if (cache != NULL) - gpkg_mode = cache->gpkg_mode; + { + gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; + } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) topo_name = (const char *) sqlite3_value_text (argv[0]); else @@ -7639,18 +8159,90 @@ return; } sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, tiny_point); gaiaFreeGeomColl (geom); if (p_blob == NULL) sqlite3_result_null (context); else sqlite3_result_blob (context, p_blob, n_bytes, free); return; + no_topo: + msg = "SQL/MM Spatial exception - invalid topology name."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + null_arg: + msg = "SQL/MM Spatial exception - null argument."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + + invalid_arg: + msg = "SQL/MM Spatial exception - invalid argument."; + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; +} + +SPATIALITE_PRIVATE void +fnctaux_TopoGeo_DisambiguateSegmentEdges (const void *xcontext, int argc, + const void *xargv) +{ +/* SQL function: +/ TopoGeo_DisambiguateSegmentEdges ( text topology-name ) +/ +/ returns: the total number of changed Edges. +/ raises an exception on failure +*/ + const char *msg; + const char *topo_name; + int changed_edges = 0; + GaiaTopologyAccessorPtr accessor = NULL; + sqlite3_context *context = (sqlite3_context *) xcontext; + sqlite3_value **argv = (sqlite3_value **) xargv; + sqlite3 *sqlite = sqlite3_context_db_handle (context); + struct splite_internal_cache *cache = sqlite3_user_data (context); + GAIA_UNUSED (); /* LCOV_EXCL_LINE */ + if (sqlite3_value_type (argv[0]) == SQLITE_NULL) + goto null_arg; + else if (sqlite3_value_type (argv[0]) == SQLITE_TEXT) + topo_name = (const char *) sqlite3_value_text (argv[0]); + else + goto invalid_arg; + +/* attempting to get a Topology Accessor */ + accessor = gaiaGetTopology (sqlite, cache, topo_name); + if (accessor == NULL) + goto no_topo; + + gaiatopo_reset_last_error_msg (accessor); + start_topo_savepoint (sqlite, cache); + changed_edges = gaiaTopoGeo_DisambiguateSegmentEdges (accessor); + if (changed_edges < 0) + rollback_topo_savepoint (sqlite, cache); + else + release_topo_savepoint (sqlite, cache); + if (changed_edges < 0) + { + msg = gaiaGetRtTopoErrorMsg (cache); + if (msg != NULL) + { + gaiatopo_set_last_error_msg (accessor, msg); + sqlite3_result_error (context, msg, -1); + return; + } + sqlite3_result_null (context); + return; + } + sqlite3_result_int (context, changed_edges); + return; + no_topo: msg = "SQL/MM Spatial exception - invalid topology name."; gaiatopo_set_last_error_msg (accessor, msg); sqlite3_result_error (context, msg, -1); return; @@ -7769,10 +8361,11 @@ unsigned char *p_blob; int n_bytes; int invalid = 0; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ @@ -7779,10 +8372,11 @@ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) @@ -7838,11 +8432,12 @@ { gaiaFreeGeomColl (geom); sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (result, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); gaiaFreeGeomColl (result); if (p_blob == NULL) sqlite3_result_null (context); else @@ -7910,10 +8505,11 @@ unsigned char *p_blob; int n_bytes; int invalid = 0; int gpkg_amphibious = 0; int gpkg_mode = 0; + int tiny_point = 0; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); GAIA_UNUSED (); /* LCOV_EXCL_LINE */ @@ -7920,10 +8516,11 @@ if (cache != NULL) { gpkg_amphibious = cache->gpkg_amphibious_mode; gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } if (sqlite3_value_type (argv[0]) == SQLITE_NULL) goto null_arg; if (sqlite3_value_type (argv[0]) == SQLITE_BLOB) @@ -7980,11 +8577,12 @@ { gaiaFreeGeomColl (geom); sqlite3_result_null (context); return; } - gaiaToSpatiaLiteBlobWkbEx (result, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (result, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); gaiaFreeGeomColl (result); if (p_blob == NULL) sqlite3_result_null (context); else @@ -8199,10 +8797,11 @@ const char *topolayer_name; int is_view = 0; char *xreftable = NULL; char *xrefcolumn = NULL; int srid; + int family; GaiaTopologyAccessorPtr accessor = NULL; sqlite3_context *context = (sqlite3_context *) xcontext; sqlite3_value **argv = (sqlite3_value **) xargv; sqlite3 *sqlite = sqlite3_context_db_handle (context); struct splite_internal_cache *cache = sqlite3_user_data (context); @@ -8265,13 +8864,13 @@ strcpy (xrefcolumn, ref_column); } else { /* checking the reference GeoTable */ - if (!check_reference_geo_table + if (!gaia_check_reference_geo_table (sqlite, db_prefix, ref_table, ref_column, &xreftable, - &xrefcolumn, &srid)) + &xrefcolumn, &srid, &family)) goto no_reference; if (!check_matching_srid (accessor, srid)) goto invalid_geom; } Index: src/topology/net_callbacks.c ================================================================== --- src/topology/net_callbacks.c +++ src/topology/net_callbacks.c @@ -1255,10 +1255,11 @@ int i; unsigned char *p_blob; int n_bytes; gaiaGeomCollPtr geom = NULL; int gpkg_mode = 0; + int tiny_point = 0; if (accessor == NULL) return 0; stmt = accessor->stmt_insertNetNodes; if (stmt == NULL) @@ -1267,10 +1268,11 @@ if (accessor->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (accessor->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } for (i = 0; i < numelems; i++) { LWN_NET_NODE *nd = nodes + i; @@ -1294,11 +1296,12 @@ nd->geom->z); else gaiaAddPointToGeomColl (geom, nd->geom->x, nd->geom->y); geom->Srid = accessor->srid; geom->DeclaredType = GAIA_POINT; - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); sqlite3_bind_blob (stmt, 2, p_blob, n_bytes, free); } ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) @@ -1475,10 +1478,11 @@ int i; gaiaGeomCollPtr geom; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (accessor == NULL) return 0; stmt = accessor->stmt_insertLinks; if (stmt == NULL) @@ -1487,10 +1491,11 @@ if (accessor->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (accessor->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } for (i = 0; i < numelems; i++) { LWN_LINK *lnk = links + i; @@ -1507,11 +1512,12 @@ sqlite3_bind_null (stmt, 4); else { /* transforming the LWN_LINE into a Geometry-Linestring */ geom = do_convert_lwnline_to_geom (lnk->geom, accessor->srid); - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); sqlite3_bind_blob (stmt, 4, p_blob, n_bytes, free); } ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) @@ -1987,18 +1993,20 @@ int i; int changed = 0; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (accessor == NULL) return -1; if (accessor->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (accessor->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } /* composing the SQL prepared statement */ table = sqlite3_mprintf ("%s_link", accessor->network_name); xtable = gaiaDoubleQuotedSql (table); @@ -2091,12 +2099,12 @@ { /* transforming the LWN_LINE into a Geometry-Linestring */ geom = do_convert_lwnline_to_geom (upd_link->geom, accessor->srid); - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, - gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, + gpkg_mode, tiny_point); gaiaFreeGeomColl (geom); sqlite3_bind_blob (stmt, icol, p_blob, n_bytes, free); } icol++; } Index: src/topology/topo_callbacks.c ================================================================== --- src/topology/topo_callbacks.c +++ src/topology/topo_callbacks.c @@ -1827,10 +1827,11 @@ RTPOINT4D pt4d; gaiaGeomCollPtr geom; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (accessor == NULL) return 0; stmt = accessor->stmt_insertNodes; if (stmt == NULL) @@ -1849,10 +1850,11 @@ if (accessor->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (accessor->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } for (i = 0; i < numelems; i++) { RTT_ISO_NODE *nd = nodes + i; @@ -1883,11 +1885,12 @@ } else gaiaAddPointToGeomColl (geom, x, y); geom->Srid = accessor->srid; geom->DeclaredType = GAIA_POINT; - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); sqlite3_bind_blob (stmt, 3, p_blob, n_bytes, free); ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) { @@ -2317,10 +2320,11 @@ int i; gaiaGeomCollPtr geom; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (accessor == NULL) return 0; stmt = accessor->stmt_insertEdges; if (stmt == NULL) @@ -2339,10 +2343,11 @@ if (accessor->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (accessor->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } for (i = 0; i < numelems; i++) { RTT_ISO_EDGE *eg = edges + i; @@ -2365,11 +2370,12 @@ sqlite3_bind_int64 (stmt, 5, eg->face_right); sqlite3_bind_int64 (stmt, 6, eg->next_left); sqlite3_bind_int64 (stmt, 7, eg->next_right); /* transforming the RTLINE into a Geometry-Linestring */ geom = do_rtline_to_geom (ctx, eg->geom, accessor->srid); - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); sqlite3_bind_blob (stmt, 8, p_blob, n_bytes, free); ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) { @@ -2414,10 +2420,11 @@ char *xtable; int icol = 1; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; int changed = 0; if (accessor == NULL) return -1; cache = (struct splite_internal_cache *) accessor->cache; @@ -2433,10 +2440,11 @@ if (accessor->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (accessor->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } /* composing the SQL prepared statement */ table = sqlite3_mprintf ("%s_edge", accessor->topology_name); xtable = gaiaDoubleQuotedSql (table); @@ -2825,11 +2833,12 @@ if (upd_fields & RTT_COL_EDGE_GEOM) { /* transforming the RTLINE into a Geometry-Linestring */ gaiaGeomCollPtr geom = do_rtline_to_geom (ctx, upd_edge->geom, accessor->srid); - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); sqlite3_bind_blob (stmt, icol, p_blob, n_bytes, free); icol++; } if (sel_edge) @@ -4792,10 +4801,11 @@ int i; int changed = 0; unsigned char *p_blob; int n_bytes; int gpkg_mode = 0; + int tiny_point = 0; if (accessor == NULL) return -1; cache = (struct splite_internal_cache *) accessor->cache; if (cache == NULL) @@ -4810,10 +4820,11 @@ if (accessor->cache != NULL) { struct splite_internal_cache *cache = (struct splite_internal_cache *) (accessor->cache); gpkg_mode = cache->gpkg_mode; + tiny_point = cache->tinyPointEnabled; } /* composing the SQL prepared statement */ table = sqlite3_mprintf ("%s_edge", accessor->topology_name); xtable = gaiaDoubleQuotedSql (table); @@ -4967,11 +4978,12 @@ if (upd_fields & RTT_COL_EDGE_GEOM) { /* transforming the RTLINE into a Geometry-Linestring */ gaiaGeomCollPtr geom = do_rtline_to_geom (ctx, upd_edge->geom, accessor->srid); - gaiaToSpatiaLiteBlobWkbEx (geom, &p_blob, &n_bytes, gpkg_mode); + gaiaToSpatiaLiteBlobWkbEx2 (geom, &p_blob, &n_bytes, gpkg_mode, + tiny_point); gaiaFreeGeomColl (geom); sqlite3_bind_blob (stmt, icol, p_blob, n_bytes, free); icol++; } sqlite3_bind_int64 (stmt, icol, upd_edge->edge_id); Index: src/virtualtext/Makefile.am ================================================================== --- src/virtualtext/Makefile.am +++ src/virtualtext/Makefile.am @@ -1,17 +1,17 @@ -AM_CPPFLAGS = @CFLAGS@ +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libvirtualtext.la virtualtext.la libvirtualtext_la_SOURCES = virtualtext.c virtualtext_la_SOURCES = virtualtext.c -virtualtext_la_CPPFLAGS = @CFLAGS@ +virtualtext_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ virtualtext_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. virtualtext_la_CPPFLAGS += -DLOADABLE_EXTENSION virtualtext_la_LDFLAGS = -module virtualtext_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/virtualtext/Makefile.in ================================================================== --- src/virtualtext/Makefile.in +++ src/virtualtext/Makefile.in @@ -305,16 +305,16 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libvirtualtext.la virtualtext.la libvirtualtext_la_SOURCES = virtualtext.c virtualtext_la_SOURCES = virtualtext.c -virtualtext_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \ - -DLOADABLE_EXTENSION +virtualtext_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ \ + -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION virtualtext_la_LDFLAGS = -module virtualtext_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/virtualtext/virtualtext.c ================================================================== --- src/virtualtext/virtualtext.c +++ src/virtualtext/virtualtext.c @@ -1102,28 +1102,28 @@ } return reader; } static void -vrttxt_line_init (struct vrttxt_line *line, off_t offset) +vrttxt_line_init (struct vrttxt_line *line, gaia_off_t offset) { /* initializing a LINE struct */ line->offset = offset; line->len = 0; line->num_fields = 0; line->error = 0; } static void -vrttxt_line_end (struct vrttxt_line *line, off_t offset) +vrttxt_line_end (struct vrttxt_line *line, gaia_off_t offset) { /* completing a Line struct (EndOfLine encountered) */ line->len = offset - line->offset; } static void -vrttxt_add_field (struct vrttxt_line *line, off_t offset) +vrttxt_add_field (struct vrttxt_line *line, gaia_off_t offset) { /* adding a Field offset to the current Line */ if (line->num_fields >= VRTTXT_FIELDS_MAX) { line->error = 1; @@ -1286,10 +1286,37 @@ return VRTTXT_INTEGER; if (vrttxt_is_double (value, decimal_separator)) return VRTTXT_DOUBLE; return VRTTXT_TEXT; } + +static void +vrttxt_unmask (char *string, char separator) +{ +/* unmasking double separators */ + int len = strlen (string); + char *buffer = malloc (len + 1); + char *in = buffer; + char *out = string; + char prevchar = '\0'; + strcpy (buffer, string); + while (*in != '\0') + { + if (*in == separator) + { + if (prevchar == separator) + *out++ = separator; + in++; + prevchar = separator; + continue; + } + prevchar = *in; + *out++ = *in++; + } + *out = '\0'; + free (buffer); +} static int vrttxt_set_column_title (gaiaTextReaderPtr txt, int col_no, const char *name) { /* setting a Column header name */ @@ -1306,10 +1333,11 @@ str[len - 1] = '\0'; str = (char *) (name + 1); len -= 2; if (len <= 0) return 0; + vrttxt_unmask (str, txt->text_separator); } utf8text = gaiaConvertToUTF8 (txt->toUtf8, str, len, &err); if (err) { if (utf8text) @@ -1436,10 +1464,12 @@ *(txt->field_buffer + len) = '\0'; } if (txt->first_line_titles && first_line) { /* first line: the current value is the Column Name */ + if (strlen (txt->field_buffer) == 0) + strcpy (txt->field_buffer, "empty"); if (!vrttxt_set_column_title (txt, ind, txt->field_buffer)) txt->error = 1; } else { @@ -1579,14 +1609,15 @@ */ char name[64]; int ind; int i2; int c; + int prevchar = '\0'; int masked = 0; int token_start = 1; int row_offset = 0; - off_t offset = 0; + gaia_off_t offset = 0; struct vrttxt_line line; vrttxt_line_init (&line, 0); txt->current_buf_off = 0; while ((c = getc (txt->text_file)) != EOF) @@ -1597,18 +1628,22 @@ masked = 0; else { if (token_start) masked = 1; + if (prevchar == txt->text_separator) + masked = 1; } vrttxt_line_push (txt, (char) c); if (txt->error) return 0; row_offset++; offset++; + prevchar = c; continue; } + prevchar = c; token_start = 0; if (c == '\r') { if (masked) { @@ -1676,10 +1711,18 @@ /* checking for duplicate column names */ for (ind = 0; ind < txt->max_fields; ind++) { for (i2 = 0; i2 < ind; i2++) { + if (txt->columns[ind].name == NULL) + { + if (!vrttxt_set_column_title (txt, ind, "empty")) + { + txt->error = 1; + return 0; + } + } if (strcasecmp (txt->columns[i2].name, txt->columns[ind].name) == 0) { sprintf (name, "COL%03d", ind + 1); if (!vrttxt_set_column_title (txt, ind, name)) @@ -1716,26 +1759,30 @@ gaiaTextReaderGetRow (gaiaTextReaderPtr txt, int line_no) { /* reading a Line (identified by relative number */ int i; char c; + char prevchar = '\0'; int masked = 0; int token_start = 1; int fld = 0; int offset = 0; struct vrttxt_row *p_row; + if (txt == NULL) + return 0; txt->current_line_ready = 0; txt->max_current_field = 0; if (line_no < 0 || line_no >= txt->num_rows || txt->rows == NULL) return 0; p_row = *(txt->rows + line_no); - if (fseek (txt->text_file, p_row->offset, SEEK_SET) != 0) + if (gaia_fseek (txt->text_file, p_row->offset, SEEK_SET) != 0) return 0; if (fread (txt->line_buffer, 1, p_row->len, txt->text_file) != (unsigned int) (p_row->len)) return 0; txt->field_offsets[0] = 0; + for (i = 0; i < p_row->len; i++) { /* parsing Fields */ c = *(txt->line_buffer + i); if (c == txt->text_separator) @@ -1744,14 +1791,18 @@ masked = 0; else { if (token_start) masked = 1; + if (prevchar == txt->text_separator) + masked = 1; } offset++; + prevchar = c; continue; } + prevchar = c; token_start = 0; if (c == '\r') { offset++; continue; @@ -1846,10 +1897,11 @@ { *type = VRTTXT_NULL; *value = NULL; return 1; } + vrttxt_unmask (str, txt->text_separator); } utf8text = gaiaConvertToUTF8 (txt->toUtf8, str, len, &err); if (err) { /* memory cleanup: Kashif Rasul 14 Jan 2010 */ Index: src/wfs/Makefile.am ================================================================== --- src/wfs/Makefile.am +++ src/wfs/Makefile.am @@ -1,17 +1,17 @@ -AM_CPPFLAGS= @CFLAGS@ @LIBXML2_CFLAGS@ +AM_CPPFLAGS= @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ AM_CPPFLAGS += -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libwfs.la wfs.la libwfs_la_SOURCES = wfs_in.c wfs_la_SOURCES = wfs_in.c -wfs_la_CPPFLAGS = @CFLAGS@ @LIBXML2_CFLAGS@ +wfs_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ wfs_la_CPPFLAGS += -I$(top_srcdir)/src/headers -I. wfs_la_CPPFLAGS += -DLOADABLE_EXTENSION wfs_la_LDFLAGS = -module wfs_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda Index: src/wfs/Makefile.in ================================================================== --- src/wfs/Makefile.in +++ src/wfs/Makefile.in @@ -304,15 +304,16 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AM_CPPFLAGS = @CFLAGS@ @LIBXML2_CFLAGS@ -I$(top_srcdir)/src/headers +AM_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ \ + -I$(top_srcdir)/src/headers noinst_LTLIBRARIES = libwfs.la wfs.la libwfs_la_SOURCES = wfs_in.c wfs_la_SOURCES = wfs_in.c -wfs_la_CPPFLAGS = @CFLAGS@ @LIBXML2_CFLAGS@ \ +wfs_la_CPPFLAGS = @CFLAGS@ @CPPFLAGS@ @LIBXML2_CFLAGS@ \ -I$(top_srcdir)/src/headers -I. -DLOADABLE_EXTENSION wfs_la_LDFLAGS = -module wfs_la_LIBTOOLFLAGS = --tag=disable-static MOSTLYCLEANFILES = *.gcna *.gcno *.gcda all: all-am Index: src/wfs/wfs_in.c ================================================================== --- src/wfs/wfs_in.c +++ src/wfs/wfs_in.c @@ -3438,10 +3438,11 @@ int startIdx = 0; int nRows; char *page_url = NULL; const char *p_page_url; int shift_index = 0; + int retry; xmlGenericErrorFunc parsingError = (xmlGenericErrorFunc) wfsParsingError; *rows = 0; if (err_msg != NULL) *err_msg = NULL; if (path_or_url == NULL) @@ -3466,11 +3467,24 @@ } /* loading the WFS payload from URL (or file) */ gaiaOutBufferInitialize (&errBuf); xmlSetGenericErrorFunc (&errBuf, parsingError); - xml_doc = xmlReadFile (p_page_url, NULL, 0); + + retry = 0; + while (1) + { + /* retry loop */ + xml_doc = xmlReadFile (p_page_url, NULL, 0); + if (xml_doc != NULL) + break; + retry++; + if (retry > 5) + break; + sqlite3_sleep (10000 * retry); + } + if (page_url != NULL) sqlite3_free (page_url); if (xml_doc == NULL) { /* parsing error; not a well-formed XML */ @@ -3485,11 +3499,11 @@ if (pageNo == 0) { if (alt_describe_uri != NULL) { - /* using the DescribetFeatureType URI from GetCapabilities */ + /* using the DescribeFeatureType URI from GetCapabilities */ len = strlen (alt_describe_uri); describe_uri = malloc (len + 1); strcpy (describe_uri, alt_describe_uri); ret = 1; } @@ -4648,14 +4662,15 @@ int page_size, int *rows, char **err_msg, void (*progress_callback) (int, void *), void *callback_ptr) { /* LIBXML2 isn't enabled: always returning an error */ - return load_from_wfs_paged_ex (sqlite, "1.1.0", alt_describe_uri, - layer_name, swap_axes, table, pk_column_name, - spatial_index, page_size, rows, err_msg, - progress_callback, callback_ptr); + return load_from_wfs_paged_ex (sqlite, "1.1.0", path_or_url, + alt_describe_uri, layer_name, swap_axes, + table, pk_column_name, spatial_index, + page_size, rows, err_msg, progress_callback, + callback_ptr); } SPATIALITE_DECLARE int load_from_wfs_paged_ex (sqlite3 * sqlite, const char *wfs_version, const char *path_or_url, const char *alt_describe_uri, @@ -4669,14 +4684,14 @@ int len; const char *msg = "Sorry ... libspatialite was built disabling LIBXML2\n" "and is thus unable to support LOADWFS"; /* silencing stupid compiler warnings */ - if (sqlite == NULL || path_or_url == NULL || layer_name == NULL - || alt_describe_uri == NULL || swap_axes == 0 || table == NULL - || pk_column_name == NULL || spatial_index == 0 || page_size == 0 - || rows == NULL || progress_callback == NULL + if (sqlite == NULL || wfs_version == NULL || path_or_url == NULL + || layer_name == NULL || alt_describe_uri == NULL || swap_axes == 0 + || table == NULL || pk_column_name == NULL || spatial_index == 0 + || page_size == 0 || rows == NULL || progress_callback == NULL || progress_callback == NULL || callback_ptr == NULL) path_or_url = NULL; if (err_msg == NULL) return 0; Index: test/Makefile.am ================================================================== --- test/Makefile.am +++ test/Makefile.am @@ -2,10 +2,11 @@ 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 \ @@ -64,11 +65,13 @@ check_network2d \ check_network3d \ check_network_log \ check_virtualknn \ check_sequence \ - check_wms + check_stored_proc \ + check_wms \ + routing_test if ENABLE_GEOPACKAGE check_PROGRAMS += \ check_createBaseTables \ check_gpkgCreateTilesTable \ @@ -197,11 +200,13 @@ archaic.dxf linked.dxf hatch.dxf \ symbol.dxf gpkg_test.sqlite gpkg_test.gpkg \ gpkg_test_broken.gpkg gpkg_test_extrasrid.gpkg \ elba-pg.shp elba-pg.shx elba-pg.dbf \ elba-ln.shp elba-ln.shx elba-ln.dbf \ - Gpx-sample.gpx 000323485.gpx + Gpx-sample.gpx 000323485.gpx \ + sqlproc_sample.txt sqlproc_logfile.txt \ + sqlproc_error.txt orbetello.sqlite SUBDIRS = sql_stmt_geosadvanced_tests sql_stmt_geos_tests \ sql_stmt_libxml2_tests sql_stmt_rtgeom_tests \ sql_stmt_mathsql_tests sql_stmt_proj_tests \ sql_stmt_proj492_tests sql_stmt_proj493_tests \ @@ -210,6 +215,9 @@ sql_stmt_freexl_tests sql_stmt_cache_tests \ sql_stmt_nocache_tests sql_stmt_voronoj1_tests \ sql_stmt_voronoj2_tests \ sql_stmt_gpkg_epsg492_tests sql_stmt_gpkg_epsg493_tests \ sql_stmt_rttopo_tests sql_stmt_gpkgcache_tests \ - sql_stmt_gpkgnocache_tests sql_stmt_sequence_tests + sql_stmt_gpkgnocache_tests sql_stmt_sequence_tests \ + sql_stmt_routing_tests sql_stmt_logfile_tests \ + sql_stmt_iconv_tests sql_stmt_point_geom \ + sql_stmt_tiny_point Index: test/Makefile.in ================================================================== --- test/Makefile.in +++ test/Makefile.in @@ -87,13 +87,14 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ check_PROGRAMS = check_endian$(EXEEXT) check_version$(EXEEXT) \ check_init$(EXEEXT) check_init2$(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_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) \ @@ -118,11 +119,12 @@ check_topology2d$(EXEEXT) check_topology3d$(EXEEXT) \ check_toponoface2d$(EXEEXT) check_topoplus$(EXEEXT) \ check_toposnap$(EXEEXT) check_network2d$(EXEEXT) \ check_network3d$(EXEEXT) check_network_log$(EXEEXT) \ check_virtualknn$(EXEEXT) check_sequence$(EXEEXT) \ - check_wms$(EXEEXT) $(am__EXEEXT_1) + check_stored_proc$(EXEEXT) check_wms$(EXEEXT) \ + routing_test$(EXEEXT) $(am__EXEEXT_1) @ENABLE_GEOPACKAGE_TRUE@am__append_1 = \ @ENABLE_GEOPACKAGE_TRUE@ check_createBaseTables \ @ENABLE_GEOPACKAGE_TRUE@ check_gpkgCreateTilesTable \ @ENABLE_GEOPACKAGE_TRUE@ check_gpkgCreateTilesTableMissingSRID \ @ENABLE_GEOPACKAGE_TRUE@ check_gpkgCreateTilesZoomLevel \ @@ -389,10 +391,13 @@ check_init_OBJECTS = check_init.$(OBJEXT) check_init_LDADD = $(LDADD) check_init2_SOURCES = check_init2.c check_init2_OBJECTS = check_init2.$(OBJEXT) check_init2_LDADD = $(LDADD) +check_init_full_SOURCES = check_init_full.c +check_init_full_OBJECTS = check_init_full.$(OBJEXT) +check_init_full_LDADD = $(LDADD) check_libxml2_SOURCES = check_libxml2.c check_libxml2_OBJECTS = check_libxml2.$(OBJEXT) check_libxml2_LDADD = $(LDADD) check_math_funcs_SOURCES = check_math_funcs.c check_math_funcs_OBJECTS = check_math_funcs.$(OBJEXT) @@ -440,10 +445,13 @@ check_sql_stmt_OBJECTS = check_sql_stmt.$(OBJEXT) check_sql_stmt_LDADD = $(LDADD) check_srid_fncts_SOURCES = check_srid_fncts.c check_srid_fncts_OBJECTS = check_srid_fncts.$(OBJEXT) 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) @@ -503,10 +511,13 @@ check_wms_OBJECTS = check_wms.$(OBJEXT) check_wms_LDADD = $(LDADD) check_xls_load_SOURCES = check_xls_load.c check_xls_load_OBJECTS = check_xls_load.$(OBJEXT) check_xls_load_LDADD = $(LDADD) +routing_test_SOURCES = routing_test.c +routing_test_OBJECTS = routing_test.$(OBJEXT) +routing_test_LDADD = $(LDADD) shape_3d_SOURCES = shape_3d.c shape_3d_OBJECTS = shape_3d.$(OBJEXT) shape_3d_LDADD = $(LDADD) shape_cp1252_SOURCES = shape_cp1252.c shape_cp1252_OBJECTS = shape_cp1252.$(OBJEXT) @@ -582,26 +593,27 @@ check_gpkg_base_core_container_data_file_format_application_id.c \ check_gpkg_base_core_contents_data_table_def.c \ check_gpkg_base_core_spatial_ref_sys_data_table_def.c \ check_gpkg_base_core_spatial_ref_sys_data_values_default.c \ check_gpkg_opt_extension_mechanism_extensions_data_table_def.c \ - check_init.c check_init2.c check_libxml2.c check_math_funcs.c \ - check_mbrcache.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_init.c check_init2.c check_init_full.c check_libxml2.c \ + check_math_funcs.c check_mbrcache.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_srid_fncts.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_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 shape_3d.c shape_cp1252.c shape_primitives.c \ - shape_utf8_1.c shape_utf8_1ex.c shape_utf8_2.c + check_xls_load.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_dxf.c check_endian.c check_exif.c check_exif2.c \ @@ -625,26 +637,27 @@ check_gpkg_base_core_container_data_file_format_application_id.c \ check_gpkg_base_core_contents_data_table_def.c \ check_gpkg_base_core_spatial_ref_sys_data_table_def.c \ check_gpkg_base_core_spatial_ref_sys_data_values_default.c \ check_gpkg_opt_extension_mechanism_extensions_data_table_def.c \ - check_init.c check_init2.c check_libxml2.c check_math_funcs.c \ - check_mbrcache.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_init.c check_init2.c check_init_full.c check_libxml2.c \ + check_math_funcs.c check_mbrcache.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_srid_fncts.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_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 shape_3d.c shape_cp1252.c shape_primitives.c \ - shape_utf8_1.c shape_utf8_1ex.c shape_utf8_2.c + check_xls_load.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 \ @@ -1135,11 +1148,13 @@ archaic.dxf linked.dxf hatch.dxf \ symbol.dxf gpkg_test.sqlite gpkg_test.gpkg \ gpkg_test_broken.gpkg gpkg_test_extrasrid.gpkg \ elba-pg.shp elba-pg.shx elba-pg.dbf \ elba-ln.shp elba-ln.shx elba-ln.dbf \ - Gpx-sample.gpx 000323485.gpx + Gpx-sample.gpx 000323485.gpx \ + sqlproc_sample.txt sqlproc_logfile.txt \ + sqlproc_error.txt orbetello.sqlite SUBDIRS = sql_stmt_geosadvanced_tests sql_stmt_geos_tests \ sql_stmt_libxml2_tests sql_stmt_rtgeom_tests \ sql_stmt_mathsql_tests sql_stmt_proj_tests \ sql_stmt_proj492_tests sql_stmt_proj493_tests \ @@ -1148,11 +1163,14 @@ sql_stmt_freexl_tests sql_stmt_cache_tests \ sql_stmt_nocache_tests sql_stmt_voronoj1_tests \ sql_stmt_voronoj2_tests \ sql_stmt_gpkg_epsg492_tests sql_stmt_gpkg_epsg493_tests \ sql_stmt_rttopo_tests sql_stmt_gpkgcache_tests \ - sql_stmt_gpkgnocache_tests sql_stmt_sequence_tests + sql_stmt_gpkgnocache_tests sql_stmt_sequence_tests \ + sql_stmt_routing_tests sql_stmt_logfile_tests \ + sql_stmt_iconv_tests sql_stmt_point_geom \ + sql_stmt_tiny_point all: all-recursive .SUFFIXES: .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs @@ -1400,10 +1418,14 @@ $(AM_V_CCLD)$(LINK) $(check_init_OBJECTS) $(check_init_LDADD) $(LIBS) check_init2$(EXEEXT): $(check_init2_OBJECTS) $(check_init2_DEPENDENCIES) $(EXTRA_check_init2_DEPENDENCIES) @rm -f check_init2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_init2_OBJECTS) $(check_init2_LDADD) $(LIBS) + +check_init_full$(EXEEXT): $(check_init_full_OBJECTS) $(check_init_full_DEPENDENCIES) $(EXTRA_check_init_full_DEPENDENCIES) + @rm -f check_init_full$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(check_init_full_OBJECTS) $(check_init_full_LDADD) $(LIBS) check_libxml2$(EXEEXT): $(check_libxml2_OBJECTS) $(check_libxml2_DEPENDENCIES) $(EXTRA_check_libxml2_DEPENDENCIES) @rm -f check_libxml2$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_libxml2_OBJECTS) $(check_libxml2_LDADD) $(LIBS) @@ -1468,10 +1490,14 @@ $(AM_V_CCLD)$(LINK) $(check_sql_stmt_OBJECTS) $(check_sql_stmt_LDADD) $(LIBS) check_srid_fncts$(EXEEXT): $(check_srid_fncts_OBJECTS) $(check_srid_fncts_DEPENDENCIES) $(EXTRA_check_srid_fncts_DEPENDENCIES) @rm -f check_srid_fncts$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_srid_fncts_OBJECTS) $(check_srid_fncts_LDADD) $(LIBS) + +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) @@ -1552,10 +1578,14 @@ $(AM_V_CCLD)$(LINK) $(check_wms_OBJECTS) $(check_wms_LDADD) $(LIBS) check_xls_load$(EXEEXT): $(check_xls_load_OBJECTS) $(check_xls_load_DEPENDENCIES) $(EXTRA_check_xls_load_DEPENDENCIES) @rm -f check_xls_load$(EXEEXT) $(AM_V_CCLD)$(LINK) $(check_xls_load_OBJECTS) $(check_xls_load_LDADD) $(LIBS) + +routing_test$(EXEEXT): $(routing_test_OBJECTS) $(routing_test_DEPENDENCIES) $(EXTRA_routing_test_DEPENDENCIES) + @rm -f routing_test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(routing_test_OBJECTS) $(routing_test_LDADD) $(LIBS) shape_3d$(EXEEXT): $(shape_3d_OBJECTS) $(shape_3d_DEPENDENCIES) $(EXTRA_shape_3d_DEPENDENCIES) @rm -f shape_3d$(EXEEXT) $(AM_V_CCLD)$(LINK) $(shape_3d_OBJECTS) $(shape_3d_LDADD) $(LIBS) @@ -1635,10 +1665,11 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_gpkg_base_core_spatial_ref_sys_data_table_def.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_gpkg_base_core_spatial_ref_sys_data_values_default.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_gpkg_opt_extension_mechanism_extensions_data_table_def.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_init.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_init2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_init_full.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_libxml2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_math_funcs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_mbrcache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_metacatalog.Po@am__quote@ @@ -1652,10 +1683,11 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_shp_load.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_shp_load_3d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_spatialindex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_sql_stmt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_srid_fncts.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_stored_proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_styling.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topology2d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topology3d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_toponoface2d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_topoplus.Po@am__quote@ @@ -1673,10 +1705,11 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_virtualtable6.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_virtualxpath.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_wfsin.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_wms.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/check_xls_load.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/routing_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_3d.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_cp1252.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_primitives.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_utf8_1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shape_utf8_1ex.Po@am__quote@ @@ -1971,10 +2004,17 @@ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) check_init2.log: check_init2$(EXEEXT) @p='check_init2$(EXEEXT)'; \ b='check_init2'; \ + $(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_init_full.log: check_init_full$(EXEEXT) + @p='check_init_full$(EXEEXT)'; \ + b='check_init_full'; \ $(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_geom_aux.log: check_geom_aux$(EXEEXT) @@ -2409,13 +2449,27 @@ b='check_sequence'; \ $(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_stored_proc.log: check_stored_proc$(EXEEXT) + @p='check_stored_proc$(EXEEXT)'; \ + b='check_stored_proc'; \ + $(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_wms.log: check_wms$(EXEEXT) @p='check_wms$(EXEEXT)'; \ b='check_wms'; \ + $(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) +routing_test.log: routing_test$(EXEEXT) + @p='routing_test$(EXEEXT)'; \ + b='routing_test'; \ $(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_createBaseTables.log: check_createBaseTables$(EXEEXT) Index: test/check_bufovflw.c ================================================================== --- test/check_bufovflw.c +++ test/check_bufovflw.c @@ -79,15 +79,18 @@ sqlite3 *handle; sqlite3_stmt *stmt; char *err_msg = NULL; int suffix_len = 16 * 1024; /* 16 KB suffix */ char *suffix; +#ifndef OMIT_ICONV char *xtable; + char *dbf; + int row_count; +#endif char *shape; char *shape2; char *shape2geom; - char *dbf; char *table_a; char *table_b; char *auth; #ifndef OMIT_PROJ /* including PROJ.4 */ char *kml1; @@ -103,11 +106,10 @@ int rows; int columns; char *string; int len; char frmt[2048]; - int row_count; char *dumpname = __FILE__ "dump"; void *cache = spatialite_alloc_connection (); if (argc > 1 || argv[0] == NULL) argc = 1; /* silencing stupid compiler warnings */ @@ -144,11 +146,13 @@ table_a = sqlite3_mprintf ("table_a_%s", suffix); table_b = sqlite3_mprintf ("table_b_%s", suffix); shape2 = sqlite3_mprintf ("shape_table_2_%s", suffix); shape2geom = sqlite3_mprintf ("shape_table_2_geom_%s", suffix); shape = sqlite3_mprintf ("shape_table_%s", suffix); - dbf = sqlite3_mprintf ("dbf_tbale_%s", suffix); +#ifndef OMIT_ICONV + dbf = sqlite3_mprintf ("dbf_table_%s", suffix); +#endif pk = sqlite3_mprintf ("id_%s", suffix); name = sqlite3_mprintf ("name_%s", suffix); geom = sqlite3_mprintf ("geom_%s", suffix); /* creating table "A" */ @@ -1742,10 +1746,11 @@ { fprintf (stderr, "Unexpected result (Dequote 4): %s\n", resvalue); return -117; } +#ifndef OMIT_ICONV /* only if ICONV is enabled */ /* checking load_shapefile */ ret = load_shapefile (handle, "./shp/gaza/route", shape, "UTF-8", 4326, NULL, 1, 0, 1, 1, &row_count, err_msg); if (!ret) { @@ -1798,10 +1803,12 @@ { fprintf (stderr, "dump_geojson() error: %s\n", err_msg); sqlite3_close (handle); return -123; } +#endif /* end ICONV */ + unlink (dumpname); /* dropping virtual geometry */ sql = sqlite3_mprintf ("SELECT DropVirtualGeometry(%Q)", shape); ret = sqlite3_exec (handle, sql, NULL, NULL, &err_msg); sqlite3_free (sql); @@ -1814,10 +1821,11 @@ sqlite3_close (handle); return -124; } sqlite3_free (shape); +#ifndef OMIT_ICONV /* only if ICONV is enabled */ /* checking load_dbf */ ret = load_dbf (handle, "./shapetest1.dbf", dbf, "UTF-8", 1, &row_count, err_msg); if (!ret) @@ -1859,10 +1867,11 @@ fprintf (stderr, "unexpected row count for load_shapefile #2: %i\n", row_count); sqlite3_close (handle); return -129; } + xtable = gaiaDoubleQuotedSql (shape2); sql = sqlite3_mprintf ("INSERT INTO \"%s\" (FEATURE_ID, DATUM, HAUSNR) " "VALUES (1250000, 0.1, 'alpha')", xtable); ret = sqlite3_exec (handle, sql, NULL, NULL, &err_msg); sqlite3_free (sql); @@ -1894,10 +1903,11 @@ fprintf (stderr, "INSERT polygons (1) error: %s\n", err_msg); sqlite3_free (err_msg); sqlite3_close (handle); return -132; } +#endif /* end ICONV */ remove_duplicated_rows (handle, shape2); elementary_geometries (handle, shape2, shape2geom, "elem_poly", "pk_elem", "mul_id"); sqlite3_free (shape2); Index: test/check_clone_table.c ================================================================== --- test/check_clone_table.c +++ test/check_clone_table.c @@ -45,14 +45,18 @@ */ #include #include #include #include + +#include "config.h" #include "sqlite3.h" #include "spatialite.h" #include "spatialite/gaiageo.h" + +#ifndef OMIT_GEOS /* only if GEOS is enabled */ int execute_check (sqlite3 * sqlite, const char *sql, char **error) { /* executing an SQL statement returning True/False */ @@ -1380,19 +1384,18 @@ if (retcode < 0) return base + retcode; return 0; } +#endif int main (int argc, char *argv[]) { - int ret; int retcode = 0; - - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ +#ifndef OMIT_GEOS /* only if GEOS is enabled */ + int ret; if (create_origin () < 0) { retcode = -66; goto end; @@ -1435,8 +1438,14 @@ } end: /* removing the origin DB */ unlink ("clone_origin.sqlite"); + +#else + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ +#endif + spatialite_shutdown (); return retcode; } Index: test/check_control_points.c ================================================================== --- test/check_control_points.c +++ test/check_control_points.c @@ -48,10 +48,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifdef ENABLE_GCP /* only if Control Points (Grass) is enabled */ + static int test_query (sqlite3 * sqlite, const char *sql, const char *expected) { /* testing some SQL query */ int ret; @@ -284,10 +286,12 @@ return 0; return 1; } +#endif + int main (int argc, char *argv[]) { #ifdef ENABLE_GCP /* only if Control Points (Grass) is enabled */ int ret; @@ -295,13 +299,10 @@ char *err_msg = NULL; const char *sql; int order; 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) { @@ -905,8 +906,11 @@ spatialite_cleanup_ex (cache); #endif /* end CGP conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_cutter.c ================================================================== --- test/check_cutter.c +++ test/check_cutter.c @@ -49,10 +49,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifndef OMIT_GEOS /* only if GEOS is enabled */ + static void do_get_cutter_message (sqlite3 * sqlite, const char *test_sql) { /* reporting the last Cutter Message */ int ret; @@ -2598,10 +2600,12 @@ } return 1; } +#endif + int main (int argc, char *argv[]) { #ifndef OMIT_GEOS /* only if GEOS is enabled */ int ret; @@ -2608,13 +2612,10 @@ int retcode; sqlite3 *handle; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - unlink ("./test_cutter.sqlite"); ret = sqlite3_open_v2 ("./test_cutter.sqlite", &handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); @@ -2758,8 +2759,11 @@ return retcode; #endif /* end GEOS conditional */ unlink ("./test_cutter.sqlite"); + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_dbf_load.c ================================================================== --- test/check_dbf_load.c +++ test/check_dbf_load.c @@ -58,13 +58,10 @@ sqlite3 *handle; char *err_msg = NULL; int row_count; 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) { @@ -114,8 +111,11 @@ spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_extra_relations_fncts.c ================================================================== --- test/check_extra_relations_fncts.c +++ test/check_extra_relations_fncts.c @@ -50,12 +50,10 @@ #include "sqlite3.h" #include "spatialite.h" #include "spatialite/gaiageo.h" -static const double double_eps = 0.00000001; - int main (int argc, char *argv[]) { int result; int returnValue = 0; Index: test/check_fdo1.c ================================================================== --- test/check_fdo1.c +++ test/check_fdo1.c @@ -562,10 +562,14 @@ if (ret != 0) { fprintf (stderr, "cannot remove testFDO database\n"); return -57; } + +#else + if (legacy_mode == 0) + legacy_mode = 1; /* suppressing stupid compiler warnings */ #endif /* end GEOS conditional */ return 0; } Index: test/check_fdo3.c ================================================================== --- test/check_fdo3.c +++ test/check_fdo3.c @@ -68,13 +68,10 @@ char **results; int rows; int columns; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - ret = system ("cp sql_stmt_tests/testFGF.sqlite testFGF.sqlite"); if (ret != 0) { fprintf (stderr, "cannot copy testFGF.sqlite database\n"); return -1001; @@ -211,8 +208,11 @@ fprintf (stderr, "cannot remove testFGF database\n"); return -16; } #endif /* end GEOS conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_gaia_utf8.c ================================================================== --- test/check_gaia_utf8.c +++ test/check_gaia_utf8.c @@ -58,13 +58,10 @@ #ifndef OMIT_ICONV /* only if ICONV is supported */ void *converter; char *test_str1; int err; - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - test_str1 = sqlite3_mprintf ("Hello World"); gaiaConvertCharset (&test_str1, "ASCII", "UTF-8"); if (strcmp (test_str1, "Hello World") != 0) { fprintf (stderr, "bad ASCII to UTF-8 conversion: %s\n", test_str1); @@ -121,8 +118,11 @@ /* there is no sane way to test this automatically */ printf ("Local codeset: %s\n", gaiaGetLocaleCharset ()); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_geom_aux.c ================================================================== --- test/check_geom_aux.c +++ test/check_geom_aux.c @@ -890,11 +890,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); /* cloning a Polygon XY (2) */ polyg1 = gaiaAllocPolygon (5, 1); @@ -912,11 +912,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); /* cloning a Polygon XYZ (1) */ polyg1 = gaiaAllocPolygonXYZ (5, 1); @@ -934,11 +934,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); /* cloning a Polygon XYZ (2) */ polyg1 = gaiaAllocPolygonXYZ (5, 1); @@ -956,11 +956,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); /* cloning a Polygon XYM (1) */ polyg1 = gaiaAllocPolygonXYM (5, 1); @@ -978,11 +978,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); /* cloning a Polygon XYM (2) */ polyg1 = gaiaAllocPolygonXYM (5, 1); @@ -1000,11 +1000,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); /* cloning a Polygon XYZM (1) */ polyg1 = gaiaAllocPolygonXYZM (5, 1); @@ -1022,11 +1022,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); /* cloning a Polygon XYZM (2) */ polyg1 = gaiaAllocPolygonXYZM (5, 1); @@ -1044,11 +1044,11 @@ gaiaRingSetPoint (ring1, 4, 1.1, 1.1, 100.1, 10.1); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_SAME_ORDER); gaiaFreePolygon (polyg2); polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_REVERSE_ORDER); gaiaFreePolygon (polyg2); - polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_LHR_ORDER); + polyg2 = gaiaClonePolygonSpecial (polyg1, GAIA_CW_ORDER); gaiaFreePolygon (polyg2); gaiaFreePolygon (polyg1); ret = sqlite3_close (handle); if (ret != SQLITE_OK) Index: test/check_geoscvt_fncts.c ================================================================== --- test/check_geoscvt_fncts.c +++ test/check_geoscvt_fncts.c @@ -63,13 +63,10 @@ int returnValue = 0; /* Common setup */ gaiaGeomCollPtr emptyGeometry = gaiaAllocGeomColl (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - /* Tests start here */ /* null input test */ result = gaiaFromGeos_XY ((const void *) NULL); if (result != NULL) @@ -102,8 +99,11 @@ spatialite_shutdown (); return returnValue; #endif /* end GEOS conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_gpkgMode.c ================================================================== --- test/check_gpkgMode.c +++ test/check_gpkgMode.c @@ -168,10 +168,12 @@ if (!test_sql_query (db_handle, sql)) { ret = -7; goto end; } + +#ifndef OMIT_GEOS /* only if GEOS is enabled */ sql = "SELECT IsValidGPB( ST_Union(geom) ) FROM ln2dm"; if (!test_sql_query (db_handle, sql)) { ret = -8; goto end; @@ -244,10 +246,11 @@ if (!test_sql_query (db_handle, sql)) { ret = -18; goto end; } +#endif /* end GEOS conditionals */ /* testing MULTILINESTRINGs */ sql = "SELECT IsValidGPB( ST_StartPoint( ST_GeometryN(geom, 1) ) ) FROM mln2d WHERE id = 1"; if (!test_sql_query (db_handle, sql)) @@ -260,10 +263,12 @@ if (!test_sql_query (db_handle, sql)) { ret = -20; goto end; } + +#ifndef OMIT_GEOS /* only if GEOS is enabled */ sql = "SELECT IsValidGPB( ST_Line_Interpolate_Point( ST_GeometryN(geom, 1), 0.66) ) FROM mln3dz WHERE id = 2"; if (!test_sql_query (db_handle, sql)) { ret = -21; @@ -274,10 +279,11 @@ if (!test_sql_query (db_handle, sql)) { ret = -22; goto end; } +#endif /* end GEOS conditionals */ /* testing MULTIPOLYGONs */ sql = "SELECT IsValidGPB( ST_EndPoint( ST_ExteriorRing( ST_GeometryN(geom, 1) ) ) ) FROM mpg2d WHERE id = 2"; if (!test_sql_query (db_handle, sql)) ADDED test/check_init_full.c Index: test/check_init_full.c ================================================================== --- test/check_init_full.c +++ test/check_init_full.c @@ -0,0 +1,437 @@ +/* + + check_init_full.c -- SpatiaLite Test Case + + Author: Sandro Furieri + + ------------------------------------------------------------------------------ + + 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) 2011 +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 +#include +#include + +#include "config.h" + +#include "sqlite3.h" +#include "spatialite.h" + +int +main (int argc, char *argv[]) +{ + int ret; + sqlite3 *handle; + 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(\"NONE\")", NULL, + NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "InitSpatialMetadataFull(\"NONE\") error: %s\n", + err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -2; + } + + ret = + sqlite3_exec (handle, "SELECT InsertEpsgSrid(4326)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Insert SRID 4326 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -3; + } + +#ifndef OMIT_EPSG +/* only if full EPSG support is enabled */ + ret = + sqlite3_exec (handle, "SELECT InsertEpsgSrid(2998)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Insert SRID 2998 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -4; + } +#endif + + ret = sqlite3_close (handle); + if (ret != SQLITE_OK) + { + fprintf (stderr, "sqlite3_close() error: %s\n", + sqlite3_errmsg (handle)); + return -5; + } + + spatialite_cleanup_ex (cache); + + cache = spatialite_alloc_connection (); + 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 -6; + } + + spatialite_init_ex (handle, cache, 0); + + ret = + sqlite3_get_table (handle, "SELECT InitSpatialMetadataFull(3.4)", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -7; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InitSpatialMetadataFull() bad result: %i/%i.\n", + rows, columns); + return -8; + } + if (strcmp (results[1], "0") != 0) + { + fprintf (stderr, + "Unexpected result: InitSpatialMetadataFull() with non-text passed: %s.\n", + results[1]); + return -9; + } + sqlite3_free_table (results); + + ret = sqlite3_close (handle); + if (ret != SQLITE_OK) + { + fprintf (stderr, "sqlite3_close() error: %s\n", + sqlite3_errmsg (handle)); + return -10; + } + + spatialite_cleanup_ex (cache); + + cache = spatialite_alloc_connection (); + 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 -11; + } + + spatialite_init_ex (handle, cache, 0); + + ret = + sqlite3_get_table (handle, "SELECT InitSpatialMetadataFull(\"EMPTY\")", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -12; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InitSpatialMetadataFull(\"EMPTY\") bad result: %i/%i.\n", + rows, columns); + return -13; + } +#ifdef ENABLE_RTTOPO + if (strcmp (results[1], "1") != 0) +#else + if (strcmp (results[1], "0") != 0) +#endif + { + fprintf (stderr, + "Unexpected error: InitSpatialMetadataFull(\"EMPTY\"): %s.\n", + results[1]); + return -14; + } + sqlite3_free_table (results); + + ret = + sqlite3_get_table (handle, "SELECT InsertEpsgSrid(4326)", &results, + &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -15; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InsertEpsgSrid(4326) bad result: %i/%i.\n", + rows, columns); + return -16; + } + if (strcmp (results[1], "1") != 0) + { + fprintf (stderr, "Unexpected error: InsertEpsgSrid(4326): %s.\n", + results[1]); + return -17; + } + sqlite3_free_table (results); + + ret = + sqlite3_get_table (handle, "SELECT InsertEpsgSrid(\"Non-integer\")", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -18; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InsertEpsgSrid(\"Non-integer\") bad result: %i/%i.\n", + rows, columns); + return -19; + } + if (strcmp (results[1], "0") != 0) + { + fprintf (stderr, + "Unexpected result: InsertEpsgSrid() with non-integer passed: %s.\n", + results[1]); + return -20; + } + sqlite3_free_table (results); + + ret = sqlite3_close (handle); + if (ret != SQLITE_OK) + { + fprintf (stderr, "sqlite3_close() error: %s\n", + sqlite3_errmsg (handle)); + return -21; + } + + spatialite_cleanup_ex (cache); + + cache = spatialite_alloc_connection (); + 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 -22; + } + + spatialite_init_ex (handle, cache, 0); + + ret = + sqlite3_get_table (handle, "SELECT InitSpatialMetadataFull(\"WGS84\")", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -23; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InitSpatialMetadataFull(\"WGS84\") bad result: %i/%i.\n", + rows, columns); + return -24; + } +#ifdef ENABLE_RTTOPO + if (strcmp (results[1], "1") != 0) +#else + if (strcmp (results[1], "0") != 0) +#endif + { + fprintf (stderr, + "Unexpected error: InitSpatialMetadataFull(\"WGS84\"): %s.\n", + results[1]); + return -25; + } + sqlite3_free_table (results); + +#ifndef OMIT_EPSG +/* only if full EPSG support is enabled */ + ret = + sqlite3_get_table (handle, "SELECT InsertEpsgSrid(3003)", &results, + &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -26; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InsertEpsgSrid(3003) bad result: %i/%i.\n", + rows, columns); + return -27; + } + if (strcmp (results[1], "1") != 0) + { + fprintf (stderr, "Unexpected error: InsertEpsgSrid(3003): %s.\n", + results[1]); + return -28; + } + sqlite3_free_table (results); +#endif + + ret = + sqlite3_get_table (handle, "SELECT InsertEpsgSrid(4326)", &results, + &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -29; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InsertEpsgSrid(4326) (dupe) bad result: %i/%i.\n", + rows, columns); + return -30; + } + if (strcmp (results[1], "0") != 0) + { + fprintf (stderr, + "Unexpected result: InsertEpsgSrid(4326) duplicate passed: %s.\n", + results[1]); + return -31; + } + sqlite3_free_table (results); + + ret = sqlite3_close (handle); + if (ret != SQLITE_OK) + { + fprintf (stderr, "sqlite3_close() error: %s\n", + sqlite3_errmsg (handle)); + return -32; + } + + spatialite_cleanup_ex (cache); + + cache = spatialite_alloc_connection (); + 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 -33; + } + + spatialite_init_ex (handle, cache, 0); + + ret = + sqlite3_get_table (handle, + "SELECT InitSpatialMetadataFull(\"WGS84_only\")", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error: %s\n", err_msg); + sqlite3_free (err_msg); + return -34; + } + if ((rows != 1) || (columns != 1)) + { + fprintf (stderr, + "Unexpected result InitSpatialMetadataFull(\"WGS84_ONLY\") bad result: %i/%i.\n", + rows, columns); + return -35; + } +#ifdef ENABLE_RTTOPO + if (strcmp (results[1], "1") != 0) +#else + if (strcmp (results[1], "0") != 0) +#endif + { + fprintf (stderr, + "Unexpected error: InitSpatialMetadataFull(\"WGS84_ONLY\"): %s.\n", + results[1]); + return -36; + } + sqlite3_free_table (results); + + ret = sqlite3_close (handle); + if (ret != SQLITE_OK) + { + fprintf (stderr, "sqlite3_close() error: %s\n", + sqlite3_errmsg (handle)); + return -32; + } + + spatialite_cleanup_ex (cache); + + return 0; +} Index: test/check_libxml2.c ================================================================== --- test/check_libxml2.c +++ test/check_libxml2.c @@ -50,10 +50,11 @@ #include "sqlite3.h" #include "spatialite.h" #ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ +#ifndef OMIT_ICONV /* only if ICONV is supported */ #define ISO_METADATA 1 #define SLD_SE_STYLE 2 #define SVG 3 @@ -771,10 +772,11 @@ free (xml); return 1; } #endif +#endif int main (int argc, char *argv[]) { int ret; @@ -796,10 +798,11 @@ } spatialite_init_ex (handle, cache, 0); #ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ +#ifndef OMIT_ICONV /* only if ICONV is supported */ if (!check_parse (cache, "books.xml")) { fprintf (stderr, "unable to parse \"books.xml\"\n"); return -2; @@ -866,10 +869,11 @@ { fprintf (stderr, "unable to test \"Gpx-sample.gpx\"\n"); return -14; } +#endif #endif ret = sqlite3_close (handle); if (ret != SQLITE_OK) { Index: test/check_mbrcache.c ================================================================== --- test/check_mbrcache.c +++ test/check_mbrcache.c @@ -62,13 +62,10 @@ int rows; int columns; int pt; 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) { @@ -618,7 +615,10 @@ } spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + return 0; } Index: test/check_network2d.c ================================================================== --- test/check_network2d.c +++ test/check_network2d.c @@ -48,10 +48,76 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" + +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + +static int +do_level3_tests (sqlite3 * handle, int *retcode) +{ +/* performing basic tests: level 3 */ + int ret; + char *err_msg = NULL; + +/* testing RegisterTopoNetCoverage */ + ret = + sqlite3_exec (handle, + "SELECT CreateStylingTables(1)", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateStylingTables() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -240; + return 0; + } + +/* testing RegisterTopoNetCoverage - short form */ + ret = + sqlite3_exec (handle, + "SELECT SE_RegisterTopoNetCoverage('net', 'roads')", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SE_RegisterTopoNetCoverage() #1 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -241; + return 0; + } + +/* testing UnRegisterVectorCoverage */ + ret = + sqlite3_exec (handle, + "SELECT SE_UnRegisterVectorCoverage('net')", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SE_RegisterVectorCoverage() #1 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -342; + return 0; + } + +/* testing RegisterTopoNetCoverage - long form */ + ret = + sqlite3_exec (handle, + "SELECT SE_RegisterTopoNetCoverage('net', 'roads', 'title', 'abstract', 1, 1)", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SE_RegisterTopoNetCoverage() #2 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -241; + return 0; + } + + return 1; +} static int do_level2_tests (sqlite3 * handle, int *retcode) { /* performing basic tests: Level 2 */ @@ -2188,10 +2254,11 @@ sqlite3_free (err_msg); return 1; } +#endif int main (int argc, char *argv[]) { int retcode = 0; @@ -2200,13 +2267,10 @@ int ret; sqlite3 *handle; char *err_msg = NULL; 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) { @@ -2259,10 +2323,18 @@ goto end; /* basic tests: level 2 */ if (!do_level2_tests (handle, &retcode)) goto end; + +#ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ + +/* testing RegisterTopoGeoCoverage */ + if (!do_level3_tests (handle, &retcode)) + goto end; + +#endif /* dropping the Network 2D */ ret = sqlite3_exec (handle, "SELECT DropNetwork('roads')", NULL, NULL, &err_msg); @@ -2279,8 +2351,11 @@ sqlite3_close (handle); spatialite_cleanup_ex (cache); #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_network3d.c ================================================================== --- test/check_network3d.c +++ test/check_network3d.c @@ -49,10 +49,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + static int do_level2_tests (sqlite3 * handle, int *retcode) { /* performing basic tests: Level 2 */ int ret; @@ -2188,10 +2190,11 @@ sqlite3_free (err_msg); return 1; } +#endif int main (int argc, char *argv[]) { int retcode = 0; @@ -2200,13 +2203,10 @@ int ret; sqlite3 *handle; char *err_msg = NULL; 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) { @@ -2279,8 +2279,11 @@ sqlite3_close (handle); spatialite_cleanup_ex (cache); #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_network_log.c ================================================================== --- test/check_network_log.c +++ test/check_network_log.c @@ -49,10 +49,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + static int do_level2_tests (sqlite3 * handle, int *retcode) { /* performing basic tests: Level 2 */ int ret; @@ -940,10 +942,11 @@ sqlite3_free (err_msg); return 1; } +#endif int main (int argc, char *argv[]) { int retcode = 0; @@ -952,13 +955,10 @@ int ret; sqlite3 *handle; char *err_msg = NULL; 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) { @@ -1021,8 +1021,11 @@ sqlite3_close (handle); spatialite_cleanup_ex (cache); #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_shp_load.c ================================================================== --- test/check_shp_load.c +++ test/check_shp_load.c @@ -49,10 +49,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifndef OMIT_ICONV /* only if ICONV is supported */ + static int do_test (sqlite3 * handle, const void *p_cache) { int ret; char *err_msg = NULL; @@ -146,21 +148,20 @@ #endif /* end RTTOPO conditionals */ return 0; } +#endif + int main (int argc, char *argv[]) { #ifndef OMIT_ICONV /* only if ICONV is supported */ int ret; sqlite3 *handle; 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) { @@ -212,8 +213,11 @@ } spatialite_cleanup (); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_shp_load_3d.c ================================================================== --- test/check_shp_load_3d.c +++ test/check_shp_load_3d.c @@ -49,10 +49,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifndef OMIT_ICONV /* only if ICONV is supported */ + static int do_test (sqlite3 * handle, const void *p_cache) { int ret; char *err_msg = NULL; @@ -717,10 +719,12 @@ gaiaFreeVectorLayersList (list); return 0; } +#endif + int main (int argc, char *argv[]) { #ifndef OMIT_ICONV /* only if ICONV is supported */ int ret; @@ -784,8 +788,11 @@ spatialite_cleanup (); } #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_spatialindex.c ================================================================== --- test/check_spatialindex.c +++ test/check_spatialindex.c @@ -459,12 +459,12 @@ sqlite3_free (err_msg); return -9; } ret = sqlite3_exec (handle, - "SELECT UpgradeGeometryTriggers(1);", - NULL, NULL, &err_msg); + "SELECT UpgradeGeometryTriggers(1);", NULL, NULL, + &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "UpgradeGeometryTriggers (1) error: %s\n", err_msg); sqlite3_free (err_msg); return -101; @@ -1250,11 +1250,13 @@ fprintf (stderr, "VACUUM error: %s\n", err_msg); sqlite3_free (err_msg); sqlite3_close (handle); return -100; } - +#else + if (handle != NULL && legacy == 0) + handle = NULL; /* silencing stupid compiler warnings */ #endif /* end ICONV conditional */ /* ok, succesfull termination */ return 0; } @@ -1336,11 +1338,11 @@ rows = 0; columns = 0; ret = sqlite3_get_table (handle, - "SELECT CheckSpatialIndex('Councils', 'geom');", + "SELECT RecoverSpatialIndex('Councils', 'geom');", &results, &rows, &columns, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "Error RecoverSpatialIndex(rowid-1): %s\n", err_msg); sqlite3_free (err_msg); @@ -1423,11 +1425,11 @@ rows = 0; columns = 0; ret = sqlite3_get_table (handle, - "SELECT CheckSpatialIndex('Councils', 'geom');", + "SELECT RecoverSpatialIndex('Councils', 'geom');", &results, &rows, &columns, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "Error RecoverSpatialIndex(rowid-2): %s\n", err_msg); sqlite3_free (err_msg); @@ -1621,10 +1623,13 @@ sqlite3_close (handle); return -239; } sqlite3_free_table (results); +#else + if (handle != NULL) + handle = NULL; /* silencing stupid compiler warnings */ #endif /* end ICONV conditional */ /* ok, succesfull termination */ return 0; } @@ -1636,13 +1641,10 @@ int ret; sqlite3 *handle; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - /* testing current style metadata layout >= v.4.0.0 */ ret = sqlite3_open_v2 (":memory:", &handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) @@ -1652,10 +1654,32 @@ sqlite3_close (handle); return -1; } spatialite_init_ex (handle, cache, 0); + +/* expected failures */ + ret = + sqlite3_exec (handle, "SELECT InitSpatialMetadata('a', 1)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "InitSpatialMetadata('a', 1) error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -113; + } + ret = + sqlite3_exec (handle, "SELECT InitSpatialMetadata(1, 2)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "InitSpatialMetadata(1, 2) error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -114; + } ret = sqlite3_exec (handle, "SELECT InitSpatialMetadata()", NULL, NULL, &err_msg); if (ret != SQLITE_OK) @@ -1859,8 +1883,11 @@ return -112; } #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_sql_stmt.c ================================================================== --- test/check_sql_stmt.c +++ test/check_sql_stmt.c @@ -290,10 +290,11 @@ /* checking for an expected exception */ if (strcmp (err_msg, data->expected_results[1]) == 0) { /* we expected this */ sqlite3_free (err_msg); + sqlite3_free_table (results); return 0; } } fprintf (stderr, "Error: %s\n", err_msg); sqlite3_free (err_msg); @@ -301,10 +302,11 @@ } if ((rows != data->expected_rows) || (columns != data->expected_columns)) { fprintf (stderr, "Unexpected error: bad result: %i/%i.\n", rows, columns); + sqlite3_free_table (results); return -11; } for (i = 0; i < (data->expected_rows + 1) * data->expected_columns; ++i) { if (results[i] != NULL && data->expected_precision[i] == 0) @@ -321,18 +323,20 @@ else { fprintf (stderr, "Null value at %i.\n", i); fprintf (stderr, "Expected value was: %s\n", data->expected_results[i]); + sqlite3_free_table (results); return -12; } } else if (strlen (results[i]) == 0) { fprintf (stderr, "zero length result at %i\n", i); fprintf (stderr, "Expected value was : %s|\n", data->expected_results[i]); + sqlite3_free_table (results); return -13; } else if (strncmp (results[i], data->expected_results[i], data->expected_precision[i]) != 0) @@ -339,10 +343,11 @@ { fprintf (stderr, "Unexpected value at %i: %s|\n", i, results[i]); fprintf (stderr, "Expected value was : %s|\n", data->expected_results[i]); + sqlite3_free_table (results); return -14; } } sqlite3_free_table (results); @@ -510,31 +515,55 @@ result = do_one_case (conn, data, load_extension, gpkg_amphibious_mode); cleanup_test_data (data); if (result != 0) - { - return result; - } - free (namelist[i]); + break; } +/* cleaning up */ + for (i = 0; i < n; ++i) + free (namelist[i]); free (namelist); + return result; } int run_all_testcases (struct db_conn *conn, int load_extension, int legacy) { int ret; int result = 0; const char *security_level; + int tiny_point = 0; result = run_subdir_test ("sql_stmt_tests", conn, load_extension, 0); if (result != 0) { return result; } + + if (getenv ("SPATIALITE_TINYPOINT") != NULL) + tiny_point = atoi (getenv ("SPATIALITE_TINYPOINT")); + + if (tiny_point) + { + result = + run_subdir_test ("sql_stmt_tiny_point", conn, load_extension, 0); + if (result != 0) + { + return result; + } + } + else + { + result = + run_subdir_test ("sql_stmt_point_geom", conn, load_extension, 0); + if (result != 0) + { + return result; + } + } security_level = getenv ("SPATIALITE_SECURITY"); if (security_level == NULL) ; else if (strcasecmp (security_level, "relaxed") == 0) @@ -543,10 +572,20 @@ run_subdir_test ("sql_stmt_security_tests", conn, load_extension, 0); if (result != 0) { return result; + } + if (!legacy) + { + result = + run_subdir_test ("sql_stmt_logfile_tests", conn, + load_extension, 0); + if (result != 0) + { + return result; + } } } if (legacy) { @@ -561,10 +600,26 @@ if (result != 0) { return result; } skip_sequence: + + if (legacy) + { + /* skipping Routing tests in legacy mode */ + fprintf (stderr, + "WARNING: skipping CreateRouting testcases in legacy mode !!!\n"); + goto skip_routing; + } + + result = + run_subdir_test ("sql_stmt_routing_tests", conn, load_extension, 0); + if (result != 0) + { + return result; + } + skip_routing: #ifndef OMIT_MATHSQL /* only if MATHSQL is supported */ result = run_subdir_test ("sql_stmt_mathsql_tests", conn, load_extension, 0); if (result != 0) @@ -705,12 +760,21 @@ } skip_rttopo: #endif /* end RTTOPO conditional */ + +#ifndef OMIT_ICONV /* only if ICONV is supported */ + result = run_subdir_test ("sql_stmt_iconv_tests", conn, load_extension, 0); + if (result != 0) + { + return result; + } +#endif /* end ICONV */ #ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ +#ifndef OMIT_ICONV /* only if ICONV is supported */ result = run_subdir_test ("sql_stmt_libxml2_tests", conn, load_extension, 0); if (result != 0) { return result; @@ -728,10 +792,11 @@ { return result; } } +#endif #endif /* end LIBXML2 conditional */ #ifdef ENABLE_GEOPACKAGE /* only if GeoPackage support is enabled */ if (!legacy) { @@ -872,10 +937,42 @@ } close_connection (&conn); spatialite_cleanup_ex (conn.cache); conn.cache = NULL; + + if (result == 0) + { + /* testing again by enabling the TinyPoint encoding */ + fprintf (stderr, + "\n****************** testing again by enabling the TinyPoint encoding\n\n"); + /* enabling TinyPoint */ +#ifdef _WIN32 + putenv ("SPATIALITE_TINYPOINT=1"); +#else /* not WIN32 */ + setenv ("SPATIALITE_TINYPOINT", "1", 1); +#endif + cache = spatialite_alloc_connection (); + conn.cache = cache; + if (argc == 1) + { + result = run_all_testcases (&conn, 0, 0); + } + else + { + result = run_specified_testcases (argc, argv, &conn, 0); + } + close_connection (&conn); + spatialite_cleanup_ex (conn.cache); + conn.cache = NULL; + /* disabling TinyPoint */ +#ifdef _WIN32 + putenv ("SPATIALITE_TINYPOINTY="); +#else /* not WIN32 */ + unsetenv ("SPATIALITE_TINYPOINT"); +#endif + } if (result == 0) { /* testing again in legacy mode */ fprintf (stderr, ADDED test/check_stored_proc.c Index: test/check_stored_proc.c ================================================================== --- test/check_stored_proc.c +++ test/check_stored_proc.c @@ -0,0 +1,1397 @@ +/* + + check_stored_proc.c -- SpatiaLite Test Case + + Testing Stored Procedures + + Author: Sandro Furieri + + ------------------------------------------------------------------------------ + + 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) 2017 +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 +#include +#include +#include + +#include "config.h" + +#include "sqlite3.h" +#include "spatialite.h" + +#ifndef OMIT_ICONV /* only if ICONV is supported */ + +static int +do_level0_tests (sqlite3 * handle, int *retcode) +{ +/* performing Level 0 tests - DB initialization */ + int ret; + char *err_msg = NULL; + char **results; + int rows; + int columns; + +/* creating Stored Procedures tables */ + ret = + sqlite3_get_table (handle, "SELECT StoredProc_CreateTables()", &results, + &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_CreateTables() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -1; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_CreateTables() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -2; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_CreateTables() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -3; + return 0; + } + sqlite3_free_table (results); + +/* creating the first test table */ + ret = sqlite3_exec (handle, "CREATE TABLE test_1 (" + "id INTEGER NOT NULL PRIMARY KEY,\n" + "name TEXT NOT NULL,\n" + "value DOUBLE NOT NULL)", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CREATE TABLE test_1 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -4; + } + +/* creating the second test table */ + ret = sqlite3_exec (handle, "CREATE TABLE test_2 (" + "pk_uid INTEGER NOT NULL PRIMARY KEY,\n" + "code TEXT NOT NULL,\n" + "description TEXT NOT NULL,\n" + "measure DOUBLE NOT NULL)", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CREATE TABLE test_2 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -5; + } + +/* populating the first test table */ + ret = sqlite3_exec (handle, "INSERT INTO test_1 (id, name, value) " + "VALUES (NULL, 'alpha', 1.5)", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "INSERT INTO test_1 #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -6; + } + ret = sqlite3_exec (handle, "INSERT INTO test_1 (id, name, value) " + "VALUES (NULL, 'beta', 2.5)", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "INSERT INTO test_1 #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -7; + } + ret = sqlite3_exec (handle, "INSERT INTO test_1 (id, name, value) " + "VALUES (NULL, 'gamma', 3.5)", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "INSERT INTO test_1 #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -8; + } + +/* populating the second test table */ + ret = + sqlite3_exec (handle, + "INSERT INTO test_2 (pk_uid, code, description, measure) " + "VALUES (NULL, 'alpha', 'first', 1000.5)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "INSERT INTO test_2 #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -9; + } + ret = + sqlite3_exec (handle, + "INSERT INTO test_2 (pk_uid, code, description, measure) " + "VALUES (NULL, 'beta', 'second', 2000.5)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "INSERT INTO test_2 #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -10; + } + ret = + sqlite3_exec (handle, + "INSERT INTO test_2 (pk_uid, code, description, measure) " + "VALUES (NULL, 'gamma', 'third', 3000.5)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "INSERT INTO test_2 #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -11; + } + + return 1; +} + +static int +do_level1_tests (sqlite3 * handle, int *retcode) +{ +/* performing Level 1 tests - Stored Procedures basics */ + const char *sql; + int ret; + char *err_msg = NULL; + char **results; + int rows; + int columns; + +/* registering a first Stored Procedure */ + sql = "SELECT StoredProc_Register('proc_1', 'this is title one', " + "SqlProc_FromText('--\n-- comment\n--\n" + "CREATE TABLE @output_1@ AS\n" + "SELECT @col_1@, @col_2@ FROM @table_1@ WHERE @col_3@ = @value_1@;\n\n" + ".echo on\n\n" + "--\n-- another comment\n--\n" + "CREATE TABLE @output_2@ AS\n" + "SELECT @col_4@, @col_5@ FROM @table_2@ WHERE @col_6@ = @value_2@;\n\n" + ".echo off\n\n" "--\n-- end comment\n--\n\n'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Register() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -12; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_Register() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -13; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_Register() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -14; + return 0; + } + sqlite3_free_table (results); + +/* registering a second Stored Procedure */ + sql = "SELECT StoredProc_Register('proc_2', 'this is title two', " + "SqlProc_FromText('SELECT @col_1@, @col_2@ FROM @table_1@ WHERE @col_3@ = @value_1@;'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Register() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -15; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_Register() #2 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -16; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_Register() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -17; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Procedure title - expected failure */ + sql = + "SELECT StoredProc_UpdateTitle('no_proc', 'this is an updated title two')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_UpdateTitle() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -18; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_UpdateTitle() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -19; + return 0; + } + if (atoi (*(results + 1)) != 0) + { + fprintf (stderr, "StoredProc_UpdateTitle() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -20; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Procedure title - expected success */ + sql = + "SELECT StoredProc_UpdateTitle('proc_2', 'this is an updated title two')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_UpdateTitle() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -21; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_UpdateTitle() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -22; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_UpdateTitle() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -23; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Procedure SQL Body - expected failure */ + sql = "SELECT StoredProc_UpdateSqlBody('no_proc', " + "SqlProc_FromText('SELECT @fld1@, @fld2@ FROM @tbl@ WHERE @fld3@ = @val1@;'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_UpdateSqlBody() #1 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -24; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_UpdateSqlBody() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -25; + return 0; + } + if (atoi (*(results + 1)) != 0) + { + fprintf (stderr, + "StoredProc_UpdateSqlBody() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -26; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Procedure SQL Body - expected success */ + sql = "SELECT StoredProc_UpdateSqlBody('proc_2', " + "SqlProc_FromText('SELECT @fld1@, @fld2@ FROM @tbl@ WHERE @fld3@ = @val1@;'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_UpdateSqlBody() #2 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -27; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_UpdateSqlBody() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -28; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, + "StoredProc_UpdateSqlBody() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -29; + return 0; + } + sqlite3_free_table (results); + +/* testing a Stored Procedure - expected failure */ + sql = "SELECT SqlProc_AllVariables(StoredProc_Get('no_proc'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret == SQLITE_OK) + { + fprintf (stderr, "StoredProc_Get() #1 unexpected success\n"); + *retcode = -30; + return 0; + } + sqlite3_free (err_msg); + +/* testing a Stored Procedure - expected success */ + sql = "SELECT SqlProc_AllVariables(StoredProc_Get('proc_2'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Get() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -31; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, "StoredProc_Get() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -32; + return 0; + } + if (*(results + 1) == NULL) + { + fprintf (stderr, "StoredProc_Get() #2 unexpected NULL\n"); + sqlite3_free_table (results); + *retcode = -33; + return 0; + } + if (strcmp (*(results + 1), "@fld1@ @fld2@ @tbl@ @fld3@ @val1@") != 0) + { + fprintf (stderr, "StoredProc_Get() #2 unexpected value \"%s\"\n", + *(results + 1)); + sqlite3_free_table (results); + *retcode = -33; + return 0; + } + sqlite3_free_table (results); + +/* deleting a Stored Procedure - expected failure */ + sql = "SELECT StoredProc_Delete('no_proc')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Delete() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -34; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, "StoredProc_Delete() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -35; + return 0; + } + if (atoi (*(results + 1)) != 0) + { + fprintf (stderr, "StoredProc_Delete() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -36; + return 0; + } + sqlite3_free_table (results); + +/* deleting a Stored Procedure - expected success */ + sql = "SELECT StoredProc_Delete('proc_2')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Delete() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -37; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, "StoredProc_Delete() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -38; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_Delete() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -39; + return 0; + } + sqlite3_free_table (results); + +/* registering a Stored Procedure from filepath */ + sql = "SELECT StoredProc_Register('proc_file', 'this is title three', " + "SqlProc_FromFile('./sqlproc_sample.txt'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Register() #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -40; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_Register() #3 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -41; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_Register() #3 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -42; + return 0; + } + sqlite3_free_table (results); + + return 1; +} + +static int +do_level2_tests (sqlite3 * handle, int *retcode) +{ +/* performing Level 2 tests - Stored Variables basics */ + const char *sql; + int ret; + char *err_msg = NULL; + char **results; + int rows; + int columns; + +/* registering a first Stored Variable */ + sql = "SELECT StoredVar_Register('var_1', 'this is title one', 1234)"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Register() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -45; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_Register() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -46; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredVar_Register() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -47; + return 0; + } + sqlite3_free_table (results); + +/* registering a second Stored Variable */ + sql = "SELECT StoredVar_Register('var_2', 'this is title two', 'abcdef')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Register() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -48; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_Register() #2 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -49; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredVar_Register() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -50; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Variable title - expected failure */ + sql = + "SELECT StoredVar_UpdateTitle('no_var', 'this is an updated title two')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_UpdateTitle() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -51; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_UpdateTitle() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -52; + return 0; + } + if (atoi (*(results + 1)) != 0) + { + fprintf (stderr, "StoredVar_UpdateTitle() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -53; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Variable title - expected success */ + sql = + "SELECT StoredVar_UpdateTitle('var_2', 'this is an updated title two')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_UpdateTitle() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -54; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_UpdateTitle() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -55; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredVar_UpdateTitle() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -56; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Variable with Value - expected failure */ + sql = "SELECT StoredVar_UpdateValue('no_var', 1956)"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_UpdateValue() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -57; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_UpdateValue() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -58; + return 0; + } + if (atoi (*(results + 1)) != 0) + { + fprintf (stderr, "StoredVar_UpdateValue() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -59; + return 0; + } + sqlite3_free_table (results); + +/* updating Stored Variable with Value - expected success */ + sql = "SELECT StoredVar_UpdateValue('var_2', 1956)"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_UpdateValue() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -60; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_UpdateValue() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -61; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredVar_UpdateValue() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -62; + return 0; + } + sqlite3_free_table (results); + +/* testing a Stored Variable - expected failure */ + sql = "SELECT StoredVar_Get('no_var')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Get() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -63; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, "StoredVar_Get() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -64; + return 0; + } + if (*(results + 1) != NULL) + { + fprintf (stderr, "StoredVar_Get() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -65; + return 0; + } + sqlite3_free_table (results); + +/* testing a Stored Variable - expected success */ + sql = "SELECT StoredVar_Get('var_2')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Get() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -66; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, "StoredVar_Get() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -67; + return 0; + } + if (*(results + 1) == NULL) + { + fprintf (stderr, "StoredVar_Get() #2 unexpected NULL\n"); + sqlite3_free_table (results); + *retcode = -68; + return 0; + } + if (strcmp (*(results + 1), "@var_2@=1956") != 0) + { + fprintf (stderr, "StoredVar_Get() #2 unexpected value \"%s\"\n", + *(results + 1)); + sqlite3_free_table (results); + *retcode = -69; + return 0; + } + sqlite3_free_table (results); + +/* testing a Stored Variable - expected failure */ + sql = "SELECT StoredVar_GetValue('no_var')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_GetValue() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -63; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_GetValue() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -64; + return 0; + } + if (*(results + 1) != NULL) + { + fprintf (stderr, "StoredVar_GetValue() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -65; + return 0; + } + sqlite3_free_table (results); + +/* testing a Stored Variable - expected success */ + sql = "SELECT StoredVar_GetValue('var_2')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_GetValue() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -66; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_GetValue() #2 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -67; + return 0; + } + if (*(results + 1) == NULL) + { + fprintf (stderr, "StoredVar_GetValue() #2 unexpected NULL\n"); + sqlite3_free_table (results); + *retcode = -68; + return 0; + } + if (strcmp (*(results + 1), "1956") != 0) + { + fprintf (stderr, "StoredVar_GetValue() #2 unexpected value \"%s\"\n", + *(results + 1)); + sqlite3_free_table (results); + *retcode = -69; + return 0; + } + sqlite3_free_table (results); + +/* deleting a Stored Variable - expected failure */ + sql = "SELECT StoredVar_Delete('no_var')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Delete() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -70; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, "StoredVar_Delete() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -71; + return 0; + } + if (atoi (*(results + 1)) != 0) + { + fprintf (stderr, "StoredVar_Delete() #1 unexpected success\n"); + sqlite3_free_table (results); + *retcode = -72; + return 0; + } + sqlite3_free_table (results); + +/* deleting a Stored Procedure - expected success */ + sql = "SELECT StoredVar_Delete('var_2')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Delete() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -73; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, "StoredVar_Delete() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -74; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredVar_Delete() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -75; + return 0; + } + sqlite3_free_table (results); + + return 1; +} + +static int +do_level3_tests (sqlite3 * handle, int *retcode) +{ +/* performing Level 3 tests - Stored Procedure Execute */ + const char *sql; + int ret; + char *err_msg = NULL; + char **results; + int rows; + int columns; + +/* executing a Stored Procedure */ + sql = "SELECT StoredProc_Execute('proc_1', '@output_1@=out_test_1', " + "'@col_1@=name', '@col_2@=value', '@table_1@=test_1', " + "'@col_3@=id', '@value_1@=2', '@output_2@=out_test_2', " + "'@col_4@=description', '@col_5@=measure', '@table_2@=test_2', " + "'@col_6@=pk_uid', '@value_2@=3')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Execute() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -76; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_Execute() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -77; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_Execute() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -78; + return 0; + } + sqlite3_free_table (results); + +/* executing another Stored Procedure */ + sql = "SELECT StoredProc_Execute('proc_file', '@col1@=description', " + "'@col2@=measure', '@table@=test_2')"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredProc_Execute() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -79; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredProc_Execute() #2 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -80; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredProc_Execute() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -81; + return 0; + } + sqlite3_free_table (results); + + return 1; +} + +static int +do_level4_tests (sqlite3 * handle, int *retcode) +{ +/* performing Level 4 tests - SQL Logfile */ + const char *sql; + int ret; + char *err_msg = NULL; + char **results; + int rows; + int columns; + +/* enabling a SQL Logfile */ + sql = "SELECT SqlProc_SetLogfile('./sql_logfile', 0)"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_SetLogfile() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -82; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_SetLogfile() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -83; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "SqlProc_SetLogfile() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -84; + return 0; + } + sqlite3_free_table (results); + +/* checking the SQL Logfile */ + sql = "SELECT SqlProc_GetLogfile()"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_GetLogfile() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -85; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_GetLogfile() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -86; + return 0; + } + if (strcmp (*(results + 1), "./sql_logfile") != 0) + { + fprintf (stderr, "SqlProc_GetLogfile() #1 unexpected failure (%s)\n", + *(results + 1)); + sqlite3_free_table (results); + *retcode = -87; + return 0; + } + sqlite3_free_table (results); + +/* executing a Stored Procedure - valid SQL */ + sql = "SELECT SqlProc_Execute(SqlProc_FromFile('./sqlproc_logfile.txt'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_Execute() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -87; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_Execute() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -88; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "SqlProc_Execute() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -89; + return 0; + } + sqlite3_free_table (results); + +/* executing a Stored Procedure - invalid SQL */ + sql = "SELECT SqlProc_Execute(SqlProc_FromFile('./sqlproc_error.txt'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret == SQLITE_OK) + { + fprintf (stderr, "SqlProc_Execute() #2 unexpected success\n"); + *retcode = -90; + return 0; + } + sqlite3_free (err_msg); + + return 1; +} + +static int +do_level5_tests (sqlite3 * handle, int *retcode) +{ +/* performing Level 5 tests - SQL Logfile */ + const char *sql; + int ret; + char *err_msg = NULL; + char **results; + int rows; + int columns; + +/* enabling a SQL Logfile - append mode */ + sql = "SELECT SqlProc_SetLogfile('./sql_logfile', 1)"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_SetLogfile() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -91; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_SetLogfile() #2 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -92; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "SqlProc_SetLogfile() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -93; + return 0; + } + sqlite3_free_table (results); + +/* executing a SQL Procedure - with no arguments */ + sql = "SELECT SqlProc_Execute(SqlProc_FromText('SELECT @num1@ * @num2@;'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_Execute() #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -94; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_Execute() #3 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -95; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "SqlProc_Execute() #3 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -96; + return 0; + } + sqlite3_free_table (results); + +/* registering a first Stored Variable */ + sql = "SELECT StoredVar_Register('num1', 'variable @num1@', 2)"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Register() #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -97; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_Register() #3 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -98; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredVar_Register() #3 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -99; + return 0; + } + sqlite3_free_table (results); + +/* registering a second Stored Variable */ + sql = "SELECT StoredVar_Register('num2', 'variable @num1@', 3.14)"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "StoredVar_Register() #4 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -100; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "StoredVar_Register() #4 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -101; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "StoredVar_Register() #4 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -102; + return 0; + } + sqlite3_free_table (results); + +/* executing a SQL Procedure - with stored variables */ + sql = "SELECT SqlProc_Execute(SqlProc_FromText('SELECT @num1@ * @num2@;'))"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_Execute() #4 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -103; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_Execute() #4 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -104; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "SqlProc_Execute() #4 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -105; + return 0; + } + sqlite3_free_table (results); + +/* executing a SQL Procedure - with explicitly set variables */ + sql = "SELECT SqlProc_Execute(SqlProc_FromText('SELECT @num1@ * @num2@;'), " + "'@num1@=2.55', '@num2@=3.05');"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_Execute() #5 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -106; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_Execute() #5 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -107; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "SqlProc_Execute() #5 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -108; + return 0; + } + sqlite3_free_table (results); + +/* testing SqlProc_Exit */ + sql = "SELECT SqlProc_Exit();"; + ret = sqlite3_get_table (handle, sql, &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SqlProc_Exit() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -109; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "SqlProc_Exit() #1 error: rows=%d columns=%d\n", rows, + columns); + sqlite3_free_table (results); + *retcode = -110; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "SqlProc_Exit() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -111; + return 0; + } + sqlite3_free_table (results); + + return 1; +} + +#endif + +int +main (int argc, char *argv[]) +{ + int retcode = 0; + int ret; + sqlite3 *handle; + char *err_msg = NULL; + void *cache = spatialite_alloc_connection (); + char *old_SPATIALITE_SECURITY_ENV = NULL; +#ifdef _WIN32 + char *env; +#endif /* not WIN32 */ + + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + + old_SPATIALITE_SECURITY_ENV = getenv ("SPATIALITE_SECURITY"); +#ifdef _WIN32 + putenv ("SPATIALITE_SECURITY=relaxed"); +#else /* not WIN32 */ + setenv ("SPATIALITE_SECURITY", "relaxed", 1); +#endif + + ret = + sqlite3_open_v2 (":memory:", &handle, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); + if (ret != SQLITE_OK) + { + fprintf (stderr, "cannot open \":memory:\" database: %s\n", + sqlite3_errmsg (handle)); + sqlite3_close (handle); + return -1; + } + + spatialite_init_ex (handle, cache, 0); + + ret = sqlite3_exec (handle, "PRAGMA foreign_keys=1", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "PRAGMA foreign_keys=1 error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -2; + } + + ret = + sqlite3_exec (handle, "SELECT InitSpatialMetadata(1)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "InitSpatialMetadata() error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -3; + } + +#ifndef OMIT_ICONV /* only if ICONV is enabled */ + +/*tests: level 0 */ + if (!do_level0_tests (handle, &retcode)) + goto end; + +/*tests: level 1 */ + if (!do_level1_tests (handle, &retcode)) + goto end; + + if (old_SPATIALITE_SECURITY_ENV) + { +#ifdef _WIN32 + env = + sqlite3_mprintf ("SPATIALITE_SECURITY=%s", + old_SPATIALITE_SECURITY_ENV); + putenv (env); + sqlite3_free (env); +#else /* not WIN32 */ + setenv ("SPATIALITE_SECURITY", old_SPATIALITE_SECURITY_ENV, 1); +#endif + } + else + { +#ifdef _WIN32 + putenv ("SPATIALITE_SECURITY="); +#else /* not WIN32 */ + unsetenv ("SPATIALITE_SECURITY"); +#endif + } + +/*tests: level 2 */ + if (!do_level2_tests (handle, &retcode)) + goto end; + +/*tests: level 3 */ + if (!do_level3_tests (handle, &retcode)) + goto end; + +/*tests: level 4 */ + if (!do_level4_tests (handle, &retcode)) + goto end; + +/*tests: level 5 */ + if (!do_level5_tests (handle, &retcode)) + goto end; + + end: + +#else + if (old_SPATIALITE_SECURITY_ENV != NULL) + old_SPATIALITE_SECURITY_ENV = NULL; /* silencing stupid compiler warnings */ +#endif /* end ICONV */ + + sqlite3_close (handle); + spatialite_cleanup_ex (cache); + spatialite_shutdown (); + return retcode; +} Index: test/check_styling.c ================================================================== --- test/check_styling.c +++ test/check_styling.c @@ -78,10 +78,13 @@ if (retcode == 1) return SQLITE_OK; return SQLITE_ERROR; } +#ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ +#ifndef OMIT_ICONV /* only if ICONV is supported */ + static unsigned char * load_blob (const char *path, int *blob_len) { /* loading an external image */ unsigned char *blob; @@ -268,38 +271,193 @@ fprintf (stderr, "Error AddGeometryColumn table2: %s\n\n", err_msg); sqlite3_free (err_msg); return -15; } -/* registering two Vector Coverages */ - sql = "SELECT SE_RegisterVectorCoverage('table1', 'table1', 'geom')"; - ret = execute_check (handle, sql, &err_msg); +/* creating a SpatialView */ + sql = + "CREATE VIEW spatialview1 AS SELECT id AS pkid, geom AS geometry FROM table1"; + ret = sqlite3_exec (handle, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { - fprintf (stderr, "Error RegisterVectorCoverage table1: %s\n\n", + fprintf (stderr, "Error Create SpatialView spatialview1: %s\n\n", err_msg); sqlite3_free (err_msg); return -16; } - sql = - "SELECT SE_RegisterVectorCoverage('table2', 'table2', 'geom', 'title-2', 'abstract-2')"; - ret = execute_check (handle, sql, &err_msg); + sql = "INSERT INTO views_geometry_columns (view_name, view_geometry, " + "view_rowid, f_table_name, f_geometry_column, read_only) " + "VALUES ('spatialview1', 'geometry', 'pkid', 'table1', 'geom', 1)"; + ret = sqlite3_exec (handle, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { - fprintf (stderr, "Error RegisterVectorCoverage table2: %s\n\n", + fprintf (stderr, "Error Register SpatialView spatialview1: %s\n\n", err_msg); sqlite3_free (err_msg); return -17; } - sql = "SELECT SE_SetVectorCoverageInfos('table1', 'title-1', 'abstract-1')"; + +/* creating a VirtualShape */ + sql = + "CREATE VIRTUAL TABLE shapetest USING VirtualShape('shp/merano-3d/roads', CP1252, 25832)"; + ret = sqlite3_exec (handle, sql, NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Error Create VirtualShape shapetest: %s\n", + err_msg); + sqlite3_free (err_msg); + return -18; + } + +/* registering two Vector Coverages */ + sql = "SELECT SE_RegisterVectorCoverage('table1', 'table1', 'geom')"; ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif { fprintf (stderr, "Error RegisterVectorCoverage table1: %s\n\n", err_msg); sqlite3_free (err_msg); - return -18; + return -19; + } + sql = + "SELECT SE_RegisterVectorCoverage('table2', 'table2', 'geom', 'title-2', 'abstract-2')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, "Error RegisterVectorCoverage table2: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -20; + } + sql = "SELECT SE_SetVectorCoverageInfos('table1', 'title-1', 'abstract-1')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, "Error RegisterVectorCoverageInfos table1: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -21; + } + sql = "SELECT SE_SetVectorCoverageCopyright('table1', 'somebody')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, + "Error RegisterVectorCoverageCopyright #1 table1: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -22; + } + sql = + "SELECT SE_SetVectorCoverageCopyright('table1', 'someone else', 'CC BY 3.0')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, + "Error RegisterVectorCoverageCopyright #2 table1: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -23; + } + sql = + "SELECT SE_SetVectorCoverageCopyright('table1', NULL, 'CC BY-SA 4.0')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, + "Error RegisterVectorCoverageCopyright #3 table1: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -24; + } + +/* registering two SpatialView Coverages */ + sql = + "SELECT SE_RegisterSpatialViewCoverage('spatialview1', 'spatialview1', 'geometry')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, + "Error RegisterSpatialViewCoverage spatialview1: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -25; + } + sql = + "SELECT SE_RegisterSpatialViewCoverage('spatialview2', 'spatialview1', 'geometry', 'title', 'abstract')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, + "Error RegisterSpatialViewCoverage spatialview2: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -26; + } + +/* registering two VirtualShape Coverages */ + sql = + "SELECT SE_RegisterVirtualShapeCoverage('shapetest1', 'shapetest', 'geometry')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, + "Error RegisterVirtualShapeCoverage shapetest1: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -27; + } + sql = + "SELECT SE_RegisterVirtualShapeCoverage('shapetest2', 'shapetest', 'geometry', 'title', 'abstract')"; + ret = execute_check (handle, sql, &err_msg); +#ifdef ENABLE_RTTOPO + if (ret != SQLITE_OK) +#else + if (ret != SQLITE_ERROR) +#endif + { + fprintf (stderr, + "Error RegisterVirtualShapeCoverage spatialview2: %s\n\n", + err_msg); + sqlite3_free (err_msg); + return -28; } /* testing Vector Styles */ xml = load_xml ("stazioni_se.xml", &len); if (xml == NULL) @@ -307,26 +465,26 @@ gaiaXmlToBlob (cache, xml, len, 1, NULL, &blob, &blob_len, NULL, NULL); free (xml); if (blob == NULL) { fprintf (stderr, "this is not a well-formed XML !!!\n"); - return -20; + return -29; } hexBlob = build_hex_blob (blob, blob_len); free (blob); if (hexBlob == NULL) - return -21; + return -30; /* Register Vector Styled Layer */ sql = sqlite3_mprintf ("SELECT SE_RegisterVectorStyle(x%Q)", hexBlob); ret = execute_check (handle, sql, &err_msg); sqlite3_free (sql); if (ret != SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyle #1: %s\n\n", err_msg); sqlite3_free (err_msg); - return -22; + return -31; } sql = sqlite3_mprintf ("SELECT SE_RegisterVectorStyledLayer('table1', 1)"); ret = execute_check (handle, sql, &err_msg); sqlite3_free (sql); @@ -333,11 +491,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyledLayer #1: %s\n\n", err_msg); sqlite3_free (err_msg); - return -23; + return -32; } sql = sqlite3_mprintf ("SELECT SE_RegisterVectorStyledLayer('table2', 'Railway Stations')"); @@ -346,37 +504,37 @@ if (ret != SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyledLayer #2: %s\n\n", err_msg); sqlite3_free (err_msg); - return -24; + return -33; } free (hexBlob); xml = load_xml ("stazioni2_se.xml", &len); if (xml == NULL) - return -25; + return -31; gaiaXmlToBlob (cache, xml, len, 1, NULL, &blob, &blob_len, NULL, NULL); free (xml); if (blob == NULL) { fprintf (stderr, "this is not a well-formed XML !!!\n"); - return -26; + return -35; } hexBlob = build_hex_blob (blob, blob_len); free (blob); if (hexBlob == NULL) - return -27; + return -36; sql = sqlite3_mprintf ("SELECT SE_RegisterVectorStyle(x%Q)", hexBlob); ret = execute_check (handle, sql, &err_msg); sqlite3_free (sql); if (ret != SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyle #2: %s\n\n", err_msg); sqlite3_free (err_msg); - return -29; + return -37; } sql = sqlite3_mprintf ("SELECT SE_RegisterVectorStyledLayer('table2', 2)"); ret = execute_check (handle, sql, &err_msg); sqlite3_free (sql); @@ -383,21 +541,21 @@ if (ret != SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyledLayer #3: %s\n\n", err_msg); sqlite3_free (err_msg); - return -30; + return -38; } sql = sqlite3_mprintf ("SELECT SE_RegisterVectorStyle(x%Q)", hexBlob); ret = execute_check (handle, sql, NULL); sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyle #3: %s\n\n", "expected failure"); - return -31; + return -39; } /* Reload Vector Style */ sql = sqlite3_mprintf ("SELECT SE_ReloadVectorStyle(12, x%Q)", hexBlob); ret = execute_check (handle, sql, NULL); @@ -404,21 +562,21 @@ sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error ReloadVectorStyle #1: %s\n\n", "expected failure"); - return -33; + return -40; } sql = sqlite3_mprintf ("SELECT SE_ReloadVectorStyle(1, x%Q)", hexBlob); ret = execute_check (handle, sql, NULL); sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error ReloadVectorStyle #2: %s\n\n", "expected failure"); - return -34; + return -41; } sql = sqlite3_mprintf ("SELECT SE_ReloadVectorStyle('Railway Stations', x%Q)", hexBlob); @@ -426,11 +584,11 @@ sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error ReloadVectorStyle #4: %s\n\n", "expected failure"); - return -36; + return -42; } sql = sqlite3_mprintf ("SELECT SE_ReloadVectorStyle('Railway Stations', x%Q)", hexBlob); @@ -438,36 +596,36 @@ sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error ReloadVectorStyle #5: %s\n\n", "expected failure"); - return -37; + return -43; } free (hexBlob); xml = load_xml ("stazioni_se.xml", &len); if (xml == NULL) - return -35; + return -44; gaiaXmlToBlob (cache, xml, len, 1, NULL, &blob, &blob_len, NULL, NULL); free (xml); if (blob == NULL) { fprintf (stderr, "this is not a well-formed XML !!!\n"); - return -39; + return -45; } hexBlob = build_hex_blob (blob, blob_len); free (blob); if (hexBlob == NULL) - return -40; + return -46; sql = sqlite3_mprintf ("SELECT SE_ReloadVectorStyle(1, x%Q)", hexBlob); ret = execute_check (handle, sql, &err_msg); sqlite3_free (sql); if (ret != SQLITE_OK) { fprintf (stderr, "Error ReloadVectorStyle #7: %s\n\n", err_msg); sqlite3_free (err_msg); - return -41; + return -47; } sql = sqlite3_mprintf ("SELECT SE_ReloadVectorStyle('Railway Stations 2', x%Q)", hexBlob); @@ -475,11 +633,11 @@ sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error ReloadVectorStyle #8: %s\n\n", "expected failure"); - return -42; + return -48; } free (hexBlob); /* Unregister Vector Style */ sql = sqlite3_mprintf ("SELECT SE_UnRegisterVectorStyle(5)"); @@ -487,21 +645,21 @@ sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error UnRegisterVectorStyle #1: %s\n\n", "expected failure"); - return -43; + return -49; } sql = sqlite3_mprintf ("SELECT SE_UnRegisterVectorStyle('alpha')"); ret = execute_check (handle, sql, NULL); sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error UnRegisterVectorStyle #2: %s\n\n", "expected failure"); - return -44; + return -50; } sql = sqlite3_mprintf ("SELECT SE_UnRegisterVectorStyle('Railway Stations 2')"); @@ -509,11 +667,11 @@ sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error UnRegisterVectorStyle #3: %s\n\n", "expected failure"); - return -45; + return -51; } sql = sqlite3_mprintf ("SELECT SE_UnRegisterVectorStyle('Railway Stations 2', 1)"); @@ -521,37 +679,37 @@ sqlite3_free (sql); if (ret != SQLITE_OK) { fprintf (stderr, "Error UnRegisterVectorStyle #5: %s\n\n", err_msg); sqlite3_free (err_msg); - return -47; + return -52; } /* Register Vector Styled Layer: again */ xml = load_xml ("stazioni2_se.xml", &len); if (xml == NULL) - return -48; + return -53; gaiaXmlToBlob (cache, xml, len, 1, NULL, &blob, &blob_len, NULL, NULL); free (xml); if (blob == NULL) { fprintf (stderr, "this is not a well-formed XML !!!\n"); - return -49; + return -54; } hexBlob = build_hex_blob (blob, blob_len); free (blob); if (hexBlob == NULL) - return -50; + return -55; sql = sqlite3_mprintf ("SELECT SE_RegisterVectorStyle(x%Q)", hexBlob); ret = execute_check (handle, sql, &err_msg); sqlite3_free (sql); if (ret != SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyle #3: %s\n\n", err_msg); sqlite3_free (err_msg); - return -51; + return -56; } free (hexBlob); sql = sqlite3_mprintf @@ -561,11 +719,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "Error RegisterVectorStyledLayer #5: %s\n\n", err_msg); sqlite3_free (err_msg); - return -53; + return -57; } /* Unregister Vector Style Layer */ sql = sqlite3_mprintf @@ -575,11 +733,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "Error UnregisterVectorStyledLayer #1: %s\n\n", err_msg); sqlite3_free (err_msg); - return -54; + return -58; } sql = sqlite3_mprintf ("SELECT SE_UnRegisterVectorStyledLayer('table1', 1)"); ret = execute_check (handle, sql, &err_msg); @@ -587,11 +745,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "Error UnregisterVectorStyledLayer #2: %s\n\n", err_msg); sqlite3_free (err_msg); - return -55; + return -59; } /* unregister External Graphic */ sql = sqlite3_mprintf ("SELECT SE_UnRegisterExternalGraphic('url-A')"); ret = execute_check (handle, sql, &err_msg); @@ -599,20 +757,20 @@ if (ret != SQLITE_OK) { fprintf (stderr, "Error UnRegisterExternalGraphic #1: %s\n\n", err_msg); sqlite3_free (err_msg); - return -56; + return -60; } sql = sqlite3_mprintf ("SELECT SE_UnRegisterExternalGraphic('jeroboam')"); ret = execute_check (handle, sql, NULL); sqlite3_free (sql); if (ret == SQLITE_OK) { fprintf (stderr, "Error UnRegisterExternalGraphic #2: %s\n\n", "expected failure"); - return -57; + return -61; } return 0; } @@ -1453,10 +1611,15 @@ } return 0; } +#endif +#endif + +#ifdef ENABLE_RTTOPO /* only is RTTOPO is supported */ + static int check_extent (sqlite3 * handle) { /* testing Vector Coverage Extents */ int ret; @@ -1751,10 +1914,12 @@ } return 0; } +#endif + int main (int argc, char *argv[]) { int ret; sqlite3 *handle; @@ -1788,10 +1953,11 @@ sqlite3_free (err_msg); return -2; } #ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ +#ifndef OMIT_ICONV /* only if ICONV is supported */ /* creating the Styling Tables */ sql = "SELECT CreateStylingTables(1)"; ret = execute_check (handle, sql, &err_msg); if (ret != SQLITE_OK) @@ -1811,14 +1977,17 @@ ret = check_group (handle, cache); if (ret != 0) return -300 - ret; +#ifdef ENABLE_RTTOPO /* only is RTTOPO is supported */ ret = check_extent (handle); if (ret != 0) return -400 - ret; +#endif +#endif #endif ret = sqlite3_close (handle); if (ret != SQLITE_OK) { Index: test/check_topology2d.c ================================================================== --- test/check_topology2d.c +++ test/check_topology2d.c @@ -48,10 +48,76 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" + +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + +static int +do_level7_tests (sqlite3 * handle, int *retcode) +{ +/* performing basic tests: level 7 */ + int ret; + char *err_msg = NULL; + +/* testing RegisterTopoGeoCoverage */ + ret = + sqlite3_exec (handle, + "SELECT CreateStylingTables(1)", NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateStylingTables() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -340; + return 0; + } + +/* testing RegisterTopoGeoCoverage - short form */ + ret = + sqlite3_exec (handle, + "SELECT SE_RegisterTopoGeoCoverage('topo', 'topo')", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SE_RegisterTopoGeoCoverage() #1 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -341; + return 0; + } + +/* testing UnRegisterVectorCoverage */ + ret = + sqlite3_exec (handle, + "SELECT SE_UnRegisterVectorCoverage('topo')", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SE_RegisterVectorCoverage() #1 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -342; + return 0; + } + +/* testing RegisterTopoGeoCoverage - long form */ + ret = + sqlite3_exec (handle, + "SELECT SE_RegisterTopoGeoCoverage('topo', 'topo', 'title', 'abstract', 1, 1)", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "SE_RegisterTopoGeoCoverage() #2 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -343; + return 0; + } + + return 1; +} static int do_level6_tests (sqlite3 * handle, int *retcode) { /* performing basic tests: Level 6 */ @@ -2961,10 +3027,12 @@ sqlite3_free (err_msg); return 1; } +#endif + int main (int argc, char *argv[]) { int retcode = 0; @@ -2972,13 +3040,10 @@ int ret; sqlite3 *handle; char *err_msg = NULL; 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) { @@ -3054,10 +3119,18 @@ goto end; /* basic tests: level 6 */ if (!do_level6_tests (handle, &retcode)) goto end; + +#ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ + +/* testing RegisterTopoGeoCoverage */ + if (!do_level7_tests (handle, &retcode)) + goto end; + +#endif /* dropping the Topology 2D */ ret = sqlite3_exec (handle, "SELECT DropTopology('topo')", NULL, NULL, &err_msg); @@ -3074,8 +3147,11 @@ sqlite3_close (handle); spatialite_cleanup_ex (cache); #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_topology3d.c ================================================================== --- test/check_topology3d.c +++ test/check_topology3d.c @@ -49,10 +49,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + static int do_level6_tests (sqlite3 * handle, int *retcode) { /* performing basic tests: Level 6 */ int ret; @@ -2886,10 +2888,12 @@ sqlite3_free (err_msg); return 1; } +#endif + int main (int argc, char *argv[]) { int retcode = 0; @@ -2999,8 +3003,11 @@ sqlite3_close (handle); spatialite_cleanup_ex (cache); #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_toponoface2d.c ================================================================== --- test/check_toponoface2d.c +++ test/check_toponoface2d.c @@ -49,10 +49,13 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ +#ifndef OMIT_ICONV /* only if ICONV is enabled */ + static int do_level0_tests (sqlite3 * handle, int *retcode) { /* performing Level 0 tests */ int ret; @@ -772,28 +775,29 @@ sqlite3_free (err_msg); return 1; } +#endif +#endif + int main (int argc, char *argv[]) { int retcode = 0; #ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ +#ifndef OMIT_ICONV /* only if ICONV is enabled */ int ret; sqlite3 *handle; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); char *old_SPATIALITE_SECURITY_ENV = NULL; #ifdef _WIN32 char *env; #endif /* not WIN32 */ - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - old_SPATIALITE_SECURITY_ENV = getenv ("SPATIALITE_SECURITY"); #ifdef _WIN32 putenv ("SPATIALITE_SECURITY=relaxed"); #else /* not WIN32 */ setenv ("SPATIALITE_SECURITY", "relaxed", 1); @@ -947,10 +951,14 @@ end: spatialite_finalize_topologies (cache); sqlite3_close (handle); spatialite_cleanup_ex (cache); +#endif #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_topoplus.c ================================================================== --- test/check_topoplus.c +++ test/check_topoplus.c @@ -48,10 +48,309 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" + +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ +#ifndef OMIT_ICONV /* only if ICONV is enabled */ + +static int +do_level11_tests (sqlite3 * handle, int *retcode) +{ +/* performing basic tests: Level 11 */ + int ret; + char *err_msg = NULL; + int i; + char **results; + int rows; + int columns; + int changed_links = 0; + +/* creating a Network 2D */ + ret = + sqlite3_exec (handle, + "SELECT CreateNetwork('netsegments', 1, 4326, 0, 0)", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateNetwork() #5 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -300; + return 0; + } + +/* inserting four Nodes */ + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNetNode('netsegments', MakePoint(-45, -45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNetNode() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -301; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNetNode('netsegments', MakePoint(-45, 45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNetNode() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -302; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNetNode('netsegments', MakePoint(45, -45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNetNode() #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -303; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNetNode('netsegments', MakePoint(45, 45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNetNode() #4 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -304; + return 0; + } + +/* inserting Links */ + ret = + sqlite3_exec (handle, + "SELECT ST_AddLink('netsegments', 1, 2, GeomFromText('LINESTRING(-45 -45, -45 45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddLink() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -305; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddLink('netsegments', 3, 4, GeomFromText('LINESTRING(45 -45, 45 45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddLink() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -306; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddLink('netsegments', 1, 3, GeomFromText('LINESTRING(-45 -45, 45 -45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddLink() #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -307; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddLink('netsegments', 2, 4, GeomFromText('LINESTRING(-45 45, 0 45, 45 45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddLink() #4 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -308; + return 0; + } + +/* disambiguating segment Links */ + ret = sqlite3_get_table + (handle, + "SELECT TopoNet_DisambiguateSegmentLinks('netsegments')", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "TopoNet_DisambiguateSegmentLinks() #1 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -309; + return 0; + } + for (i = 1; i <= rows; i++) + { + const char *value = results[(i * columns)]; + changed_links = atoi (value); + } + sqlite3_free_table (results); + if (changed_links != 3) + { + fprintf (stderr, + "TopoNet_DisambiguateSegmentLinks() #1 invalid count: %d\n", + changed_links); + *retcode = -310; + return 0; + } + + return 1; +} + +static int +do_level10_tests (sqlite3 * handle, int *retcode) +{ +/* performing basic tests: Level 10 */ + int ret; + char *err_msg = NULL; + int i; + char **results; + int rows; + int columns; + int changed_edges = 0; + +/* creating a Topology 2D */ + ret = + sqlite3_exec (handle, + "SELECT CreateTopology('segments', 4326, 0, 0)", NULL, + NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateTopology() #10 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -300; + return 0; + } + +/* inserting four Nodes */ + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNode('segments', NULL, MakePoint(-45, -45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNode() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -301; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNode('segments', NULL, MakePoint(-45, 45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNode() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -302; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNode('segments', NULL, MakePoint(45, -45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNode() #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -303; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoNode('segments', NULL, MakePoint(45, 45, 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoNode() #4 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -304; + return 0; + } + +/* inserting Edges */ + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoEdge('segments', 1, 2, GeomFromText('LINESTRING(-45 -45, -45 45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoEdge() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -305; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddIsoEdge('segments', 3, 4, GeomFromText('LINESTRING(45 -45, 45 45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddIsoEdge() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -306; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddEdgeNewFaces('segments', 1, 3, GeomFromText('LINESTRING(-45 -45, 45 -45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddEdgeNewFaces() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -307; + return 0; + } + ret = + sqlite3_exec (handle, + "SELECT ST_AddEdgeNewFaces('segments', 2, 4, GeomFromText('LINESTRING(-45 45, 0 45, 45 45)', 4326))", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "ST_AddEdgeNewFaces() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -308; + return 0; + } + +/* disambiguating segment Edges */ + ret = sqlite3_get_table + (handle, + "SELECT TopoGeo_DisambiguateSegmentEdges('segments')", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "TopoGeo_DisambiguateSegmentEdges() #1 error: %s\n", + err_msg); + sqlite3_free (err_msg); + *retcode = -309; + return 0; + } + for (i = 1; i <= rows; i++) + { + const char *value = results[(i * columns)]; + changed_edges = atoi (value); + } + sqlite3_free_table (results); + if (changed_edges != 3) + { + fprintf (stderr, + "TopoGeo_DisambiguateSegmentEdges() #1 invalid count: %d\n", + changed_edges); + *retcode = -310; + return 0; + } + + return 1; +} static int do_level9_tests (sqlite3 * handle, int *retcode) { /* performing basic tests: Level 9 */ @@ -410,11 +709,12 @@ sqlite3_exec (handle, "DETACH DATABASE inputDB", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "DETACH DATABASE error: %s\n", err_msg); sqlite3_free (err_msg); - return -303; + *retcode = -303; + return 0; } /* attempting to load a Topology - non-existing Topology */ ret = sqlite3_exec (handle, @@ -713,11 +1013,12 @@ sqlite3_exec (handle, "DETACH DATABASE inputDB", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "DETACH DATABASE error: %s\n", err_msg); sqlite3_free (err_msg); - return -203; + *retcode = -203; + return 0; } /* creating a Topology 2D */ ret = sqlite3_exec (handle, "SELECT CreateTopology('elbasplit', 32632, 0)", @@ -777,10 +1078,23 @@ fprintf (stderr, "TopoNet_FromGeoTable() #1 error: %s\n", err_msg); sqlite3_free (err_msg); *retcode = -208; return 0; } + +/* testing TopNet_LineLinksList - ok */ + ret = + sqlite3_exec (handle, + "SELECT TopoNet_LineLinksList('roads', NULL, 'roads', 'geometry', 'line_links_list')", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "TopoNet_LineLinksList() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -209; + return 0; + } /* testing TopoGeo_GetEdgeSeed */ ret = sqlite3_exec (handle, "SELECT TopoGeo_GetEdgeSeed('elbasplit', edge_id) FROM MAIN.elbasplit_edge", @@ -787,11 +1101,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_GetEdgeSeed() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -209; + *retcode = -210; return 0; } /* testing TopoGeo_GetFaceSeed */ ret = @@ -800,11 +1114,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_GetFaceSeed() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -210; + *retcode = -211; return 0; } /* testing TopoNet_GetLinkSeed */ ret = @@ -813,11 +1127,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_GetLinkSeed() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -211; + *retcode = -212; return 0; } /* testing TopoGeo_UpdateSeeds */ ret = @@ -826,11 +1140,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_UpdateSeeds() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -212; + *retcode = -213; return 0; } /* testing TopoNet_UpdateSeeds */ ret = @@ -839,11 +1153,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoNet_UpdateSeeds() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -213; + *retcode = -214; return 0; } /* sleeping for 2 secs, so to be sure that 'now' really changes */ sqlite3_sleep (2000); @@ -855,11 +1169,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "UPDATE elbasplit error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -214; + *retcode = -215; return 0; } /* testing TopoGeo_UpdateSeeds */ ret = @@ -868,11 +1182,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_UpdateSeeds() #2 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -215; + *retcode = -216; return 0; } /* Link's fake update */ ret = @@ -881,11 +1195,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "UPDATE roads error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -216; + *retcode = -217; return 0; } /* testing TopoNet_UpdateSeeds */ ret = @@ -894,11 +1208,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoNet_UpdateSeeds() #2 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -217; + *retcode = -218; return 0; } /* testing TopoGeo_ToGeoTable */ ret = @@ -907,11 +1221,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_ToGeoTable() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -218; + *retcode = -219; return 0; } /* testing TopoGeo_ToGeoTable */ ret = @@ -920,11 +1234,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_ToGeoTable() #2 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -219; + *retcode = -220; return 0; } /* testing TopoNet_ToGeoTable */ ret = @@ -933,11 +1247,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoNet_ToGeoTable() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -220; + *retcode = -221; return 0; } /* testing TopoGeo_ToGeoTableGeneralize */ ret = @@ -947,11 +1261,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_ToGeoTableGeneralize() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -221; + *retcode = -222; return 0; } /* testing TopoGeo_ToGeoTableGeneralize */ ret = @@ -961,11 +1275,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_ToGeoTableGeneralize() #2 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -222; + *retcode = -223; return 0; } /* testing TopoNet_ToGeoTableGeneralize */ ret = @@ -975,11 +1289,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "TopoNet_ToGeoTableGeneralize() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -223; + *retcode = -224; return 0; } /* testing TopoNet_ToGeoTableGeneralize */ ret = @@ -989,11 +1303,11 @@ if (ret != SQLITE_OK) { fprintf (stderr, "TopoNet_ToGeoTableGeneralize() #2 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -224; + *retcode = -225; return 0; } /* testing TopoGeo_CreateTopoLayer */ ret = @@ -1002,11 +1316,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_CreateTopoLayer() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -225; + *retcode = -226; return 0; } /* testing TopoGeo_ExportTopoLayer */ ret = @@ -1015,11 +1329,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_ExportTopoLayer() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -226; + *retcode = -227; return 0; } /* testing TopoGeo_RemoveTopoLayer */ ret = @@ -1028,11 +1342,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_RemoveTopoLayer() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -227; + *retcode = -228; return 0; } /* testing TopoGeo_CreateTopoLayer */ ret = @@ -1041,11 +1355,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_CreateTopoLayer() #2 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -228; + *retcode = -229; return 0; } /* testing TopoGeo_ExportTopoLayer - create only */ ret = @@ -1054,11 +1368,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_ExportTopoLayer() #2 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -229; + *retcode = -230; return 0; } /* testing TopoGeo_InsertFeatureFromTopoLayer */ ret = @@ -1069,11 +1383,11 @@ { fprintf (stderr, "TopoGeo_InsertFeatureFromTopoLayer() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -230; + *retcode = -231; return 0; } /* testing CreateTopoGeo - ok */ ret = @@ -1082,11 +1396,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "ST_CreateTopoGeo() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -231; + *retcode = -232; return 0; } /* testing CreateTopoGeo - already populated Topology */ ret = @@ -1094,19 +1408,19 @@ "SELECT ST_CreateTopoGeo('badelba1', MakePoint(1, 2, 4326))", NULL, NULL, &err_msg); if (ret == SQLITE_OK) { fprintf (stderr, "ST_CreateTopoGeo() #2: expected failure\n"); - *retcode = -232; + *retcode = -233; return 0; } if (strcmp (err_msg, "SQL/MM Spatial exception - non-empty topology.") != 0) { fprintf (stderr, "ST_CreateTopoGeo() #2: unexpected \"%s\"\n", err_msg); sqlite3_free (err_msg); - *retcode = -233; + *retcode = -234; return 0; } sqlite3_free (err_msg); /* testing SpatNetFromGeom - ok */ @@ -1116,11 +1430,11 @@ NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "ST_SpatNetFromGeom() #1 error: %s\n", err_msg); sqlite3_free (err_msg); - *retcode = -234; + *retcode = -235; return 0; } /* testing SpatNetFromGeom - already populated Network */ ret = @@ -1128,22 +1442,48 @@ "SELECT ST_SpatNetFromGeom('badnet1', MakePoint(1, 2, 3003))", NULL, NULL, &err_msg); if (ret == SQLITE_OK) { fprintf (stderr, "ST_SpatNetFromGeom() #2: expected failure\n"); - *retcode = -235; + *retcode = -236; return 0; } if (strcmp (err_msg, "SQL/MM Spatial exception - non-empty network.") != 0) { fprintf (stderr, "ST_SpatNetFromGeom() #2: unexpected \"%s\"\n", err_msg); sqlite3_free (err_msg); - *retcode = -236; + *retcode = -237; return 0; } sqlite3_free (err_msg); + +/* testing TopoGeo_PolyFacesList - ok */ + ret = + sqlite3_exec (handle, + "SELECT TopoGeo_PolyFacesList('elbasplit', NULL, 'elba_pg', 'geometry', 'poly_faces_list')", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "TopoGeo_PolyFacesList() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -238; + return 0; + } + +/* testing TopoGeo_LineEdgesList - ok */ + ret = + sqlite3_exec (handle, + "SELECT TopoGeo_LineEdgesList('elbasplit', NULL, 'elba_ln', 'geometry', 'line_edges_list')", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "TopoGeo_LineEdgesList() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -239; + return 0; + } return 1; } @@ -3921,28 +4261,29 @@ sqlite3_free (err_msg); return 1; } +#endif +#endif + int main (int argc, char *argv[]) { int retcode = 0; #ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ +#ifndef OMIT_ICONV /* only if ICONV is enabled */ int ret; sqlite3 *handle; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); char *old_SPATIALITE_SECURITY_ENV = NULL; #ifdef _WIN32 char *env; #endif /* not WIN32 */ - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - old_SPATIALITE_SECURITY_ENV = getenv ("SPATIALITE_SECURITY"); #ifdef _WIN32 putenv ("SPATIALITE_SECURITY=relaxed"); #else /* not WIN32 */ setenv ("SPATIALITE_SECURITY", "relaxed", 1); @@ -4293,15 +4634,27 @@ /* basic tests: level 9 */ if (!do_level9_tests (handle, &retcode)) goto end; +/* basic tests: level 10 */ + if (!do_level10_tests (handle, &retcode)) + goto end; + +/* basic tests: level 11 */ + if (!do_level11_tests (handle, &retcode)) + goto end; + end: spatialite_finalize_topologies (cache); sqlite3_close (handle); spatialite_cleanup_ex (cache); +#endif #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_toposnap.c ================================================================== --- test/check_toposnap.c +++ test/check_toposnap.c @@ -49,10 +49,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifdef ENABLE_RTTOPO /* only if RTTOPO is enabled */ + static int do_level0_tests (sqlite3 * handle, int *retcode) { /* performing Level 0 tests */ int ret; @@ -108,12 +110,13 @@ int ret; char *err_msg = NULL; /* importing the sezcen_2001 GeoTable */ ret = sqlite3_exec (handle, - "SELECT TopoGeo_AddLinestringNoFace('elba', LinesFromRings(TopoGeo_TopoSnap('elba', geometry, 1, 1, 0))) " - "FROM ext.sezcen_2001 WHERE rowid < 5", NULL, NULL, &err_msg); + "SELECT TopoGeo_AddLinestringNoFace('elba', LinesFromRings(TopoGeo_TopoSnap('elba', geometry, 1, 1, 0))) " + "FROM ext.sezcen_2001 WHERE rowid < 5", NULL, NULL, + &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "TopoGeo_AddLinestringNoFace() #1 error: %s\n", err_msg); sqlite3_free (err_msg); @@ -255,13 +258,13 @@ do_level4_tests (sqlite3 * handle, int *retcode) { /* performing Level 4 tests */ int ret; char *err_msg = NULL; - + /* disabled: indecently slow !!! */ -return 1; + return 1; /* testing TopoGeo_SnappedGeoTable */ ret = sqlite3_exec (handle, "SELECT TopoGeo_SnappedGeoTable('elba', 'ext', 'sezcen_2001', NULL, 'snapped_2001', 1, 1)", @@ -285,11 +288,11 @@ char *err_msg = NULL; /* testing TopoGeo_SnappedGeoTable - invalid input table */ ret = sqlite3_exec (handle, - "SELECT TopoGeo_SnappedGeoTable('elba', 'ext', 'sezcen_1234', NULL, 'snapped', 1, 1)", + "SELECT TopoGeo_SnappedGeoTable('elba', 'ext', 'sezcen_1234', NULL, 'snapped', 1)", NULL, NULL, &err_msg); if (ret == SQLITE_OK) { fprintf (stderr, "TopoGeo_SnappedGeoTable() #2 unexpected succes\n"); sqlite3_free (err_msg); @@ -309,11 +312,11 @@ /* testing TopoGeo_SnappedGeoTable -already existing output table * disabled - indecently slow !!! ret = sqlite3_exec (handle, - "SELECT TopoGeo_SnappedGeoTable('elba', 'ext', 'sezcen_2001', NULL, 'snapped_2001', 1, 1)", + "SELECT TopoGeo_SnappedGeoTable('elba', 'ext', 'sezcen_2001', NULL, 'snapped_2001', 1)", NULL, NULL, &err_msg); if (ret == SQLITE_OK) { fprintf (stderr, "TopoGeo_SnappedGeoTable() #4 unexpected succes\n"); sqlite3_free (err_msg); @@ -334,11 +337,11 @@ */ /* testing TopoGeo_SnappedGeoTable -invalid input SRID or dimensions */ ret = sqlite3_exec (handle, - "SELECT TopoGeo_SnappedGeoTable('elba', 'ext', 'points', NULL, 'snapped', 1, 1)", + "SELECT TopoGeo_SnappedGeoTable('elba', 'ext', 'points', NULL, 'snapped', 1)", NULL, NULL, &err_msg); if (ret == SQLITE_OK) { fprintf (stderr, "TopoGeo_SnappedGeoTable() #6 unexpected succes\n"); sqlite3_free (err_msg); @@ -431,11 +434,11 @@ sqlite3_free (err_msg); *retcode = -69; return 0; } sqlite3_free (err_msg); - + /* testing TopoGeo_NewEdgesSplit - inconsistent topology */ ret = sqlite3_exec (handle, "SELECT TopoGeo_NewEdgesSplit('elba', 256)", NULL, NULL, &err_msg); @@ -484,10 +487,12 @@ } sqlite3_free (err_msg); return 1; } + +#endif int main (int argc, char *argv[]) { int retcode = 0; @@ -570,23 +575,23 @@ if (!do_level0_tests (handle, &retcode)) goto end; /*tests: level 1 */ if (!do_level1_tests (handle, &retcode)) - goto end; + goto end; /*tests: level 2 */ if (!do_level2_tests (handle, &retcode)) goto end; /*tests: level 3 */ if (!do_level3_tests (handle, &retcode)) goto end; -/*tests: level 4 */ +/*tests: level 4 */ if (!do_level4_tests (handle, &retcode)) - goto end; + goto end; /*tests: level 5 */ if (!do_level5_tests (handle, &retcode)) goto end; @@ -604,8 +609,11 @@ sqlite3_close (handle); spatialite_cleanup_ex (cache); #endif /* end RTTOPO conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return retcode; } Index: test/check_virtual_ovflw.c ================================================================== --- test/check_virtual_ovflw.c +++ test/check_virtual_ovflw.c @@ -52,10 +52,11 @@ #include "spatialite.h" int main (int argc, char *argv[]) { +#ifndef OMIT_ICONV /* only if ICONV is enabled */ sqlite3 *db_handle = NULL; int ret; char *err_msg = NULL; char **results; int rows; @@ -64,13 +65,10 @@ char *suffix; char *table; char *sql; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - ret = sqlite3_open_v2 (":memory:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { @@ -165,11 +163,10 @@ sqlite3_free_table (results); sqlite3_free (table); #endif /* end FreeXL conditional */ -#ifndef OMIT_ICONV /* only if ICONV is supported */ table = sqlite3_mprintf ("shapetest_%s", suffix); sql = sqlite3_mprintf ("create VIRTUAL TABLE %s USING VirtualShape(\"shapetest1\", UTF-8, 4326);", @@ -341,11 +338,10 @@ sqlite3_free (err_msg); return -30; } sqlite3_free (table); -#endif /* end ICONV conditional */ sqlite3_close (db_handle); spatialite_cleanup_ex (cache); ret = system ("cp sql_stmt_tests/testdb1.sqlite testdb1.sqlite"); @@ -445,8 +441,13 @@ return -39; } free (suffix); +#endif /* end ICONV */ + + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_virtualknn.c ================================================================== --- test/check_virtualknn.c +++ test/check_virtualknn.c @@ -48,10 +48,12 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifndef OMIT_KNN /* only if KNN is enabled */ + static int create_table (sqlite3 * sqlite) { /* creating a test table */ int ret; @@ -150,13 +152,13 @@ sqlite3_errmsg (sqlite)); goto end; } } } - for (y = 4000750.5; y < 4001000.0; y += 1.0) + for (y = 4000750.5; y < 4001000.0; y += 5.0) { - for (x = 100750.5; x < 101000.0; x += 1.0) + for (x = 100750.5; x < 101000.0; x += 5.0) { sqlite3_reset (stmt); sqlite3_clear_bindings (stmt); sqlite3_bind_double (stmt, 1, x); sqlite3_bind_double (stmt, 2, y); @@ -423,10 +425,12 @@ error: if (stmt != NULL) sqlite3_finalize (stmt); return 0; } + +#endif int main (int argc, char *argv[]) { sqlite3 *db_handle = NULL; Index: test/check_virtualtable1.c ================================================================== --- test/check_virtualtable1.c +++ test/check_virtualtable1.c @@ -63,13 +63,10 @@ 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:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { @@ -485,8 +482,11 @@ sqlite3_close (db_handle); spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_virtualtable2.c ================================================================== --- test/check_virtualtable2.c +++ test/check_virtualtable2.c @@ -72,10 +72,21 @@ { fprintf (stderr, "VirtualShape error: %s\n", err_msg); sqlite3_free (err_msg); return -2; } + + ret = + sqlite3_exec (db_handle, "SELECT GetShapefileExtent('shapetest');", + NULL, NULL, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "GetShapefileExtent() error: %s\n", err_msg); + sqlite3_free (err_msg); + return -222; + } + ret = sqlite3_get_table (db_handle, "SELECT RegisterVirtualGeometry('shapetest')", &results, &rows, &columns, &err_msg); if (ret != SQLITE_OK) @@ -1120,10 +1131,13 @@ fprintf (stderr, "VACUUM error: %s\n", err_msg); sqlite3_free (err_msg); sqlite3_close (db_handle); return -132; } +#else + if (db_handle != NULL) + db_handle = NULL; /* silencing stupid compiler warnings */ #endif /* end ICONV conditional */ return 0; } @@ -1134,13 +1148,10 @@ sqlite3 *db_handle = NULL; int ret; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - /* testing current style metadata layout >= v.4.0.0 */ ret = sqlite3_open_v2 (":memory:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) @@ -1215,8 +1226,11 @@ return -20; } #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_virtualtable3.c ================================================================== --- test/check_virtualtable3.c +++ test/check_virtualtable3.c @@ -63,13 +63,10 @@ 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:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { @@ -847,8 +844,11 @@ sqlite3_close (db_handle); spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_virtualtable4.c ================================================================== --- test/check_virtualtable4.c +++ test/check_virtualtable4.c @@ -101,10 +101,11 @@ int main (int argc, char *argv[]) { #ifndef OMIT_FREEXL /* only if FreeXL is supported */ +#ifndef OMIT_ICONV /* only if ICONV is supported */ sqlite3 *db_handle = NULL; char *sql_statement; int ret; char *err_msg = NULL; int i; @@ -111,13 +112,10 @@ 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:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { @@ -451,10 +449,14 @@ } sqlite3_free (err_msg); sqlite3_close (db_handle); spatialite_cleanup_ex (cache); +#endif /* end ICONV conditional */ #endif /* end FreeXL conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_virtualtable5.c ================================================================== --- test/check_virtualtable5.c +++ test/check_virtualtable5.c @@ -100,13 +100,10 @@ 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:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { @@ -198,8 +195,11 @@ sqlite3_close (db_handle); spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_virtualtable6.c ================================================================== --- test/check_virtualtable6.c +++ test/check_virtualtable6.c @@ -101,13 +101,10 @@ 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:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { @@ -265,8 +262,11 @@ sqlite3_close (db_handle); spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_virtualxpath.c ================================================================== --- test/check_virtualxpath.c +++ test/check_virtualxpath.c @@ -49,15 +49,16 @@ #include "config.h" #include "sqlite3.h" #include "spatialite.h" +#ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ + static int load_xml (void *cache, sqlite3 * db_handle, sqlite3_stmt * stmt, const char *path) { -#ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ /* loading an XMLDocument into the DB */ FILE *fl; int sz = 0; int rd; unsigned char *xml = NULL; @@ -101,14 +102,13 @@ ret = sqlite3_step (stmt); if (ret == SQLITE_DONE || ret == SQLITE_ROW) return 1; fprintf (stderr, "INSERT error: %s\n", sqlite3_errmsg (db_handle)); return 0; -#else - return -1; /* no support */ -#endif } + +#endif int main (int argc, char *argv[]) { #ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ @@ -120,13 +120,10 @@ 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:", &db_handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) { @@ -626,8 +623,11 @@ sqlite3_close (db_handle); spatialite_cleanup_ex (cache); #endif /* end LIBXML2 conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/check_wfsin.c ================================================================== --- test/check_wfsin.c +++ test/check_wfsin.c @@ -55,10 +55,11 @@ main (int argc, char *argv[]) { int ret; sqlite3 *handle; char *err_msg = NULL; +#ifdef ENABLE_LIBXML2 /* only if LIBXML2 is supported */ int row_count; int count; int srid; gaiaWFScatalogPtr catalog = NULL; gaiaWFSitemPtr lyr; @@ -67,10 +68,11 @@ char *str; const char *name; int type; int dims; int nillable; +#endif void *cache = spatialite_alloc_connection (); if (argc > 1 || argv[0] == NULL) argc = 1; /* silencing stupid compiler warnings */ Index: test/check_wms.c ================================================================== --- test/check_wms.c +++ test/check_wms.c @@ -1058,10 +1058,98 @@ { fprintf (stderr, "WMS_CreateTables() #2 unexpected success\n"); sqlite3_free_table (results); *retcode = -110; return 0; + } + sqlite3_free_table (results); + +/* testing WMS GetMap Copyright and License */ + ret = + sqlite3_get_table (handle, + "SELECT WMS_SetGetMapCopyright('urlmap_alpha_zero', 'layer', 'somebody')", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "WMS_SetGetMapCopyright() #1 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -111; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "WMS_SetGetMapCopyright() #1 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -112; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "WMS_SetGetMapCopyright() #1 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -113; + return 0; + } + sqlite3_free_table (results); + + ret = + sqlite3_get_table (handle, + "SELECT WMS_SetGetMapCopyright('urlmap_alpha_zero', 'layer', 'someone else', 'CC BY-SA 3.0')", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "WMS_SetGetMapCopyright() #2 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -114; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "WMS_SetGetMapCopyright() #2 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -115; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "WMS_SetGetMapCopyright() #2 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -116; + return 0; + } + sqlite3_free_table (results); + + ret = + sqlite3_get_table (handle, + "SELECT WMS_SetGetMapCopyright('urlmap_alpha_zero', 'layer', NULL, 'CC BY-SA 4.0')", + &results, &rows, &columns, &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "WMS_SetGetMapCopyright() #3 error: %s\n", err_msg); + sqlite3_free (err_msg); + *retcode = -117; + return 0; + } + if (rows != 1 || columns != 1) + { + fprintf (stderr, + "WMS_SetGetMapCopyright() #3 error: rows=%d columns=%d\n", + rows, columns); + sqlite3_free_table (results); + *retcode = -118; + return 0; + } + if (atoi (*(results + 1)) != 1) + { + fprintf (stderr, "WMS_SetGetMapCopyright() #3 unexpected failure\n"); + sqlite3_free_table (results); + *retcode = -119; + return 0; } sqlite3_free_table (results); return 1; } Index: test/check_xls_load.c ================================================================== --- test/check_xls_load.c +++ test/check_xls_load.c @@ -59,13 +59,10 @@ char *err_msg = NULL; unsigned int row_count; int rcnt; 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) { @@ -152,8 +149,11 @@ } spatialite_cleanup_ex (cache); #endif /* end FreeXL conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } ADDED test/orbetello.sqlite Index: test/orbetello.sqlite ================================================================== --- test/orbetello.sqlite +++ test/orbetello.sqlite cannot compute difference between binary files ADDED test/routing_test.c Index: test/routing_test.c ================================================================== --- test/routing_test.c +++ test/routing_test.c @@ -0,0 +1,1521 @@ +/* + + routing_test.c -- SpatiaLite Test Case + + Author: Sandro Furieri + + ------------------------------------------------------------------------------ + + 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) 2011 +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 +#include +#include +#include + +#include "config.h" + +#include "sqlite3.h" +#include "spatialite.h" + +static int +perform_bad_test (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing a generic invalid test */ + int ret; + int result = 1; + + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + result = sqlite3_column_int (stmt, 0); + } + else + { + fprintf (stderr, "CreateRouting Invalid: %s\n", + sqlite3_errmsg (handle)); + result = 0; + break; + } + } + if (result) + return -2; + + return 0; +} + +static int +do_test_invalid_table (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong table-name */ + sqlite3_bind_text (stmt, 1, "invalid", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_from_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_to_from", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid_from (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong node-from */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "roads", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "invalid", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_from_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_to_from", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid_to (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong node-to */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "roads", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "invalid", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_from_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_to_from", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid_geom (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong node-to */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "roads", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "invalid", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_from_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_to_from", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid_cost (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong road-name */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "roads", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "invalid", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_from_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_to_from", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid_name (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong road-name */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "roads", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "invalid", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_from_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_to_from", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid_oneway_from (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong oneway-from */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "roads", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "invalid", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_to_from", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid_oneway_to (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - wrong oneway-to */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "roads", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "invalid", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_1 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #1 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_1", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_2 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #2 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_2", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_3 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #3 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_3", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_4 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #4 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_4", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_5 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #5 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_5", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_6 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #6 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_6", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_7 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #7 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_7", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_8 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #8 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_8", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_9 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #9 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_9", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_10 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #10 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_10", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_11 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #11 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_11", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_12 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #12 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_12", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_13 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #13 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_13", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_14 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #14 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_14", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_15 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #15 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_15", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 1); + sqlite3_bind_text (stmt, 8, "oneway_to_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + return perform_bad_test (handle, stmt); +} + +static int +do_test_bad_16 (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* performing an invalid testcase - bad input table #16 */ + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + sqlite3_bind_text (stmt, 1, "bad_roads_16", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 2, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 3, "node_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "geom", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 5, "cost", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 6, "road_name", -1, SQLITE_TRANSIENT); + sqlite3_bind_int (stmt, 7, 0); + sqlite3_bind_null (stmt, 8); + sqlite3_bind_null (stmt, 9); + return perform_bad_test (handle, stmt); +} + +static int +do_test_invalid (sqlite3 * handle) +{ +/* performing invalid testcases */ + const char *sql; + sqlite3_stmt *stmt = NULL; + int ret; + + sql = + "SELECT CreateRouting('invalid_data', 'invalid', ?, ?, ?, ?, ?, ?, 0, ?, ?, ?)"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateRouting #3: %s\n", sqlite3_errmsg (handle)); + return -1; + } + + if (do_test_invalid_table (handle, stmt) != 0) + return -1; + if (do_test_invalid_from (handle, stmt) != 0) + return -1; + if (do_test_invalid_to (handle, stmt) != 0) + return -1; + if (do_test_invalid_geom (handle, stmt) != 0) + return -1; + if (do_test_invalid_cost (handle, stmt) != 0) + return -1; + if (do_test_invalid_name (handle, stmt) != 0) + return -1; + if (do_test_invalid_oneway_from (handle, stmt) != 0) + return -1; + if (do_test_invalid_oneway_to (handle, stmt) != 0) + return -1; + + if (do_test_bad_1 (handle, stmt) != 0) + return -1; + if (do_test_bad_2 (handle, stmt) != 0) + return -1; + if (do_test_bad_3 (handle, stmt) != 0) + return -1; + if (do_test_bad_4 (handle, stmt) != 0) + return -1; + if (do_test_bad_5 (handle, stmt) != 0) + return -1; + if (do_test_bad_6 (handle, stmt) != 0) + return -1; + if (do_test_bad_7 (handle, stmt) != 0) + return -1; + if (do_test_bad_8 (handle, stmt) != 0) + return -1; + if (do_test_bad_9 (handle, stmt) != 0) + return -1; + if (do_test_bad_10 (handle, stmt) != 0) + return -1; + if (do_test_bad_11 (handle, stmt) != 0) + return -1; + if (do_test_bad_12 (handle, stmt) != 0) + return -1; + if (do_test_bad_13 (handle, stmt) != 0) + return -1; + if (do_test_bad_14 (handle, stmt) != 0) + return -1; + if (do_test_bad_15 (handle, stmt) != 0) + return -1; + if (do_test_bad_16 (handle, stmt) != 0) + return -1; + + sqlite3_finalize (stmt); + return 0; +} + +static int +do_create_spatial_index (sqlite3 * handle, const char *geom) +{ +/* creating a Spatial Index */ + int ok = 0; + sqlite3_stmt *stmt = NULL; + char *sql = + sqlite3_mprintf ("SELECT CreateSpatialIndex('roads', %Q)", geom); + int ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateSpatialIndex: roads.%s #1: %s\n", geom, + sqlite3_errmsg (handle)); + return 0; + } + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + ok = sqlite3_column_int (stmt, 0); + else + { + fprintf (stderr, "CreateSpatialIndex: roads.%s #2: %s\n", geom, + sqlite3_errmsg (handle)); + ok = 0; + break; + } + } + sqlite3_finalize (stmt); + return ok; +} + +static void +set_algorithm (sqlite3_stmt * stmt, int algorithm) +{ +/* setting a routing algorithm */ + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + if (algorithm == 1) + sqlite3_bind_text (stmt, 1, "A*", -1, SQLITE_STATIC); + else + sqlite3_bind_text (stmt, 1, "DIJKSTRA", -1, SQLITE_STATIC); + sqlite3_step (stmt); +} + +static void +set_request (sqlite3_stmt * stmt, int request) +{ +/* setting a routing request */ + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + if (request == 1) + sqlite3_bind_text (stmt, 1, "TSP NN", -1, SQLITE_STATIC); + else if (request == 2) + sqlite3_bind_text (stmt, 1, "TSP GA", -1, SQLITE_STATIC); + else + sqlite3_bind_text (stmt, 1, "SHORTEST PATH", -1, SQLITE_STATIC); + sqlite3_step (stmt); +} + +static void +set_option (sqlite3_stmt * stmt, int option) +{ +/* setting a routing option */ + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + if (option == 1) + sqlite3_bind_text (stmt, 1, "NO LINKS", -1, SQLITE_STATIC); + else if (option == 2) + sqlite3_bind_text (stmt, 1, "NO GEOMETRIES", -1, SQLITE_STATIC); + else if (option == 3) + sqlite3_bind_text (stmt, 1, "SIMPLE", -1, SQLITE_STATIC); + else + sqlite3_bind_text (stmt, 1, "FULL", -1, SQLITE_STATIC); + sqlite3_step (stmt); +} + +static int +do_routing (sqlite3 * handle, sqlite3_stmt * stmt, const char *base_name, + int which, int multi) +{ +/* testing a routing solution */ + int ret; + int ind = strlen (base_name) - 4; + int has_ids = 0; + const char *list_codes = + "RT05301806761GZ,RT05301806955GZ,RT05301806819GZ,RT05301806691GZ,RT05301806772GZ,RT05301806760GZ,RT05301806624GZ"; + const char *list_ids = "58,133,295,352,203,235,342"; + int count = 0; + + if (base_name[ind] == 'i') + has_ids = 1; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + if (has_ids) + { + if (which == 0) + { + sqlite3_bind_int (stmt, 1, 273); + if (multi == 0) + sqlite3_bind_int (stmt, 2, 352); + else + sqlite3_bind_text (stmt, 2, list_ids, strlen (list_ids), + SQLITE_STATIC); + } + else + { + if (multi == 0) + sqlite3_bind_int (stmt, 1, 352); + else + sqlite3_bind_text (stmt, 1, list_ids, strlen (list_ids), + SQLITE_STATIC); + sqlite3_bind_int (stmt, 2, 317); + } + } + else + { + if (which == 0) + { + sqlite3_bind_text (stmt, 1, "RT05301806875GZ", -1, + SQLITE_STATIC); + if (multi == 0) + sqlite3_bind_text (stmt, 2, "RT05301806761GZ", -1, + SQLITE_STATIC); + else + sqlite3_bind_text (stmt, 2, list_codes, strlen (list_codes), + SQLITE_STATIC); + } + else + { + if (multi == 0) + sqlite3_bind_text (stmt, 1, "RT05301806761GZ", -1, + SQLITE_STATIC); + else + sqlite3_bind_text (stmt, 1, list_codes, strlen (list_codes), + SQLITE_STATIC); + sqlite3_bind_text (stmt, 2, "RT05301806875GZ", -1, + SQLITE_STATIC); + } + } + + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + count++; + else + { + fprintf (stderr, "CreateRouting #2: %s\n", + sqlite3_errmsg (handle)); + break; + } + } + return count; +} + +static int +do_range (sqlite3 * handle, sqlite3_stmt * stmt, const char *base_name, + int which, int cost) +{ +/* testing a range solution */ + int ret; + int ind = strlen (base_name) - 4; + int has_ids = 0; + int count = 0; + + if (base_name[ind] == 'i') + has_ids = 1; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + if (which == 0) + { + if (has_ids) + { + sqlite3_bind_int (stmt, 1, 154); + } + else + { + sqlite3_bind_text (stmt, 1, "RT05301806955GZ", -1, + SQLITE_STATIC); + } + if (cost == 0) + sqlite3_bind_double (stmt, 2, 50.0); + else + sqlite3_bind_int (stmt, 2, 50); + } + else + { + if (cost == 0) + sqlite3_bind_double (stmt, 1, 50.0); + else + sqlite3_bind_int (stmt, 1, 50); + if (has_ids) + { + sqlite3_bind_int (stmt, 2, 154); + } + else + { + sqlite3_bind_text (stmt, 2, "RT05301806955GZ", -1, + SQLITE_STATIC); + } + } + + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + count++; + else + { + fprintf (stderr, "CreateRouting #2: %s\n", + sqlite3_errmsg (handle)); + break; + } + } + return count; +} + +static int +do_point2point (sqlite3 * handle, sqlite3_stmt * stmt) +{ +/* testing a poin2point solution */ + int ret; + int count = 0; + + sqlite3_reset (stmt); + sqlite3_clear_bindings (stmt); + + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + count++; + else + { + fprintf (stderr, "CreateRouting #2: %s\n", + sqlite3_errmsg (handle)); + break; + } + } + return count; +} + +static int +do_create_routing_nodes (sqlite3 * handle) +{ +/* adding "id_node_from" and "id_node_to" columns */ + int result = 0; + int ret; + sqlite3_stmt *stmt; + const char *sql = + "SELECT CreateRoutingNodes(NULL, 'roads', 'geom', 'id_node_from', 'id_node_to')"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateRoutingNodes #1: %s\n", + sqlite3_errmsg (handle)); + return -1; + } + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + result = sqlite3_column_int (stmt, 0); + } + else + { + fprintf (stderr, "CreateRoutingNodes #2: %s\n", + sqlite3_errmsg (handle)); + break; + } + } + sqlite3_finalize (stmt); + if (!result) + return -2; + return 1; +} + +static int +do_test (sqlite3 * handle, const char *base_name, int srid, int has_z, + int with_codes, int name, int cost, int oneways) +{ +/* performing one routing test */ + char *sql; + char *data_name; + sqlite3_stmt *stmt; + sqlite3_stmt *stmt_tsp_1 = NULL; + sqlite3_stmt *stmt_tsp_2 = NULL; + sqlite3_stmt *stmt_rng_1 = NULL; + sqlite3_stmt *stmt_rng_2 = NULL; + sqlite3_stmt *stmt_p2p_1 = NULL; + sqlite3_stmt *stmt_p2p_2 = NULL; + sqlite3_stmt *stmt_alg = NULL; + sqlite3_stmt *stmt_req = NULL; + sqlite3_stmt *stmt_opt = NULL; + int ret; + int result = 0; + int with_astar; + int alg; + int req; + int opt; + int count = 0; + + sql = "SELECT CreateRouting(?, ?, 'roads', ?, ?, ?, ?, ?, ?, 1, ?, ?)"; + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt, NULL); + if (ret != SQLITE_OK) + { + fprintf (stderr, "CreateRouting #1: %s\n", sqlite3_errmsg (handle)); + return -1; + } + + data_name = sqlite3_mprintf ("%s_data", base_name); + sqlite3_bind_text (stmt, 1, data_name, strlen (data_name), + SQLITE_TRANSIENT); + sqlite3_free (data_name); + sqlite3_bind_text (stmt, 2, base_name, strlen (base_name), SQLITE_STATIC); + if (with_codes) + { + sqlite3_bind_text (stmt, 3, "node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "node_to", -1, SQLITE_TRANSIENT); + } + else + { + sqlite3_bind_text (stmt, 3, "id_node_from", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 4, "id_node_to", -1, SQLITE_TRANSIENT); + } + if (srid == 3003) + { + if (has_z) + sqlite3_bind_text (stmt, 5, "geom_z", -1, SQLITE_TRANSIENT); + else + sqlite3_bind_text (stmt, 5, "geom", -1, SQLITE_TRANSIENT); + } + else if (srid == 4326) + { + if (has_z) + sqlite3_bind_text (stmt, 5, "geom_wgs84_z", -1, SQLITE_TRANSIENT); + else + sqlite3_bind_text (stmt, 5, "geom_wgs84", -1, SQLITE_TRANSIENT); + } + else + sqlite3_bind_null (stmt, 5); + if (cost) + sqlite3_bind_text (stmt, 6, "cost", -1, SQLITE_TRANSIENT); + else + sqlite3_bind_null (stmt, 6); + if (name) + sqlite3_bind_text (stmt, 7, "road_name", -1, SQLITE_TRANSIENT); + else + sqlite3_bind_null (stmt, 7); + if (srid == 3003 || srid == 4326) + with_astar = 1; + else + with_astar = 0; + sqlite3_bind_int (stmt, 8, with_astar); + if (oneways) + { + sqlite3_bind_text (stmt, 9, "oneway_from_to", -1, SQLITE_TRANSIENT); + sqlite3_bind_text (stmt, 10, "oneway_to_from", -1, SQLITE_TRANSIENT); + } + else + { + sqlite3_bind_null (stmt, 9); + sqlite3_bind_null (stmt, 10); + } + + while (1) + { + ret = sqlite3_step (stmt); + if (ret == SQLITE_DONE) + break; + if (ret == SQLITE_ROW) + { + result = sqlite3_column_int (stmt, 0); + } + else + { + fprintf (stderr, "CreateRouting #2: %s\n", + sqlite3_errmsg (handle)); + break; + } + } + sqlite3_finalize (stmt); + if (!result) + return -2; + +/* creating aux UPDATE queries */ + sql = sqlite3_mprintf ("UPDATE %s SET algorithm = ?", base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_alg, NULL); + sqlite3_free (sql); + sql = sqlite3_mprintf ("UPDATE %s SET request = ?", base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_req, NULL); + sqlite3_free (sql); + sql = sqlite3_mprintf ("UPDATE %s SET options = ?", base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_opt, NULL); + sqlite3_free (sql); + +/* creating the ShortestPath / TSP queries */ + sql = + sqlite3_mprintf ("SELECT * FROM %s WHERE NodeFrom = ? AND NodeTo = ?", + base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tsp_1, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Testing Routing #1a-0: %s\n", + sqlite3_errmsg (handle)); + return -1; + } + sql = + sqlite3_mprintf ("SELECT * FROM %s WHERE NodeTo = ? AND NodeFrom = ?", + base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_tsp_2, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Testing Routing #1a-1: %s\n", + sqlite3_errmsg (handle)); + return -2; + } + +/* creating the Range queries */ + sql = + sqlite3_mprintf ("SELECT * FROM %s WHERE NodeFrom = ? AND Cost <= ?", + base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_rng_1, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Testing Routing #1b-0: %s\n", + sqlite3_errmsg (handle)); + return -3; + } + sql = + sqlite3_mprintf ("SELECT * FROM %s WHERE Cost <= ? AND NodeFrom = ?", + base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_rng_2, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Testing Routing #1b-1: %s\n", + sqlite3_errmsg (handle)); + return -4; + } + +/* creating the Point2Point queries */ + sql = + sqlite3_mprintf ("SELECT * FROM %s WHERE " + "PointFrom = (SELECT geom FROM house_nr WHERE code_hnr = 'RT053018003491CV') AND " + "PointTo = (SELECT geom FROM house_nr WHERE code_hnr = 'RT053018004313CV')", + base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_p2p_1, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Testing Routing #1c-0: %s\n", + sqlite3_errmsg (handle)); + return -5; + } + sql = + sqlite3_mprintf ("SELECT * FROM %s WHERE " + "PointTo = (SELECT geom FROM house_nr WHERE code_hnr = 'RT053018004313CV') AND " + "PointFrom = (SELECT geom FROM house_nr WHERE code_hnr = 'RT053018003491CV')", + base_name); + ret = sqlite3_prepare_v2 (handle, sql, strlen (sql), &stmt_p2p_2, NULL); + sqlite3_free (sql); + if (ret != SQLITE_OK) + { + fprintf (stderr, "Testing Routing #1c-1: %s\n", + sqlite3_errmsg (handle)); + return -6; + } + + for (alg = 0; alg < 2; alg++) + { + if (!with_astar && alg != 0) + continue; /* skipping A* test */ + set_algorithm (stmt_alg, alg); + for (req = 0; req < 3; req++) + { + set_request (stmt_req, req); + for (opt = 0; opt < 4; opt++) + { + int multi = 1; + set_option (stmt_opt, opt); + if (req == 0) + multi = count % 3; + if (count % 2 == 0) + { + if (do_routing + (handle, stmt_tsp_1, base_name, 0, multi) <= 0) + return -7; + } + else + { + if (do_routing + (handle, stmt_tsp_2, base_name, 1, multi) <= 0) + return -8; + } + if (count % 2 == 0) + { + if (do_range + (handle, stmt_rng_1, base_name, 0, + count % 3) <= 0) + return -9; + } + else + { + if (do_range + (handle, stmt_rng_2, base_name, 1, + count % 3) <= 0) + return -10; + } + if (count % 2 == 0) + { + if (do_point2point (handle, stmt_p2p_1) <= 0) + return -11; + } + else + { + if (do_point2point (handle, stmt_p2p_2) <= 0) + return -12; + } + count++; + } + } + } + + sqlite3_finalize (stmt_tsp_1); + sqlite3_finalize (stmt_tsp_2); + sqlite3_finalize (stmt_rng_1); + sqlite3_finalize (stmt_rng_2); + sqlite3_finalize (stmt_p2p_1); + sqlite3_finalize (stmt_p2p_2); + sqlite3_finalize (stmt_alg); + sqlite3_finalize (stmt_req); + sqlite3_finalize (stmt_opt); + + return 0; +} + +int +main (int argc, char *argv[]) +{ + int ret; + sqlite3 *handle; + char *err_msg = NULL; + void *cache = spatialite_alloc_connection (); + + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + + ret = system ("cp orbetello.sqlite copy-orbetello.sqlite"); + if (ret != 0) + { + fprintf (stderr, "cannot copy orbetello.sqlite database\n"); + return -1; + } + + ret = + sqlite3_open_v2 ("copy-orbetello.sqlite", &handle, + SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); + if (ret != SQLITE_OK) + { + fprintf (stderr, "cannot open copy-orbetello.sqlite database: %s\n", + sqlite3_errmsg (handle)); + sqlite3_close (handle); + return -1; + } + + spatialite_init_ex (handle, cache, 0); + + ret = + sqlite3_exec (handle, "SELECT InitSpatialMetadata(1)", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + fprintf (stderr, "InitSpatialMetadata() error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -2; + } + +/* building all Spatial Index */ + if (!do_create_spatial_index (handle, "geom")) + return -3; + if (!do_create_spatial_index (handle, "geom_z")) + return -4; + if (!do_create_spatial_index (handle, "geom_wgs84")) + return -5; + if (!do_create_spatial_index (handle, "geom_wgs84_z")) + return -6; + +/* adding "id_node_from" and "id_node_to" columns */ + if (!do_create_routing_nodes (handle)) + return -7; + +/* testing 2D projected - node-codes, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_2d_cnnn", 3003, 0, 1, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #1 error\n"); + return -8; + } + +/* testing 2D projected - node-codes, name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_2d_cynn", 3003, 0, 1, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #2 error\n"); + return -9; + } + +/* testing 2D projected - node-codes, name, cost, no-oneways */ + ret = do_test (handle, "test_3003_2d_cyyn", 3003, 0, 1, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #3 error\n"); + return -10; + } + +/* testing 2D projected - node-codes, name, cost, oneways */ + ret = do_test (handle, "test_3003_2d_cyyy", 3003, 0, 1, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #4 error\n"); + return -11; + } + +/* testing 3D projected - node-codes, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_3d_cnnn", 3003, 1, 1, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #1 error\n"); + return -12; + } + +/* testing 3D projected - node-codes, name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_3d_cynn", 3003, 1, 1, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #2 error\n"); + return -13; + } + +/* testing 3D projected - node-codes, name, cost, no-oneways */ + ret = do_test (handle, "test_3003_3d_cyyn", 3003, 1, 1, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #3 error\n"); + return -14; + } + +/* testing 3D projected - node-codes, name, cost, oneways */ + ret = do_test (handle, "test_3003_3d_cyyy", 3003, 1, 1, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #4 error\n"); + return -15; + } + +/* testing 2D long/lat - node-codes, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_2d_cnnn", 4326, 0, 1, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #5 error\n"); + return -16; + } + +/* testing 2D long/lat - node-codes, name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_2d_cynn", 4326, 0, 1, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #6 error\n"); + return -17; + } + +/* testing 2D long/lat - node-codes, name, cost, no-oneways */ + ret = do_test (handle, "test_4326_2d_cyyn", 4326, 0, 1, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #7 error\n"); + return -18; + } + +/* testing 2D long/lat - node-codes, name, cost, oneways */ + ret = do_test (handle, "test_4326_2d_cyyy", 4326, 0, 1, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #8 error\n"); + return -19; + } + +/* testing 3D long/lat - node-codes, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_3d_cnnn", 4326, 1, 1, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #9 error\n"); + return -20; + } + +/* testing 3D long/lat - node-codes, name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_3d_cynn", 4326, 1, 1, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #10 error\n"); + return -21; + } + +/* testing 3D long/lat - node-codes, name, cost, no-oneways */ + ret = do_test (handle, "test_4326_3d_cyyn", 4326, 1, 1, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #11 error\n"); + return -22; + } + +/* testing 3D long/lat - node-codes, name, cost, oneways */ + ret = do_test (handle, "test_4326_3d_cyyy", 4326, 1, 1, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #12 error\n"); + return -23; + } + +/* testing no-geometry - node-codes, no-name, cost, no-oneways */ + ret = do_test (handle, "test_none_cnyn", 0, 0, 1, 0, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #13 error\n"); + return -24; + } + +/* testing no-geometry - node-codes, name, cost, no-oneways */ + ret = do_test (handle, "test_none_cyyn", 0, 0, 1, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #14 error\n"); + return -25; + } + +/* testing no-geometry - node-codes, name, cost, oneways */ + ret = do_test (handle, "test_none_cyyy", 0, 0, 1, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #15 error\n"); + return -26; + } + +/* testing 2D projected - node-ids, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_2d_innn", 3003, 0, 0, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #1 error\n"); + return -27; + } + +/* testing 2D projected - node-ids, name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_2d_iynn", 3003, 0, 0, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #2 error\n"); + return -28; + } + +/* testing 2D projected - node-ids, name, cost, no-oneways */ + ret = do_test (handle, "test_3003_2d_iyyn", 3003, 0, 0, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #3 error\n"); + return -29; + } + +/* testing 2D projected - node-ids, name, cost, oneways */ + ret = do_test (handle, "test_3003_2d_iyyy", 3003, 0, 0, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #4 error\n"); + return -30; + } + +/* testing 3D projected - node-ids, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_3d_innn", 3003, 1, 0, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #1 error\n"); + return -31; + } + +/* testing 3D projected - node-ids, name, no-cost, no-oneways */ + ret = do_test (handle, "test_3003_3d_iynn", 3003, 1, 0, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #2 error\n"); + return -32; + } + +/* testing 3D projected - node-ids, name, cost, no-oneways */ + ret = do_test (handle, "test_3003_3d_iyyn", 3003, 1, 0, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #3 error\n"); + return -33; + } + +/* testing 3D projected - node-ids, name, cost, oneways */ + ret = do_test (handle, "test_3003_3d_iyyy", 3003, 1, 0, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #4 error\n"); + return -34; + } + +/* testing 2D long/lat - node-ids, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_2d_innn", 4326, 0, 0, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #5 error\n"); + return -35; + } + +/* testing 2D long/lat - node-ids, name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_2d_iynn", 4326, 0, 0, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #6 error\n"); + return -36; + } + +/* testing 2D long/lat - node-ids, name, cost, no-oneways */ + ret = do_test (handle, "test_4326_2d_iyyn", 4326, 0, 0, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #7 error\n"); + return -37; + } + +/* testing 2D long/lat - node-ids, name, cost, oneways */ + ret = do_test (handle, "test_4326_2d_iyyy", 4326, 0, 0, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #8 error\n"); + return -38; + } + +/* testing 3D long/lat - node-ids, no-name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_3d_innn", 4326, 1, 0, 0, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #9 error\n"); + return -39; + } + +/* testing 3D long/lat - node-ids, name, no-cost, no-oneways */ + ret = do_test (handle, "test_4326_3d_iynn", 4326, 1, 0, 1, 0, 0); + if (ret != 0) + { + fprintf (stderr, "Test #10 error\n"); + return -40; + } + +/* testing 3D long/lat - node-ids, name, cost, no-oneways */ + ret = do_test (handle, "test_4326_3d_iyyn", 4326, 1, 0, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #11 error\n"); + return -41; + } + +/* testing 3D long/lat - node-ids, name, cost, oneways */ + ret = do_test (handle, "test_4326_3d_iyyy", 4326, 1, 0, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #12 error\n"); + return -42; + } + +/* testing no-geometry - node-ids, no-name, cost, no-oneways */ + ret = do_test (handle, "test_none_inyn", 0, 0, 0, 0, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #13 error\n"); + return -43; + } + +/* testing no-geometry - node-ids, name, cost, no-oneways */ + ret = do_test (handle, "test_none_iyyn", 0, 0, 0, 1, 1, 0); + if (ret != 0) + { + fprintf (stderr, "Test #14 error\n"); + return -44; + } + +/* testing no-geometry - node-ids, name, cost, oneways */ + ret = do_test (handle, "test_none_iyyy", 0, 0, 0, 1, 1, 1); + if (ret != 0) + { + fprintf (stderr, "Test #15 error\n"); + return -45; + } + +/* testing invalid cases */ + ret = do_test_invalid (handle); + if (ret != 0) + { + fprintf (stderr, "Test Invalid cases error\n"); + return -4; + } + + spatialite_cleanup_ex (cache); + sqlite3_close (handle); + ret = unlink ("copy-orbetello.sqlite"); + if (ret != 0) + { + fprintf (stderr, "cannot remove copy-orbetello.sqlite\n"); + return -47; + } + + spatialite_shutdown (); + return 0; +} Index: test/shape_3d.c ================================================================== --- test/shape_3d.c +++ test/shape_3d.c @@ -80,13 +80,10 @@ char *dumpname = __FILE__ "dump"; char *err_msg = NULL; int row_count; 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) { @@ -235,8 +232,11 @@ } spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/shape_cp1252.c ================================================================== --- test/shape_cp1252.c +++ test/shape_cp1252.c @@ -60,13 +60,10 @@ char *dbfname = __FILE__ "test.dbf"; char *err_msg = NULL; int row_count; 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) { @@ -170,8 +167,11 @@ } spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/shape_primitives.c ================================================================== --- test/shape_primitives.c +++ test/shape_primitives.c @@ -239,11 +239,11 @@ return -14; } ret = sqlite3_exec (handle, - "INSERT INTO Point_Test (Name, Description, geomXYZM) VALUES ('Point 4', 'Some pointXYZM', GeomFromText('POINT(136 -33 424 233.2)', 4326))", + "INSERT INTO Point_Test (Name, Description, geomXYZM) VALUES ('Point 4', 'Some pointXYZM', GeomFromText('POINTZM(136 -33 424 233.2)', 4326))", NULL, NULL, &err_msg); if (ret != SQLITE_OK) { fprintf (stderr, "INSERT POINT XYZM error: %s\n", err_msg); sqlite3_free (err_msg); @@ -861,29 +861,56 @@ fprintf (stderr, "VACUUM error: %s\n", err_msg); sqlite3_free (err_msg); sqlite3_close (handle); return -66; } +#else + if (handle != NULL) + handle = NULL; /* silencing stupid compiler warnings */ #endif /* end ICONV conditional */ /* ok, succesfull termination */ return 0; } -int -main (int argc, char *argv[]) +static int +do_check_tiny_point_enabled (sqlite3 * handle, int tiny_point) { -#ifndef OMIT_ICONV /* only if ICONV is supported */ -#ifdef ENABLE_RTTOPO /* only if RTTOPO is supported */ +/* testing IsTinyPointEnabed */ + int i; + char **results; + int rows; + int columns; + int value = -1; + int ret = + sqlite3_get_table (handle, "SELECT IsTinyPointEnabled()", &results, + &rows, &columns, NULL); + if (ret != SQLITE_OK) + return -1; + if (rows < 1) + ; + else + { + for (i = 1; i <= rows; i++) + { + value = atoi (results[(i * columns) + 0]); + } + } + sqlite3_free_table (results); + if (value == tiny_point) + return 0; + return -1; +} + +static int +do_test_400 (int tiny_point) +{ int ret; sqlite3 *handle; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - /* testing current style metadata layout >= v.4.0.0 */ ret = sqlite3_open_v2 (":memory:", &handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) @@ -904,10 +931,36 @@ fprintf (stderr, "InitSpatialMetadata() error: %s\n", err_msg); sqlite3_free (err_msg); sqlite3_close (handle); return -2; } + +/* enabling/disabling TinyPoint */ + if (tiny_point) + ret = + sqlite3_exec (handle, "SELECT EnableTinyPoint()", NULL, NULL, + &err_msg); + else + ret = + sqlite3_exec (handle, "SELECT DisableTinyPoint()", NULL, NULL, + &err_msg); + if (ret != SQLITE_OK) + { + if (tiny_point) + fprintf (stderr, "EnableTinyPoint() error: %s\n", err_msg); + else + fprintf (stderr, "DisableTinyPoint() error: %s\n", err_msg); + sqlite3_free (err_msg); + sqlite3_close (handle); + return -3; + } + + if (do_check_tiny_point_enabled (handle, tiny_point) != 0) + { + fprintf (stderr, "IsTinyBlobEnabled() error\n"); + return -4; + } ret = do_test (handle); if (ret != 0) { fprintf (stderr, @@ -915,10 +968,28 @@ return ret; } spatialite_cleanup_ex (cache); sqlite3_close (handle); + + return 0; +} + +int +main (int argc, char *argv[]) +{ +#ifndef OMIT_ICONV /* only if ICONV is supported */ +#ifdef ENABLE_RTTOPO /* only if RTTOPO is supported */ + int ret; + sqlite3 *handle; + void *cache = NULL; + +/* testing current style metadata layout >= v.4.0.0 */ + if (do_test_400 (0) != 0) + return -1; + if (do_test_400 (1) != 0) + return -2; /* testing legacy style metadata layout <= v.3.1.0 */ cache = spatialite_alloc_connection (); ret = system @@ -1090,8 +1161,11 @@ } #endif /* end RTTOPO conditionals */ #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/shape_utf8_1.c ================================================================== --- test/shape_utf8_1.c +++ test/shape_utf8_1.c @@ -357,10 +357,13 @@ sqlite3_free (err_msg); sqlite3_close (handle); return -27; } } +#else + if (handle != NULL && legacy == 0) + handle = NULL; /* silencing stupid compiler warnings */ #endif /* end ICONV conditional */ /* ok, succesfull termination */ return 0; @@ -373,13 +376,10 @@ int ret; sqlite3 *handle; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - /* testing current style metadata layout >= v.4.0.0 */ ret = sqlite3_open_v2 (":memory:", &handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) @@ -465,8 +465,11 @@ return -20; } #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/shape_utf8_1ex.c ================================================================== --- test/shape_utf8_1ex.c +++ test/shape_utf8_1ex.c @@ -362,10 +362,13 @@ sqlite3_free (err_msg); sqlite3_close (handle); return -27; } } +#else + if (handle != NULL && legacy == 0) + handle = NULL; /* silencing stupid compiler warnings */ #endif /* end ICONV conditional */ /* ok, succesfull termination */ return 0; @@ -378,13 +381,10 @@ int ret; sqlite3 *handle; char *err_msg = NULL; void *cache = spatialite_alloc_connection (); - if (argc > 1 || argv[0] == NULL) - argc = 1; /* silencing stupid compiler warnings */ - /* testing current style metadata layout >= v.4.0.0 */ ret = sqlite3_open_v2 (":memory:", &handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); if (ret != SQLITE_OK) @@ -471,8 +471,11 @@ return -20; } #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/shape_utf8_2.c ================================================================== --- test/shape_utf8_2.c +++ test/shape_utf8_2.c @@ -62,13 +62,10 @@ char *geojsonname = __FILE__ "test.geojson"; char *err_msg = NULL; int row_count; 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) { @@ -228,8 +225,11 @@ } spatialite_cleanup_ex (cache); #endif /* end ICONV conditional */ + if (argc > 1 || argv[0] == NULL) + argc = 1; /* silencing stupid compiler warnings */ + spatialite_shutdown (); return 0; } Index: test/sql_stmt_geopackage_tests/Makefile.am ================================================================== --- test/sql_stmt_geopackage_tests/Makefile.am +++ test/sql_stmt_geopackage_tests/Makefile.am @@ -22,10 +22,18 @@ geomfromgpb5.testcase \ geomfromgpb6.testcase \ geomfromgpb7.testcase \ geomfromgpb8.testcase \ geomfromgpb9.testcase \ + gpkg1.testcase \ + gpkg2.testcase \ + gpkg3.testcase \ + gpkg4.testcase \ + gpkg5.testcase \ + gpkg6.testcase \ + gpkg7.testcase \ + gpkg8.testcase \ implicitgeopackagebinary1.testcase \ implicitgeopackagebinary2.testcase \ makepoint1.testcase \ makepoint2.testcase \ makepoint3.testcase \ Index: test/sql_stmt_geopackage_tests/Makefile.in ================================================================== --- test/sql_stmt_geopackage_tests/Makefile.in +++ test/sql_stmt_geopackage_tests/Makefile.in @@ -274,10 +274,18 @@ geomfromgpb5.testcase \ geomfromgpb6.testcase \ geomfromgpb7.testcase \ geomfromgpb8.testcase \ geomfromgpb9.testcase \ + gpkg1.testcase \ + gpkg2.testcase \ + gpkg3.testcase \ + gpkg4.testcase \ + gpkg5.testcase \ + gpkg6.testcase \ + gpkg7.testcase \ + gpkg8.testcase \ implicitgeopackagebinary1.testcase \ implicitgeopackagebinary2.testcase \ makepoint1.testcase \ makepoint2.testcase \ makepoint3.testcase \ ADDED test/sql_stmt_geopackage_tests/gpkg1.testcase Index: test/sql_stmt_geopackage_tests/gpkg1.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg1.testcase +++ test/sql_stmt_geopackage_tests/gpkg1.testcase @@ -0,0 +1,7 @@ +GPKG1 +:memory: #use in-memory database +SELECT AutoGpkgStart() +1 # rows (not including the header row) +1 # columns +AutoGpkgStart() +0 ADDED test/sql_stmt_geopackage_tests/gpkg2.testcase Index: test/sql_stmt_geopackage_tests/gpkg2.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg2.testcase +++ test/sql_stmt_geopackage_tests/gpkg2.testcase @@ -0,0 +1,7 @@ +GPKG2 +:memory: #use in-memory database +SELECT AutoGpkgStop() +1 # rows (not including the header row) +1 # columns +AutoGpkgStop() +0 ADDED test/sql_stmt_geopackage_tests/gpkg3.testcase Index: test/sql_stmt_geopackage_tests/gpkg3.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg3.testcase +++ test/sql_stmt_geopackage_tests/gpkg3.testcase @@ -0,0 +1,7 @@ +GPKG3 +:memory: #use in-memory database +SELECT AutoGpkgStart('a') +1 # rows (not including the header row) +1 # columns +AutoGpkgStart('a') +0 ADDED test/sql_stmt_geopackage_tests/gpkg4.testcase Index: test/sql_stmt_geopackage_tests/gpkg4.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg4.testcase +++ test/sql_stmt_geopackage_tests/gpkg4.testcase @@ -0,0 +1,7 @@ +GPKG4 +:memory: #use in-memory database +SELECT AutoGpkgStart(1) +1 # rows (not including the header row) +1 # columns +AutoGpkgStart(1) +-1 ADDED test/sql_stmt_geopackage_tests/gpkg5.testcase Index: test/sql_stmt_geopackage_tests/gpkg5.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg5.testcase +++ test/sql_stmt_geopackage_tests/gpkg5.testcase @@ -0,0 +1,7 @@ +GPKG5 +:memory: #use in-memory database +SELECT AutoGpkgStop('a') +1 # rows (not including the header row) +1 # columns +AutoGpkgStop('a') +0 ADDED test/sql_stmt_geopackage_tests/gpkg6.testcase Index: test/sql_stmt_geopackage_tests/gpkg6.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg6.testcase +++ test/sql_stmt_geopackage_tests/gpkg6.testcase @@ -0,0 +1,7 @@ +GPKG6 +:memory: #use in-memory database +SELECT AutoGpkgStop(1) +1 # rows (not including the header row) +1 # columns +AutoGpkgStop(1) +-1 ADDED test/sql_stmt_geopackage_tests/gpkg7.testcase Index: test/sql_stmt_geopackage_tests/gpkg7.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg7.testcase +++ test/sql_stmt_geopackage_tests/gpkg7.testcase @@ -0,0 +1,7 @@ +GPKG7 +:memory: #use in-memory database +SELECT AutoGpkgStart(NULL) +1 # rows (not including the header row) +1 # columns +AutoGpkgStart(NULL) +0 ADDED test/sql_stmt_geopackage_tests/gpkg8.testcase Index: test/sql_stmt_geopackage_tests/gpkg8.testcase ================================================================== --- test/sql_stmt_geopackage_tests/gpkg8.testcase +++ test/sql_stmt_geopackage_tests/gpkg8.testcase @@ -0,0 +1,7 @@ +GPKG8 +:memory: #use in-memory database +SELECT AutoGpkgStop(NULL) +1 # rows (not including the header row) +1 # columns +AutoGpkgStop(NULL) +0 Index: test/sql_stmt_geos_tests/Makefile.am ================================================================== --- test/sql_stmt_geos_tests/Makefile.am +++ test/sql_stmt_geos_tests/Makefile.am @@ -152,10 +152,60 @@ distance5.testcase \ distance6.testcase \ distance7.testcase \ distance8.testcase \ distance9.testcase \ + drapeline1.testcase \ + drapeline2.testcase \ + drapeline3.testcase \ + drapeline4.testcase \ + drapeline5.testcase \ + drapeline6.testcase \ + drapeline7.testcase \ + drapeline8.testcase \ + drapeline9.testcase \ + drapeline10.testcase \ + drapeline11.testcase \ + drapeline12.testcase \ + drapeline13.testcase \ + drapeline14.testcase \ + drapeline15.testcase \ + drapeline16.testcase \ + drapeline17.testcase \ + drapeline18.testcase \ + drapeline19.testcase \ + drapeline20.testcase \ + drapeline21.testcase \ + drapeline22.testcase \ + drapelineex1.testcase \ + drapelineex2.testcase \ + drapelineex3.testcase \ + drapelineex4.testcase \ + drapelineex5.testcase \ + drapelineex6.testcase \ + drapelineex7.testcase \ + drapelineex8.testcase \ + drapelineex9.testcase \ + drapelineex10.testcase \ + drapelineex11.testcase \ + drapelineex12.testcase \ + drapelineex13.testcase \ + drapelineex14.testcase \ + drapelineex15.testcase \ + drapelineex16.testcase \ + drapelineex17.testcase \ + drapelineex18.testcase \ + drapelineex19.testcase \ + drapelineex20.testcase \ + drapelineex21.testcase \ + drapelineex22.testcase \ + drapelineex23.testcase \ + drapelineex24.testcase \ + drapelineex25.testcase \ + drapelineex26.testcase \ + drapelineex27.testcase \ + drapelineex28.testcase \ intersection10.testcase \ intersection11.testcase \ intersection12.testcase \ intersection1.testcase \ intersection2.testcase \ @@ -635,10 +685,28 @@ locatepoint5.testcase \ locatepoint6.testcase \ locatepoint7.testcase \ locatepoint8.testcase \ locatepoint9.testcase \ + m_interpolatepoint10.testcase \ + m_interpolatepoint11.testcase \ + m_interpolatepoint12.testcase \ + m_interpolatepoint13.testcase \ + m_interpolatepoint14.testcase \ + m_interpolatepoint15.testcase \ + m_interpolatepoint16.testcase \ + m_interpolatepoint17.testcase \ + m_interpolatepoint18.testcase \ + m_interpolatepoint1.testcase \ + m_interpolatepoint2.testcase \ + m_interpolatepoint3.testcase \ + m_interpolatepoint4.testcase \ + m_interpolatepoint5.testcase \ + m_interpolatepoint6.testcase \ + m_interpolatepoint7.testcase \ + m_interpolatepoint8.testcase \ + m_interpolatepoint9.testcase \ offsetcurve10.testcase \ offsetcurve11.testcase \ offsetcurve12.testcase \ offsetcurve13.testcase \ offsetcurve14.testcase \ Index: test/sql_stmt_geos_tests/Makefile.in ================================================================== --- test/sql_stmt_geos_tests/Makefile.in +++ test/sql_stmt_geos_tests/Makefile.in @@ -405,10 +405,60 @@ distance5.testcase \ distance6.testcase \ distance7.testcase \ distance8.testcase \ distance9.testcase \ + drapeline1.testcase \ + drapeline2.testcase \ + drapeline3.testcase \ + drapeline4.testcase \ + drapeline5.testcase \ + drapeline6.testcase \ + drapeline7.testcase \ + drapeline8.testcase \ + drapeline9.testcase \ + drapeline10.testcase \ + drapeline11.testcase \ + drapeline12.testcase \ + drapeline13.testcase \ + drapeline14.testcase \ + drapeline15.testcase \ + drapeline16.testcase \ + drapeline17.testcase \ + drapeline18.testcase \ + drapeline19.testcase \ + drapeline20.testcase \ + drapeline21.testcase \ + drapeline22.testcase \ + drapelineex1.testcase \ + drapelineex2.testcase \ + drapelineex3.testcase \ + drapelineex4.testcase \ + drapelineex5.testcase \ + drapelineex6.testcase \ + drapelineex7.testcase \ + drapelineex8.testcase \ + drapelineex9.testcase \ + drapelineex10.testcase \ + drapelineex11.testcase \ + drapelineex12.testcase \ + drapelineex13.testcase \ + drapelineex14.testcase \ + drapelineex15.testcase \ + drapelineex16.testcase \ + drapelineex17.testcase \ + drapelineex18.testcase \ + drapelineex19.testcase \ + drapelineex20.testcase \ + drapelineex21.testcase \ + drapelineex22.testcase \ + drapelineex23.testcase \ + drapelineex24.testcase \ + drapelineex25.testcase \ + drapelineex26.testcase \ + drapelineex27.testcase \ + drapelineex28.testcase \ intersection10.testcase \ intersection11.testcase \ intersection12.testcase \ intersection1.testcase \ intersection2.testcase \ @@ -888,10 +938,28 @@ locatepoint5.testcase \ locatepoint6.testcase \ locatepoint7.testcase \ locatepoint8.testcase \ locatepoint9.testcase \ + m_interpolatepoint10.testcase \ + m_interpolatepoint11.testcase \ + m_interpolatepoint12.testcase \ + m_interpolatepoint13.testcase \ + m_interpolatepoint14.testcase \ + m_interpolatepoint15.testcase \ + m_interpolatepoint16.testcase \ + m_interpolatepoint17.testcase \ + m_interpolatepoint18.testcase \ + m_interpolatepoint1.testcase \ + m_interpolatepoint2.testcase \ + m_interpolatepoint3.testcase \ + m_interpolatepoint4.testcase \ + m_interpolatepoint5.testcase \ + m_interpolatepoint6.testcase \ + m_interpolatepoint7.testcase \ + m_interpolatepoint8.testcase \ + m_interpolatepoint9.testcase \ offsetcurve10.testcase \ offsetcurve11.testcase \ offsetcurve12.testcase \ offsetcurve13.testcase \ offsetcurve14.testcase \ ADDED test/sql_stmt_geos_tests/drapeline1.testcase Index: test/sql_stmt_geos_tests/drapeline1.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline1.testcase +++ test/sql_stmt_geos_tests/drapeline1.testcase @@ -0,0 +1,7 @@ +DrapeLine - NULL geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(NULL, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(NULL, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline10.testcase Index: test/sql_stmt_geos_tests/drapeline10.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline10.testcase +++ test/sql_stmt_geos_tests/drapeline10.testcase @@ -0,0 +1,7 @@ +DrapeLine - int geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1)) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline11.testcase Index: test/sql_stmt_geos_tests/drapeline11.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline11.testcase +++ test/sql_stmt_geos_tests/drapeline11.testcase @@ -0,0 +1,7 @@ +DrapeLine - double geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1.2)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1.2)) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline12.testcase Index: test/sql_stmt_geos_tests/drapeline12.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline12.testcase +++ test/sql_stmt_geos_tests/drapeline12.testcase @@ -0,0 +1,7 @@ +DrapeLine - invalid BLOB geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), zeroblob(12))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), zeroblob(12))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline13.testcase Index: test/sql_stmt_geos_tests/drapeline13.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline13.testcase +++ test/sql_stmt_geos_tests/drapeline13.testcase @@ -0,0 +1,7 @@ +DrapeLine - Point BLOB geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), MakePointZ(0, 0, 0))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), MakePointZ(0, 0, 0))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline14.testcase Index: test/sql_stmt_geos_tests/drapeline14.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline14.testcase +++ test/sql_stmt_geos_tests/drapeline14.testcase @@ -0,0 +1,7 @@ +DrapeLine - 2D Linestring geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), GeomFromText('LINESTRING(0 0, 1 1, 5 1)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), GeomFromText('LINESTRING(0 0, 1 1, 5 1)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline15.testcase Index: test/sql_stmt_geos_tests/drapeline15.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline15.testcase +++ test/sql_stmt_geos_tests/drapeline15.testcase @@ -0,0 +1,7 @@ +DrapeLine - mismatching SRIDs +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4325))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4325))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline16.testcase Index: test/sql_stmt_geos_tests/drapeline16.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline16.testcase +++ test/sql_stmt_geos_tests/drapeline16.testcase @@ -0,0 +1,7 @@ +DrapeLine - valid test (no tolerance) +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326))) +LINESTRING Z(0 0 0, 1 1 1, 3 1 1.5, 5 1 2) ADDED test/sql_stmt_geos_tests/drapeline17.testcase Index: test/sql_stmt_geos_tests/drapeline17.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline17.testcase +++ test/sql_stmt_geos_tests/drapeline17.testcase @@ -0,0 +1,7 @@ +DrapeLine - valid test (with tolerance) +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0.1)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0.1)) +LINESTRING Z(0 0 0, 1 1 1, 3 1 1.5, 5 1 2) ADDED test/sql_stmt_geos_tests/drapeline18.testcase Index: test/sql_stmt_geos_tests/drapeline18.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline18.testcase +++ test/sql_stmt_geos_tests/drapeline18.testcase @@ -0,0 +1,7 @@ +DrapeLine - NULL tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), NULL)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), NULL)) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline19.testcase Index: test/sql_stmt_geos_tests/drapeline19.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline19.testcase +++ test/sql_stmt_geos_tests/drapeline19.testcase @@ -0,0 +1,7 @@ +DrapeLine - text tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 'tolerance')); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 'tolerance')) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline2.testcase Index: test/sql_stmt_geos_tests/drapeline2.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline2.testcase +++ test/sql_stmt_geos_tests/drapeline2.testcase @@ -0,0 +1,7 @@ +DrapeLine - text geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine('geom1', GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine('geom1', GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline20.testcase Index: test/sql_stmt_geos_tests/drapeline20.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline20.testcase +++ test/sql_stmt_geos_tests/drapeline20.testcase @@ -0,0 +1,7 @@ +DrapeLine - negative tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), -0.1)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), -0.1)) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline21.testcase Index: test/sql_stmt_geos_tests/drapeline21.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline21.testcase +++ test/sql_stmt_geos_tests/drapeline21.testcase @@ -0,0 +1,7 @@ +DrapeLine - int tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0)) +LINESTRING Z(0 0 0, 1 1 1, 3 1 1.5, 5 1 2) ADDED test/sql_stmt_geos_tests/drapeline22.testcase Index: test/sql_stmt_geos_tests/drapeline22.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline22.testcase +++ test/sql_stmt_geos_tests/drapeline22.testcase @@ -0,0 +1,7 @@ +DrapeLine - BLOB tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), zeroblob(4))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), zeroblob(4))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline3.testcase Index: test/sql_stmt_geos_tests/drapeline3.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline3.testcase +++ test/sql_stmt_geos_tests/drapeline3.testcase @@ -0,0 +1,7 @@ +DrapeLine - int geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(1, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(1, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline4.testcase Index: test/sql_stmt_geos_tests/drapeline4.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline4.testcase +++ test/sql_stmt_geos_tests/drapeline4.testcase @@ -0,0 +1,7 @@ +DrapeLine - double geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(1.2, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(1.2, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline5.testcase Index: test/sql_stmt_geos_tests/drapeline5.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline5.testcase +++ test/sql_stmt_geos_tests/drapeline5.testcase @@ -0,0 +1,7 @@ +DrapeLine - invalid BLOB geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(zeroblob(10), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(zeroblob(10), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline6.testcase Index: test/sql_stmt_geos_tests/drapeline6.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline6.testcase +++ test/sql_stmt_geos_tests/drapeline6.testcase @@ -0,0 +1,7 @@ +DrapeLine - Point geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(MakePoint(0, 0), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(MakePoint(0, 0), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline7.testcase Index: test/sql_stmt_geos_tests/drapeline7.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline7.testcase +++ test/sql_stmt_geos_tests/drapeline7.testcase @@ -0,0 +1,7 @@ +DrapeLine - 3D Linestring geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline8.testcase Index: test/sql_stmt_geos_tests/drapeline8.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline8.testcase +++ test/sql_stmt_geos_tests/drapeline8.testcase @@ -0,0 +1,7 @@ +DrapeLine - NULL geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), NULL)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), NULL)) +(NULL) ADDED test/sql_stmt_geos_tests/drapeline9.testcase Index: test/sql_stmt_geos_tests/drapeline9.testcase ================================================================== --- test/sql_stmt_geos_tests/drapeline9.testcase +++ test/sql_stmt_geos_tests/drapeline9.testcase @@ -0,0 +1,7 @@ +DrapeLine - text geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 'geom2')); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLine(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 'geom2')) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex1.testcase Index: test/sql_stmt_geos_tests/drapelineex1.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex1.testcase +++ test/sql_stmt_geos_tests/drapelineex1.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - NULL geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(NULL, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(NULL, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex10.testcase Index: test/sql_stmt_geos_tests/drapelineex10.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex10.testcase +++ test/sql_stmt_geos_tests/drapelineex10.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - int geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex11.testcase Index: test/sql_stmt_geos_tests/drapelineex11.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex11.testcase +++ test/sql_stmt_geos_tests/drapelineex11.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - double geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1.2)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 1.2)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex12.testcase Index: test/sql_stmt_geos_tests/drapelineex12.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex12.testcase +++ test/sql_stmt_geos_tests/drapelineex12.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - invalid BLOB geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), zeroblob(12))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), zeroblob(12))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex13.testcase Index: test/sql_stmt_geos_tests/drapelineex13.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex13.testcase +++ test/sql_stmt_geos_tests/drapelineex13.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - Point BLOB geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), MakePointZ(0, 0, 0))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), MakePointZ(0, 0, 0))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex14.testcase Index: test/sql_stmt_geos_tests/drapelineex14.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex14.testcase +++ test/sql_stmt_geos_tests/drapelineex14.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - 2D Linestring geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), GeomFromText('LINESTRING(0 0, 1 1, 5 1)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), GeomFromText('LINESTRING(0 0, 1 1, 5 1)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex15.testcase Index: test/sql_stmt_geos_tests/drapelineex15.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex15.testcase +++ test/sql_stmt_geos_tests/drapelineex15.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - mismatching SRIDs +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4325))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4325))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex16.testcase Index: test/sql_stmt_geos_tests/drapelineex16.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex16.testcase +++ test/sql_stmt_geos_tests/drapelineex16.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - valid test (no tolerance) +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex17.testcase Index: test/sql_stmt_geos_tests/drapelineex17.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex17.testcase +++ test/sql_stmt_geos_tests/drapelineex17.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - valid test (with tolerance) +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0.1)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0.1)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex18.testcase Index: test/sql_stmt_geos_tests/drapelineex18.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex18.testcase +++ test/sql_stmt_geos_tests/drapelineex18.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - NULL tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), NULL)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), NULL)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex19.testcase Index: test/sql_stmt_geos_tests/drapelineex19.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex19.testcase +++ test/sql_stmt_geos_tests/drapelineex19.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - text tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 'tolerance')); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 'tolerance')) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex2.testcase Index: test/sql_stmt_geos_tests/drapelineex2.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex2.testcase +++ test/sql_stmt_geos_tests/drapelineex2.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - text geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions('geom1', GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions('geom1', GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex20.testcase Index: test/sql_stmt_geos_tests/drapelineex20.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex20.testcase +++ test/sql_stmt_geos_tests/drapelineex20.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - negative tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), -0.1)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), -0.1)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex21.testcase Index: test/sql_stmt_geos_tests/drapelineex21.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex21.testcase +++ test/sql_stmt_geos_tests/drapelineex21.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - int tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex22.testcase Index: test/sql_stmt_geos_tests/drapelineex22.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex22.testcase +++ test/sql_stmt_geos_tests/drapelineex22.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - NULL interpolated +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, NULL)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, NULL)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex23.testcase Index: test/sql_stmt_geos_tests/drapelineex23.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex23.testcase +++ test/sql_stmt_geos_tests/drapelineex23.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - text interpolated +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 'interpolated')); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 'interpolated')) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex24.testcase Index: test/sql_stmt_geos_tests/drapelineex24.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex24.testcase +++ test/sql_stmt_geos_tests/drapelineex24.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - BLOB interpolated +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, zeroblob(4))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, zeroblob(4))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex25.testcase Index: test/sql_stmt_geos_tests/drapelineex25.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex25.testcase +++ test/sql_stmt_geos_tests/drapelineex25.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - Double interpolated +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 1.2)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 1.2)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex26.testcase Index: test/sql_stmt_geos_tests/drapelineex26.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex26.testcase +++ test/sql_stmt_geos_tests/drapelineex26.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - BLOB tolerance +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), zeroblob(4))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 3 1, 5 1)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), zeroblob(4))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex27.testcase Index: test/sql_stmt_geos_tests/drapelineex27.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex27.testcase +++ test/sql_stmt_geos_tests/drapelineex27.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - interpolated=TRUE +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(1 0, 0 0, 1 1, 3 1, 5 1, 5 2)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 1)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(1 0, 0 0, 1 1, 3 1, 5 1, 5 2)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 1)) +MULTIPOINT Z(1 0 0, 5 2 0) ADDED test/sql_stmt_geos_tests/drapelineex28.testcase Index: test/sql_stmt_geos_tests/drapelineex28.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex28.testcase +++ test/sql_stmt_geos_tests/drapelineex28.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - interpolated=FALSE +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(1 0, 0 0, 1 1, 3 1, 5 1, 5 2)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 0)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(1 0, 0 0, 1 1, 3 1, 5 1, 5 2)', 4326), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)', 4326), 0, 0)) +MULTIPOINT Z(1 0 0, 3 1 1.5, 5 2 0) ADDED test/sql_stmt_geos_tests/drapelineex3.testcase Index: test/sql_stmt_geos_tests/drapelineex3.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex3.testcase +++ test/sql_stmt_geos_tests/drapelineex3.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - int geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(1, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(1, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex4.testcase Index: test/sql_stmt_geos_tests/drapelineex4.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex4.testcase +++ test/sql_stmt_geos_tests/drapelineex4.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - double geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(1.2, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(1.2, GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex5.testcase Index: test/sql_stmt_geos_tests/drapelineex5.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex5.testcase +++ test/sql_stmt_geos_tests/drapelineex5.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - invalid BLOB geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(zeroblob(10), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(zeroblob(10), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex6.testcase Index: test/sql_stmt_geos_tests/drapelineex6.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex6.testcase +++ test/sql_stmt_geos_tests/drapelineex6.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - Point geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(MakePoint(0, 0), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(MakePoint(0, 0), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex7.testcase Index: test/sql_stmt_geos_tests/drapelineex7.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex7.testcase +++ test/sql_stmt_geos_tests/drapelineex7.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - 3D Linestring geom1 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'), GeomFromText('LINESTRING Z(0 0 0, 1 1 1, 5 1 2)'))) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex8.testcase Index: test/sql_stmt_geos_tests/drapelineex8.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex8.testcase +++ test/sql_stmt_geos_tests/drapelineex8.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - NULL geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), NULL)); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), NULL)) +(NULL) ADDED test/sql_stmt_geos_tests/drapelineex9.testcase Index: test/sql_stmt_geos_tests/drapelineex9.testcase ================================================================== --- test/sql_stmt_geos_tests/drapelineex9.testcase +++ test/sql_stmt_geos_tests/drapelineex9.testcase @@ -0,0 +1,7 @@ +DrapeLineExceptions - text geom2 +:memory: #use in-memory database +SELECT AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 'geom2')); +1 # rows (not including the header row) +1 # columns +AsText(ST_DrapeLineExceptions(GeomFromText('LINESTRING(0 0, 1 1, 5 1)'), 'geom2')) +(NULL) Index: test/sql_stmt_geos_tests/hexgrid22.testcase ================================================================== --- test/sql_stmt_geos_tests/hexgrid22.testcase +++ test/sql_stmt_geos_tests/hexgrid22.testcase @@ -1,7 +1,7 @@ HexagonalGrid - valid - with Origin, MultiLinestring :memory: #use in-memory database -SELECT ST_NumGeometries(HexagonalGrid(GeomFromText('POLYGON((0.2 0.2, 2.2 0.2, 2.2 1.2, 0.2 1.2, 0.2 0.2))', 4326), 1.0, 1, GeomFromText('POINT(0.1 0.1)'))); +SELECT ST_NumGeometries(HexagonalGrid(GeomFromText('POLYGON((0.2 0.2, 2.2 0.2, 2.2 1.2, 0.2 1.2, 0.2 0.2))', 4326), 1.0, 1, GeomFromText('POINT(0.5 0.5)'))); 1 # rows (not including the header row) 1 # columns -ST_NumGeometries(HexagonalGrid(GeomFromText('POLYGON((0.2 0.2, 2.2 0.2, 2.2 1.2, 0.2 1.2, 0.2 0.2))', 4326), 1.0, 1, GeomFromText('POINT(0.1 0.1)'))) -22 +ST_NumGeometries(HexagonalGrid(GeomFromText('POLYGON((0.2 0.2, 2.2 0.2, 2.2 1.2, 0.2 1.2, 0.2 0.2))', 4326), 1.0, 1, GeomFromText('POINT(0.5 0.5)'))) +20 ADDED test/sql_stmt_geos_tests/m_interpolatepoint1.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint1.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint1.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint1.testcase @@ -0,0 +1,7 @@ +interpolate point - NULL first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(NULL, MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(NULL, MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint10.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint10.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint10.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint10.testcase @@ -0,0 +1,7 @@ +interpolate point - NULL second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), NULL); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), NULL) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint11.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint11.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint11.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint11.testcase @@ -0,0 +1,7 @@ +interpolate point - Int second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), 1); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), 1) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint12.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint12.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint12.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint12.testcase @@ -0,0 +1,7 @@ +interpolate point - Double second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), 1.5); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), 1.5) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint13.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint13.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint13.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint13.testcase @@ -0,0 +1,7 @@ +interpolate point - Text second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), 'geom'); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), 'geom') +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint14.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint14.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint14.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint14.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid BLOB second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), zeroblob(10)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), zeroblob(10)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint15.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint15.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint15.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint15.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid Linestring second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('LINESTRING(5 5, 6 6)')); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('LINESTRING(5 5, 6 6)')) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint16.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint16.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint16.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint16.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid Polygon second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))')) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint17.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint17.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint17.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint17.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid MultiPoint second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('MULTIPOINT(0 0, 1 0)')); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('MULTIPOINT(0 0, 1 0)')) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint18.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint18.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint18.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint18.testcase @@ -0,0 +1,7 @@ +interpolate point - valid Point second geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('POINT(5 5)')); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING M(0 0 0, 10 0 20)'), GeomFromText('POINT(5 5)')) +10.0 ADDED test/sql_stmt_geos_tests/m_interpolatepoint2.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint2.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint2.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint2.testcase @@ -0,0 +1,7 @@ +interpolate point - Int first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(1, MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(1, MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint3.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint3.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint3.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint3.testcase @@ -0,0 +1,7 @@ +interpolate point - Double first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(1.5, MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(1.5, MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint4.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint4.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint4.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint4.testcase @@ -0,0 +1,7 @@ +interpolate point - Text first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint('geom', MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint('geom', MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint5.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint5.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint5.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint5.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid BLOB first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(zeroblob(10), MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(zeroblob(10), MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint6.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint6.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint6.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint6.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid Point first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(MakePoint(0, 0), MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(MakePoint(0, 0), MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint7.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint7.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint7.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint7.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid Polygon first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'), MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'), MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint8.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint8.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint8.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint8.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid non M Linestring first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('LINESTRING(0 0, 10 0)'), MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('LINESTRING(0 0, 10 0)'), MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_geos_tests/m_interpolatepoint9.testcase Index: test/sql_stmt_geos_tests/m_interpolatepoint9.testcase ================================================================== --- test/sql_stmt_geos_tests/m_interpolatepoint9.testcase +++ test/sql_stmt_geos_tests/m_interpolatepoint9.testcase @@ -0,0 +1,7 @@ +interpolate point - Invalid MultiLinestring first geometry +:memory: #use in-memory database +SELECT ST_InterpolatePoint(GeomFromText('MULTILINESTRING M((0 0 0, 10 0 20), (100 0 0, 110 0 20))'), MakePoint(5, 5)); +1 # rows (not including the header row) +1 # columns +ST_InterpolatePoint(GeomFromText('MULTILINESTRING M((0 0 0, 10 0 20), (100 0 0, 110 0 20))'), MakePoint(5, 5)) +(NULL) ADDED test/sql_stmt_iconv_tests/Makefile.am Index: test/sql_stmt_iconv_tests/Makefile.am ================================================================== --- test/sql_stmt_iconv_tests/Makefile.am +++ test/sql_stmt_iconv_tests/Makefile.am @@ -0,0 +1,207 @@ + +EXTRA_DIST = decodeurl1.testcase \ + decodeurl2.testcase \ + decodeurl3.testcase \ + decodeurl4.testcase \ + decodeurl5.testcase \ + decodeurl6.testcase \ + decodeurl7.testcase \ + decodeurl8.testcase \ + decodeurl9.testcase \ + decodeurl10.testcase \ + decodeurl11.testcase \ + encodeurl1.testcase \ + encodeurl2.testcase \ + encodeurl3.testcase \ + encodeurl4.testcase \ + encodeurl5.testcase \ + encodeurl6.testcase \ + encodeurl7.testcase \ + encodeurl8.testcase \ + encodeurl9.testcase \ + encodeurl10.testcase \ + encodeurl11.testcase \ + sp_allvars1.testcase \ + sp_allvars2.testcase \ + sp_allvars3.testcase \ + sp_allvars4.testcase \ + sp_allvars5.testcase \ + sp_allvars6.testcase \ + sp_cookedsql1.testcase \ + sp_cookedsql2.testcase \ + sp_cookedsql3.testcase \ + sp_cookedsql4.testcase \ + sp_cookedsql5.testcase \ + sp_cookedsql6.testcase \ + sp_cookedsql7.testcase \ + sp_cookedsql8.testcase \ + sp_cookedsql9.testcase \ + sp_cookedsql10.testcase \ + sp_cookedsql11.testcase \ + sp_cookedsql12.testcase \ + sp_cookedsql13.testcase \ + sp_createtables.testcase \ + sp_delete1.testcase \ + sp_delete2.testcase \ + sp_delete3.testcase \ + sp_delete4.testcase \ + sp_delete5.testcase \ + sp_deletevar1.testcase \ + sp_deletevar2.testcase \ + sp_deletevar3.testcase \ + sp_deletevar4.testcase \ + sp_deletevar5.testcase \ + sp_execute1.testcase \ + sp_execute2.testcase \ + sp_execute3.testcase \ + sp_execute4.testcase \ + sp_execute5.testcase \ + sp_execute6.testcase \ + sp_execute7.testcase \ + sp_execute8.testcase \ + sp_execute9.testcase \ + sp_execute10.testcase \ + sp_execute11.testcase \ + sp_execute12.testcase \ + sp_execute13.testcase \ + sp_executestored1.testcase \ + sp_executestored2.testcase \ + sp_executestored3.testcase \ + sp_executestored4.testcase \ + sp_executestored5.testcase \ + sp_fetch1.testcase \ + sp_fetch2.testcase \ + sp_fetch3.testcase \ + sp_fetch4.testcase \ + sp_fetch5.testcase \ + sp_fetchval1.testcase \ + sp_fetchval2.testcase \ + sp_fetchval3.testcase \ + sp_fetchval4.testcase \ + sp_fetchval5.testcase \ + sp_fetchvar1.testcase \ + sp_fetchvar2.testcase \ + sp_fetchvar3.testcase \ + sp_fetchvar4.testcase \ + sp_fetchvar5.testcase \ + sp_fromtext1.testcase \ + sp_fromtext2.testcase \ + sp_fromtext3.testcase \ + sp_fromtext4.testcase \ + sp_fromtext5.testcase \ + sp_fromtext6.testcase \ + sp_fromtext7.testcase \ + sp_fromtext8.testcase \ + sp_fromtext9.testcase \ + sp_fromtext10.testcase \ + sp_fromtext11.testcase \ + sp_fromtext12.testcase \ + sp_isvalid1.testcase \ + sp_isvalid2.testcase \ + sp_isvalid3.testcase \ + sp_isvalid4.testcase \ + sp_isvalid5.testcase \ + sp_isvalid6.testcase \ + sp_isvalidvar1.testcase \ + sp_isvalidvar2.testcase \ + sp_isvalidvar3.testcase \ + sp_isvalidvar4.testcase \ + sp_isvalidvar5.testcase \ + sp_isvalidvar6.testcase \ + sp_lasterror.testcase \ + sp_numvars1.testcase \ + sp_numvars2.testcase \ + sp_numvars3.testcase \ + sp_numvars4.testcase \ + sp_numvars5.testcase \ + sp_numvars6.testcase \ + sp_rawsql1.testcase \ + sp_rawsql2.testcase \ + sp_rawsql3.testcase \ + sp_rawsql4.testcase \ + sp_rawsql5.testcase \ + sp_rawsql6.testcase \ + sp_register1.testcase \ + sp_register2.testcase \ + sp_register3.testcase \ + sp_register4.testcase \ + sp_register5.testcase \ + sp_register6.testcase \ + sp_register7.testcase \ + sp_register8.testcase \ + sp_register9.testcase \ + sp_register10.testcase \ + sp_register11.testcase \ + sp_register12.testcase \ + sp_register13.testcase \ + sp_register14.testcase \ + sp_registervar1.testcase \ + sp_registervar2.testcase \ + sp_registervar3.testcase \ + sp_registervar4.testcase \ + sp_registervar5.testcase \ + sp_registervar6.testcase \ + sp_registervar7.testcase \ + sp_registervar8.testcase \ + sp_registervar9.testcase \ + sp_registervar10.testcase \ + sp_registervar11.testcase \ + sp_registervar12.testcase \ + sp_registervar13.testcase \ + sp_updatesql1.testcase \ + sp_updatesql2.testcase \ + sp_updatesql3.testcase \ + sp_updatesql4.testcase \ + sp_updatesql5.testcase \ + sp_updatesql6.testcase \ + sp_updatesql7.testcase \ + sp_updatesql8.testcase \ + sp_updatesql9.testcase \ + sp_updatetitle1.testcase \ + sp_updatetitle2.testcase \ + sp_updatetitle3.testcase \ + sp_updatetitle4.testcase \ + sp_updatetitle5.testcase \ + sp_updatetitle6.testcase \ + sp_updatetitle7.testcase \ + sp_updatetitle8.testcase \ + sp_updatetitle9.testcase \ + sp_updatevartitle1.testcase \ + sp_updatevartitle2.testcase \ + sp_updatevartitle3.testcase \ + sp_updatevartitle4.testcase \ + sp_updatevartitle5.testcase \ + sp_updatevartitle6.testcase \ + sp_updatevartitle7.testcase \ + sp_updatevartitle8.testcase \ + sp_updatevartitle9.testcase \ + sp_updatevarval1.testcase \ + sp_updatevarval2.testcase \ + sp_updatevarval3.testcase \ + sp_updatevarval4.testcase \ + sp_updatevarval5.testcase \ + sp_updatevarval6.testcase \ + sp_updatevarval7.testcase \ + sp_updatevarval8.testcase \ + sp_updatevarval9.testcase \ + sp_var_n1.testcase \ + sp_var_n2.testcase \ + sp_var_n3.testcase \ + sp_var_n4.testcase \ + sp_var_n5.testcase \ + sp_var_n6.testcase \ + sp_var_n7.testcase \ + sp_var_n8.testcase \ + sp_var_n9.testcase \ + sp_var_n10.testcase \ + sp_var_n11.testcase \ + sp_var_n12.testcase \ + sp_vararg1.testcase \ + sp_vararg2.testcase \ + sp_vararg3.testcase \ + sp_vararg4.testcase \ + sp_vararg5.testcase \ + sp_vararg6.testcase \ + sp_vararg7.testcase \ + sp_vararg8.testcase \ + sp_vararg9.testcase ADDED test/sql_stmt_iconv_tests/Makefile.in Index: test/sql_stmt_iconv_tests/Makefile.in ================================================================== --- test/sql_stmt_iconv_tests/Makefile.in +++ test/sql_stmt_iconv_tests/Makefile.in @@ -0,0 +1,655 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/sql_stmt_iconv_tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GEOSCONFIG = @GEOSCONFIG@ +GEOS_CFLAGS = @GEOS_CFLAGS@ +GEOS_LDFLAGS = @GEOS_LDFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = decodeurl1.testcase \ + decodeurl2.testcase \ + decodeurl3.testcase \ + decodeurl4.testcase \ + decodeurl5.testcase \ + decodeurl6.testcase \ + decodeurl7.testcase \ + decodeurl8.testcase \ + decodeurl9.testcase \ + decodeurl10.testcase \ + decodeurl11.testcase \ + encodeurl1.testcase \ + encodeurl2.testcase \ + encodeurl3.testcase \ + encodeurl4.testcase \ + encodeurl5.testcase \ + encodeurl6.testcase \ + encodeurl7.testcase \ + encodeurl8.testcase \ + encodeurl9.testcase \ + encodeurl10.testcase \ + encodeurl11.testcase \ + sp_allvars1.testcase \ + sp_allvars2.testcase \ + sp_allvars3.testcase \ + sp_allvars4.testcase \ + sp_allvars5.testcase \ + sp_allvars6.testcase \ + sp_cookedsql1.testcase \ + sp_cookedsql2.testcase \ + sp_cookedsql3.testcase \ + sp_cookedsql4.testcase \ + sp_cookedsql5.testcase \ + sp_cookedsql6.testcase \ + sp_cookedsql7.testcase \ + sp_cookedsql8.testcase \ + sp_cookedsql9.testcase \ + sp_cookedsql10.testcase \ + sp_cookedsql11.testcase \ + sp_cookedsql12.testcase \ + sp_cookedsql13.testcase \ + sp_createtables.testcase \ + sp_delete1.testcase \ + sp_delete2.testcase \ + sp_delete3.testcase \ + sp_delete4.testcase \ + sp_delete5.testcase \ + sp_deletevar1.testcase \ + sp_deletevar2.testcase \ + sp_deletevar3.testcase \ + sp_deletevar4.testcase \ + sp_deletevar5.testcase \ + sp_execute1.testcase \ + sp_execute2.testcase \ + sp_execute3.testcase \ + sp_execute4.testcase \ + sp_execute5.testcase \ + sp_execute6.testcase \ + sp_execute7.testcase \ + sp_execute8.testcase \ + sp_execute9.testcase \ + sp_execute10.testcase \ + sp_execute11.testcase \ + sp_execute12.testcase \ + sp_execute13.testcase \ + sp_executestored1.testcase \ + sp_executestored2.testcase \ + sp_executestored3.testcase \ + sp_executestored4.testcase \ + sp_executestored5.testcase \ + sp_fetch1.testcase \ + sp_fetch2.testcase \ + sp_fetch3.testcase \ + sp_fetch4.testcase \ + sp_fetch5.testcase \ + sp_fetchval1.testcase \ + sp_fetchval2.testcase \ + sp_fetchval3.testcase \ + sp_fetchval4.testcase \ + sp_fetchval5.testcase \ + sp_fetchvar1.testcase \ + sp_fetchvar2.testcase \ + sp_fetchvar3.testcase \ + sp_fetchvar4.testcase \ + sp_fetchvar5.testcase \ + sp_fromtext1.testcase \ + sp_fromtext2.testcase \ + sp_fromtext3.testcase \ + sp_fromtext4.testcase \ + sp_fromtext5.testcase \ + sp_fromtext6.testcase \ + sp_fromtext7.testcase \ + sp_fromtext8.testcase \ + sp_fromtext9.testcase \ + sp_fromtext10.testcase \ + sp_fromtext11.testcase \ + sp_fromtext12.testcase \ + sp_isvalid1.testcase \ + sp_isvalid2.testcase \ + sp_isvalid3.testcase \ + sp_isvalid4.testcase \ + sp_isvalid5.testcase \ + sp_isvalid6.testcase \ + sp_isvalidvar1.testcase \ + sp_isvalidvar2.testcase \ + sp_isvalidvar3.testcase \ + sp_isvalidvar4.testcase \ + sp_isvalidvar5.testcase \ + sp_isvalidvar6.testcase \ + sp_lasterror.testcase \ + sp_numvars1.testcase \ + sp_numvars2.testcase \ + sp_numvars3.testcase \ + sp_numvars4.testcase \ + sp_numvars5.testcase \ + sp_numvars6.testcase \ + sp_rawsql1.testcase \ + sp_rawsql2.testcase \ + sp_rawsql3.testcase \ + sp_rawsql4.testcase \ + sp_rawsql5.testcase \ + sp_rawsql6.testcase \ + sp_register1.testcase \ + sp_register2.testcase \ + sp_register3.testcase \ + sp_register4.testcase \ + sp_register5.testcase \ + sp_register6.testcase \ + sp_register7.testcase \ + sp_register8.testcase \ + sp_register9.testcase \ + sp_register10.testcase \ + sp_register11.testcase \ + sp_register12.testcase \ + sp_register13.testcase \ + sp_register14.testcase \ + sp_registervar1.testcase \ + sp_registervar2.testcase \ + sp_registervar3.testcase \ + sp_registervar4.testcase \ + sp_registervar5.testcase \ + sp_registervar6.testcase \ + sp_registervar7.testcase \ + sp_registervar8.testcase \ + sp_registervar9.testcase \ + sp_registervar10.testcase \ + sp_registervar11.testcase \ + sp_registervar12.testcase \ + sp_registervar13.testcase \ + sp_updatesql1.testcase \ + sp_updatesql2.testcase \ + sp_updatesql3.testcase \ + sp_updatesql4.testcase \ + sp_updatesql5.testcase \ + sp_updatesql6.testcase \ + sp_updatesql7.testcase \ + sp_updatesql8.testcase \ + sp_updatesql9.testcase \ + sp_updatetitle1.testcase \ + sp_updatetitle2.testcase \ + sp_updatetitle3.testcase \ + sp_updatetitle4.testcase \ + sp_updatetitle5.testcase \ + sp_updatetitle6.testcase \ + sp_updatetitle7.testcase \ + sp_updatetitle8.testcase \ + sp_updatetitle9.testcase \ + sp_updatevartitle1.testcase \ + sp_updatevartitle2.testcase \ + sp_updatevartitle3.testcase \ + sp_updatevartitle4.testcase \ + sp_updatevartitle5.testcase \ + sp_updatevartitle6.testcase \ + sp_updatevartitle7.testcase \ + sp_updatevartitle8.testcase \ + sp_updatevartitle9.testcase \ + sp_updatevarval1.testcase \ + sp_updatevarval2.testcase \ + sp_updatevarval3.testcase \ + sp_updatevarval4.testcase \ + sp_updatevarval5.testcase \ + sp_updatevarval6.testcase \ + sp_updatevarval7.testcase \ + sp_updatevarval8.testcase \ + sp_updatevarval9.testcase \ + sp_var_n1.testcase \ + sp_var_n2.testcase \ + sp_var_n3.testcase \ + sp_var_n4.testcase \ + sp_var_n5.testcase \ + sp_var_n6.testcase \ + sp_var_n7.testcase \ + sp_var_n8.testcase \ + sp_var_n9.testcase \ + sp_var_n10.testcase \ + sp_var_n11.testcase \ + sp_var_n12.testcase \ + sp_vararg1.testcase \ + sp_vararg2.testcase \ + sp_vararg3.testcase \ + sp_vararg4.testcase \ + sp_vararg5.testcase \ + sp_vararg6.testcase \ + sp_vararg7.testcase \ + sp_vararg8.testcase \ + sp_vararg9.testcase + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/sql_stmt_iconv_tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/sql_stmt_iconv_tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: ADDED test/sql_stmt_iconv_tests/decodeurl1.testcase Index: test/sql_stmt_iconv_tests/decodeurl1.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl1.testcase +++ test/sql_stmt_iconv_tests/decodeurl1.testcase @@ -0,0 +1,7 @@ +DecodeURL - NULL +:memory: #use in-memory database +SELECT DecodeURL(NULL); +1 # rows (not including the header row) +1 # columns +DecodeURL(NULL) +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl10.testcase Index: test/sql_stmt_iconv_tests/decodeurl10.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl10.testcase +++ test/sql_stmt_iconv_tests/decodeurl10.testcase @@ -0,0 +1,7 @@ +DecodeURL - invalid charset +:memory: #use in-memory database +SELECT DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 'invalid'); +1 # rows (not including the header row) +1 # columns +DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 'invalid') +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl11.testcase Index: test/sql_stmt_iconv_tests/decodeurl11.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl11.testcase +++ test/sql_stmt_iconv_tests/decodeurl11.testcase @@ -0,0 +1,7 @@ +DecodeURL - valid charset +:memory: #use in-memory database +SELECT DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 'CP1252'); +1 # rows (not including the header row) +1 # columns +DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 'CP1252') +http://www.acme.it/search?q1=però più perché ADDED test/sql_stmt_iconv_tests/decodeurl2.testcase Index: test/sql_stmt_iconv_tests/decodeurl2.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl2.testcase +++ test/sql_stmt_iconv_tests/decodeurl2.testcase @@ -0,0 +1,7 @@ +DecodeURL - INT +:memory: #use in-memory database +SELECT DecodeURL(1); +1 # rows (not including the header row) +1 # columns +DecodeURL(1) +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl3.testcase Index: test/sql_stmt_iconv_tests/decodeurl3.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl3.testcase +++ test/sql_stmt_iconv_tests/decodeurl3.testcase @@ -0,0 +1,7 @@ +DecodeURL - DOUBLE +:memory: #use in-memory database +SELECT DecodeURL(1.5); +1 # rows (not including the header row) +1 # columns +DecodeURL(1.5) +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl4.testcase Index: test/sql_stmt_iconv_tests/decodeurl4.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl4.testcase +++ test/sql_stmt_iconv_tests/decodeurl4.testcase @@ -0,0 +1,7 @@ +DecodeURL - BLOB +:memory: #use in-memory database +SELECT DecodeURL(zeroblob(4)); +1 # rows (not including the header row) +1 # columns +DecodeURL(zeroblob(4)) +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl5.testcase Index: test/sql_stmt_iconv_tests/decodeurl5.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl5.testcase +++ test/sql_stmt_iconv_tests/decodeurl5.testcase @@ -0,0 +1,7 @@ +DecodeURL - valid +:memory: #use in-memory database +SELECT DecodeURL('http://www.acme.it/search?q1=C+%26+opeator&q2=C%2b%2b+%2a+operator'); +1 # rows (not including the header row) +1 # columns +DecodeURL('http://www.acme.it/search?q1=C+%26+opeator&q2=C%2b%2b+%2a+operator') +http://www.acme.it/search?q1=C & opeator&q2=C++ * operator ADDED test/sql_stmt_iconv_tests/decodeurl6.testcase Index: test/sql_stmt_iconv_tests/decodeurl6.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl6.testcase +++ test/sql_stmt_iconv_tests/decodeurl6.testcase @@ -0,0 +1,7 @@ +DecodeURL - NULL charset +:memory: #use in-memory database +SELECT DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', NULL); +1 # rows (not including the header row) +1 # columns +DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', NULL) +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl7.testcase Index: test/sql_stmt_iconv_tests/decodeurl7.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl7.testcase +++ test/sql_stmt_iconv_tests/decodeurl7.testcase @@ -0,0 +1,7 @@ +DecodeURL - INT charset +:memory: #use in-memory database +SELECT DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 1); +1 # rows (not including the header row) +1 # columns +DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 1) +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl8.testcase Index: test/sql_stmt_iconv_tests/decodeurl8.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl8.testcase +++ test/sql_stmt_iconv_tests/decodeurl8.testcase @@ -0,0 +1,7 @@ +DecodeURL - DOUBLE charset +:memory: #use in-memory database +SELECT DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 1.5); +1 # rows (not including the header row) +1 # columns +DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', 1.5) +(NULL) ADDED test/sql_stmt_iconv_tests/decodeurl9.testcase Index: test/sql_stmt_iconv_tests/decodeurl9.testcase ================================================================== --- test/sql_stmt_iconv_tests/decodeurl9.testcase +++ test/sql_stmt_iconv_tests/decodeurl9.testcase @@ -0,0 +1,7 @@ +DecodeURL - BLOB charset +:memory: #use in-memory database +SELECT DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +DecodeURL('http://www.acme.it/search?q1=per%f2%20pi%f9%20perch%e9', zeroblob(4)) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl1.testcase Index: test/sql_stmt_iconv_tests/encodeurl1.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl1.testcase +++ test/sql_stmt_iconv_tests/encodeurl1.testcase @@ -0,0 +1,7 @@ +EncodeURL - NULL +:memory: #use in-memory database +SELECT EncodeURL(NULL); +1 # rows (not including the header row) +1 # columns +EncodeURL(NULL) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl10.testcase Index: test/sql_stmt_iconv_tests/encodeurl10.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl10.testcase +++ test/sql_stmt_iconv_tests/encodeurl10.testcase @@ -0,0 +1,7 @@ +EncodeURL - invalid charset +:memory: #use in-memory database +SELECT EncodeURL('però più perché', 'invalid'); +1 # rows (not including the header row) +1 # columns +EncodeURL('però più perché', 'invalid') +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl11.testcase Index: test/sql_stmt_iconv_tests/encodeurl11.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl11.testcase +++ test/sql_stmt_iconv_tests/encodeurl11.testcase @@ -0,0 +1,7 @@ +EncodeURL - valid charset +:memory: #use in-memory database +SELECT EncodeURL('però più perché', 'CP1252'); +1 # rows (not including the header row) +1 # columns +EncodeURL('però più perché', 'CP1252') +per%f2%20pi%f9%20perch%e9 ADDED test/sql_stmt_iconv_tests/encodeurl2.testcase Index: test/sql_stmt_iconv_tests/encodeurl2.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl2.testcase +++ test/sql_stmt_iconv_tests/encodeurl2.testcase @@ -0,0 +1,7 @@ +EncodeURL - INT +:memory: #use in-memory database +SELECT EncodeURL(1); +1 # rows (not including the header row) +1 # columns +EncodeURL(1) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl3.testcase Index: test/sql_stmt_iconv_tests/encodeurl3.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl3.testcase +++ test/sql_stmt_iconv_tests/encodeurl3.testcase @@ -0,0 +1,7 @@ +EncodeURL - DOUBLE +:memory: #use in-memory database +SELECT EncodeURL(1.5); +1 # rows (not including the header row) +1 # columns +EncodeURL(1.5) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl4.testcase Index: test/sql_stmt_iconv_tests/encodeurl4.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl4.testcase +++ test/sql_stmt_iconv_tests/encodeurl4.testcase @@ -0,0 +1,7 @@ +EncodeURL - BLOB +:memory: #use in-memory database +SELECT EncodeURL(zeroblob(4)); +1 # rows (not including the header row) +1 # columns +EncodeURL(zeroblob(4)) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl5.testcase Index: test/sql_stmt_iconv_tests/encodeurl5.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl5.testcase +++ test/sql_stmt_iconv_tests/encodeurl5.testcase @@ -0,0 +1,7 @@ +EncodeURL - valid +:memory: #use in-memory database +SELECT EncodeURL('C++ * operator'); +1 # rows (not including the header row) +1 # columns +EncodeURL('C++ * operator') +C%2b%2b%20%2a%20operator ADDED test/sql_stmt_iconv_tests/encodeurl6.testcase Index: test/sql_stmt_iconv_tests/encodeurl6.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl6.testcase +++ test/sql_stmt_iconv_tests/encodeurl6.testcase @@ -0,0 +1,7 @@ +EncodeURL - NULL charset +:memory: #use in-memory database +SELECT EncodeURL('però più perché', NULL); +1 # rows (not including the header row) +1 # columns +EncodeURL('però più perché', NULL) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl7.testcase Index: test/sql_stmt_iconv_tests/encodeurl7.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl7.testcase +++ test/sql_stmt_iconv_tests/encodeurl7.testcase @@ -0,0 +1,7 @@ +EncodeURL - INT charset +:memory: #use in-memory database +SELECT EncodeURL('però più perché', 1); +1 # rows (not including the header row) +1 # columns +EncodeURL('però più perché', 1) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl8.testcase Index: test/sql_stmt_iconv_tests/encodeurl8.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl8.testcase +++ test/sql_stmt_iconv_tests/encodeurl8.testcase @@ -0,0 +1,7 @@ +EncodeURL - DOUBLE charset +:memory: #use in-memory database +SELECT EncodeURL('però più perché', 1.5); +1 # rows (not including the header row) +1 # columns +EncodeURL('però più perché', 1.5) +(NULL) ADDED test/sql_stmt_iconv_tests/encodeurl9.testcase Index: test/sql_stmt_iconv_tests/encodeurl9.testcase ================================================================== --- test/sql_stmt_iconv_tests/encodeurl9.testcase +++ test/sql_stmt_iconv_tests/encodeurl9.testcase @@ -0,0 +1,7 @@ +EncodeURL - BLOB charset +:memory: #use in-memory database +SELECT EncodeURL('però più perché', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +EncodeURL('però più perché', zeroblob(4)) +(NULL) ADDED test/sql_stmt_iconv_tests/sp_allvars1.testcase Index: test/sql_stmt_iconv_tests/sp_allvars1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_allvars1.testcase +++ test/sql_stmt_iconv_tests/sp_allvars1.testcase @@ -0,0 +1,7 @@ +SqlProc_AllVariables - NULL +:memory: #use in-memory database +SELECT SqlProc_AllVariables(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_AllVariables(NULL) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_allvars2.testcase Index: test/sql_stmt_iconv_tests/sp_allvars2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_allvars2.testcase +++ test/sql_stmt_iconv_tests/sp_allvars2.testcase @@ -0,0 +1,7 @@ +SqlProc_AllVariables - INT +:memory: #use in-memory database +SELECT SqlProc_AllVariables(1); +1 # rows (not including the header row) +1 # columns +SqlProc_AllVariables(1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_allvars3.testcase Index: test/sql_stmt_iconv_tests/sp_allvars3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_allvars3.testcase +++ test/sql_stmt_iconv_tests/sp_allvars3.testcase @@ -0,0 +1,7 @@ +SqlProc_AllVariables - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_AllVariables(1.2); +1 # rows (not including the header row) +1 # columns +SqlProc_AllVariables(1.2) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_allvars4.testcase Index: test/sql_stmt_iconv_tests/sp_allvars4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_allvars4.testcase +++ test/sql_stmt_iconv_tests/sp_allvars4.testcase @@ -0,0 +1,7 @@ +SqlProc_AllVariables - TEXT +:memory: #use in-memory database +SELECT SqlProc_AllVariables('text'); +1 # rows (not including the header row) +1 # columns +SqlProc_AllVariables('text') +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_allvars5.testcase Index: test/sql_stmt_iconv_tests/sp_allvars5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_allvars5.testcase +++ test/sql_stmt_iconv_tests/sp_allvars5.testcase @@ -0,0 +1,7 @@ +SqlProc_AllVariables - valid BLOB +:memory: #use in-memory database +SELECT SqlProc_AllVariables(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')); +1 # rows (not including the header row) +1 # columns +SqlProc_AllVariables(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')) +@col1@ @col2@ @table@ ADDED test/sql_stmt_iconv_tests/sp_allvars6.testcase Index: test/sql_stmt_iconv_tests/sp_allvars6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_allvars6.testcase +++ test/sql_stmt_iconv_tests/sp_allvars6.testcase @@ -0,0 +1,7 @@ +SqlProc_AllVariables - invalid BLOB +:memory: #use in-memory database +SELECT SqlProc_AllVariables(zeroblob(100)); +1 # rows (not including the header row) +1 # columns +SqlProc_AllVariables(zeroblob(100)) +SqlProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_cookedsql1.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql1.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql1.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - NULL +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(NULL) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_cookedsql10.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql10.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql10.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql10.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - BLOB vararg +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), zeroblob(10)) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_cookedsql11.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql11.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql11.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql11.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - invalid TEXT vararg +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 'abcdefgh'); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 'abcdefgh') +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_cookedsql12.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql12.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql12.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql12.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - just one vararg +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), '@TABLE@=some_table'); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), '@TABLE@=some_table') +SELECT NULL, NULL FROM some_table ADDED test/sql_stmt_iconv_tests/sp_cookedsql13.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql13.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql13.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql13.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - all varargs +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), '@TABLE@=some_table', '$col1$=first_col', '@col2@=second_col'); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), '@TABLE@=some_table', '$col1$=first_col', '@col2@=second_col') +SELECT first_col, second_col FROM some_table ADDED test/sql_stmt_iconv_tests/sp_cookedsql2.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql2.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql2.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - INT +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(1); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_cookedsql3.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql3.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql3.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(1.2); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(1.2) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_cookedsql4.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql4.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql4.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - TEXT +:memory: #use in-memory database +SELECT SqlProc_CookedSQL('text'); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL('text') +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_cookedsql5.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql5.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql5.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - invalid BLOB +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(zeroblob(100)); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(zeroblob(100)) +SqlProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_cookedsql6.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql6.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql6.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - valid BLOB +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')) +SELECT NULL, NULL FROM NULL ADDED test/sql_stmt_iconv_tests/sp_cookedsql7.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql7.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql7.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - NULL vararg +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), NULL) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_cookedsql8.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql8.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql8.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - INT vararg +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_cookedsql9.testcase Index: test/sql_stmt_iconv_tests/sp_cookedsql9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_cookedsql9.testcase +++ test/sql_stmt_iconv_tests/sp_cookedsql9.testcase @@ -0,0 +1,7 @@ +SqlProc_CookedSQL - Double vararg +:memory: #use in-memory database +SELECT SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1.1); +1 # rows (not including the header row) +1 # columns +SqlProc_CookedSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1.1) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_createtables.testcase Index: test/sql_stmt_iconv_tests/sp_createtables.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_createtables.testcase +++ test/sql_stmt_iconv_tests/sp_createtables.testcase @@ -0,0 +1,7 @@ +StoredProc_CreateTables +:memory: #use in-memory database +SELECT StoredProc_CreateTables(); +1 # rows (not including the header row) +1 # columns +StoredProc_CreateTables() +1 ADDED test/sql_stmt_iconv_tests/sp_delete1.testcase Index: test/sql_stmt_iconv_tests/sp_delete1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_delete1.testcase +++ test/sql_stmt_iconv_tests/sp_delete1.testcase @@ -0,0 +1,7 @@ +StoredProc_Delete - NULL name +:memory: #use in-memory database +SELECT StoredProc_Delete(NULL); +1 # rows (not including the header row) +1 # columns +StoredProc_Delete(NULL) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_delete2.testcase Index: test/sql_stmt_iconv_tests/sp_delete2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_delete2.testcase +++ test/sql_stmt_iconv_tests/sp_delete2.testcase @@ -0,0 +1,7 @@ +StoredProc_Delete - Int name +:memory: #use in-memory database +SELECT StoredProc_Delete(1); +1 # rows (not including the header row) +1 # columns +StoredProc_Delete(1) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_delete3.testcase Index: test/sql_stmt_iconv_tests/sp_delete3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_delete3.testcase +++ test/sql_stmt_iconv_tests/sp_delete3.testcase @@ -0,0 +1,7 @@ +StoredProc_Delete - Double name +:memory: #use in-memory database +SELECT StoredProc_Delete(1.5); +1 # rows (not including the header row) +1 # columns +StoredProc_Delete(1.5) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_delete4.testcase Index: test/sql_stmt_iconv_tests/sp_delete4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_delete4.testcase +++ test/sql_stmt_iconv_tests/sp_delete4.testcase @@ -0,0 +1,7 @@ +StoredProc_Delete - BLOB name +:memory: #use in-memory database +SELECT StoredProc_Delete(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredProc_Delete(zeroblob(10)) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_delete5.testcase Index: test/sql_stmt_iconv_tests/sp_delete5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_delete5.testcase +++ test/sql_stmt_iconv_tests/sp_delete5.testcase @@ -0,0 +1,7 @@ +StoredProc_Delete - Text name +:memory: #use in-memory database +SELECT StoredProc_Delete('name'); +1 # rows (not including the header row) +1 # columns +StoredProc_Delete('name') +0 ADDED test/sql_stmt_iconv_tests/sp_deletevar1.testcase Index: test/sql_stmt_iconv_tests/sp_deletevar1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_deletevar1.testcase +++ test/sql_stmt_iconv_tests/sp_deletevar1.testcase @@ -0,0 +1,7 @@ +StoredVar_Delete - NULL name +:memory: #use in-memory database +SELECT StoredVar_Delete(NULL); +1 # rows (not including the header row) +1 # columns +StoredVar_Delete(NULL) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_deletevar2.testcase Index: test/sql_stmt_iconv_tests/sp_deletevar2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_deletevar2.testcase +++ test/sql_stmt_iconv_tests/sp_deletevar2.testcase @@ -0,0 +1,7 @@ +StoredVar_Delete - Int name +:memory: #use in-memory database +SELECT StoredVar_Delete(1); +1 # rows (not including the header row) +1 # columns +StoredVar_Delete(1) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_deletevar3.testcase Index: test/sql_stmt_iconv_tests/sp_deletevar3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_deletevar3.testcase +++ test/sql_stmt_iconv_tests/sp_deletevar3.testcase @@ -0,0 +1,7 @@ +StoredVar_Delete - Double name +:memory: #use in-memory database +SELECT StoredVar_Delete(1.5); +1 # rows (not including the header row) +1 # columns +StoredVar_Delete(1.5) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_deletevar4.testcase Index: test/sql_stmt_iconv_tests/sp_deletevar4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_deletevar4.testcase +++ test/sql_stmt_iconv_tests/sp_deletevar4.testcase @@ -0,0 +1,7 @@ +StoredVar_Delete - BLOB name +:memory: #use in-memory database +SELECT StoredVar_Delete(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredVar_Delete(zeroblob(10)) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_deletevar5.testcase Index: test/sql_stmt_iconv_tests/sp_deletevar5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_deletevar5.testcase +++ test/sql_stmt_iconv_tests/sp_deletevar5.testcase @@ -0,0 +1,7 @@ +StoredVar_Delete - Text name +:memory: #use in-memory database +SELECT StoredVar_Delete('xname'); +1 # rows (not including the header row) +1 # columns +StoredVar_Delete('xname') +0 ADDED test/sql_stmt_iconv_tests/sp_execute1.testcase Index: test/sql_stmt_iconv_tests/sp_execute1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute1.testcase +++ test/sql_stmt_iconv_tests/sp_execute1.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - NULL +:memory: #use in-memory database +SELECT SqlProc_Execute(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(NULL) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_execute10.testcase Index: test/sql_stmt_iconv_tests/sp_execute10.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute10.testcase +++ test/sql_stmt_iconv_tests/sp_execute10.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - BLOB vararg +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), zeroblob(10)) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_execute11.testcase Index: test/sql_stmt_iconv_tests/sp_execute11.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute11.testcase +++ test/sql_stmt_iconv_tests/sp_execute11.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - invalid TEXT vararg +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), 'abcdefgh'); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), 'abcdefgh') +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_execute12.testcase Index: test/sql_stmt_iconv_tests/sp_execute12.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute12.testcase +++ test/sql_stmt_iconv_tests/sp_execute12.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - just one vararg +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), '@col2@=ref_sys_name'); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), '@col2@=ref_sys_name') +SqlProc exception - a fatal SQL error was encountered. ADDED test/sql_stmt_iconv_tests/sp_execute13.testcase Index: test/sql_stmt_iconv_tests/sp_execute13.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute13.testcase +++ test/sql_stmt_iconv_tests/sp_execute13.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - all varargs +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), '$col1$=srid', '@col2@=ref_sys_name', '@table@=spatial_ref_sys', '@filter@=%deprecated%'); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;'), '$col1$=srid', '@col2@=ref_sys_name', '@table@=spatial_ref_sys', '@filter@=%deprecated%') +1 ADDED test/sql_stmt_iconv_tests/sp_execute2.testcase Index: test/sql_stmt_iconv_tests/sp_execute2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute2.testcase +++ test/sql_stmt_iconv_tests/sp_execute2.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - INT +:memory: #use in-memory database +SELECT SqlProc_Execute(1); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_execute3.testcase Index: test/sql_stmt_iconv_tests/sp_execute3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute3.testcase +++ test/sql_stmt_iconv_tests/sp_execute3.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_Execute(1.2); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(1.2) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_execute4.testcase Index: test/sql_stmt_iconv_tests/sp_execute4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute4.testcase +++ test/sql_stmt_iconv_tests/sp_execute4.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - TEXT +:memory: #use in-memory database +SELECT SqlProc_Execute('text'); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute('text') +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_execute5.testcase Index: test/sql_stmt_iconv_tests/sp_execute5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute5.testcase +++ test/sql_stmt_iconv_tests/sp_execute5.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - invalid BLOB +:memory: #use in-memory database +SELECT SqlProc_Execute(zeroblob(100)); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(zeroblob(100)) +SqlProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_execute6.testcase Index: test/sql_stmt_iconv_tests/sp_execute6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute6.testcase +++ test/sql_stmt_iconv_tests/sp_execute6.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - valid BLOB, no Variables +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;')); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@ WHERE @col2@ LIKE ''@filter@''; SELECT Count(*) FROM @table@;')) +SqlProc exception - a fatal SQL error was encountered. ADDED test/sql_stmt_iconv_tests/sp_execute7.testcase Index: test/sql_stmt_iconv_tests/sp_execute7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute7.testcase +++ test/sql_stmt_iconv_tests/sp_execute7.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - NULL vararg +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), NULL) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_execute8.testcase Index: test/sql_stmt_iconv_tests/sp_execute8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute8.testcase +++ test/sql_stmt_iconv_tests/sp_execute8.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - INT vararg +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_execute9.testcase Index: test/sql_stmt_iconv_tests/sp_execute9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_execute9.testcase +++ test/sql_stmt_iconv_tests/sp_execute9.testcase @@ -0,0 +1,7 @@ +SqlProc_Execute - Double vararg +:memory: #use in-memory database +SELECT SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1.1); +1 # rows (not including the header row) +1 # columns +SqlProc_Execute(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1.1) +SqlProc exception - the List of Variables with Values contains illegal items. ADDED test/sql_stmt_iconv_tests/sp_executestored1.testcase Index: test/sql_stmt_iconv_tests/sp_executestored1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_executestored1.testcase +++ test/sql_stmt_iconv_tests/sp_executestored1.testcase @@ -0,0 +1,7 @@ +StoredProc_Execute - NULL +:memory: #use in-memory database +SELECT StoredProc_Execute(NULL); +1 # rows (not including the header row) +1 # columns +StoredProc_Execute(NULL) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_executestored2.testcase Index: test/sql_stmt_iconv_tests/sp_executestored2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_executestored2.testcase +++ test/sql_stmt_iconv_tests/sp_executestored2.testcase @@ -0,0 +1,7 @@ +StoredProc_Execute - INT +:memory: #use in-memory database +SELECT StoredProc_Execute(1); +1 # rows (not including the header row) +1 # columns +StoredProc_Execute(1) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_executestored3.testcase Index: test/sql_stmt_iconv_tests/sp_executestored3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_executestored3.testcase +++ test/sql_stmt_iconv_tests/sp_executestored3.testcase @@ -0,0 +1,7 @@ +StoredProc_Execute - DOUBLE +:memory: #use in-memory database +SELECT StoredProc_Execute(1.2); +1 # rows (not including the header row) +1 # columns +StoredProc_Execute(1.2) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_executestored4.testcase Index: test/sql_stmt_iconv_tests/sp_executestored4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_executestored4.testcase +++ test/sql_stmt_iconv_tests/sp_executestored4.testcase @@ -0,0 +1,7 @@ +StoredProc_Execute - BLOB +:memory: #use in-memory database +SELECT StoredProc_Execute(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredProc_Execute(zeroblob(10)) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_executestored5.testcase Index: test/sql_stmt_iconv_tests/sp_executestored5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_executestored5.testcase +++ test/sql_stmt_iconv_tests/sp_executestored5.testcase @@ -0,0 +1,7 @@ +StoredProc_Execute - not existing +:memory: #use in-memory database +SELECT StoredProc_Execute('not existing'); +1 # rows (not including the header row) +1 # columns +StoredProc_Execute('not existing') +StoredProc exception - unable to retrive a Stored Procedure named "not existing". ADDED test/sql_stmt_iconv_tests/sp_fetch1.testcase Index: test/sql_stmt_iconv_tests/sp_fetch1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetch1.testcase +++ test/sql_stmt_iconv_tests/sp_fetch1.testcase @@ -0,0 +1,7 @@ +StoredProc_Get - NULL name +:memory: #use in-memory database +SELECT StoredProc_Get(NULL); +1 # rows (not including the header row) +1 # columns +StoredProc_Get(NULL) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetch2.testcase Index: test/sql_stmt_iconv_tests/sp_fetch2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetch2.testcase +++ test/sql_stmt_iconv_tests/sp_fetch2.testcase @@ -0,0 +1,7 @@ +StoredProc_Get - Int name +:memory: #use in-memory database +SELECT StoredProc_Get(1); +1 # rows (not including the header row) +1 # columns +StoredProc_Get(1) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetch3.testcase Index: test/sql_stmt_iconv_tests/sp_fetch3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetch3.testcase +++ test/sql_stmt_iconv_tests/sp_fetch3.testcase @@ -0,0 +1,7 @@ +StoredProc_Get - Double name +:memory: #use in-memory database +SELECT StoredProc_Get(1.5); +1 # rows (not including the header row) +1 # columns +StoredProc_Get(1.5) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetch4.testcase Index: test/sql_stmt_iconv_tests/sp_fetch4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetch4.testcase +++ test/sql_stmt_iconv_tests/sp_fetch4.testcase @@ -0,0 +1,7 @@ +StoredProc_Get - BLOB name +:memory: #use in-memory database +SELECT StoredProc_Get(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredProc_Get(zeroblob(10)) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetch5.testcase Index: test/sql_stmt_iconv_tests/sp_fetch5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetch5.testcase +++ test/sql_stmt_iconv_tests/sp_fetch5.testcase @@ -0,0 +1,7 @@ +StoredProc_Get - Text name +:memory: #use in-memory database +SELECT StoredProc_Get('name'); +1 # rows (not including the header row) +1 # columns +StoredProc_Get('name') +(NULL) ADDED test/sql_stmt_iconv_tests/sp_fetchval1.testcase Index: test/sql_stmt_iconv_tests/sp_fetchval1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchval1.testcase +++ test/sql_stmt_iconv_tests/sp_fetchval1.testcase @@ -0,0 +1,7 @@ +StoredVar_GetValue - NULL name +:memory: #use in-memory database +SELECT StoredVar_GetValue(NULL); +1 # rows (not including the header row) +1 # columns +StoredVar_GetValue(NULL) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchval2.testcase Index: test/sql_stmt_iconv_tests/sp_fetchval2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchval2.testcase +++ test/sql_stmt_iconv_tests/sp_fetchval2.testcase @@ -0,0 +1,7 @@ +StoredVar_GetValue - Int name +:memory: #use in-memory database +SELECT StoredVar_GetValue(1); +1 # rows (not including the header row) +1 # columns +StoredVar_GetValue(1) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchval3.testcase Index: test/sql_stmt_iconv_tests/sp_fetchval3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchval3.testcase +++ test/sql_stmt_iconv_tests/sp_fetchval3.testcase @@ -0,0 +1,7 @@ +StoredVar_GetValue - Double name +:memory: #use in-memory database +SELECT StoredVar_GetValue(1.5); +1 # rows (not including the header row) +1 # columns +StoredVar_GetValue(1.5) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchval4.testcase Index: test/sql_stmt_iconv_tests/sp_fetchval4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchval4.testcase +++ test/sql_stmt_iconv_tests/sp_fetchval4.testcase @@ -0,0 +1,7 @@ +StoredVar_GetValue - BLOB name +:memory: #use in-memory database +SELECT StoredVar_GetValue(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredVar_GetValue(zeroblob(10)) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchval5.testcase Index: test/sql_stmt_iconv_tests/sp_fetchval5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchval5.testcase +++ test/sql_stmt_iconv_tests/sp_fetchval5.testcase @@ -0,0 +1,7 @@ +StoredVar_GetValue - Text name +:memory: #use in-memory database +SELECT StoredVar_GetValue('xname'); +1 # rows (not including the header row) +1 # columns +StoredVar_GetValue('xname') +(NULL) ADDED test/sql_stmt_iconv_tests/sp_fetchvar1.testcase Index: test/sql_stmt_iconv_tests/sp_fetchvar1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchvar1.testcase +++ test/sql_stmt_iconv_tests/sp_fetchvar1.testcase @@ -0,0 +1,7 @@ +StoredVar_Get - NULL name +:memory: #use in-memory database +SELECT StoredVar_Get(NULL); +1 # rows (not including the header row) +1 # columns +StoredVar_Get(NULL) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchvar2.testcase Index: test/sql_stmt_iconv_tests/sp_fetchvar2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchvar2.testcase +++ test/sql_stmt_iconv_tests/sp_fetchvar2.testcase @@ -0,0 +1,7 @@ +StoredVar_Get - Int name +:memory: #use in-memory database +SELECT StoredVar_Get(1); +1 # rows (not including the header row) +1 # columns +StoredVar_Get(1) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchvar3.testcase Index: test/sql_stmt_iconv_tests/sp_fetchvar3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchvar3.testcase +++ test/sql_stmt_iconv_tests/sp_fetchvar3.testcase @@ -0,0 +1,7 @@ +StoredVar_Get - Double name +:memory: #use in-memory database +SELECT StoredVar_Get(1.5); +1 # rows (not including the header row) +1 # columns +StoredVar_Get(1.5) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchvar4.testcase Index: test/sql_stmt_iconv_tests/sp_fetchvar4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchvar4.testcase +++ test/sql_stmt_iconv_tests/sp_fetchvar4.testcase @@ -0,0 +1,7 @@ +StoredVar_Get - BLOB name +:memory: #use in-memory database +SELECT StoredVar_Get(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredVar_Get(zeroblob(10)) +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_fetchvar5.testcase Index: test/sql_stmt_iconv_tests/sp_fetchvar5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fetchvar5.testcase +++ test/sql_stmt_iconv_tests/sp_fetchvar5.testcase @@ -0,0 +1,7 @@ +StoredVar_Get - Text name +:memory: #use in-memory database +SELECT StoredVar_Get('xname'); +1 # rows (not including the header row) +1 # columns +StoredVar_Get('xname') +(NULL) ADDED test/sql_stmt_iconv_tests/sp_fromtext1.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext1.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext1.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - NULL SQL body +:memory: #use in-memory database +SELECT SqlProc_FromText(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_FromText(NULL) +SqlProc exception - illegal SQL Body argument. ADDED test/sql_stmt_iconv_tests/sp_fromtext10.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext10.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext10.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext10.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - DOUBLE charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', zeroblob(10))); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', zeroblob(10))) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_iconv_tests/sp_fromtext11.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext11.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext11.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext11.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - valid charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 'ASCII')); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 'ASCII')) +00CD0187030087040087636F6C3187010087040087636F6C32870100870500877461626C6587010087220000008753454C4543542040636F6C31402C2040636F6C32402046524F4D20407461626C6540DC ADDED test/sql_stmt_iconv_tests/sp_fromtext12.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext12.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext12.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext12.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - undefined charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 'abcdefghi')); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 'abcdefghi')) +SqlProc exception - invalid SQL Body. ADDED test/sql_stmt_iconv_tests/sp_fromtext2.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext2.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext2.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - INT SQL body +:memory: #use in-memory database +SELECT SqlProc_FromText(2); +1 # rows (not including the header row) +1 # columns +SqlProc_FromText(2) +SqlProc exception - illegal SQL Body argument. ADDED test/sql_stmt_iconv_tests/sp_fromtext3.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext3.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext3.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - DOUBLE SQL body +:memory: #use in-memory database +SELECT SqlProc_FromText(2.5); +1 # rows (not including the header row) +1 # columns +SqlProc_FromText(2.5) +SqlProc exception - illegal SQL Body argument. ADDED test/sql_stmt_iconv_tests/sp_fromtext4.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext4.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext4.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - BLOB SQL body +:memory: #use in-memory database +SELECT SqlProc_FromText(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SqlProc_FromText(zeroblob(10)) +SqlProc exception - illegal SQL Body argument. ADDED test/sql_stmt_iconv_tests/sp_fromtext5.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext5.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext5.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - Empty SQL body +:memory: #use in-memory database +SELECT SqlProc_FromText(''); +1 # rows (not including the header row) +1 # columns +SqlProc_FromText('') +SqlProc exception - invalid SQL Body. ADDED test/sql_stmt_iconv_tests/sp_fromtext6.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext6.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext6.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - Valid SQL body +:memory: #use in-memory database +SELECT Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@')); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@')) +00CD0187030087040087636F6C3187010087040087636F6C32870100870500877461626C6587010087220000008753454C4543542040636F6C31402C2040636F6C32402046524F4D20407461626C6540DC ADDED test/sql_stmt_iconv_tests/sp_fromtext7.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext7.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext7.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - NULL charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', NULL)); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', NULL)) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_iconv_tests/sp_fromtext8.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext8.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext8.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - INT charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 1)); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 1)) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_iconv_tests/sp_fromtext9.testcase Index: test/sql_stmt_iconv_tests/sp_fromtext9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_fromtext9.testcase +++ test/sql_stmt_iconv_tests/sp_fromtext9.testcase @@ -0,0 +1,7 @@ +SqlProc_FromText - DOUBLE charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 1.5)); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromText('SELECT @col1@, @col2@ FROM @table@', 1.5)) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_iconv_tests/sp_isvalid1.testcase Index: test/sql_stmt_iconv_tests/sp_isvalid1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalid1.testcase +++ test/sql_stmt_iconv_tests/sp_isvalid1.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValid - NULL +:memory: #use in-memory database +SELECT SqlProc_isValid(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_isValid(NULL) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalid2.testcase Index: test/sql_stmt_iconv_tests/sp_isvalid2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalid2.testcase +++ test/sql_stmt_iconv_tests/sp_isvalid2.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValid - INT +:memory: #use in-memory database +SELECT SqlProc_isValid(1); +1 # rows (not including the header row) +1 # columns +SqlProc_isValid(1) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalid3.testcase Index: test/sql_stmt_iconv_tests/sp_isvalid3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalid3.testcase +++ test/sql_stmt_iconv_tests/sp_isvalid3.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValid - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_isValid(1.2); +1 # rows (not including the header row) +1 # columns +SqlProc_isValid(1.2) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalid4.testcase Index: test/sql_stmt_iconv_tests/sp_isvalid4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalid4.testcase +++ test/sql_stmt_iconv_tests/sp_isvalid4.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValid - TEXT +:memory: #use in-memory database +SELECT SqlProc_isValid('text'); +1 # rows (not including the header row) +1 # columns +SqlProc_isValid('text') +0 ADDED test/sql_stmt_iconv_tests/sp_isvalid5.testcase Index: test/sql_stmt_iconv_tests/sp_isvalid5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalid5.testcase +++ test/sql_stmt_iconv_tests/sp_isvalid5.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValid - valid BLOB +:memory: #use in-memory database +SELECT SqlProc_isValid(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')); +1 # rows (not including the header row) +1 # columns +SqlProc_isValid(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')) +1 ADDED test/sql_stmt_iconv_tests/sp_isvalid6.testcase Index: test/sql_stmt_iconv_tests/sp_isvalid6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalid6.testcase +++ test/sql_stmt_iconv_tests/sp_isvalid6.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValid - invalid BLOB +:memory: #use in-memory database +SELECT SqlProc_isValid(zeroblob(100)); +1 # rows (not including the header row) +1 # columns +SqlProc_isValid(zeroblob(100)) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalidvar1.testcase Index: test/sql_stmt_iconv_tests/sp_isvalidvar1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalidvar1.testcase +++ test/sql_stmt_iconv_tests/sp_isvalidvar1.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValidVarValueVarValue - NULL +:memory: #use in-memory database +SELECT SqlProc_IsValidVarValue(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_IsValidVarValue(NULL) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalidvar2.testcase Index: test/sql_stmt_iconv_tests/sp_isvalidvar2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalidvar2.testcase +++ test/sql_stmt_iconv_tests/sp_isvalidvar2.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValidVarValue - INT +:memory: #use in-memory database +SELECT SqlProc_IsValidVarValue(1); +1 # rows (not including the header row) +1 # columns +SqlProc_IsValidVarValue(1) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalidvar3.testcase Index: test/sql_stmt_iconv_tests/sp_isvalidvar3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalidvar3.testcase +++ test/sql_stmt_iconv_tests/sp_isvalidvar3.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValidVarValue - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_IsValidVarValue(1.2); +1 # rows (not including the header row) +1 # columns +SqlProc_IsValidVarValue(1.2) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalidvar4.testcase Index: test/sql_stmt_iconv_tests/sp_isvalidvar4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalidvar4.testcase +++ test/sql_stmt_iconv_tests/sp_isvalidvar4.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValidVarValue - BLOB +:memory: #use in-memory database +SELECT SqlProc_IsValidVarValue(zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SqlProc_IsValidVarValue(zeroblob(4)) +0 ADDED test/sql_stmt_iconv_tests/sp_isvalidvar5.testcase Index: test/sql_stmt_iconv_tests/sp_isvalidvar5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalidvar5.testcase +++ test/sql_stmt_iconv_tests/sp_isvalidvar5.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValidVarValue - valid TEXT +:memory: #use in-memory database +SELECT SqlProc_IsValidVarValue('@var@=value'); +1 # rows (not including the header row) +1 # columns +SqlProc_IsValidVarValue('@var@=value') +1 ADDED test/sql_stmt_iconv_tests/sp_isvalidvar6.testcase Index: test/sql_stmt_iconv_tests/sp_isvalidvar6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_isvalidvar6.testcase +++ test/sql_stmt_iconv_tests/sp_isvalidvar6.testcase @@ -0,0 +1,7 @@ +SqlProc_IsValidVarValue - invalid TEXT +:memory: #use in-memory database +SELECT SqlProc_IsValidVarValue('invalid'); +1 # rows (not including the header row) +1 # columns +SqlProc_IsValidVarValue('invalid') +0 ADDED test/sql_stmt_iconv_tests/sp_lasterror.testcase Index: test/sql_stmt_iconv_tests/sp_lasterror.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_lasterror.testcase +++ test/sql_stmt_iconv_tests/sp_lasterror.testcase @@ -0,0 +1,7 @@ +SqlProc_GetLastError +:memory: #use in-memory database +SELECT SqlProc_GetLastError(); +1 # rows (not including the header row) +1 # columns +SqlProc_GetLastError() +(NULL) ADDED test/sql_stmt_iconv_tests/sp_numvars1.testcase Index: test/sql_stmt_iconv_tests/sp_numvars1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_numvars1.testcase +++ test/sql_stmt_iconv_tests/sp_numvars1.testcase @@ -0,0 +1,7 @@ +SqlProc_NumVariables - NULL +:memory: #use in-memory database +SELECT SqlProc_NumVariables(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_NumVariables(NULL) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_numvars2.testcase Index: test/sql_stmt_iconv_tests/sp_numvars2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_numvars2.testcase +++ test/sql_stmt_iconv_tests/sp_numvars2.testcase @@ -0,0 +1,7 @@ +SqlProc_NumVariables - INT +:memory: #use in-memory database +SELECT SqlProc_NumVariables(1); +1 # rows (not including the header row) +1 # columns +SqlProc_NumVariables(1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_numvars3.testcase Index: test/sql_stmt_iconv_tests/sp_numvars3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_numvars3.testcase +++ test/sql_stmt_iconv_tests/sp_numvars3.testcase @@ -0,0 +1,7 @@ +SqlProc_NumVariables - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_NumVariables(1.2); +1 # rows (not including the header row) +1 # columns +SqlProc_NumVariables(1.2) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_numvars4.testcase Index: test/sql_stmt_iconv_tests/sp_numvars4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_numvars4.testcase +++ test/sql_stmt_iconv_tests/sp_numvars4.testcase @@ -0,0 +1,7 @@ +SqlProc_NumVariables - TEXT +:memory: #use in-memory database +SELECT SqlProc_NumVariables('text'); +1 # rows (not including the header row) +1 # columns +SqlProc_NumVariables('text') +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_numvars5.testcase Index: test/sql_stmt_iconv_tests/sp_numvars5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_numvars5.testcase +++ test/sql_stmt_iconv_tests/sp_numvars5.testcase @@ -0,0 +1,7 @@ +SqlProc_NumVariables - valid BLOB +:memory: #use in-memory database +SELECT SqlProc_NumVariables(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')); +1 # rows (not including the header row) +1 # columns +SqlProc_NumVariables(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')) +3 ADDED test/sql_stmt_iconv_tests/sp_numvars6.testcase Index: test/sql_stmt_iconv_tests/sp_numvars6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_numvars6.testcase +++ test/sql_stmt_iconv_tests/sp_numvars6.testcase @@ -0,0 +1,7 @@ +SqlProc_NumVariables - invalid BLOB +:memory: #use in-memory database +SELECT SqlProc_NumVariables(zeroblob(100)); +1 # rows (not including the header row) +1 # columns +SqlProc_NumVariables(zeroblob(100)) +SqlProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_rawsql1.testcase Index: test/sql_stmt_iconv_tests/sp_rawsql1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_rawsql1.testcase +++ test/sql_stmt_iconv_tests/sp_rawsql1.testcase @@ -0,0 +1,7 @@ +SqlProc_RawSQL - NULL +:memory: #use in-memory database +SELECT SqlProc_RawSQL(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_RawSQL(NULL) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_rawsql2.testcase Index: test/sql_stmt_iconv_tests/sp_rawsql2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_rawsql2.testcase +++ test/sql_stmt_iconv_tests/sp_rawsql2.testcase @@ -0,0 +1,7 @@ +SqlProc_RawSQL - INT +:memory: #use in-memory database +SELECT SqlProc_RawSQL(1); +1 # rows (not including the header row) +1 # columns +SqlProc_RawSQL(1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_rawsql3.testcase Index: test/sql_stmt_iconv_tests/sp_rawsql3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_rawsql3.testcase +++ test/sql_stmt_iconv_tests/sp_rawsql3.testcase @@ -0,0 +1,7 @@ +SqlProc_RawSQL - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_RawSQL(1.2); +1 # rows (not including the header row) +1 # columns +SqlProc_RawSQL(1.2) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_rawsql4.testcase Index: test/sql_stmt_iconv_tests/sp_rawsql4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_rawsql4.testcase +++ test/sql_stmt_iconv_tests/sp_rawsql4.testcase @@ -0,0 +1,7 @@ +SqlProc_RawSQL - TEXT +:memory: #use in-memory database +SELECT SqlProc_RawSQL('text'); +1 # rows (not including the header row) +1 # columns +SqlProc_RawSQL('text') +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_rawsql5.testcase Index: test/sql_stmt_iconv_tests/sp_rawsql5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_rawsql5.testcase +++ test/sql_stmt_iconv_tests/sp_rawsql5.testcase @@ -0,0 +1,7 @@ +SqlProc_RawSQL - valid BLOB +:memory: #use in-memory database +SELECT SqlProc_RawSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')); +1 # rows (not including the header row) +1 # columns +SqlProc_RawSQL(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@')) +SELECT @col1@, $col2$ FROM @table@ ADDED test/sql_stmt_iconv_tests/sp_rawsql6.testcase Index: test/sql_stmt_iconv_tests/sp_rawsql6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_rawsql6.testcase +++ test/sql_stmt_iconv_tests/sp_rawsql6.testcase @@ -0,0 +1,7 @@ +SqlProc_RawSQL - invalid BLOB +:memory: #use in-memory database +SELECT SqlProc_RawSQL(zeroblob(100)); +1 # rows (not including the header row) +1 # columns +SqlProc_RawSQL(zeroblob(100)) +SqlProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_register1.testcase Index: test/sql_stmt_iconv_tests/sp_register1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register1.testcase +++ test/sql_stmt_iconv_tests/sp_register1.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - NULL name +:memory: #use in-memory database +SELECT StoredProc_Register(NULL, 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register(NULL, 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register10.testcase Index: test/sql_stmt_iconv_tests/sp_register10.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register10.testcase +++ test/sql_stmt_iconv_tests/sp_register10.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - Int SQL body +:memory: #use in-memory database +SELECT StoredProc_Register('name', 'title', 1); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 'title', 1)) +StoredProc exception - illegal Stored Procedure Body [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_register11.testcase Index: test/sql_stmt_iconv_tests/sp_register11.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register11.testcase +++ test/sql_stmt_iconv_tests/sp_register11.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - Double SQL body +:memory: #use in-memory database +SELECT StoredProc_Register('name', 'title', 1.1); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 'title', 1.1)) +StoredProc exception - illegal Stored Procedure Body [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_register12.testcase Index: test/sql_stmt_iconv_tests/sp_register12.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register12.testcase +++ test/sql_stmt_iconv_tests/sp_register12.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - Text SQL body +:memory: #use in-memory database +SELECT StoredProc_Register('name', 'title', 'sql'); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 'title', 'sql') +StoredProc exception - illegal Stored Procedure Body [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_register13.testcase Index: test/sql_stmt_iconv_tests/sp_register13.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register13.testcase +++ test/sql_stmt_iconv_tests/sp_register13.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - invalid BLOB SQL body +:memory: #use in-memory database +SELECT StoredProc_Register('name', 'title', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 'title', zeroblob(10)) +StoredProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_register14.testcase Index: test/sql_stmt_iconv_tests/sp_register14.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register14.testcase +++ test/sql_stmt_iconv_tests/sp_register14.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - valid SQL body +:memory: #use in-memory database +SELECT StoredProc_Register('name', 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')) +1 ADDED test/sql_stmt_iconv_tests/sp_register2.testcase Index: test/sql_stmt_iconv_tests/sp_register2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register2.testcase +++ test/sql_stmt_iconv_tests/sp_register2.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - INT name +:memory: #use in-memory database +SELECT StoredProc_Register(1, 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register(1, 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register3.testcase Index: test/sql_stmt_iconv_tests/sp_register3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register3.testcase +++ test/sql_stmt_iconv_tests/sp_register3.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - Double name +:memory: #use in-memory database +SELECT StoredProc_Register(1.6, 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register(1.6, 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register4.testcase Index: test/sql_stmt_iconv_tests/sp_register4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register4.testcase +++ test/sql_stmt_iconv_tests/sp_register4.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - BLOB name +:memory: #use in-memory database +SELECT StoredProc_Register(zeroblob(4), 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register(zeroblob(4), 'title', SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register5.testcase Index: test/sql_stmt_iconv_tests/sp_register5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register5.testcase +++ test/sql_stmt_iconv_tests/sp_register5.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - NULL title +:memory: #use in-memory database +SELECT StoredProc_Register('name', NULL, SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', NULL, SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register6.testcase Index: test/sql_stmt_iconv_tests/sp_register6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register6.testcase +++ test/sql_stmt_iconv_tests/sp_register6.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - INT title +:memory: #use in-memory database +SELECT StoredProc_Register('name', 1, SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 1, SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register7.testcase Index: test/sql_stmt_iconv_tests/sp_register7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register7.testcase +++ test/sql_stmt_iconv_tests/sp_register7.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - Double title +:memory: #use in-memory database +SELECT StoredProc_Register('name', 1.2, SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 1.2, SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register8.testcase Index: test/sql_stmt_iconv_tests/sp_register8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register8.testcase +++ test/sql_stmt_iconv_tests/sp_register8.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - BLOB title +:memory: #use in-memory database +SELECT StoredProc_Register('name', zeroblob(6), SqlProc_FromText('SELECT @column1@ FROM @table1@')); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', zeroblob(6), SqlProc_FromText('SELECT @column1@ FROM @table1@')) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_register9.testcase Index: test/sql_stmt_iconv_tests/sp_register9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_register9.testcase +++ test/sql_stmt_iconv_tests/sp_register9.testcase @@ -0,0 +1,7 @@ +StoredProc_Register - NULL SQL body +:memory: #use in-memory database +SELECT StoredProc_Register('name', 'title', NULL); +1 # rows (not including the header row) +1 # columns +StoredProc_Register('name', 'title', NULL)) +StoredProc exception - illegal Stored Procedure Body [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_registervar1.testcase Index: test/sql_stmt_iconv_tests/sp_registervar1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar1.testcase +++ test/sql_stmt_iconv_tests/sp_registervar1.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - NULL name +:memory: #use in-memory database +SELECT StoredVar_Register(NULL, 'title', 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register(NULL, 'title', 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar10.testcase Index: test/sql_stmt_iconv_tests/sp_registervar10.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar10.testcase +++ test/sql_stmt_iconv_tests/sp_registervar10.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - Int Value +:memory: #use in-memory database +SELECT StoredVar_Register('varint', 'title', 1); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('varint', 'title', 1)) +1 ADDED test/sql_stmt_iconv_tests/sp_registervar11.testcase Index: test/sql_stmt_iconv_tests/sp_registervar11.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar11.testcase +++ test/sql_stmt_iconv_tests/sp_registervar11.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - Double Value +:memory: #use in-memory database +SELECT StoredVar_Register('varfloat', 'title', 1.1); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('varfloat', 'title', 1.1)) +1 ADDED test/sql_stmt_iconv_tests/sp_registervar12.testcase Index: test/sql_stmt_iconv_tests/sp_registervar12.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar12.testcase +++ test/sql_stmt_iconv_tests/sp_registervar12.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - BLOB Value +:memory: #use in-memory database +SELECT StoredVar_Register('varblob', 'title', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('varblob', 'title', zeroblob(10)) +1 ADDED test/sql_stmt_iconv_tests/sp_registervar13.testcase Index: test/sql_stmt_iconv_tests/sp_registervar13.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar13.testcase +++ test/sql_stmt_iconv_tests/sp_registervar13.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - TEXT Value +:memory: #use in-memory database +SELECT StoredVar_Register('vartext', 'title', 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('vartext', 'title', 'value') +1 ADDED test/sql_stmt_iconv_tests/sp_registervar2.testcase Index: test/sql_stmt_iconv_tests/sp_registervar2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar2.testcase +++ test/sql_stmt_iconv_tests/sp_registervar2.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - INT name +:memory: #use in-memory database +SELECT StoredVar_Register(1, 'title', 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register(1, 'title', 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar3.testcase Index: test/sql_stmt_iconv_tests/sp_registervar3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar3.testcase +++ test/sql_stmt_iconv_tests/sp_registervar3.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - Double name +:memory: #use in-memory database +SELECT StoredVar_Register(1.6, 'title', 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register(1.6, 'title', 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar4.testcase Index: test/sql_stmt_iconv_tests/sp_registervar4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar4.testcase +++ test/sql_stmt_iconv_tests/sp_registervar4.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - BLOB name +:memory: #use in-memory database +SELECT StoredVar_Register(zeroblob(4), 'title', 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register(zeroblob(4), 'title', 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar5.testcase Index: test/sql_stmt_iconv_tests/sp_registervar5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar5.testcase +++ test/sql_stmt_iconv_tests/sp_registervar5.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - NULL title +:memory: #use in-memory database +SELECT StoredVar_Register('name', NULL, 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('name', NULL, 'value') +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar6.testcase Index: test/sql_stmt_iconv_tests/sp_registervar6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar6.testcase +++ test/sql_stmt_iconv_tests/sp_registervar6.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - INT title +:memory: #use in-memory database +SELECT StoredVar_Register('name', 1, 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('name', 1, 'value') +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar7.testcase Index: test/sql_stmt_iconv_tests/sp_registervar7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar7.testcase +++ test/sql_stmt_iconv_tests/sp_registervar7.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - Double title +:memory: #use in-memory database +SELECT StoredVar_Register('name', 1.2, 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('name', 1.2, 'value') +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar8.testcase Index: test/sql_stmt_iconv_tests/sp_registervar8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar8.testcase +++ test/sql_stmt_iconv_tests/sp_registervar8.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - BLOB title +:memory: #use in-memory database +SELECT StoredVar_Register('name', zeroblob(6), 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('name', zeroblob(6), 'value') +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_registervar9.testcase Index: test/sql_stmt_iconv_tests/sp_registervar9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_registervar9.testcase +++ test/sql_stmt_iconv_tests/sp_registervar9.testcase @@ -0,0 +1,7 @@ +StoredVar_Register - NULL Value +:memory: #use in-memory database +SELECT StoredVar_Register('varnull', 'title', NULL); +1 # rows (not including the header row) +1 # columns +StoredVar_Register('varnull', 'title', NULL)) +1 ADDED test/sql_stmt_iconv_tests/sp_updatesql1.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql1.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql1.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - NULL name +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody(NULL, SqlProc_FromText('SELECT @col1@ FROM @tbl@')); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody(NULL, SqlProc_FromText('SELECT @col1@ FROM @tbl@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatesql2.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql2.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql2.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - Int name +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody(1, SqlProc_FromText('SELECT @col1@ FROM @tbl@')); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody(1, SqlProc_FromText('SELECT @col1@ FROM @tbl@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatesql3.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql3.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql3.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - Double name +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody(1.5, SqlProc_FromText('SELECT @col1@ FROM @tbl@')); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody(1.5, SqlProc_FromText('SELECT @col1@ FROM @tbl@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatesql4.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql4.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql4.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - BLOB name +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody(zeroblob(10), SqlProc_FromText('SELECT @col1@ FROM @tbl@')); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody(zeroblob(10), SqlProc_FromText('SELECT @col1@ FROM @tbl@')) +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatesql5.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql5.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql5.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - NULL SQL body +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody('name', NULL); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody('name', NULL) +StoredProc exception - illegal Stored Procedure Body [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_updatesql6.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql6.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql6.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - Int SQL body +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody('name', 1); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody('name', 1) +StoredProc exception - illegal Stored Procedure Body [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_updatesql7.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql7.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql7.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - Double SQL body +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody('name', 1.4); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody('name', 1.4) +StoredProc exception - illegal Stored Procedure Body [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_updatesql8.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql8.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql8.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - invalid BLOB SQL body +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody('myname', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody('myname', zeroblob(10)) +StoredProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_updatesql9.testcase Index: test/sql_stmt_iconv_tests/sp_updatesql9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatesql9.testcase +++ test/sql_stmt_iconv_tests/sp_updatesql9.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateSqlBody - valid BLOB SQL body +:memory: #use in-memory database +SELECT StoredProc_UpdateSqlBody('myname', SqlProc_FromText('SELECT @col@ FROM @tbl@')); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateSqlBody('myname', SqlProc_FromText('SELECT @col@ FROM @tbl@')) +0 ADDED test/sql_stmt_iconv_tests/sp_updatetitle1.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle1.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle1.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - NULL name +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle(NULL, 'title'); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle(NULL, 'title') +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle2.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle2.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle2.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - Int name +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle(1, 'title'); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle(1, 'title') +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle3.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle3.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle3.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - Double name +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle(1.5, 'title'); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle(1.5, 'title') +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle4.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle4.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle4.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - BLOB name +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle(zeroblob(10), 'title'); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle(zeroblob(10), 'title') +StoredProc exception - illegal Stored Procedure Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle5.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle5.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle5.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - NULL title +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle('name', NULL); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle('name', NULL) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle6.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle6.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle6.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - Int title +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle('name', 1); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle('name', 1) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle7.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle7.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle7.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - Double title +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle('name', 1.4); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle('name', 1.4) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle8.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle8.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle8.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - BLOB title +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle('name', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle('name', zeroblob(10)) +StoredProc exception - illegal Stored Procedure Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatetitle9.testcase Index: test/sql_stmt_iconv_tests/sp_updatetitle9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatetitle9.testcase +++ test/sql_stmt_iconv_tests/sp_updatetitle9.testcase @@ -0,0 +1,7 @@ +StoredProc_UpdateTitle - Text title +:memory: #use in-memory database +SELECT StoredProc_UpdateTitle('procname', 'another title'); +1 # rows (not including the header row) +1 # columns +StoredProc_UpdateTitle('procname', 'another title') +0 ADDED test/sql_stmt_iconv_tests/sp_updatevartitle1.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle1.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle1.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - NULL name +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle(NULL, 'title'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle(NULL, 'title') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle2.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle2.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle2.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - Int name +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle(1, 'title'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle(1, 'title') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle3.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle3.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle3.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - Double name +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle(1.5, 'title'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle(1.5, 'title') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle4.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle4.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle4.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - BLOB name +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle(zeroblob(10), 'title'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle(zeroblob(10), 'title') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle5.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle5.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle5.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - NULL title +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle('name', NULL); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle('name', NULL) +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle6.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle6.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle6.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - Int title +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle('name', 1); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle('name', 1) +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle7.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle7.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle7.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - Double title +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle('name', 1.4); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle('name', 1.4) +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle8.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle8.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle8.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - BLOB title +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle('name', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle('name', zeroblob(10)) +StoredVar exception - illegal Stored Variable Title [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevartitle9.testcase Index: test/sql_stmt_iconv_tests/sp_updatevartitle9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevartitle9.testcase +++ test/sql_stmt_iconv_tests/sp_updatevartitle9.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateTitle - Text title +:memory: #use in-memory database +SELECT StoredVar_UpdateTitle('varname', 'another title'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateTitle('varname', 'another title') +0 ADDED test/sql_stmt_iconv_tests/sp_updatevarval1.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval1.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval1.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - NULL name +:memory: #use in-memory database +SELECT StoredVar_UpdateValue(NULL, 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue(NULL, 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevarval2.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval2.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval2.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - Int name +:memory: #use in-memory database +SELECT StoredVar_UpdateValue(1, 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue(1, 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevarval3.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval3.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval3.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - Double name +:memory: #use in-memory database +SELECT StoredVar_UpdateValue(1.5, 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue(1.5, 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevarval4.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval4.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval4.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - BLOB name +:memory: #use in-memory database +SELECT StoredVar_UpdateValue(zeroblob(10), 'value'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue(zeroblob(10), 'value') +StoredVar exception - illegal Stored Variable Name [not a TEXT string]. ADDED test/sql_stmt_iconv_tests/sp_updatevarval5.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval5.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval5.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - NULL value +:memory: #use in-memory database +SELECT StoredVar_UpdateValue('varnull', NULL); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue('varnull', NULL) +1 ADDED test/sql_stmt_iconv_tests/sp_updatevarval6.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval6.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval6.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - Int value +:memory: #use in-memory database +SELECT StoredVar_UpdateValue('varint', 11); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue('varint', 11) +1 ADDED test/sql_stmt_iconv_tests/sp_updatevarval7.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval7.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval7.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - Double value +:memory: #use in-memory database +SELECT StoredVar_UpdateValue('varfloat', 11.4); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue('varfloat', 11.4) +1 ADDED test/sql_stmt_iconv_tests/sp_updatevarval8.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval8.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval8.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - BLOB value +:memory: #use in-memory database +SELECT StoredVar_UpdateValue('varblob', zeroblob(20)); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue('varblob', zeroblob(20)) +1 ADDED test/sql_stmt_iconv_tests/sp_updatevarval9.testcase Index: test/sql_stmt_iconv_tests/sp_updatevarval9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_updatevarval9.testcase +++ test/sql_stmt_iconv_tests/sp_updatevarval9.testcase @@ -0,0 +1,7 @@ +StoredVar_UpdateValue - Text value +:memory: #use in-memory database +SELECT StoredVar_UpdateValue('vartext', 'another value'); +1 # rows (not including the header row) +1 # columns +StoredVar_UpdateValue('vartext', 'another value') +1 ADDED test/sql_stmt_iconv_tests/sp_var_n1.testcase Index: test/sql_stmt_iconv_tests/sp_var_n1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n1.testcase +++ test/sql_stmt_iconv_tests/sp_var_n1.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - NULL +:memory: #use in-memory database +SELECT SqlProc_VariableN(NULL, 1); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(NULL, 1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_var_n10.testcase Index: test/sql_stmt_iconv_tests/sp_var_n10.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n10.testcase +++ test/sql_stmt_iconv_tests/sp_var_n10.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - BLOB index +:memory: #use in-memory database +SELECT SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), zeroblob(10)) +SqlProc exception - illegal Index arg [not an INTEGER]. ADDED test/sql_stmt_iconv_tests/sp_var_n11.testcase Index: test/sql_stmt_iconv_tests/sp_var_n11.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n11.testcase +++ test/sql_stmt_iconv_tests/sp_var_n11.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - negative index +:memory: #use in-memory database +SELECT SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), -1); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), -1) +SqlProc exception - illegal Index (expected to be between 0 and 2). ADDED test/sql_stmt_iconv_tests/sp_var_n12.testcase Index: test/sql_stmt_iconv_tests/sp_var_n12.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n12.testcase +++ test/sql_stmt_iconv_tests/sp_var_n12.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - invalid index +:memory: #use in-memory database +SELECT SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 6); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 6) +SqlProc exception - illegal Index (expected to be between 0 and 2). ADDED test/sql_stmt_iconv_tests/sp_var_n2.testcase Index: test/sql_stmt_iconv_tests/sp_var_n2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n2.testcase +++ test/sql_stmt_iconv_tests/sp_var_n2.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - INT +:memory: #use in-memory database +SELECT SqlProc_VariableN(1, 1); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(1, 1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_var_n3.testcase Index: test/sql_stmt_iconv_tests/sp_var_n3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n3.testcase +++ test/sql_stmt_iconv_tests/sp_var_n3.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - DOUBLE +:memory: #use in-memory database +SELECT SqlProc_VariableN(1.2, 1); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(1.2, 1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_var_n4.testcase Index: test/sql_stmt_iconv_tests/sp_var_n4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n4.testcase +++ test/sql_stmt_iconv_tests/sp_var_n4.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - TEXT +:memory: #use in-memory database +SELECT SqlProc_VariableN('text', 1); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN('text', 1) +SqlProc exception - illegal SQL Procedure arg [not a BLOB]. ADDED test/sql_stmt_iconv_tests/sp_var_n5.testcase Index: test/sql_stmt_iconv_tests/sp_var_n5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n5.testcase +++ test/sql_stmt_iconv_tests/sp_var_n5.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - valid BLOB +:memory: #use in-memory database +SELECT SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1) +@col2@ ADDED test/sql_stmt_iconv_tests/sp_var_n6.testcase Index: test/sql_stmt_iconv_tests/sp_var_n6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n6.testcase +++ test/sql_stmt_iconv_tests/sp_var_n6.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - invalid BLOB +:memory: #use in-memory database +SELECT SqlProc_VariableN(zeroblob(100), 1); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(zeroblob(100), 1) +SqlProc exception - invalid SQL Procedure BLOB. ADDED test/sql_stmt_iconv_tests/sp_var_n7.testcase Index: test/sql_stmt_iconv_tests/sp_var_n7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n7.testcase +++ test/sql_stmt_iconv_tests/sp_var_n7.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - NULL index +:memory: #use in-memory database +SELECT SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), NULL) +SqlProc exception - illegal Index arg [not an INTEGER]. ADDED test/sql_stmt_iconv_tests/sp_var_n8.testcase Index: test/sql_stmt_iconv_tests/sp_var_n8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n8.testcase +++ test/sql_stmt_iconv_tests/sp_var_n8.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - Double index +:memory: #use in-memory database +SELECT SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1.5); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 1.5) +SqlProc exception - illegal Index arg [not an INTEGER]. ADDED test/sql_stmt_iconv_tests/sp_var_n9.testcase Index: test/sql_stmt_iconv_tests/sp_var_n9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_var_n9.testcase +++ test/sql_stmt_iconv_tests/sp_var_n9.testcase @@ -0,0 +1,7 @@ +SqlProc_VariableN - Text index +:memory: #use in-memory database +SELECT SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 'first'); +1 # rows (not including the header row) +1 # columns +SqlProc_VariableN(SqlProc_FromText('SELECT @col1@, $col2$ FROM @table@'), 'first') +SqlProc exception - illegal Index arg [not an INTEGER]. ADDED test/sql_stmt_iconv_tests/sp_vararg1.testcase Index: test/sql_stmt_iconv_tests/sp_vararg1.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg1.testcase +++ test/sql_stmt_iconv_tests/sp_vararg1.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - NULL Name +:memory: #use in-memory database +SELECT SqlProc_VarValue(NULL, 'value'); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue(NULL, 'value') +SqlProc exception - illegal Name arg [not TEXT]. ADDED test/sql_stmt_iconv_tests/sp_vararg2.testcase Index: test/sql_stmt_iconv_tests/sp_vararg2.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg2.testcase +++ test/sql_stmt_iconv_tests/sp_vararg2.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - Int Name +:memory: #use in-memory database +SELECT SqlProc_VarValue(1, 'value'); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue(1, 'value') +SqlProc exception - illegal Name arg [not TEXT]. ADDED test/sql_stmt_iconv_tests/sp_vararg3.testcase Index: test/sql_stmt_iconv_tests/sp_vararg3.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg3.testcase +++ test/sql_stmt_iconv_tests/sp_vararg3.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - Double Name +:memory: #use in-memory database +SELECT SqlProc_VarValue(1.5, 'value'); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue(1-5, 'value') +SqlProc exception - illegal Name arg [not TEXT]. ADDED test/sql_stmt_iconv_tests/sp_vararg4.testcase Index: test/sql_stmt_iconv_tests/sp_vararg4.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg4.testcase +++ test/sql_stmt_iconv_tests/sp_vararg4.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - BLOB Name +:memory: #use in-memory database +SELECT SqlProc_VarValue(zeroblob(4), 'value'); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue(zeroblob(4), 'value') +SqlProc exception - illegal Name arg [not TEXT]. ADDED test/sql_stmt_iconv_tests/sp_vararg5.testcase Index: test/sql_stmt_iconv_tests/sp_vararg5.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg5.testcase +++ test/sql_stmt_iconv_tests/sp_vararg5.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - NULL Value +:memory: #use in-memory database +SELECT SqlProc_VarValue('$name$', NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue('$name$', NULL) +$name$=NULL ADDED test/sql_stmt_iconv_tests/sp_vararg6.testcase Index: test/sql_stmt_iconv_tests/sp_vararg6.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg6.testcase +++ test/sql_stmt_iconv_tests/sp_vararg6.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - Int Value +:memory: #use in-memory database +SELECT SqlProc_VarValue('@name@', 1024); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue('@name@', 1024) +@name@=1024 ADDED test/sql_stmt_iconv_tests/sp_vararg7.testcase Index: test/sql_stmt_iconv_tests/sp_vararg7.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg7.testcase +++ test/sql_stmt_iconv_tests/sp_vararg7.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - Double Value +:memory: #use in-memory database +SELECT SqlProc_VarValue('name', 1.23456789); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue('name', 1.23456789) +@name@=1.2345678900 ADDED test/sql_stmt_iconv_tests/sp_vararg8.testcase Index: test/sql_stmt_iconv_tests/sp_vararg8.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg8.testcase +++ test/sql_stmt_iconv_tests/sp_vararg8.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - Text Value +:memory: #use in-memory database +SELECT SqlProc_VarValue('name', 'value'); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue('name', 'value') +@name@=value ADDED test/sql_stmt_iconv_tests/sp_vararg9.testcase Index: test/sql_stmt_iconv_tests/sp_vararg9.testcase ================================================================== --- test/sql_stmt_iconv_tests/sp_vararg9.testcase +++ test/sql_stmt_iconv_tests/sp_vararg9.testcase @@ -0,0 +1,7 @@ +SqlProc_VarValue - BLOB Value +:memory: #use in-memory database +SELECT SqlProc_VarValue('name', x'0123456789abcdef102132435465768798a9bacbdcedfe'); +1 # rows (not including the header row) +1 # columns +SqlProc_VarValue('name', x'0123456789abcdef102132435465768798a9bacbdcedfe') +@name@=x'0123456789ABCDEF102132435465768798A9BACBDCEDFE' Index: test/sql_stmt_libxml2_tests/Makefile.am ================================================================== --- test/sql_stmt_libxml2_tests/Makefile.am +++ test/sql_stmt_libxml2_tests/Makefile.am @@ -196,10 +196,64 @@ registerVector13.testcase \ registerVector2.testcase \ registerVector3.testcase \ registerVector4.testcase \ registerVector9.testcase \ + registertopogeocvg1.testcase \ + registertopogeocvg2.testcase \ + registertopogeocvg3.testcase \ + registertopogeocvg4.testcase \ + registertopogeocvg5.testcase \ + registertopogeocvg6.testcase \ + registertopogeocvg7.testcase \ + registertopogeocvg8.testcase \ + registertopogeocvg9.testcase \ + registertopogeocvg10.testcase \ + registertopogeocvg11.testcase \ + registertopogeocvg12.testcase \ + registertopogeocvg13.testcase \ + registertopogeocvg14.testcase \ + registertopogeocvg15.testcase \ + registertopogeocvg16.testcase \ + registertopogeocvg17.testcase \ + registertopogeocvg18.testcase \ + registertopogeocvg19.testcase \ + registertopogeocvg20.testcase \ + registertopogeocvg21.testcase \ + registertopogeocvg22.testcase \ + registertopogeocvg23.testcase \ + registertopogeocvg24.testcase \ + registertopogeocvg25.testcase \ + registertopogeocvg26.testcase \ + registertopogeocvg27.testcase \ + registertoponetcvg1.testcase \ + registertoponetcvg2.testcase \ + registertoponetcvg3.testcase \ + registertoponetcvg4.testcase \ + registertoponetcvg5.testcase \ + registertoponetcvg6.testcase \ + registertoponetcvg7.testcase \ + registertoponetcvg8.testcase \ + registertoponetcvg9.testcase \ + registertoponetcvg10.testcase \ + registertoponetcvg11.testcase \ + registertoponetcvg12.testcase \ + registertoponetcvg13.testcase \ + registertoponetcvg14.testcase \ + registertoponetcvg15.testcase \ + registertoponetcvg16.testcase \ + registertoponetcvg17.testcase \ + registertoponetcvg18.testcase \ + registertoponetcvg19.testcase \ + registertoponetcvg20.testcase \ + registertoponetcvg21.testcase \ + registertoponetcvg22.testcase \ + registertoponetcvg23.testcase \ + registertoponetcvg24.testcase \ + registertoponetcvg25.testcase \ + registertoponetcvg26.testcase \ + registertoponetcvg27.testcase \ registervectorcvg1.testcase \ registervectorcvg2.testcase \ registervectorcvg3.testcase \ registervectorcvg4.testcase \ registervectorcvg5.testcase \ @@ -218,10 +272,77 @@ registervectorcvg18.testcase \ registervectorcvg19.testcase \ registervectorcvg20.testcase \ registervectorcvg21.testcase \ registervectorcvg22.testcase \ + registervectorcvg23.testcase \ + registervectorcvg24.testcase \ + registervectorcvg25.testcase \ + registervectorcvg26.testcase \ + registervectorcvg27.testcase \ + registervectorcvg28.testcase \ + registervectorcvg29.testcase \ + registervectorcvg30.testcase \ + registervectorcvg31.testcase \ + registerviewcvg1.testcase \ + registerviewcvg2.testcase \ + registerviewcvg3.testcase \ + registerviewcvg4.testcase \ + registerviewcvg5.testcase \ + registerviewcvg6.testcase \ + registerviewcvg7.testcase \ + registerviewcvg8.testcase \ + registerviewcvg9.testcase \ + registerviewcvg10.testcase \ + registerviewcvg11.testcase \ + registerviewcvg12.testcase \ + registerviewcvg13.testcase \ + registerviewcvg14.testcase \ + registerviewcvg15.testcase \ + registerviewcvg16.testcase \ + registerviewcvg17.testcase \ + registerviewcvg18.testcase \ + registerviewcvg19.testcase \ + registerviewcvg20.testcase \ + registerviewcvg21.testcase \ + registerviewcvg22.testcase \ + registerviewcvg23.testcase \ + registerviewcvg24.testcase \ + registerviewcvg25.testcase \ + registerviewcvg26.testcase \ + registerviewcvg27.testcase \ + registerviewcvg28.testcase \ + registerviewcvg29.testcase \ + registerviewcvg30.testcase \ + registerviewcvg31.testcase \ + registervirtualcvg1.testcase \ + registervirtualcvg2.testcase \ + registervirtualcvg3.testcase \ + registervirtualcvg4.testcase \ + registervirtualcvg5.testcase \ + registervirtualcvg6.testcase \ + registervirtualcvg7.testcase \ + registervirtualcvg8.testcase \ + registervirtualcvg9.testcase \ + registervirtualcvg10.testcase \ + registervirtualcvg11.testcase \ + registervirtualcvg12.testcase \ + registervirtualcvg13.testcase \ + registervirtualcvg14.testcase \ + registervirtualcvg15.testcase \ + registervirtualcvg16.testcase \ + registervirtualcvg17.testcase \ + registervirtualcvg18.testcase \ + registervirtualcvg19.testcase \ + registervirtualcvg20.testcase \ + registervirtualcvg21.testcase \ + registervirtualcvg22.testcase \ + registervirtualcvg23.testcase \ + registervirtualcvg24.testcase \ + registervirtualcvg25.testcase \ + registervirtualcvg26.testcase \ + registervirtualcvg27.testcase \ registervectorkeyword1.testcase \ registervectorkeyword2.testcase \ registervectorkeyword3.testcase \ registervectorkeyword4.testcase \ registervectorkeyword5.testcase \ @@ -326,10 +447,26 @@ setparentid1.testcase \ setparentid2.testcase \ setparentid3.testcase \ setparentid4.testcase \ setparentid5.testcase \ + setvectorcopyright1.testcase \ + setvectorcopyright2.testcase \ + setvectorcopyright3.testcase \ + setvectorcopyright4.testcase \ + setvectorcopyright5.testcase \ + setvectorcopyright6.testcase \ + setvectorcopyright7.testcase \ + setvectorcopyright8.testcase \ + setvectorcopyright9.testcase \ + setvectorcopyright10.testcase \ + setvectorcopyright11.testcase \ + setvectorcopyright12.testcase \ + setvectorcopyright13.testcase \ + setvectorcopyright14.testcase \ + setvectorcopyright15.testcase \ + setvectorcopyright16.testcase \ setvectorinfos1.testcase \ setvectorinfos2.testcase \ setvectorinfos3.testcase \ setvectorinfos4.testcase \ setvectorinfos5.testcase \ @@ -339,10 +476,19 @@ setvectorinfos9.testcase \ setvectorinfos10.testcase \ setvectorinfos11.testcase \ setvectorinfos12.testcase \ setvectorinfos13.testcase \ + setvectorinfos14.testcase \ + setvectorinfos15.testcase \ + setvectorinfos16.testcase \ + setvectorinfos17.testcase \ + setvectorinfos18.testcase \ + setvectorinfos19.testcase \ + setvectorinfos20.testcase \ + setvectorinfos21.testcase \ + setvectorinfos22.testcase \ unregisterGraphic1.testcase \ unregisterGraphic2.testcase \ unregisterGraphic3.testcase \ unregisterGraphic4.testcase \ unregisterGraphic5.testcase \ Index: test/sql_stmt_libxml2_tests/Makefile.in ================================================================== --- test/sql_stmt_libxml2_tests/Makefile.in +++ test/sql_stmt_libxml2_tests/Makefile.in @@ -448,10 +448,64 @@ registerVector13.testcase \ registerVector2.testcase \ registerVector3.testcase \ registerVector4.testcase \ registerVector9.testcase \ + registertopogeocvg1.testcase \ + registertopogeocvg2.testcase \ + registertopogeocvg3.testcase \ + registertopogeocvg4.testcase \ + registertopogeocvg5.testcase \ + registertopogeocvg6.testcase \ + registertopogeocvg7.testcase \ + registertopogeocvg8.testcase \ + registertopogeocvg9.testcase \ + registertopogeocvg10.testcase \ + registertopogeocvg11.testcase \ + registertopogeocvg12.testcase \ + registertopogeocvg13.testcase \ + registertopogeocvg14.testcase \ + registertopogeocvg15.testcase \ + registertopogeocvg16.testcase \ + registertopogeocvg17.testcase \ + registertopogeocvg18.testcase \ + registertopogeocvg19.testcase \ + registertopogeocvg20.testcase \ + registertopogeocvg21.testcase \ + registertopogeocvg22.testcase \ + registertopogeocvg23.testcase \ + registertopogeocvg24.testcase \ + registertopogeocvg25.testcase \ + registertopogeocvg26.testcase \ + registertopogeocvg27.testcase \ + registertoponetcvg1.testcase \ + registertoponetcvg2.testcase \ + registertoponetcvg3.testcase \ + registertoponetcvg4.testcase \ + registertoponetcvg5.testcase \ + registertoponetcvg6.testcase \ + registertoponetcvg7.testcase \ + registertoponetcvg8.testcase \ + registertoponetcvg9.testcase \ + registertoponetcvg10.testcase \ + registertoponetcvg11.testcase \ + registertoponetcvg12.testcase \ + registertoponetcvg13.testcase \ + registertoponetcvg14.testcase \ + registertoponetcvg15.testcase \ + registertoponetcvg16.testcase \ + registertoponetcvg17.testcase \ + registertoponetcvg18.testcase \ + registertoponetcvg19.testcase \ + registertoponetcvg20.testcase \ + registertoponetcvg21.testcase \ + registertoponetcvg22.testcase \ + registertoponetcvg23.testcase \ + registertoponetcvg24.testcase \ + registertoponetcvg25.testcase \ + registertoponetcvg26.testcase \ + registertoponetcvg27.testcase \ registervectorcvg1.testcase \ registervectorcvg2.testcase \ registervectorcvg3.testcase \ registervectorcvg4.testcase \ registervectorcvg5.testcase \ @@ -470,10 +524,77 @@ registervectorcvg18.testcase \ registervectorcvg19.testcase \ registervectorcvg20.testcase \ registervectorcvg21.testcase \ registervectorcvg22.testcase \ + registervectorcvg23.testcase \ + registervectorcvg24.testcase \ + registervectorcvg25.testcase \ + registervectorcvg26.testcase \ + registervectorcvg27.testcase \ + registervectorcvg28.testcase \ + registervectorcvg29.testcase \ + registervectorcvg30.testcase \ + registervectorcvg31.testcase \ + registerviewcvg1.testcase \ + registerviewcvg2.testcase \ + registerviewcvg3.testcase \ + registerviewcvg4.testcase \ + registerviewcvg5.testcase \ + registerviewcvg6.testcase \ + registerviewcvg7.testcase \ + registerviewcvg8.testcase \ + registerviewcvg9.testcase \ + registerviewcvg10.testcase \ + registerviewcvg11.testcase \ + registerviewcvg12.testcase \ + registerviewcvg13.testcase \ + registerviewcvg14.testcase \ + registerviewcvg15.testcase \ + registerviewcvg16.testcase \ + registerviewcvg17.testcase \ + registerviewcvg18.testcase \ + registerviewcvg19.testcase \ + registerviewcvg20.testcase \ + registerviewcvg21.testcase \ + registerviewcvg22.testcase \ + registerviewcvg23.testcase \ + registerviewcvg24.testcase \ + registerviewcvg25.testcase \ + registerviewcvg26.testcase \ + registerviewcvg27.testcase \ + registerviewcvg28.testcase \ + registerviewcvg29.testcase \ + registerviewcvg30.testcase \ + registerviewcvg31.testcase \ + registervirtualcvg1.testcase \ + registervirtualcvg2.testcase \ + registervirtualcvg3.testcase \ + registervirtualcvg4.testcase \ + registervirtualcvg5.testcase \ + registervirtualcvg6.testcase \ + registervirtualcvg7.testcase \ + registervirtualcvg8.testcase \ + registervirtualcvg9.testcase \ + registervirtualcvg10.testcase \ + registervirtualcvg11.testcase \ + registervirtualcvg12.testcase \ + registervirtualcvg13.testcase \ + registervirtualcvg14.testcase \ + registervirtualcvg15.testcase \ + registervirtualcvg16.testcase \ + registervirtualcvg17.testcase \ + registervirtualcvg18.testcase \ + registervirtualcvg19.testcase \ + registervirtualcvg20.testcase \ + registervirtualcvg21.testcase \ + registervirtualcvg22.testcase \ + registervirtualcvg23.testcase \ + registervirtualcvg24.testcase \ + registervirtualcvg25.testcase \ + registervirtualcvg26.testcase \ + registervirtualcvg27.testcase \ registervectorkeyword1.testcase \ registervectorkeyword2.testcase \ registervectorkeyword3.testcase \ registervectorkeyword4.testcase \ registervectorkeyword5.testcase \ @@ -578,10 +699,26 @@ setparentid1.testcase \ setparentid2.testcase \ setparentid3.testcase \ setparentid4.testcase \ setparentid5.testcase \ + setvectorcopyright1.testcase \ + setvectorcopyright2.testcase \ + setvectorcopyright3.testcase \ + setvectorcopyright4.testcase \ + setvectorcopyright5.testcase \ + setvectorcopyright6.testcase \ + setvectorcopyright7.testcase \ + setvectorcopyright8.testcase \ + setvectorcopyright9.testcase \ + setvectorcopyright10.testcase \ + setvectorcopyright11.testcase \ + setvectorcopyright12.testcase \ + setvectorcopyright13.testcase \ + setvectorcopyright14.testcase \ + setvectorcopyright15.testcase \ + setvectorcopyright16.testcase \ setvectorinfos1.testcase \ setvectorinfos2.testcase \ setvectorinfos3.testcase \ setvectorinfos4.testcase \ setvectorinfos5.testcase \ @@ -591,10 +728,19 @@ setvectorinfos9.testcase \ setvectorinfos10.testcase \ setvectorinfos11.testcase \ setvectorinfos12.testcase \ setvectorinfos13.testcase \ + setvectorinfos14.testcase \ + setvectorinfos15.testcase \ + setvectorinfos16.testcase \ + setvectorinfos17.testcase \ + setvectorinfos18.testcase \ + setvectorinfos19.testcase \ + setvectorinfos20.testcase \ + setvectorinfos21.testcase \ + setvectorinfos22.testcase \ unregisterGraphic1.testcase \ unregisterGraphic2.testcase \ unregisterGraphic3.testcase \ unregisterGraphic4.testcase \ unregisterGraphic5.testcase \ ADDED test/sql_stmt_libxml2_tests/registertopogeocvg1.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg1.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg1.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg1.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - NULL coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage(NULL, 'topo'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage(NULL, 'topo') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg10.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg10.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg10.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg10.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - NULL Title +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', NULL, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', NULL, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg11.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg11.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg11.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg11.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Int Title +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg12.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg12.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg12.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg12.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Double Title +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 1.1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 1.1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg13.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg13.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg13.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg13.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - BLOB Title +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', zeroblob(10), 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', zeroblob(10), 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg14.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg14.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg14.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg14.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - NULL Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg15.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg15.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg15.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg15.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Int Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg16.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg16.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg16.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg16.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Double Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 1.5); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 1.5) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg17.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg17.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg17.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg17.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - BLOB Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', zeroblob(5)); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', zeroblob(5)) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg18.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg18.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg18.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg18.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Text Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract') +0 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg19.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg19.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg19.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg19.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - NULL Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', NULL, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', NULL, 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg2.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg2.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg2.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg2.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Int coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage(1, 'topo'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage(1, 'topo') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg20.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg20.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg20.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg20.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Double Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1.2, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1.2, 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg21.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg21.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg21.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg21.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Text Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 'yes', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 'yes', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg22.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg22.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg22.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg22.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - BLOB Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', zeroblob(4), 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', zeroblob(4), 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg23.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg23.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg23.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg23.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - NULL Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg24.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg24.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg24.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg24.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Double Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, 1.3); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, 1.3) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg25.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg25.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg25.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg25.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Text Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, 'no'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, 'no') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg26.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg26.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg26.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg26.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - BLOB Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg27.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg27.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg27.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg27.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - valid +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo', 'title', 'abstract', 1, 1) +0 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg3.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg3.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg3.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg3.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Double coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage(1.1, 'topo'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage(1.1, 'topo') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg4.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg4.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg4.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg4.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - BLOB coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage(zeroblob(4), 'topo'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage(zeroblob(4), 'topo') +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg5.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg5.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg5.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg5.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - NULL topology +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg6.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg6.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg6.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg6.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Int topology +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg7.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg7.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg7.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg7.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Double topology +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 1.1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 1.1) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg8.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg8.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg8.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg8.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - BLOB topology +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registertopogeocvg9.testcase Index: test/sql_stmt_libxml2_tests/registertopogeocvg9.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertopogeocvg9.testcase +++ test/sql_stmt_libxml2_tests/registertopogeocvg9.testcase @@ -0,0 +1,7 @@ +RegisterTopoGeoCoverage - Text topology +:memory: #use in-memory database +SELECT SE_RegisterTopoGeoCoverage('alpha', 'topo'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoGeoCoverage('alpha', 'topo') +0 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg1.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg1.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg1.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg1.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - NULL coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage(NULL, 'network'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage(NULL, 'network') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg10.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg10.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg10.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg10.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - NULL Title +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', NULL, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', NULL, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg11.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg11.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg11.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg11.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Int Title +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg12.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg12.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg12.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg12.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Double Title +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 1.1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 1.1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg13.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg13.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg13.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg13.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - BLOB Title +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', zeroblob(10), 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', zeroblob(10), 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg14.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg14.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg14.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg14.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - NULL Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg15.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg15.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg15.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg15.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Int Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg16.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg16.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg16.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg16.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Double Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 1.5); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 1.5) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg17.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg17.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg17.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg17.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - BLOB Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', zeroblob(5)); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', zeroblob(5)) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg18.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg18.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg18.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg18.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Text Abstract +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract') +0 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg19.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg19.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg19.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg19.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - NULL Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', NULL, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', NULL, 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg2.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg2.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg2.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg2.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Int coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage(1, 'network'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage(1, 'network') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg20.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg20.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg20.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg20.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Double Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1.2, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1.2, 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg21.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg21.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg21.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg21.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Text Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 'yes', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 'yes', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg22.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg22.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg22.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg22.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - BLOB Queryable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', zeroblob(4), 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', zeroblob(4), 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg23.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg23.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg23.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg23.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - NULL Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg24.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg24.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg24.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg24.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Double Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, 1.3); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, 1.3) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg25.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg25.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg25.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg25.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Text Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, 'no'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, 'no') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg26.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg26.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg26.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg26.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - BLOB Editable +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg27.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg27.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg27.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg27.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - valid +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network', 'title', 'abstract', 1, 1) +0 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg3.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg3.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg3.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg3.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Double coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage(1.1, 'network'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage(1.1, 'network') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg4.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg4.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg4.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg4.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - BLOB coverage +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage(zeroblob(4), 'network'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage(zeroblob(4), 'network') +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg5.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg5.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg5.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg5.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - NULL Network +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg6.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg6.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg6.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg6.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Int Network +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg7.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg7.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg7.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg7.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Double Network +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 1.1); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 1.1) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg8.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg8.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg8.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg8.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - BLOB Network +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registertoponetcvg9.testcase Index: test/sql_stmt_libxml2_tests/registertoponetcvg9.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registertoponetcvg9.testcase +++ test/sql_stmt_libxml2_tests/registertoponetcvg9.testcase @@ -0,0 +1,7 @@ +RegisterTopoNetCoverage - Text Network +:memory: #use in-memory database +SELECT SE_RegisterTopoNetCoverage('alpha', 'network'); +1 # rows (not including the header row) +1 # columns +SE_RegisterTopoNetCoverage('alpha', 'network') +0 Index: test/sql_stmt_libxml2_tests/registervectorcvg1.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg1.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg1.testcase @@ -1,7 +1,7 @@ RegisterVectorCoverage - NULL coverage :memory: #use in-memory database -SELECT SE_RegisterVectorCoverage(NULL, 'title', 'abstract'); +SELECT SE_RegisterVectorCoverage(NULL, 'table', 'geom'); 1 # rows (not including the header row) 1 # columns -SE_RegisterVectorCoverage(NULL, 'title', 'abstract') +SE_RegisterVectorCoverage(NULL, 'table', 'geom') -1 Index: test/sql_stmt_libxml2_tests/registervectorcvg2.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg2.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg2.testcase @@ -1,7 +1,7 @@ RegisterVectorCoverage - Int coverage :memory: #use in-memory database -SELECT SE_RegisterVectorCoverage(1, 'title', 'abstract'); +SELECT SE_RegisterVectorCoverage(1, 'table', 'geom'); 1 # rows (not including the header row) 1 # columns -SE_RegisterVectorCoverage(1, 'title', 'abstract') +SE_RegisterVectorCoverage(1, 'table', 'geom') -1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg23.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg23.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg23.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg23.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - NULL is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 0); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 0) +-1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg24.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg24.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg24.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg24.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - Text is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 'no'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 'no') +-1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg25.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg25.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg25.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg25.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - BLOB is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, zeroblob(10)) +-1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg26.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg26.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg26.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg26.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - Double is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 1.0); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 1.0) +-1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg27.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg27.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg27.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg27.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - NULL is_editable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg28.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg28.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg28.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg28.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - Text is_editable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 'no'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 'no') +-1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg29.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg29.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg29.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg29.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - BLOB is_editable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, zeroblob(10)) +-1 Index: test/sql_stmt_libxml2_tests/registervectorcvg3.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg3.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg3.testcase @@ -1,7 +1,7 @@ RegisterVectorCoverage - Double coverage :memory: #use in-memory database -SELECT SE_RegisterVectorCoverage(1.1, 'title', 'abstract'); +SELECT SE_RegisterVectorCoverage(1.1, 'table', 'geom'); 1 # rows (not including the header row) 1 # columns -SE_RegisterVectorCoverage(1.1, 'title', 'abstract') +SE_RegisterVectorCoverage(1.1, 'table', 'geom') -1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg30.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg30.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg30.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg30.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - Double is_editable +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1.0); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1.0) +-1 ADDED test/sql_stmt_libxml2_tests/registervectorcvg31.testcase Index: test/sql_stmt_libxml2_tests/registervectorcvg31.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg31.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg31.testcase @@ -0,0 +1,7 @@ +RegisterVectorCoverage - valid - ultralong form +:memory: #use in-memory database +SELECT SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterVectorCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1) +0 Index: test/sql_stmt_libxml2_tests/registervectorcvg4.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervectorcvg4.testcase +++ test/sql_stmt_libxml2_tests/registervectorcvg4.testcase @@ -1,7 +1,7 @@ RegisterVectorCoverage - BLOB coverage :memory: #use in-memory database -SELECT SE_RegisterVectorCoverage(zeroblob(4), 'title', 'abstract'); +SELECT SE_RegisterVectorCoverage(zeroblob(4), 'table', 'geom'); 1 # rows (not including the header row) 1 # columns -SE_RegisterVectorCoverage(zeroblob(4), 'title', 'abstract') +SE_RegisterVectorCoverage(zeroblob(4), 'table', 'geom') -1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg1.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg1.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg1.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg1.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - NULL coverage +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage(NULL, 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage(NULL, 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg10.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg10.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg10.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg10.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Int f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg11.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg11.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg11.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg11.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Double f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 1.1); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 1.1) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg12.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg12.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg12.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg12.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - BLOB f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg13.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg13.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg13.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg13.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - valid short form +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom') +0 ADDED test/sql_stmt_libxml2_tests/registerviewcvg14.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg14.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg14.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg14.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - NULL title +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', NULL, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', NULL, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg15.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg15.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg15.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg15.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Int title +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg16.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg16.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg16.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg16.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Double title +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 1.1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 1.1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg17.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg17.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg17.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg17.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - BLOB title +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', zeroblob(4), 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', zeroblob(4), 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg18.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg18.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg18.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg18.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - NULL abstract +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg19.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg19.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg19.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg19.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Int abstract +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg2.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg2.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg2.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg2.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Int coverage +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage(1, 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage(1, 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg20.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg20.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg20.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg20.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Double abstract +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 1.1); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 1.1) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg21.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg21.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg21.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg21.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - BLOB abstract +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg22.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg22.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg22.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg22.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - valid - long form +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract') +0 ADDED test/sql_stmt_libxml2_tests/registerviewcvg23.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg23.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg23.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg23.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - NULL is_queryable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 0); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 0) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg24.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg24.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg24.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg24.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Text is_queryable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 'no'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 'no') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg25.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg25.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg25.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg25.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - BLOB is_queryable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, zeroblob(10)) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg26.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg26.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg26.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg26.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Double is_queryable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 1.0); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL, 1.0) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg27.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg27.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg27.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg27.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - NULL is_editable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg28.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg28.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg28.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg28.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Text is_editable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 'no'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 'no') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg29.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg29.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg29.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg29.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - BLOB is_editable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, zeroblob(10)) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg3.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg3.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg3.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg3.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Double coverage +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage(1.1, 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage(1.1, 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg30.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg30.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg30.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg30.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Double is_editable +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1.0); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1.0) +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg31.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg31.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg31.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg31.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - valid - ultralong form +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1, 1) +0 ADDED test/sql_stmt_libxml2_tests/registerviewcvg4.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg4.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg4.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg4.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - BLOB coverage +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage(zeroblob(4), 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage(zeroblob(4), 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg5.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg5.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg5.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg5.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - NULL f_table_name +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', NULL, 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', NULL, 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg6.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg6.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg6.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg6.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Int f_table_name +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 1, 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 1, 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg7.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg7.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg7.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg7.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - Double f_table_name +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 1.1, 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 1.1, 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg8.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg8.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg8.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg8.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - BLOB f_table_name +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', zeroblob(4), 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', zeroblob(4), 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registerviewcvg9.testcase Index: test/sql_stmt_libxml2_tests/registerviewcvg9.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registerviewcvg9.testcase +++ test/sql_stmt_libxml2_tests/registerviewcvg9.testcase @@ -0,0 +1,7 @@ +RegisterSpatialViewCoverage - NULL f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterSpatialViewCoverage('alpha', 'table', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterSpatialViewCoverage('alpha', 'table', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg1.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg1.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg1.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg1.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - NULL coverage +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage(NULL, 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage(NULL, 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg10.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg10.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg10.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg10.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Int f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg11.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg11.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg11.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg11.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Double f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 1.1); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 1.1) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg12.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg12.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg12.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg12.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - BLOB f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg13.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg13.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg13.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg13.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - valid short form +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom') +0 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg14.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg14.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg14.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg14.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - NULL title +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', NULL, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', NULL, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg15.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg15.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg15.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg15.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Int title +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg16.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg16.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg16.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg16.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Double title +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 1.1, 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 1.1, 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg17.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg17.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg17.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg17.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - BLOB title +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', zeroblob(4), 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', zeroblob(4), 'abstract') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg18.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg18.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg18.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg18.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - NULL abstract +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg19.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg19.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg19.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg19.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Int abstract +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 1) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg2.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg2.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg2.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg2.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Int coverage +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage(1, 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage(1, 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg20.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg20.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg20.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg20.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Double abstract +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 1.1); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 1.1) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg21.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg21.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg21.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg21.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - BLOB abstract +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', zeroblob(4)) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg22.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg22.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg22.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg22.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - valid - long form +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract') +0 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg23.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg23.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg23.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg23.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - NULL is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg24.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg24.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg24.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg24.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Text is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', 'no'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', 'no') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg25.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg25.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg25.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg25.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - BLOB is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', zeroblob(10)) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg26.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg26.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg26.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg26.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Double is_queryable +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1.0); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1.0) +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg27.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg27.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg27.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg27.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - valid - ultralong form +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', 'geom', 'title', 'abstract', 1) +0 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg3.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg3.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg3.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg3.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Double coverage +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage(1.1, 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage(1.1, 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg4.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg4.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg4.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg4.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - BLOB coverage +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage(zeroblob(4), 'table', 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage(zeroblob(4), 'table', 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg5.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg5.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg5.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg5.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - NULL f_table_name +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', NULL, 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', NULL, 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg6.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg6.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg6.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg6.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Int f_table_name +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 1, 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 1, 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg7.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg7.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg7.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg7.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - Double f_table_name +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 1.1, 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 1.1, 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg8.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg8.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg8.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg8.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - BLOB f_table_name +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', zeroblob(4), 'geom'); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', zeroblob(4), 'geom') +-1 ADDED test/sql_stmt_libxml2_tests/registervirtualcvg9.testcase Index: test/sql_stmt_libxml2_tests/registervirtualcvg9.testcase ================================================================== --- test/sql_stmt_libxml2_tests/registervirtualcvg9.testcase +++ test/sql_stmt_libxml2_tests/registervirtualcvg9.testcase @@ -0,0 +1,7 @@ +RegisterVirtualShapeCoverage - NULL f_geometry_column +:memory: #use in-memory database +SELECT SE_RegisterVirtualShapeCoverage('alpha', 'table', NULL); +1 # rows (not including the header row) +1 # columns +SE_RegisterVirtualShapeCoverage('alpha', 'table', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright1.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright1.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright1.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright1.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - NULL coverage +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright(NULL, 'somebody'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright(NULL, 'somebody') +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright10.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright10.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright10.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright10.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - NULL License +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 'somebody', NULL); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 'somebody', NULL) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright11.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright11.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright11.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright11.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Int License +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 'somebody', 1); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 'somebody', 1) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright12.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright12.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright12.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright12.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Double License +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 'somebody', 1.5); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 'somebody', 1.5) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright13.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright13.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright13.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright13.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - BLOB License +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 'somebody', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 'somebody', zeroblob(10)) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright14.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright14.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright14.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright14.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Text License +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 'somebody', 'CC0 1.0'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 'somebody', 'CC0 1.0') +0 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright15.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright15.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright15.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright15.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Text Copyright +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 'somebody'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 'somebody') +0 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright16.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright16.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright16.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright16.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Text License, NULL copyright +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', NULL, 'CC0 1.0'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', NULL, 'CC0 1.0') +0 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright2.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright2.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright2.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright2.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Int coverage +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright(1, 'somebody'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright(1, 'somebody') +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright3.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright3.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright3.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright3.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Double coverage +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright(1.5, 'somebody'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright(1.5, 'somebody') +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright4.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright4.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright4.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright4.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - BLOB coverage +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright(zeroblob(4), 'somebody'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright(zeroblob(4), 'somebody') +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright5.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright5.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright5.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright5.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - NULL Copyright +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', NULL); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', NULL)) +1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright6.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright6.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright6.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright6.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Int Copyright +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 1); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 1) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright7.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright7.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright7.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright7.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Double Copyright +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 1.5); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 1.5) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright8.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright8.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright8.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright8.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - Blob Copyright +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', zeroblob(10)) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorcopyright9.testcase Index: test/sql_stmt_libxml2_tests/setvectorcopyright9.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorcopyright9.testcase +++ test/sql_stmt_libxml2_tests/setvectorcopyright9.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageCopyright - valid Copyright +:memory: #use in-memory database +SELECT SE_SetVectorCoverageCopyright('coverage', 'somebody'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageCopyright('coverage', 'somebody') +0 ADDED test/sql_stmt_libxml2_tests/setvectorinfos14.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos14.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos14.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos14.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - NULL is_queryable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', NULL, 1); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', NULL, 1) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos15.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos15.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos15.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos15.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - Text is_queryable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 'no', 1); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 'no', 1) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos16.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos16.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos16.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos16.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - BLOB is_queryable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', zeroblob(10), 1); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', zeroblob(10), 1) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos17.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos17.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos17.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos17.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - Double is_queryable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1.0, 1); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1.0, 1) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos18.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos18.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos18.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos18.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - NULL is_editable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, NULL); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, NULL) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos19.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos19.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos19.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos19.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - Text is_editable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, 'no'); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, 'no') +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos20.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos20.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos20.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos20.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - BLOB is_editable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, zeroblob(10)) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos21.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos21.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos21.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos21.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - Double is_editable +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, 1.0); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, 1.0) +-1 ADDED test/sql_stmt_libxml2_tests/setvectorinfos22.testcase Index: test/sql_stmt_libxml2_tests/setvectorinfos22.testcase ================================================================== --- test/sql_stmt_libxml2_tests/setvectorinfos22.testcase +++ test/sql_stmt_libxml2_tests/setvectorinfos22.testcase @@ -0,0 +1,7 @@ +SetVectorCoverageInfos - valid long format +:memory: #use in-memory database +SELECT SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, 1); +1 # rows (not including the header row) +1 # columns +SE_SetVectorCoverageInfos('alpha', 'title', 'abstract', 1, 1) +0 ADDED test/sql_stmt_logfile_tests/Makefile.am Index: test/sql_stmt_logfile_tests/Makefile.am ================================================================== --- test/sql_stmt_logfile_tests/Makefile.am +++ test/sql_stmt_logfile_tests/Makefile.am @@ -0,0 +1,11 @@ + +EXTRA_DIST = sp_setlogfile1.testcase \ + sp_setlogfile2.testcase \ + sp_setlogfile3.testcase \ + sp_setlogfile4.testcase \ + sp_setlogfile5.testcase \ + sp_setlogfile6.testcase \ + sp_setlogfile7.testcase \ + sp_setlogfile8.testcase \ + sp_setlogfile9.testcase \ + sp_setlogfile10.testcase ADDED test/sql_stmt_logfile_tests/Makefile.in Index: test/sql_stmt_logfile_tests/Makefile.in ================================================================== --- test/sql_stmt_logfile_tests/Makefile.in +++ test/sql_stmt_logfile_tests/Makefile.in @@ -0,0 +1,459 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/sql_stmt_logfile_tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GEOSCONFIG = @GEOSCONFIG@ +GEOS_CFLAGS = @GEOS_CFLAGS@ +GEOS_LDFLAGS = @GEOS_LDFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = sp_setlogfile1.testcase \ + sp_setlogfile2.testcase \ + sp_setlogfile3.testcase \ + sp_setlogfile4.testcase \ + sp_setlogfile5.testcase \ + sp_setlogfile6.testcase \ + sp_setlogfile7.testcase \ + sp_setlogfile8.testcase \ + sp_setlogfile9.testcase \ + sp_setlogfile10.testcase + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/sql_stmt_logfile_tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/sql_stmt_logfile_tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: ADDED test/sql_stmt_logfile_tests/sp_setlogfile1.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile1.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile1.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile1.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - Int filepath +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(1); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(1) +SqlProc exception - illegal File Path argument. ADDED test/sql_stmt_logfile_tests/sp_setlogfile10.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile10.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile10.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile10.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - Int append +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(NULL, 1); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(NULL, 1) +1 ADDED test/sql_stmt_logfile_tests/sp_setlogfile2.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile2.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile2.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile2.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - Double filepath +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(1.5); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(1.5) +SqlProc exception - illegal File Path argument. ADDED test/sql_stmt_logfile_tests/sp_setlogfile3.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile3.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile3.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile3.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - BLOB filepath +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(zeroblob(10)) +SqlProc exception - illegal File Path argument. ADDED test/sql_stmt_logfile_tests/sp_setlogfile4.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile4.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile4.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile4.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - Text filepath +:memory: #use in-memory database +SELECT SqlProc_SetLogfile('./sql_logfile'); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile('./sql_logfile') +1 ADDED test/sql_stmt_logfile_tests/sp_setlogfile5.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile5.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile5.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile5.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - NULL filepath +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(NULL) +1 ADDED test/sql_stmt_logfile_tests/sp_setlogfile6.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile6.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile6.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile6.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - NULL append +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(NULL, NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(NULL, NULL) +SqlProc exception - illegal Append Mode argument. ADDED test/sql_stmt_logfile_tests/sp_setlogfile7.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile7.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile7.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile7.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - Double append +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(NULL, 1.5); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(NULL, 1.5) +SqlProc exception - illegal Append Mode argument. ADDED test/sql_stmt_logfile_tests/sp_setlogfile8.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile8.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile8.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile8.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - Text append +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(NULL, 'yes'); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(NULL, 'yes') +SqlProc exception - illegal Append Mode argument. ADDED test/sql_stmt_logfile_tests/sp_setlogfile9.testcase Index: test/sql_stmt_logfile_tests/sp_setlogfile9.testcase ================================================================== --- test/sql_stmt_logfile_tests/sp_setlogfile9.testcase +++ test/sql_stmt_logfile_tests/sp_setlogfile9.testcase @@ -0,0 +1,7 @@ +SqlProc_SetLogfile - BLOB append +:memory: #use in-memory database +SELECT SqlProc_SetLogfile(NULL, zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SqlProc_SetLogfile(NULL, zeroblob(10)) +SqlProc exception - illegal Append Mode argument. ADDED test/sql_stmt_point_geom/Makefile.am Index: test/sql_stmt_point_geom/Makefile.am ================================================================== --- test/sql_stmt_point_geom/Makefile.am +++ test/sql_stmt_point_geom/Makefile.am @@ -0,0 +1,2 @@ + +EXTRA_DIST = isXblob5.testcase ADDED test/sql_stmt_point_geom/Makefile.in Index: test/sql_stmt_point_geom/Makefile.in ================================================================== --- test/sql_stmt_point_geom/Makefile.in +++ test/sql_stmt_point_geom/Makefile.in @@ -0,0 +1,449 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/sql_stmt_point_geom +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GEOSCONFIG = @GEOSCONFIG@ +GEOS_CFLAGS = @GEOS_CFLAGS@ +GEOS_LDFLAGS = @GEOS_LDFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = isXblob5.testcase +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/sql_stmt_point_geom/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/sql_stmt_point_geom/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: ADDED test/sql_stmt_point_geom/isXblob5.testcase Index: test/sql_stmt_point_geom/isXblob5.testcase ================================================================== --- test/sql_stmt_point_geom/isXblob5.testcase +++ test/sql_stmt_point_geom/isXblob5.testcase @@ -0,0 +1,29 @@ +isXblob - geom - Point-Geometry +:memory: #use in-memory database +SELECT Hex(blob), IsPngBlob(blob), IsGifBlob(blob), IsGeometryBlob(blob), IsTinyPointBlob(blob), IsZipBlob(blob), IsPdfBlob(blob), IsTiffBlob(blob), IsJpegBlob(blob), IsExifBlob(blob), IsExifGpsBlob(blob), IsWebpBlob(blob) FROM (SELECT GeomFromText("POINT(1 3)") as blob) dummy +1 # rows (not including the header row) +12 # columns +Hex(blob) +IsPngBlob(blob) +IsGifBlob(blob) +IsGeometryBlob(blob) +IsTinyPointBlob(blob) +IsZipBlob(blob) +IsPdfBlob(blob) +IsTiffBlob(blob) +IsJpegBlob(blob) +IsExifBlob(blob) +IsExifGpsBlob(blob) +IsWebpBlob(blob) +000100000000000000000000F03F0000000000000840000000000000F03F00000000000008407C01000000000000000000F03F0000000000000840FE +0 +0 +1 +0 +0 +0 +0 +0 +0 +0 +0 Index: test/sql_stmt_proj492_tests/Makefile.am ================================================================== --- test/sql_stmt_proj492_tests/Makefile.am +++ test/sql_stmt_proj492_tests/Makefile.am @@ -17,6 +17,17 @@ transform4.testcase \ transform5.testcase \ transform6.testcase \ transform7.testcase \ transform8.testcase \ - transform9.testcase + transform9.testcase \ + transformxy10.testcase \ + transformxy11.testcase \ + transformxy1.testcase \ + transformxy2.testcase \ + transformxy3.testcase \ + transformxy4.testcase \ + transformxy5.testcase \ + transformxy6.testcase \ + transformxy7.testcase \ + transformxy8.testcase \ + transformxy9.testcase Index: test/sql_stmt_proj492_tests/Makefile.in ================================================================== --- test/sql_stmt_proj492_tests/Makefile.in +++ test/sql_stmt_proj492_tests/Makefile.in @@ -269,11 +269,22 @@ transform4.testcase \ transform5.testcase \ transform6.testcase \ transform7.testcase \ transform8.testcase \ - transform9.testcase + transform9.testcase \ + transformxy10.testcase \ + transformxy11.testcase \ + transformxy1.testcase \ + transformxy2.testcase \ + transformxy3.testcase \ + transformxy4.testcase \ + transformxy5.testcase \ + transformxy6.testcase \ + transformxy7.testcase \ + transformxy8.testcase \ + transformxy9.testcase all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ADDED test/sql_stmt_proj492_tests/transformxy1.testcase Index: test/sql_stmt_proj492_tests/transformxy1.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy1.testcase +++ test/sql_stmt_proj492_tests/transformxy1.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - null Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(NULL, 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(NULL, 4326) +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy10.testcase Index: test/sql_stmt_proj492_tests/transformxy10.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy10.testcase +++ test/sql_stmt_proj492_tests/transformxy10.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - 2D XY GeometryCollection +:memory: #use in-memory database +SELECT AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTION(POINT(11.1 41.1), LINESTRING(11.2 41.2, 11.3 41.3), POLYGON((11.3 41.3, 11.8 41.3, 11.8 41.8, 11.3 41.8, 11.3 41.3), (11.4 41.4, 11.7 41.4, 11.7 41.7, 11.4 41.7, 11.4 41.4)))', 4326), 3003)); +1 # rows (not including the header row) +1 # columns +AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTION(POINT(11.1 41.1), LINESTRING(11.2 41.2, 11.3 41.3), POLYGON((11.3 41.3, 11.8 41.3, 11.8 41.8, 11.3 41.8, 11.3 41.3), (11.4 41.4, 11.7 41.4, 11.7 41.7, 11.4 41.7, 11.4 41.4)))', 4326), 3003)) +GEOMETRYCOLLECTION(POINT(1676380.538791 4551993.304759), LINESTRING(1684498.324131 4563303.102442, 1692590.049453 4574622.920763), POLYGON((1692590.049453 4574622.920763, 1734455.803025 4575853.343594, 1732655.006872 4631372.543298, 1691111.320326 4630139.503574, 1692590.049453 4574622.920763), (1700655.635839 4585952.766718, 1725736.586456 4586691.348854, 1724694.769275 4620002.530275, 1699729.76246 4619263.006007, 1700655.635839 4585952.766718))) ADDED test/sql_stmt_proj492_tests/transformxy11.testcase Index: test/sql_stmt_proj492_tests/transformxy11.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy11.testcase +++ test/sql_stmt_proj492_tests/transformxy11.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - 3D XYZ GeometryCollection +:memory: #use in-memory database +SELECT AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTIONZ(POINTZ(11.1 41.1 1.0), LINESTRINGZ(11.2 41.2 1.1, 11.3 41.3 1.2), POLYGONZ((11.3 41.3 1.1, 11.8 41.3 1.2, 11.8 41.8 1.3, 11.3 41.8 1.2, 11.3 41.3 1.1), (11.4 41.4 1.2, 11.7 41.4 1.3, 11.7 41.7 1.4, 11.4 41.7 1.3, 11.4 41.4 1.2)))', 4326), 3003)); +1 # rows (not including the header row) +1 # columns +AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTIONZ(POINTZ(11.1 41.1 1.0), LINESTRINGZ(11.2 41.2 1.1, 11.3 41.3 1.2), POLYGONZ((11.3 41.3 1.1, 11.8 41.3 1.2, 11.8 41.8 1.3, 11.3 41.8 1.2, 11.3 41.3 1.1), (11.4 41.4 1.2, 11.7 41.4 1.3, 11.7 41.7 1.4, 11.4 41.7 1.3, 11.4 41.4 1.2)))', 4326), 3003)) +GEOMETRYCOLLECTION Z(POINT Z(1676380.538791 4551993.304759 1), LINESTRING Z(1684498.324131 4563303.102442 1.1, 1692590.049453 4574622.920763 1.2), POLYGON Z((1692590.049453 4574622.920763 1.1, 1734455.803025 4575853.343594 1.2, 1732655.006872 4631372.543298 1.3, 1691111.320326 4630139.503574 1.2, 1692590.049453 4574622.920763 1.1), (1700655.635839 4585952.766718 1.2, 1725736.586456 4586691.348854 1.3, 1724694.769275 4620002.530275 1.4, 1699729.76246 4619263.006007 1.3, 1700655.635839 4585952.766718 1.2))) ADDED test/sql_stmt_proj492_tests/transformxy2.testcase Index: test/sql_stmt_proj492_tests/transformxy2.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy2.testcase +++ test/sql_stmt_proj492_tests/transformxy2.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Text Geometry +:memory: #use in-memory database +SELECT ST_TransformXY('geom', 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY('geom', 4326) +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy3.testcase Index: test/sql_stmt_proj492_tests/transformxy3.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy3.testcase +++ test/sql_stmt_proj492_tests/transformxy3.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Int Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(1, 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(1, 4326) +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy4.testcase Index: test/sql_stmt_proj492_tests/transformxy4.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy4.testcase +++ test/sql_stmt_proj492_tests/transformxy4.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Double Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(1.5, 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(1.5, 4326) +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy5.testcase Index: test/sql_stmt_proj492_tests/transformxy5.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy5.testcase +++ test/sql_stmt_proj492_tests/transformxy5.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Invalid Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(zeroblob(10), 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(zeroblob(10), 4326) +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy6.testcase Index: test/sql_stmt_proj492_tests/transformxy6.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy6.testcase +++ test/sql_stmt_proj492_tests/transformxy6.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - NULL SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), NULL); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), NULL); +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy7.testcase Index: test/sql_stmt_proj492_tests/transformxy7.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy7.testcase +++ test/sql_stmt_proj492_tests/transformxy7.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Text SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), 'srid'); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), 'srid') +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy8.testcase Index: test/sql_stmt_proj492_tests/transformxy8.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy8.testcase +++ test/sql_stmt_proj492_tests/transformxy8.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Double SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), 3003.4); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), 3003.4) +(NULL) ADDED test/sql_stmt_proj492_tests/transformxy9.testcase Index: test/sql_stmt_proj492_tests/transformxy9.testcase ================================================================== --- test/sql_stmt_proj492_tests/transformxy9.testcase +++ test/sql_stmt_proj492_tests/transformxy9.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - BLOB SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), zeroblob(4)); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), zeroblob(4)) +(NULL) Index: test/sql_stmt_proj493_tests/Makefile.am ================================================================== --- test/sql_stmt_proj493_tests/Makefile.am +++ test/sql_stmt_proj493_tests/Makefile.am @@ -17,6 +17,17 @@ transform4.testcase \ transform5.testcase \ transform6.testcase \ transform7.testcase \ transform8.testcase \ - transform9.testcase + transform9.testcase \ + transformxy10.testcase \ + transformxy11.testcase \ + transformxy1.testcase \ + transformxy2.testcase \ + transformxy3.testcase \ + transformxy4.testcase \ + transformxy5.testcase \ + transformxy6.testcase \ + transformxy7.testcase \ + transformxy8.testcase \ + transformxy9.testcase Index: test/sql_stmt_proj493_tests/Makefile.in ================================================================== --- test/sql_stmt_proj493_tests/Makefile.in +++ test/sql_stmt_proj493_tests/Makefile.in @@ -269,11 +269,22 @@ transform4.testcase \ transform5.testcase \ transform6.testcase \ transform7.testcase \ transform8.testcase \ - transform9.testcase + transform9.testcase \ + transformxy10.testcase \ + transformxy11.testcase \ + transformxy1.testcase \ + transformxy2.testcase \ + transformxy3.testcase \ + transformxy4.testcase \ + transformxy5.testcase \ + transformxy6.testcase \ + transformxy7.testcase \ + transformxy8.testcase \ + transformxy9.testcase all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ADDED test/sql_stmt_proj493_tests/transformxy1.testcase Index: test/sql_stmt_proj493_tests/transformxy1.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy1.testcase +++ test/sql_stmt_proj493_tests/transformxy1.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - null Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(NULL, 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(NULL, 4326) +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy10.testcase Index: test/sql_stmt_proj493_tests/transformxy10.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy10.testcase +++ test/sql_stmt_proj493_tests/transformxy10.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - 2D XY GeometryCollection +:memory: #use in-memory database +SELECT AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTION(POINT(11.1 41.1), LINESTRING(11.2 41.2, 11.3 41.3), POLYGON((11.3 41.3, 11.8 41.3, 11.8 41.8, 11.3 41.8, 11.3 41.3), (11.4 41.4, 11.7 41.4, 11.7 41.7, 11.4 41.7, 11.4 41.4)))', 4326), 3003)); +1 # rows (not including the header row) +1 # columns +AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTION(POINT(11.1 41.1), LINESTRING(11.2 41.2, 11.3 41.3), POLYGON((11.3 41.3, 11.8 41.3, 11.8 41.8, 11.3 41.8, 11.3 41.3), (11.4 41.4, 11.7 41.4, 11.7 41.7, 11.4 41.7, 11.4 41.4)))', 4326), 3003)) +GEOMETRYCOLLECTION(POINT(1676380.538791 4551993.304759), LINESTRING(1684498.324131 4563303.102442, 1692590.049453 4574622.920763), POLYGON((1692590.049453 4574622.920763, 1734455.803025 4575853.343594, 1732655.006872 4631372.543298, 1691111.320326 4630139.503574, 1692590.049453 4574622.920763), (1700655.635839 4585952.766718, 1725736.586456 4586691.348854, 1724694.769275 4620002.530275, 1699729.76246 4619263.006007, 1700655.635839 4585952.766718))) ADDED test/sql_stmt_proj493_tests/transformxy11.testcase Index: test/sql_stmt_proj493_tests/transformxy11.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy11.testcase +++ test/sql_stmt_proj493_tests/transformxy11.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - 3D XYZ GeometryCollection +:memory: #use in-memory database +SELECT AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTIONZ(POINTZ(11.1 41.1 1.0), LINESTRINGZ(11.2 41.2 1.1, 11.3 41.3 1.2), POLYGONZ((11.3 41.3 1.1, 11.8 41.3 1.2, 11.8 41.8 1.3, 11.3 41.8 1.2, 11.3 41.3 1.1), (11.4 41.4 1.2, 11.7 41.4 1.3, 11.7 41.7 1.4, 11.4 41.7 1.3, 11.4 41.4 1.2)))', 4326), 3003)); +1 # rows (not including the header row) +1 # columns +AsText(ST_TransformXY(GeomFromText('GEOMETRYCOLLECTIONZ(POINTZ(11.1 41.1 1.0), LINESTRINGZ(11.2 41.2 1.1, 11.3 41.3 1.2), POLYGONZ((11.3 41.3 1.1, 11.8 41.3 1.2, 11.8 41.8 1.3, 11.3 41.8 1.2, 11.3 41.3 1.1), (11.4 41.4 1.2, 11.7 41.4 1.3, 11.7 41.7 1.4, 11.4 41.7 1.3, 11.4 41.4 1.2)))', 4326), 3003)) +GEOMETRYCOLLECTION Z(POINT Z(1676380.538791 4551993.304759 1), LINESTRING Z(1684498.324131 4563303.102442 1.1, 1692590.049453 4574622.920763 1.2), POLYGON Z((1692590.049453 4574622.920763 1.1, 1734455.803025 4575853.343594 1.2, 1732655.006872 4631372.543298 1.3, 1691111.320326 4630139.503574 1.2, 1692590.049453 4574622.920763 1.1), (1700655.635839 4585952.766718 1.2, 1725736.586456 4586691.348854 1.3, 1724694.769275 4620002.530275 1.4, 1699729.76246 4619263.006007 1.3, 1700655.635839 4585952.766718 1.2))) ADDED test/sql_stmt_proj493_tests/transformxy2.testcase Index: test/sql_stmt_proj493_tests/transformxy2.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy2.testcase +++ test/sql_stmt_proj493_tests/transformxy2.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Text Geometry +:memory: #use in-memory database +SELECT ST_TransformXY('geom', 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY('geom', 4326) +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy3.testcase Index: test/sql_stmt_proj493_tests/transformxy3.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy3.testcase +++ test/sql_stmt_proj493_tests/transformxy3.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Int Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(1, 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(1, 4326) +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy4.testcase Index: test/sql_stmt_proj493_tests/transformxy4.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy4.testcase +++ test/sql_stmt_proj493_tests/transformxy4.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Double Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(1.5, 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(1.5, 4326) +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy5.testcase Index: test/sql_stmt_proj493_tests/transformxy5.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy5.testcase +++ test/sql_stmt_proj493_tests/transformxy5.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Invalid Geometry +:memory: #use in-memory database +SELECT ST_TransformXY(zeroblob(10), 4326) +1 # rows (not including the header row) +1 # columns +ST_TransformXY(zeroblob(10), 4326) +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy6.testcase Index: test/sql_stmt_proj493_tests/transformxy6.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy6.testcase +++ test/sql_stmt_proj493_tests/transformxy6.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - NULL SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), NULL); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), NULL); +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy7.testcase Index: test/sql_stmt_proj493_tests/transformxy7.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy7.testcase +++ test/sql_stmt_proj493_tests/transformxy7.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Text SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), 'srid'); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), 'srid') +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy8.testcase Index: test/sql_stmt_proj493_tests/transformxy8.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy8.testcase +++ test/sql_stmt_proj493_tests/transformxy8.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - Double SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), 3003.4); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), 3003.4) +(NULL) ADDED test/sql_stmt_proj493_tests/transformxy9.testcase Index: test/sql_stmt_proj493_tests/transformxy9.testcase ================================================================== --- test/sql_stmt_proj493_tests/transformxy9.testcase +++ test/sql_stmt_proj493_tests/transformxy9.testcase @@ -0,0 +1,7 @@ +ST_TransformXY - BLOB SRID +:memory: #use in-memory database +SELECT ST_TransformXY(MakePoint(11, 42, 4326), zeroblob(4)); +1 # rows (not including the header row) +1 # columns +ST_TransformXY(MakePoint(11, 42, 4326), zeroblob(4)) +(NULL) ADDED test/sql_stmt_routing_tests/Makefile.am Index: test/sql_stmt_routing_tests/Makefile.am ================================================================== --- test/sql_stmt_routing_tests/Makefile.am +++ test/sql_stmt_routing_tests/Makefile.am @@ -0,0 +1,36 @@ + +EXTRA_DIST = createrouterr.testcase \ + createrouting1.testcase \ + createrouting2.testcase \ + createrouting3.testcase \ + createrouting4.testcase \ + createrouting5.testcase \ + createrouting6.testcase \ + createrouting7.testcase \ + createrouting8.testcase \ + createrouting9.testcase \ + createrouting10.testcase \ + createrouting11.testcase \ + createrouting12.testcase \ + createrouting13.testcase \ + createrouting14.testcase \ + createroutnodes1.testcase \ + createroutnodes2.testcase \ + createroutnodes3.testcase \ + createroutnodes4.testcase \ + createroutnodes5.testcase \ + createroutnodes6.testcase \ + createroutnodes7.testcase \ + createroutnodes8.testcase \ + createroutnodes9.testcase \ + createroutnodes10.testcase \ + createroutnodes11.testcase \ + createroutnodes12.testcase \ + createroutnodes13.testcase \ + createroutnodes14.testcase \ + createroutnodes15.testcase \ + createroutnodes16.testcase \ + createroutnodes17.testcase \ + createroutnodes18.testcase \ + createroutnodes19.testcase \ + createroutnodes20.testcase ADDED test/sql_stmt_routing_tests/Makefile.in Index: test/sql_stmt_routing_tests/Makefile.in ================================================================== --- test/sql_stmt_routing_tests/Makefile.in +++ test/sql_stmt_routing_tests/Makefile.in @@ -0,0 +1,484 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/sql_stmt_routing_tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GEOSCONFIG = @GEOSCONFIG@ +GEOS_CFLAGS = @GEOS_CFLAGS@ +GEOS_LDFLAGS = @GEOS_LDFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = createrouterr.testcase \ + createrouting1.testcase \ + createrouting2.testcase \ + createrouting3.testcase \ + createrouting4.testcase \ + createrouting5.testcase \ + createrouting6.testcase \ + createrouting7.testcase \ + createrouting8.testcase \ + createrouting9.testcase \ + createrouting10.testcase \ + createrouting11.testcase \ + createrouting12.testcase \ + createrouting13.testcase \ + createrouting14.testcase \ + createroutnodes1.testcase \ + createroutnodes2.testcase \ + createroutnodes3.testcase \ + createroutnodes4.testcase \ + createroutnodes5.testcase \ + createroutnodes6.testcase \ + createroutnodes7.testcase \ + createroutnodes8.testcase \ + createroutnodes9.testcase \ + createroutnodes10.testcase \ + createroutnodes11.testcase \ + createroutnodes12.testcase \ + createroutnodes13.testcase \ + createroutnodes14.testcase \ + createroutnodes15.testcase \ + createroutnodes16.testcase \ + createroutnodes17.testcase \ + createroutnodes18.testcase \ + createroutnodes19.testcase \ + createroutnodes20.testcase + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/sql_stmt_routing_tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/sql_stmt_routing_tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: ADDED test/sql_stmt_routing_tests/createrouterr.testcase Index: test/sql_stmt_routing_tests/createrouterr.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouterr.testcase +++ test/sql_stmt_routing_tests/createrouterr.testcase @@ -0,0 +1,7 @@ +CreateRouting_GetLastError() +:memory: #use in-memory database +SELECT CreateRouting_GetLastError(); +1 # rows (not including the header row) +1 # columns +CreateRouting_GetLastError() +(NULL) ADDED test/sql_stmt_routing_tests/createrouting1.testcase Index: test/sql_stmt_routing_tests/createrouting1.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting1.testcase +++ test/sql_stmt_routing_tests/createrouting1.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL DataTable +:memory: #use in-memory database +SELECT CreateRouting(NULL, 'virt_route', 'input', 'from', 'to', 'geom', 'cost'); +1 # rows (not including the header row) +1 # columns +CreateRouting(NULL, 'virt_route', 'input', 'from', 'to', 'geom', 'cost') +CreateRouting exception - illegal Routing-Data Table Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting10.testcase Index: test/sql_stmt_routing_tests/createrouting10.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting10.testcase +++ test/sql_stmt_routing_tests/createrouting10.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL bidirectional option +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, NULL); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, NULL) +CreateRouting exception - illegal Bidirectional option [not an INTEGER]. ADDED test/sql_stmt_routing_tests/createrouting11.testcase Index: test/sql_stmt_routing_tests/createrouting11.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting11.testcase +++ test/sql_stmt_routing_tests/createrouting11.testcase @@ -0,0 +1,7 @@ +CreateRouting() - Int OnewWay FromTo +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 1, 'tofrom'); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 1, 'tofrom') +CreateRouting exception - illegal OnewayFromTo Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting12.testcase Index: test/sql_stmt_routing_tests/createrouting12.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting12.testcase +++ test/sql_stmt_routing_tests/createrouting12.testcase @@ -0,0 +1,7 @@ +CreateRouting() - Int OnewWay ToFrom +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 'fromto', 1); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 'fromto', 1) +CreateRouting exception - illegal OnewayToFrom Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting13.testcase Index: test/sql_stmt_routing_tests/createrouting13.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting13.testcase +++ test/sql_stmt_routing_tests/createrouting13.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL Overwrite +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 'fromto', 'tofrom', NULL); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 'fromto', 'tofrom', NULL) +CreateRouting exception - illegal OverWrite option [not an INTEGER]. ADDED test/sql_stmt_routing_tests/createrouting14.testcase Index: test/sql_stmt_routing_tests/createrouting14.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting14.testcase +++ test/sql_stmt_routing_tests/createrouting14.testcase @@ -0,0 +1,7 @@ +CreateRouting() - Ok Overwrite +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 'fromto', 'tofrom', 1); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', 1, 1, 'fromto', 'tofrom', 1) +CreateRouting exception - FromNode Column "from" is not defined in the Input Table ADDED test/sql_stmt_routing_tests/createrouting2.testcase Index: test/sql_stmt_routing_tests/createrouting2.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting2.testcase +++ test/sql_stmt_routing_tests/createrouting2.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL VirtualRouting Table +:memory: #use in-memory database +SELECT CreateRouting('data_route', NULL, 'input', 'from', 'to', 'geom', 'cost'); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', NULL, 'input', 'from', 'to', 'geom', 'cost') +CreateRouting exception - illegal VirtualRouting-Table Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting3.testcase Index: test/sql_stmt_routing_tests/createrouting3.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting3.testcase +++ test/sql_stmt_routing_tests/createrouting3.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL Input Table +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', NULL, 'from', 'to', 'geom', 'cost'); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', NULL, 'from', 'to', 'geom', 'cost') +CreateRouting exception - illegal Input-Table Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting4.testcase Index: test/sql_stmt_routing_tests/createrouting4.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting4.testcase +++ test/sql_stmt_routing_tests/createrouting4.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL FromNode Column +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', NULL, 'to', 'geom', 'cost'); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', NULL, 'to', 'geom', 'cost') +CreateRouting exception - illegal FromNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting5.testcase Index: test/sql_stmt_routing_tests/createrouting5.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting5.testcase +++ test/sql_stmt_routing_tests/createrouting5.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL ToNode Column +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', NULL, 'geom', 'cost'); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', NULL, 'geom', 'cost') +CreateRouting exception - illegal ToNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting6.testcase Index: test/sql_stmt_routing_tests/createrouting6.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting6.testcase +++ test/sql_stmt_routing_tests/createrouting6.testcase @@ -0,0 +1,7 @@ +CreateRouting() - Int Geometry Column +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 1, 'cost'); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 1, 'cost') +CreateRouting exception - illegal Geometry Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting7.testcase Index: test/sql_stmt_routing_tests/createrouting7.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting7.testcase +++ test/sql_stmt_routing_tests/createrouting7.testcase @@ -0,0 +1,7 @@ +CreateRouting() - Int Cost Column +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 1); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 1) +CreateRouting exception - illegal Cost Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting8.testcase Index: test/sql_stmt_routing_tests/createrouting8.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting8.testcase +++ test/sql_stmt_routing_tests/createrouting8.testcase @@ -0,0 +1,7 @@ +CreateRouting() - Int RoadName Column +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 1, 1, 1); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 1, 1, 1) +CreateRouting exception - illegal RoadName Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createrouting9.testcase Index: test/sql_stmt_routing_tests/createrouting9.testcase ================================================================== --- test/sql_stmt_routing_tests/createrouting9.testcase +++ test/sql_stmt_routing_tests/createrouting9.testcase @@ -0,0 +1,7 @@ +CreateRouting() - NULL AStar enabled +:memory: #use in-memory database +SELECT CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', NULL, 1); +1 # rows (not including the header row) +1 # columns +CreateRouting('data_route', 'virt_route', 'input', 'from', 'to', 'geom', 'cost', 'name', NULL, 1) +CreateRouting exception - illegal A* Enabled option [not an INTEGER]. ADDED test/sql_stmt_routing_tests/createroutnodes1.testcase Index: test/sql_stmt_routing_tests/createroutnodes1.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes1.testcase +++ test/sql_stmt_routing_tests/createroutnodes1.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - INT DB-prefix +:memory: #use in-memory database +SELECT CreateRoutingNodes(1, 'table', 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(1, 'table', 'geom', 'from', 'to') +CreateRoutingNodes exception - illegal DB-prefix [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes10.testcase Index: test/sql_stmt_routing_tests/createroutnodes10.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes10.testcase +++ test/sql_stmt_routing_tests/createroutnodes10.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - BLOB geometry-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', zeroblob(4), 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', zeroblob(4), 'from', 'to') +CreateRoutingNodes exception - illegal Geometry Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes11.testcase Index: test/sql_stmt_routing_tests/createroutnodes11.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes11.testcase +++ test/sql_stmt_routing_tests/createroutnodes11.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - NULL from-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, NULL, 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, NULL, 'to') +CreateRoutingNodes exception - illegal FromNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes12.testcase Index: test/sql_stmt_routing_tests/createroutnodes12.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes12.testcase +++ test/sql_stmt_routing_tests/createroutnodes12.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - INT from-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, 1, 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, 1, 'to') +CreateRoutingNodes exception - illegal FromNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes13.testcase Index: test/sql_stmt_routing_tests/createroutnodes13.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes13.testcase +++ test/sql_stmt_routing_tests/createroutnodes13.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - DOUBLE from-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, 1.8, 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, 1.8, 'to') +CreateRoutingNodes exception - illegal FromNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes14.testcase Index: test/sql_stmt_routing_tests/createroutnodes14.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes14.testcase +++ test/sql_stmt_routing_tests/createroutnodes14.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - BLOB from-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, zeroblob(5), 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, zeroblob(5), 'to') +CreateRoutingNodes exception - illegal FromNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes15.testcase Index: test/sql_stmt_routing_tests/createroutnodes15.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes15.testcase +++ test/sql_stmt_routing_tests/createroutnodes15.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - NULL to-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, 'from', NULL); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, 'from', NULL) +CreateRoutingNodes exception - illegal ToNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes16.testcase Index: test/sql_stmt_routing_tests/createroutnodes16.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes16.testcase +++ test/sql_stmt_routing_tests/createroutnodes16.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - INT to-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, 'from', 1); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, 'from', 1) +CreateRoutingNodes exception - illegal ToNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes17.testcase Index: test/sql_stmt_routing_tests/createroutnodes17.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes17.testcase +++ test/sql_stmt_routing_tests/createroutnodes17.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - DOUBLE to-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, 'from', 1.5); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, 'from', 1.5) +CreateRoutingNodes exception - illegal ToNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes18.testcase Index: test/sql_stmt_routing_tests/createroutnodes18.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes18.testcase +++ test/sql_stmt_routing_tests/createroutnodes18.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - BLOB to-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, 'from', zeroblob(5)); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, 'from', zeroblob(5)) +CreateRoutingNodes exception - illegal ToNode Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes19.testcase Index: test/sql_stmt_routing_tests/createroutnodes19.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes19.testcase +++ test/sql_stmt_routing_tests/createroutnodes19.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - not existing spatial table #1 +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', NULL, 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', NULL, 'from', 'to') +CreateRoutingNodes exception - 'table' is not a valid Spatial Table (LINESTRING) ADDED test/sql_stmt_routing_tests/createroutnodes2.testcase Index: test/sql_stmt_routing_tests/createroutnodes2.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes2.testcase +++ test/sql_stmt_routing_tests/createroutnodes2.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - DOUBLE DB-prefix +:memory: #use in-memory database +SELECT CreateRoutingNodes(1.5, 'table', 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(1.5, 'table', 'geom', 'from', 'to') +CreateRoutingNodes exception - illegal DB-prefix [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes20.testcase Index: test/sql_stmt_routing_tests/createroutnodes20.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes20.testcase +++ test/sql_stmt_routing_tests/createroutnodes20.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - not existing spatial table #2 +:memory: #use in-memory database +SELECT CreateRoutingNodes('main', 'table', 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes('main', 'table', 'geom', 'from', 'to') +CreateRoutingNodes exception - 'table'.'geom' is not a valid Spatial Table (LINESTRING) ADDED test/sql_stmt_routing_tests/createroutnodes3.testcase Index: test/sql_stmt_routing_tests/createroutnodes3.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes3.testcase +++ test/sql_stmt_routing_tests/createroutnodes3.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - BLOB DB-prefix +:memory: #use in-memory database +SELECT CreateRoutingNodes(zeroblob(4), 'table', 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(zeroblob(4), 'table', 'geom', 'from', 'to') +CreateRoutingNodes exception - illegal DB-prefix [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes4.testcase Index: test/sql_stmt_routing_tests/createroutnodes4.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes4.testcase +++ test/sql_stmt_routing_tests/createroutnodes4.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - NULL table-name +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, NULL, 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, NULL, 'geom', 'from', 'to') +CreateRoutingNodes exception - illegal Spatial-Table Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes5.testcase Index: test/sql_stmt_routing_tests/createroutnodes5.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes5.testcase +++ test/sql_stmt_routing_tests/createroutnodes5.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - INT table-name +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 1, 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 1, 'geom', 'from', 'to') +CreateRoutingNodes exception - illegal Spatial-Table Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes6.testcase Index: test/sql_stmt_routing_tests/createroutnodes6.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes6.testcase +++ test/sql_stmt_routing_tests/createroutnodes6.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - DOUBLE table-name +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 1.5, 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 1.5, 'geom', 'from', 'to') +CreateRoutingNodes exception - illegal Spatial-Table Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes7.testcase Index: test/sql_stmt_routing_tests/createroutnodes7.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes7.testcase +++ test/sql_stmt_routing_tests/createroutnodes7.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - BLOB table-name +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, zeroblob(4), 'geom', 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, zeroblob(4), 'geom', 'from', 'to') +CreateRoutingNodes exception - illegal Spatial-Table Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes8.testcase Index: test/sql_stmt_routing_tests/createroutnodes8.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes8.testcase +++ test/sql_stmt_routing_tests/createroutnodes8.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - INT geometry-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', 1, 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', 1, 'from', 'to') +CreateRoutingNodes exception - illegal Geometry Column Name [not a TEXT string]. ADDED test/sql_stmt_routing_tests/createroutnodes9.testcase Index: test/sql_stmt_routing_tests/createroutnodes9.testcase ================================================================== --- test/sql_stmt_routing_tests/createroutnodes9.testcase +++ test/sql_stmt_routing_tests/createroutnodes9.testcase @@ -0,0 +1,7 @@ +CreateRoutingNodes() - DOUBLE geometry-column +:memory: #use in-memory database +SELECT CreateRoutingNodes(NULL, 'table', 1.4, 'from', 'to'); +1 # rows (not including the header row) +1 # columns +CreateRoutingNodes(NULL, 'table', 1.4, 'from', 'to') +CreateRoutingNodes exception - illegal Geometry Column Name [not a TEXT string]. Index: test/sql_stmt_rtgeom_tests/Makefile.am ================================================================== --- test/sql_stmt_rtgeom_tests/Makefile.am +++ test/sql_stmt_rtgeom_tests/Makefile.am @@ -34,10 +34,24 @@ circularity14.testcase \ circularity15.testcase \ circularity16.testcase \ circularity17.testcase \ circularity18.testcase \ + fromtwkb1.testcase \ + fromtwkb2.testcase \ + fromtwkb3.testcase \ + fromtwkb4.testcase \ + fromtwkb5.testcase \ + fromtwkb6.testcase \ + fromtwkb7.testcase \ + fromtwkb8.testcase \ + fromtwkb9.testcase \ + fromtwkb10.testcase \ + fromtwkb11.testcase \ + fromtwkb12.testcase \ + fromtwkb13.testcase \ + fromtwkb14.testcase \ maxdistance10.testcase \ maxdistance1.testcase \ maxdistance2.testcase \ maxdistance3.testcase \ maxdistance4.testcase \ @@ -301,7 +315,36 @@ st_self4.testcase \ st_self5.testcase \ st_self6.testcase \ st_self7.testcase \ st_self8.testcase \ - st_self9.testcase - + st_self9.testcase \ + totwkb1.testcase \ + totwkb2.testcase \ + totwkb3.testcase \ + totwkb4.testcase \ + totwkb5.testcase \ + totwkb6.testcase \ + totwkb7.testcase \ + totwkb8.testcase \ + totwkb9.testcase \ + totwkb10.testcase \ + totwkb11.testcase \ + totwkb12.testcase \ + totwkb13.testcase \ + totwkb14.testcase \ + totwkb15.testcase \ + totwkb16.testcase \ + totwkb17.testcase \ + totwkb18.testcase \ + totwkb19.testcase \ + totwkb20.testcase \ + totwkb21.testcase \ + totwkb22.testcase \ + totwkb23.testcase \ + totwkb24.testcase \ + totwkb25.testcase \ + totwkb26.testcase \ + totwkb27.testcase \ + totwkb28.testcase \ + totwkb29.testcase \ + totwkb30.testcase Index: test/sql_stmt_rtgeom_tests/Makefile.in ================================================================== --- test/sql_stmt_rtgeom_tests/Makefile.in +++ test/sql_stmt_rtgeom_tests/Makefile.in @@ -286,10 +286,24 @@ circularity14.testcase \ circularity15.testcase \ circularity16.testcase \ circularity17.testcase \ circularity18.testcase \ + fromtwkb1.testcase \ + fromtwkb2.testcase \ + fromtwkb3.testcase \ + fromtwkb4.testcase \ + fromtwkb5.testcase \ + fromtwkb6.testcase \ + fromtwkb7.testcase \ + fromtwkb8.testcase \ + fromtwkb9.testcase \ + fromtwkb10.testcase \ + fromtwkb11.testcase \ + fromtwkb12.testcase \ + fromtwkb13.testcase \ + fromtwkb14.testcase \ maxdistance10.testcase \ maxdistance1.testcase \ maxdistance2.testcase \ maxdistance3.testcase \ maxdistance4.testcase \ @@ -553,11 +567,41 @@ st_self4.testcase \ st_self5.testcase \ st_self6.testcase \ st_self7.testcase \ st_self8.testcase \ - st_self9.testcase + st_self9.testcase \ + totwkb1.testcase \ + totwkb2.testcase \ + totwkb3.testcase \ + totwkb4.testcase \ + totwkb5.testcase \ + totwkb6.testcase \ + totwkb7.testcase \ + totwkb8.testcase \ + totwkb9.testcase \ + totwkb10.testcase \ + totwkb11.testcase \ + totwkb12.testcase \ + totwkb13.testcase \ + totwkb14.testcase \ + totwkb15.testcase \ + totwkb16.testcase \ + totwkb17.testcase \ + totwkb18.testcase \ + totwkb19.testcase \ + totwkb20.testcase \ + totwkb21.testcase \ + totwkb22.testcase \ + totwkb23.testcase \ + totwkb24.testcase \ + totwkb25.testcase \ + totwkb26.testcase \ + totwkb27.testcase \ + totwkb28.testcase \ + totwkb29.testcase \ + totwkb30.testcase all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ADDED test/sql_stmt_rtgeom_tests/circularity10.testcase Index: test/sql_stmt_rtgeom_tests/circularity10.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity10.testcase +++ test/sql_stmt_rtgeom_tests/circularity10.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - valid Polygon - Sphere/Equator +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 0); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 0) +0.78:2 ADDED test/sql_stmt_rtgeom_tests/circularity11.testcase Index: test/sql_stmt_rtgeom_tests/circularity11.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity11.testcase +++ test/sql_stmt_rtgeom_tests/circularity11.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - valid Polygon - Ellipsoid/Equator +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 1); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 1) +0.79:2 ADDED test/sql_stmt_rtgeom_tests/circularity12.testcase Index: test/sql_stmt_rtgeom_tests/circularity12.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity12.testcase +++ test/sql_stmt_rtgeom_tests/circularity12.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - valid Polygon - Sphere +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((50.4 50.4, 50.4 54, 54 54, 54 50.4, 50.4 50.4),(51 51, 51 53, 53 53, 53 51, 51 51))"), 0); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((50.4 50.4, 50.4 54, 54 54, 54 50.4, 50.4 50.4),(51 51, 51 53, 53 53, 53 51, 51 51))"), 0) +0.73:2 ADDED test/sql_stmt_rtgeom_tests/circularity13.testcase Index: test/sql_stmt_rtgeom_tests/circularity13.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity13.testcase +++ test/sql_stmt_rtgeom_tests/circularity13.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - valid Polygon - Ellipsoid +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((50.4 50.4, 50.4 54, 54 54, 54 50.4, 50.4 50.4),(51 51, 51 53, 53 53, 53 51, 51 51))"), 1); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((50.4 50.4, 50.4 54, 54 54, 54 50.4, 50.4 50.4),(51 51, 51 53, 53 53, 53 51, 51 51))"), 1) +0.74:2 ADDED test/sql_stmt_rtgeom_tests/circularity14.testcase Index: test/sql_stmt_rtgeom_tests/circularity14.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity14.testcase +++ test/sql_stmt_rtgeom_tests/circularity14.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - Point - Ellipsoid +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POINT(50.4 50.4)"), 1); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POINT(50.4 50.4)"), 1) +(NULL) ADDED test/sql_stmt_rtgeom_tests/circularity15.testcase Index: test/sql_stmt_rtgeom_tests/circularity15.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity15.testcase +++ test/sql_stmt_rtgeom_tests/circularity15.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - planar Polygon - Sphere +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((50.4 50.4, 50.4 54, 54 54, 54 50.4, 50.4 50.4),(51 51, 51 53, 53 53, 53 51, 51 51))", 32632), 0); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((50.4 50.4, 50.4 54, 54 54, 54 50.4, 50.4 50.4),(51 51, 51 53, 53 53, 53 51, 51 51))", 32632), 0) +(NULL) ADDED test/sql_stmt_rtgeom_tests/circularity16.testcase Index: test/sql_stmt_rtgeom_tests/circularity16.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity16.testcase +++ test/sql_stmt_rtgeom_tests/circularity16.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - DOUBLE use_ellipsoid +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 0.5); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 0.5) +(NULL) ADDED test/sql_stmt_rtgeom_tests/circularity17.testcase Index: test/sql_stmt_rtgeom_tests/circularity17.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity17.testcase +++ test/sql_stmt_rtgeom_tests/circularity17.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - TEXT use_ellipsoid +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 'alpha'); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), 'alpha') +(NULL) ADDED test/sql_stmt_rtgeom_tests/circularity18.testcase Index: test/sql_stmt_rtgeom_tests/circularity18.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/circularity18.testcase +++ test/sql_stmt_rtgeom_tests/circularity18.testcase @@ -0,0 +1,7 @@ +Circularity Geodesic - BLOB use_ellipsoid +:memory: #use in-memory database +SELECT Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), zeroblob(4)); +1 # rows (not including the header row) +1 # columns +Circularity(GeomFromText("POLYGON((-0.4 -0.4, -0.4 4, 4 4, 4 -0.4, -0.4 -0.4),(1 1, 1 3, 3 3, 3 1, 1 1))"), zeroblob(4)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb1.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb1.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb1.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb1.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - NULL TWKB +:memory: #use in-memory database +SELECT GeomFromTWKB(NULL); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(NULL); +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb10.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb10.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb10.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb10.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - POINT XY +:memory: #use in-memory database +SELECT AsEWKT(GeomFromTWKB(X'C10080897A8092F401', 4326)); +1 # rows (not including the header row) +1 # columns +AsEWKT(GeomFromTWKB(X'C10080897A8092F401', 4326)) +SRID=4326;POINT(1 2) ADDED test/sql_stmt_rtgeom_tests/fromtwkb11.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb11.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb11.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb11.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - Polygon Z +:memory: #use in-memory database +SELECT AsText(GeomFromTWKB(X'C308D90105000080897A80897A0080897A0080897A80897AFF887A00FF91F40100FF887A00')); +1 # rows (not including the header row) +1 # columns +AsText(GeomFromTWKB(X'C308D90105000080897A80897A0080897A0080897A80897AFF887A00FF91F40100FF887A00')) +POLYGON Z((0 0 1, 1 0 2, 1 1 3, 0 1 1, 0 0 1)) ADDED test/sql_stmt_rtgeom_tests/fromtwkb12.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb12.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb12.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb12.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - MultiLinestring M +:memory: #use in-memory database +SELECT AsText(GeomFromTWKB(X'C508DA0202000080897A80897A0080897A020080897A80897AFF887A0080897A')); +1 # rows (not including the header row) +1 # columns +AsText(GeomFromTWKB(X'C508DA0202000080897A80897A0080897A020080897A80897AFF887A0080897A')) +MULTILINESTRING M((0 0 1, 1 0 2), (1 1 3, 0 1 4)) ADDED test/sql_stmt_rtgeom_tests/fromtwkb13.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb13.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb13.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb13.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - MultiPoint ZM +:memory: #use in-memory database +SELECT AsText(GeomFromTWKB(X'C408DB04000080897A8092F40180897A008092F4018092F4010080897A8092F4018092F401FF887A008092F4018092F401')); +1 # rows (not including the header row) +1 # columns +AsText(GeomFromTWKB(X'C408DB04000080897A8092F40180897A008092F4018092F4010080897A8092F4018092F401FF887A008092F4018092F401')) +MULTIPOINT ZM(0 0 1 2, 1 0 3 4, 1 1 5 6, 0 1 7 8) ADDED test/sql_stmt_rtgeom_tests/fromtwkb14.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb14.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb14.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb14.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - GeometryCollection +:memory: #use in-memory database +SELECT AsText(GeomFromTWKB(X'C70003C10080897A8092F401C2000280DAC40980DAC40980DAC40980DAC409C30001058084AF5F8084AF5F0080897A80897A0000FF887AFF887A00')); +1 # rows (not including the header row) +1 # columns +AsText(GeomFromTWKB(X'C70003C10080897A8092F401C2000280DAC40980DAC40980DAC40980DAC409C30001058084AF5F8084AF5F0080897A80897A0000FF887AFF887A00')) +GEOMETRYCOLLECTION(POINT(1 2), LINESTRING(10 10, 20 20), POLYGON((100 100, 100 101, 101 101, 101 100, 100 100))) ADDED test/sql_stmt_rtgeom_tests/fromtwkb2.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb2.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb2.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb2.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - Int TWKB +:memory: #use in-memory database +SELECT GeomFromTWKB(1); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(1); +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb3.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb3.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb3.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb3.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - Double TWKB +:memory: #use in-memory database +SELECT GeomFromTWKB(1.7); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(1.7); +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb4.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb4.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb4.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb4.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - Text TWKB +:memory: #use in-memory database +SELECT GeomFromTWKB('twkb'); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB('twkb'); +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb5.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb5.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb5.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb5.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - Invalid BLOB TWKB +:memory: #use in-memory database +SELECT GeomFromTWKB(zeroblob(100)); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(zeroblob(100)); +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb6.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb6.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb6.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb6.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - NULL srid +:memory: #use in-memory database +SELECT GeomFromTWKB(X'C10080897A8092F401', NULL); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(X'C10080897A8092F401', NULL) +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb7.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb7.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb7.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb7.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - Double srid +:memory: #use in-memory database +SELECT GeomFromTWKB(X'C10080897A8092F401', 1.5); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(X'C10080897A8092F401', 1.5) +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb8.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb8.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb8.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb8.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - Text srid +:memory: #use in-memory database +SELECT GeomFromTWKB(X'C10080897A8092F401', 'srid'); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(X'C10080897A8092F401', 'srid') +(NULL) ADDED test/sql_stmt_rtgeom_tests/fromtwkb9.testcase Index: test/sql_stmt_rtgeom_tests/fromtwkb9.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/fromtwkb9.testcase +++ test/sql_stmt_rtgeom_tests/fromtwkb9.testcase @@ -0,0 +1,7 @@ +GeomFromTWKB - BLOB srid +:memory: #use in-memory database +SELECT GeomFromTWKB(X'C10080897A8092F401', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +GeomFromTWKB(X'C10080897A8092F401', zeroblob(4)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb1.testcase Index: test/sql_stmt_rtgeom_tests/totwkb1.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb1.testcase +++ test/sql_stmt_rtgeom_tests/totwkb1.testcase @@ -0,0 +1,7 @@ +AsTWKB - NULL Geometry +:memory: #use in-memory database +SELECT AsTWKB(NULL); +1 # rows (not including the header row) +1 # columns +AsTWKB(NULL) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb10.testcase Index: test/sql_stmt_rtgeom_tests/totwkb10.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb10.testcase +++ test/sql_stmt_rtgeom_tests/totwkb10.testcase @@ -0,0 +1,7 @@ +AsTWKB - NULL precision Z +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, NULL); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, NULL) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb11.testcase Index: test/sql_stmt_rtgeom_tests/totwkb11.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb11.testcase +++ test/sql_stmt_rtgeom_tests/totwkb11.testcase @@ -0,0 +1,7 @@ +AsTWKB - Double precision Z +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 1.2); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 1.2) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb12.testcase Index: test/sql_stmt_rtgeom_tests/totwkb12.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb12.testcase +++ test/sql_stmt_rtgeom_tests/totwkb12.testcase @@ -0,0 +1,7 @@ +AsTWKB - Text precision Z +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 'six'); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 'six') +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb13.testcase Index: test/sql_stmt_rtgeom_tests/totwkb13.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb13.testcase +++ test/sql_stmt_rtgeom_tests/totwkb13.testcase @@ -0,0 +1,7 @@ +AsTWKB - BLOB precision Z +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, zeroblob(4)); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, zeroblob(4)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb14.testcase Index: test/sql_stmt_rtgeom_tests/totwkb14.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb14.testcase +++ test/sql_stmt_rtgeom_tests/totwkb14.testcase @@ -0,0 +1,7 @@ +AsTWKB - NULL precision M +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, NULL); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, NULL) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb15.testcase Index: test/sql_stmt_rtgeom_tests/totwkb15.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb15.testcase +++ test/sql_stmt_rtgeom_tests/totwkb15.testcase @@ -0,0 +1,7 @@ +AsTWKB - Double precision M +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 1.2); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 1.2) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb16.testcase Index: test/sql_stmt_rtgeom_tests/totwkb16.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb16.testcase +++ test/sql_stmt_rtgeom_tests/totwkb16.testcase @@ -0,0 +1,7 @@ +AsTWKB - Text precision M +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 'six'); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 'six') +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb17.testcase Index: test/sql_stmt_rtgeom_tests/totwkb17.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb17.testcase +++ test/sql_stmt_rtgeom_tests/totwkb17.testcase @@ -0,0 +1,7 @@ +AsTWKB - BLOB precision M +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, zeroblob(3)); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, zeroblob(3)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb18.testcase Index: test/sql_stmt_rtgeom_tests/totwkb18.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb18.testcase +++ test/sql_stmt_rtgeom_tests/totwkb18.testcase @@ -0,0 +1,7 @@ +AsTWKB - NULL with size +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, NULL); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, NULL) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb19.testcase Index: test/sql_stmt_rtgeom_tests/totwkb19.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb19.testcase +++ test/sql_stmt_rtgeom_tests/totwkb19.testcase @@ -0,0 +1,7 @@ +AsTWKB - Double with size +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, 1.5); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, 1.5) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb2.testcase Index: test/sql_stmt_rtgeom_tests/totwkb2.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb2.testcase +++ test/sql_stmt_rtgeom_tests/totwkb2.testcase @@ -0,0 +1,7 @@ +AsTWKB - Int Geometry +:memory: #use in-memory database +SELECT AsTWKB(1); +1 # rows (not including the header row) +1 # columns +AsTWKB(1) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb20.testcase Index: test/sql_stmt_rtgeom_tests/totwkb20.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb20.testcase +++ test/sql_stmt_rtgeom_tests/totwkb20.testcase @@ -0,0 +1,7 @@ +AsTWKB - Text with size +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, 'yes'); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, 'yes') +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb21.testcase Index: test/sql_stmt_rtgeom_tests/totwkb21.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb21.testcase +++ test/sql_stmt_rtgeom_tests/totwkb21.testcase @@ -0,0 +1,7 @@ +AsTWKB - BLOB with size +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, zeroblob(10)); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, zeroblob(10)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb22.testcase Index: test/sql_stmt_rtgeom_tests/totwkb22.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb22.testcase +++ test/sql_stmt_rtgeom_tests/totwkb22.testcase @@ -0,0 +1,7 @@ +AsTWKB - NULL with bbox +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, NULL); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, NULL)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb23.testcase Index: test/sql_stmt_rtgeom_tests/totwkb23.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb23.testcase +++ test/sql_stmt_rtgeom_tests/totwkb23.testcase @@ -0,0 +1,7 @@ +AsTWKB - Double with bbox +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, 1.2); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, 1.2) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb24.testcase Index: test/sql_stmt_rtgeom_tests/totwkb24.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb24.testcase +++ test/sql_stmt_rtgeom_tests/totwkb24.testcase @@ -0,0 +1,7 @@ +AsTWKB - Text with bbox +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, 'yes'); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, 'yes') +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb25.testcase Index: test/sql_stmt_rtgeom_tests/totwkb25.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb25.testcase +++ test/sql_stmt_rtgeom_tests/totwkb25.testcase @@ -0,0 +1,7 @@ +AsTWKB - BLOB with bbox +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, zeroblob(2)); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, zeroblob(2)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb26.testcase Index: test/sql_stmt_rtgeom_tests/totwkb26.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb26.testcase +++ test/sql_stmt_rtgeom_tests/totwkb26.testcase @@ -0,0 +1,7 @@ +AsTWKB - Point XY +:memory: #use in-memory database +SELECT Hex(AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, 0)); +1 # rows (not including the header row) +1 # columns +Hex(AsTWKB(MakePoint(1, 2), 6, 6, 6, 0, 0)) +C10080897A8092F401 ADDED test/sql_stmt_rtgeom_tests/totwkb27.testcase Index: test/sql_stmt_rtgeom_tests/totwkb27.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb27.testcase +++ test/sql_stmt_rtgeom_tests/totwkb27.testcase @@ -0,0 +1,7 @@ +AsTWKB - Polygon Z +:memory: #use in-memory database +SELECT Hex(AsTWKB(GeomFromText('POLYGON Z((0 0 1, 1 0 2, 1 1 3, 0 1 1, 0 0 1))'), 6, 6, 6)); +1 # rows (not including the header row) +1 # columns +Hex(AsTWKB(GeomFromText('POLYGON Z((0 0 1, 1 0 2, 1 1 3, 0 1 1, 0 0 1))'), 6, 6, 6)); +C308D90105000080897A80897A0080897A0080897A80897AFF887A00FF91F40100FF887A00 ADDED test/sql_stmt_rtgeom_tests/totwkb28.testcase Index: test/sql_stmt_rtgeom_tests/totwkb28.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb28.testcase +++ test/sql_stmt_rtgeom_tests/totwkb28.testcase @@ -0,0 +1,7 @@ +AsTWKB - MultiLinestring M +:memory: #use in-memory database +SELECT Hex(AsTWKB(GeomFromText('MULTILINESTRING M((0 0 1, 1 0 2), (1 1 3, 0 1 4))'), 6, 6, 6)); +1 # rows (not including the header row) +1 # columns +Hex(AsTWKB(GeomFromText('MULTILINESTRING M((0 0 1, 1 0 2), (1 1 3, 0 1 4))'), 6, 6, 6)) +C508DA0202000080897A80897A0080897A020080897A80897AFF887A0080897A ADDED test/sql_stmt_rtgeom_tests/totwkb29.testcase Index: test/sql_stmt_rtgeom_tests/totwkb29.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb29.testcase +++ test/sql_stmt_rtgeom_tests/totwkb29.testcase @@ -0,0 +1,7 @@ +AsTWKB - MultiPoint ZM +:memory: #use in-memory database +SELECT Hex(AsTWKB(GeomFromText('MULTIPOINT ZM(0 0 1 2, 1 0 3 4, 1 1 5 6, 0 1 7 8)'), 6, 6, 6)); +1 # rows (not including the header row) +1 # columns +Hex(AsTWKB(GeomFromText('MULTIPOINT ZM(0 0 1 2, 1 0 3 4, 1 1 5 6, 0 1 7 8)'), 6, 6, 6)) +C408DB04000080897A8092F40180897A008092F4018092F4010080897A8092F4018092F401FF887A008092F4018092F401 ADDED test/sql_stmt_rtgeom_tests/totwkb3.testcase Index: test/sql_stmt_rtgeom_tests/totwkb3.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb3.testcase +++ test/sql_stmt_rtgeom_tests/totwkb3.testcase @@ -0,0 +1,7 @@ +AsTWKB - Double Geometry +:memory: #use in-memory database +SELECT AsTWKB(1.3); +1 # rows (not including the header row) +1 # columns +AsTWKB(1.3) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb30.testcase Index: test/sql_stmt_rtgeom_tests/totwkb30.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb30.testcase +++ test/sql_stmt_rtgeom_tests/totwkb30.testcase @@ -0,0 +1,7 @@ +AsTWKB - GeometryCollection +:memory: #use in-memory database +SELECT Hex(AsTWKB(GeomFromText('GEOMETRYCOLLECTION(POINT(1 2), LINESTRING(10 10, 20 20), POLYGON((100 100, 100 101, 101 101, 101 100, 100 100)))'), 6, 6, 6)); +1 # rows (not including the header row) +1 # columns +Hex(AsTWKB(GeomFromText('GEOMETRYCOLLECTION(POINT(1 2), LINESTRING(10 10, 20 20), POLYGON((100 100, 100 101, 101 101, 101 100, 100 100)))'), 6, 6, 6)) +C70003C10080897A8092F401C2000280DAC40980DAC40980DAC40980DAC409C30001058084AF5F8084AF5F0080897A80897A0000FF887AFF887A00 ADDED test/sql_stmt_rtgeom_tests/totwkb4.testcase Index: test/sql_stmt_rtgeom_tests/totwkb4.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb4.testcase +++ test/sql_stmt_rtgeom_tests/totwkb4.testcase @@ -0,0 +1,7 @@ +AsTWKB - Text Geometry +:memory: #use in-memory database +SELECT AsTWKB('geom'); +1 # rows (not including the header row) +1 # columns +AsTWKB('geom') +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb5.testcase Index: test/sql_stmt_rtgeom_tests/totwkb5.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb5.testcase +++ test/sql_stmt_rtgeom_tests/totwkb5.testcase @@ -0,0 +1,7 @@ +AsTWKB - Invalid BLOB Geometry +:memory: #use in-memory database +SELECT AsTWKB(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +AsTWKB(zeroblob(10)) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb6.testcase Index: test/sql_stmt_rtgeom_tests/totwkb6.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb6.testcase +++ test/sql_stmt_rtgeom_tests/totwkb6.testcase @@ -0,0 +1,7 @@ +AsTWKB - NULL precision XY +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), NULL); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), NULL) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb7.testcase Index: test/sql_stmt_rtgeom_tests/totwkb7.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb7.testcase +++ test/sql_stmt_rtgeom_tests/totwkb7.testcase @@ -0,0 +1,7 @@ +AsTWKB - Double precision XY +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 1.2); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 1.2) +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb8.testcase Index: test/sql_stmt_rtgeom_tests/totwkb8.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb8.testcase +++ test/sql_stmt_rtgeom_tests/totwkb8.testcase @@ -0,0 +1,7 @@ +AsTWKB - Text precision XY +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), 'six'); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), 'six') +(NULL) ADDED test/sql_stmt_rtgeom_tests/totwkb9.testcase Index: test/sql_stmt_rtgeom_tests/totwkb9.testcase ================================================================== --- test/sql_stmt_rtgeom_tests/totwkb9.testcase +++ test/sql_stmt_rtgeom_tests/totwkb9.testcase @@ -0,0 +1,7 @@ +AsTWKB - BLOB precision XY +:memory: #use in-memory database +SELECT AsTWKB(MakePoint(1, 2), zeroblob(2)); +1 # rows (not including the header row) +1 # columns +AsTWKB(MakePoint(1, 2), zeroblob(2)) +(NULL) Index: test/sql_stmt_rttopo_tests/Makefile.am ================================================================== --- test/sql_stmt_rttopo_tests/Makefile.am +++ test/sql_stmt_rttopo_tests/Makefile.am @@ -134,10 +134,11 @@ changelinkgeom4.testcase \ changelinkgeom5.testcase \ changelinkgeom6.testcase \ changelinkgeom7.testcase \ changelinkgeom8.testcase \ + createtopotables.testcase \ createtopogeo1.testcase \ createtopogeo2.testcase \ createtopogeo3.testcase \ createtopogeo4.testcase \ createtopogeo5.testcase \ @@ -192,10 +193,11 @@ createtopology18.testcase \ createtopology19.testcase \ createtopology20.testcase \ createtopology21.testcase \ createtopology22.testcase \ + createvectorcoverages.testcase \ createnetwork1.testcase \ createnetwork2.testcase \ createnetwork3.testcase \ createnetwork4.testcase \ createnetwork5.testcase \ @@ -433,10 +435,52 @@ inittopolayer13.testcase \ inittopolayer14.testcase \ inittopolayer15.testcase \ inittopolayer16.testcase \ inittopolayer17.testcase \ + lineedgeslist1.testcase \ + lineedgeslist2.testcase \ + lineedgeslist3.testcase \ + lineedgeslist4.testcase \ + lineedgeslist5.testcase \ + lineedgeslist6.testcase \ + lineedgeslist7.testcase \ + lineedgeslist8.testcase \ + lineedgeslist9.testcase \ + lineedgeslist10.testcase \ + lineedgeslist11.testcase \ + lineedgeslist12.testcase \ + lineedgeslist13.testcase \ + lineedgeslist14.testcase \ + lineedgeslist15.testcase \ + lineedgeslist16.testcase \ + lineedgeslist17.testcase \ + lineedgeslist18.testcase \ + lineedgeslist19.testcase \ + lineedgeslist20.testcase \ + lineedgeslist21.testcase \ + linelinkslist1.testcase \ + linelinkslist2.testcase \ + linelinkslist3.testcase \ + linelinkslist4.testcase \ + linelinkslist5.testcase \ + linelinkslist6.testcase \ + linelinkslist7.testcase \ + linelinkslist8.testcase \ + linelinkslist9.testcase \ + linelinkslist10.testcase \ + linelinkslist11.testcase \ + linelinkslist12.testcase \ + linelinkslist13.testcase \ + linelinkslist14.testcase \ + linelinkslist15.testcase \ + linelinkslist16.testcase \ + linelinkslist17.testcase \ + linelinkslist18.testcase \ + linelinkslist19.testcase \ + linelinkslist20.testcase \ + linelinkslist21.testcase \ linesnapseed1.testcase \ linesnapseed2.testcase \ linesnapseed3.testcase \ linesnapseed4.testcase \ linesnapseed5.testcase \ @@ -730,10 +774,15 @@ snappedgeotable29.testcase \ snappedgeotable30.testcase \ snappedgeotable31.testcase \ snappedgeotable32.testcase \ snappedgeotable33.testcase \ + snappedgeotable34.testcase \ + snappedgeotable35.testcase \ + snappedgeotable36.testcase \ + snappedgeotable37.testcase \ + snappedgeotable38.testcase \ spatnetfromtgeo1.testcase \ spatnetfromtgeo2.testcase \ spatnetfromtgeo3.testcase \ spatnetfromtgeo4.testcase \ spatnetfromtgeo5.testcase \ @@ -818,10 +867,15 @@ topogeoclone8.testcase \ topogeoclone9.testcase \ topogeoclone10.testcase \ topogeoclone11.testcase \ topogeoclone12.testcase \ + topogeodisambiguate1.testcase \ + topogeodisambiguate2.testcase \ + topogeodisambiguate3.testcase \ + topogeodisambiguate4.testcase \ + topogeodisambiguate5.testcase \ topogeofromext1.testcase \ topogeofromext2.testcase \ topogeofromext3.testcase \ topogeofromext4.testcase \ topogeofromext5.testcase \ @@ -1012,10 +1066,31 @@ topogeonewedgessplit11.testcase \ topogeonewedgessplit12.testcase \ topogeonewedgessplit13.testcase \ topogeonewedgessplit14.testcase \ topogeonewedgessplit15.testcase \ + polyfaceslist1.testcase \ + polyfaceslist2.testcase \ + polyfaceslist3.testcase \ + polyfaceslist4.testcase \ + polyfaceslist5.testcase \ + polyfaceslist6.testcase \ + polyfaceslist7.testcase \ + polyfaceslist8.testcase \ + polyfaceslist9.testcase \ + polyfaceslist10.testcase \ + polyfaceslist11.testcase \ + polyfaceslist12.testcase \ + polyfaceslist13.testcase \ + polyfaceslist14.testcase \ + polyfaceslist15.testcase \ + polyfaceslist16.testcase \ + polyfaceslist17.testcase \ + polyfaceslist18.testcase \ + polyfaceslist19.testcase \ + polyfaceslist20.testcase \ + polyfaceslist21.testcase \ topogeosplitline1.testcase \ topogeosplitline2.testcase \ topogeosplitline3.testcase \ topogeosplitline4.testcase \ topogeosplitline5.testcase \ @@ -1134,10 +1209,15 @@ toponetclone8.testcase \ toponetclone9.testcase \ toponetclone10.testcase \ toponetclone11.testcase \ toponetclone12.testcase \ + toponetdisambiguate1.testcase \ + toponetdisambiguate2.testcase \ + toponetdisambiguate3.testcase \ + toponetdisambiguate4.testcase \ + toponetdisambiguate5.testcase \ toponetfromtable1.testcase \ toponetfromtable2.testcase \ toponetfromtable3.testcase \ toponetfromtable4.testcase \ toponetfromtable5.testcase \ @@ -1232,10 +1312,15 @@ toposnap20.testcase \ toposnap21.testcase \ toposnap22.testcase \ toposnap23.testcase \ toposnap24.testcase \ + toposnap25.testcase \ + toposnap26.testcase \ + toposnap27.testcase \ + toposnap28.testcase \ + toposnap29.testcase \ validatetopogeo1.testcase \ validatetopogeo2.testcase \ validatetopogeo3.testcase \ validatetopogeo4.testcase \ validatetopogeo5.testcase \ Index: test/sql_stmt_rttopo_tests/Makefile.in ================================================================== --- test/sql_stmt_rttopo_tests/Makefile.in +++ test/sql_stmt_rttopo_tests/Makefile.in @@ -386,10 +386,11 @@ changelinkgeom4.testcase \ changelinkgeom5.testcase \ changelinkgeom6.testcase \ changelinkgeom7.testcase \ changelinkgeom8.testcase \ + createtopotables.testcase \ createtopogeo1.testcase \ createtopogeo2.testcase \ createtopogeo3.testcase \ createtopogeo4.testcase \ createtopogeo5.testcase \ @@ -444,10 +445,11 @@ createtopology18.testcase \ createtopology19.testcase \ createtopology20.testcase \ createtopology21.testcase \ createtopology22.testcase \ + createvectorcoverages.testcase \ createnetwork1.testcase \ createnetwork2.testcase \ createnetwork3.testcase \ createnetwork4.testcase \ createnetwork5.testcase \ @@ -685,10 +687,52 @@ inittopolayer13.testcase \ inittopolayer14.testcase \ inittopolayer15.testcase \ inittopolayer16.testcase \ inittopolayer17.testcase \ + lineedgeslist1.testcase \ + lineedgeslist2.testcase \ + lineedgeslist3.testcase \ + lineedgeslist4.testcase \ + lineedgeslist5.testcase \ + lineedgeslist6.testcase \ + lineedgeslist7.testcase \ + lineedgeslist8.testcase \ + lineedgeslist9.testcase \ + lineedgeslist10.testcase \ + lineedgeslist11.testcase \ + lineedgeslist12.testcase \ + lineedgeslist13.testcase \ + lineedgeslist14.testcase \ + lineedgeslist15.testcase \ + lineedgeslist16.testcase \ + lineedgeslist17.testcase \ + lineedgeslist18.testcase \ + lineedgeslist19.testcase \ + lineedgeslist20.testcase \ + lineedgeslist21.testcase \ + linelinkslist1.testcase \ + linelinkslist2.testcase \ + linelinkslist3.testcase \ + linelinkslist4.testcase \ + linelinkslist5.testcase \ + linelinkslist6.testcase \ + linelinkslist7.testcase \ + linelinkslist8.testcase \ + linelinkslist9.testcase \ + linelinkslist10.testcase \ + linelinkslist11.testcase \ + linelinkslist12.testcase \ + linelinkslist13.testcase \ + linelinkslist14.testcase \ + linelinkslist15.testcase \ + linelinkslist16.testcase \ + linelinkslist17.testcase \ + linelinkslist18.testcase \ + linelinkslist19.testcase \ + linelinkslist20.testcase \ + linelinkslist21.testcase \ linesnapseed1.testcase \ linesnapseed2.testcase \ linesnapseed3.testcase \ linesnapseed4.testcase \ linesnapseed5.testcase \ @@ -982,10 +1026,15 @@ snappedgeotable29.testcase \ snappedgeotable30.testcase \ snappedgeotable31.testcase \ snappedgeotable32.testcase \ snappedgeotable33.testcase \ + snappedgeotable34.testcase \ + snappedgeotable35.testcase \ + snappedgeotable36.testcase \ + snappedgeotable37.testcase \ + snappedgeotable38.testcase \ spatnetfromtgeo1.testcase \ spatnetfromtgeo2.testcase \ spatnetfromtgeo3.testcase \ spatnetfromtgeo4.testcase \ spatnetfromtgeo5.testcase \ @@ -1070,10 +1119,15 @@ topogeoclone8.testcase \ topogeoclone9.testcase \ topogeoclone10.testcase \ topogeoclone11.testcase \ topogeoclone12.testcase \ + topogeodisambiguate1.testcase \ + topogeodisambiguate2.testcase \ + topogeodisambiguate3.testcase \ + topogeodisambiguate4.testcase \ + topogeodisambiguate5.testcase \ topogeofromext1.testcase \ topogeofromext2.testcase \ topogeofromext3.testcase \ topogeofromext4.testcase \ topogeofromext5.testcase \ @@ -1264,10 +1318,31 @@ topogeonewedgessplit11.testcase \ topogeonewedgessplit12.testcase \ topogeonewedgessplit13.testcase \ topogeonewedgessplit14.testcase \ topogeonewedgessplit15.testcase \ + polyfaceslist1.testcase \ + polyfaceslist2.testcase \ + polyfaceslist3.testcase \ + polyfaceslist4.testcase \ + polyfaceslist5.testcase \ + polyfaceslist6.testcase \ + polyfaceslist7.testcase \ + polyfaceslist8.testcase \ + polyfaceslist9.testcase \ + polyfaceslist10.testcase \ + polyfaceslist11.testcase \ + polyfaceslist12.testcase \ + polyfaceslist13.testcase \ + polyfaceslist14.testcase \ + polyfaceslist15.testcase \ + polyfaceslist16.testcase \ + polyfaceslist17.testcase \ + polyfaceslist18.testcase \ + polyfaceslist19.testcase \ + polyfaceslist20.testcase \ + polyfaceslist21.testcase \ topogeosplitline1.testcase \ topogeosplitline2.testcase \ topogeosplitline3.testcase \ topogeosplitline4.testcase \ topogeosplitline5.testcase \ @@ -1386,10 +1461,15 @@ toponetclone8.testcase \ toponetclone9.testcase \ toponetclone10.testcase \ toponetclone11.testcase \ toponetclone12.testcase \ + toponetdisambiguate1.testcase \ + toponetdisambiguate2.testcase \ + toponetdisambiguate3.testcase \ + toponetdisambiguate4.testcase \ + toponetdisambiguate5.testcase \ toponetfromtable1.testcase \ toponetfromtable2.testcase \ toponetfromtable3.testcase \ toponetfromtable4.testcase \ toponetfromtable5.testcase \ @@ -1484,10 +1564,15 @@ toposnap20.testcase \ toposnap21.testcase \ toposnap22.testcase \ toposnap23.testcase \ toposnap24.testcase \ + toposnap25.testcase \ + toposnap26.testcase \ + toposnap27.testcase \ + toposnap28.testcase \ + toposnap29.testcase \ validatetopogeo1.testcase \ validatetopogeo2.testcase \ validatetopogeo3.testcase \ validatetopogeo4.testcase \ validatetopogeo5.testcase \ ADDED test/sql_stmt_rttopo_tests/createtopotables.testcase Index: test/sql_stmt_rttopo_tests/createtopotables.testcase ================================================================== --- test/sql_stmt_rttopo_tests/createtopotables.testcase +++ test/sql_stmt_rttopo_tests/createtopotables.testcase @@ -0,0 +1,7 @@ +CreateTopoTables +:memory: #use in-memory database +SELECT CreateTopoTables(); +1 # rows (not including the header row) +1 # columns +CreateTopoTables() +1 ADDED test/sql_stmt_rttopo_tests/createvectorcoverages.testcase Index: test/sql_stmt_rttopo_tests/createvectorcoverages.testcase ================================================================== --- test/sql_stmt_rttopo_tests/createvectorcoverages.testcase +++ test/sql_stmt_rttopo_tests/createvectorcoverages.testcase @@ -0,0 +1,8 @@ +CreateVectorsCoveragesTables +NEW:memory: #use in-memory database +SELECT CreateVectorCoveragesTables(); +1 # rows (not including the header row) +1 # columns +CreateVectorCoveragesTables() +1 + ADDED test/sql_stmt_rttopo_tests/lineedgeslist1.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist1.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist1.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist1.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - NULL Topology +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList(NULL, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList(NULL, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist10.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist10.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist10.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist10.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - NULL ref-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, NULL, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, NULL, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist11.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist11.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist11.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist11.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - INT ref-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 1, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 1, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist12.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist12.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist12.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist12.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Double ref-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 1.2, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 1.2, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist13.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist13.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist13.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist13.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - BLOB ref-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, zeroblob(4), NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, zeroblob(4), NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist14.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist14.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist14.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist14.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Text Column +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', 'column', 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', 'column', 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/lineedgeslist15.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist15.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist15.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist15.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Int Column +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', 1, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', 1, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist16.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist16.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist16.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist16.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Double Column +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', 1.2, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', 1.2, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist17.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist17.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist17.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist17.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - BLOB Column +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', zeroblob(4), 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', zeroblob(4), 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist18.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist18.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist18.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist18.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - NULL out-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, NULL); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, NULL) +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist19.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist19.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist19.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist19.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Double out-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, 1.2); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, 1.2) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist2.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist2.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist2.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist2.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Int Topology +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList(1, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList(1, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist20.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist20.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist20.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist20.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - BLOB out-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, zeroblob(4)); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, zeroblob(4)) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist21.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist21.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist21.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist21.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Text out-table +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/lineedgeslist3.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist3.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist3.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist3.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Double Topology +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList(1.5, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList(1.5, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist4.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist4.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist4.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist4.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Blob Topology +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList(zeroblob(4), NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList(zeroblob(4), NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist5.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist5.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist5.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist5.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Text Topology +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/lineedgeslist6.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist6.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist6.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist6.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - TEXT prefix +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', 'a', 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', 'a', 'table', NULL, 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/lineedgeslist7.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist7.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist7.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist7.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - INT prefix +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', 1, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', 1, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist8.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist8.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist8.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist8.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - Double prefix +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', 1.2, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', 1.2, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/lineedgeslist9.testcase Index: test/sql_stmt_rttopo_tests/lineedgeslist9.testcase ================================================================== --- test/sql_stmt_rttopo_tests/lineedgeslist9.testcase +++ test/sql_stmt_rttopo_tests/lineedgeslist9.testcase @@ -0,0 +1,7 @@ +TopoGeo_LineEdgesList - BLOB prefix +:memory: #use in-memory database +SELECT TopoGeo_LineEdgesList('topology', zeroblob(4), 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_LineEdgesList('topology', zeroblob(4), 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist1.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist1.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist1.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist1.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - NULL Network +:memory: #use in-memory database +SELECT TopoNet_LineLinksList(NULL, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList(NULL, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist10.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist10.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist10.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist10.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - NULL ref-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, NULL, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, NULL, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist11.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist11.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist11.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist11.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - INT ref-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 1, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 1, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist12.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist12.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist12.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist12.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Double ref-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 1.2, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 1.2, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist13.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist13.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist13.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist13.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - BLOB ref-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, zeroblob(4), NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, zeroblob(4), NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist14.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist14.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist14.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist14.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Text Column +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', 'column', 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', 'column', 'out') +SQL/MM Spatial exception - invalid network name. ADDED test/sql_stmt_rttopo_tests/linelinkslist15.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist15.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist15.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist15.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Int Column +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', 1, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', 1, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist16.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist16.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist16.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist16.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Double Column +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', 1.2, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', 1.2, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist17.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist17.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist17.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist17.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - BLOB Column +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', zeroblob(4), 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', zeroblob(4), 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist18.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist18.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist18.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist18.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - NULL out-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', NULL, NULL); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', NULL, NULL) +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist19.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist19.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist19.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist19.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Double out-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', NULL, 1.2); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', NULL, 1.2) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist2.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist2.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist2.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist2.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Int Network +:memory: #use in-memory database +SELECT TopoNet_LineLinksList(1, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList(1, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist20.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist20.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist20.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist20.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - BLOB out-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', NULL, zeroblob(4)); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', NULL, zeroblob(4)) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist21.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist21.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist21.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist21.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Text out-table +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid network name. ADDED test/sql_stmt_rttopo_tests/linelinkslist3.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist3.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist3.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist3.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Double Network +:memory: #use in-memory database +SELECT TopoNet_LineLinksList(1.5, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList(1.5, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist4.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist4.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist4.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist4.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Blob Network +:memory: #use in-memory database +SELECT TopoNet_LineLinksList(zeroblob(4), NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList(zeroblob(4), NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist5.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist5.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist5.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist5.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Text Network +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid network name. ADDED test/sql_stmt_rttopo_tests/linelinkslist6.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist6.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist6.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist6.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - TEXT prefix +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', 'a', 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', 'a', 'table', NULL, 'out') +SQL/MM Spatial exception - invalid network name. ADDED test/sql_stmt_rttopo_tests/linelinkslist7.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist7.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist7.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist7.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - INT prefix +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', 1, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', 1, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist8.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist8.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist8.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist8.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - Double prefix +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', 1.2, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', 1.2, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/linelinkslist9.testcase Index: test/sql_stmt_rttopo_tests/linelinkslist9.testcase ================================================================== --- test/sql_stmt_rttopo_tests/linelinkslist9.testcase +++ test/sql_stmt_rttopo_tests/linelinkslist9.testcase @@ -0,0 +1,7 @@ +TopoNet_LineLinksList - BLOB prefix +:memory: #use in-memory database +SELECT TopoNet_LineLinksList('network', zeroblob(4), 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoNet_LineLinksList('network', zeroblob(4), 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist1.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist1.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist1.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist1.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - NULL Topology +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList(NULL, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList(NULL, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist10.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist10.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist10.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist10.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - NULL ref-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, NULL, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, NULL, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist11.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist11.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist11.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist11.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - INT ref-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 1, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 1, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist12.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist12.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist12.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist12.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Double ref-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 1.2, NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 1.2, NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist13.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist13.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist13.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist13.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - BLOB ref-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, zeroblob(4), NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, zeroblob(4), NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist14.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist14.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist14.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist14.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Text Column +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', 'column', 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', 'column', 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/polyfaceslist15.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist15.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist15.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist15.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Int Column +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', 1, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', 1, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist16.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist16.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist16.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist16.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Double Column +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', 1.2, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', 1.2, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist17.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist17.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist17.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist17.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - BLOB Column +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', zeroblob(4), 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', zeroblob(4), 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist18.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist18.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist18.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist18.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - NULL out-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, NULL); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, NULL) +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist19.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist19.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist19.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist19.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Double out-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, 1.2); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, 1.2) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist2.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist2.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist2.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist2.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Int Topology +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList(1, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList(1, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist20.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist20.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist20.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist20.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - BLOB out-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, zeroblob(4)); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, zeroblob(4)) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist21.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist21.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist21.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist21.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Text out-table +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/polyfaceslist3.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist3.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist3.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist3.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Double Topology +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList(1.5, NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList(1.5, NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist4.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist4.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist4.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist4.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Blob Topology +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList(zeroblob(4), NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList(zeroblob(4), NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist5.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist5.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist5.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist5.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Text Topology +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', NULL, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/polyfaceslist6.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist6.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist6.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist6.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - TEXT prefix +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', 'a', 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', 'a', 'table', NULL, 'out') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/polyfaceslist7.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist7.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist7.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist7.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - INT prefix +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', 1, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', 1, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist8.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist8.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist8.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist8.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - Double prefix +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', 1.2, 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', 1.2, 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/polyfaceslist9.testcase Index: test/sql_stmt_rttopo_tests/polyfaceslist9.testcase ================================================================== --- test/sql_stmt_rttopo_tests/polyfaceslist9.testcase +++ test/sql_stmt_rttopo_tests/polyfaceslist9.testcase @@ -0,0 +1,7 @@ +TopoGeo_PolyFacesList - BLOB prefix +:memory: #use in-memory database +SELECT TopoGeo_PolyFacesList('topology', zeroblob(4), 'table', NULL, 'out'); +1 # rows (not including the header row) +1 # columns +TopoGeo_PolyFacesList('topology', zeroblob(4), 'table', NULL, 'out') +SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable1.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable1.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable1.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - NULL Topology :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable(NULL, 'db', 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable(NULL, 'db', 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable(NULL, 'db', 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable(NULL, 'db', 'input', 'geom', 'output', 1) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable10.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable10.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable10.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Int input table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 1, 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 1, 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 1, 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 1, 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable11.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable11.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable11.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Double input table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 1.5, 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 1.5, 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 1.5, 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 1.5, 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable12.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable12.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable12.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - BLOB input table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', zeroblob(10), 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', zeroblob(10), 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', zeroblob(10), 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', zeroblob(10), 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable13.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable13.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable13.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - NULL geometry column :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input', NULL, 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input', NULL, 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', NULL, 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', NULL, 'output', 1) SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/snappedgeotable14.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable14.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable14.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Double geometry column :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input', 1.5, 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input', 1.5, 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 1.5, 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 1.5, 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable15.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable15.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable15.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - BLOB geometry column :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input', zeroblob(10), 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input', zeroblob(10), 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', zeroblob(10), 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', zeroblob(10), 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable16.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable16.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable16.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - NULL output table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', NULL, 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', NULL, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', NULL, 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', NULL, 1) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable17.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable17.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable17.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Int output table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 1, 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 1, 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 1, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable18.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable18.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable18.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Double output table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 1.5, 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 1.5, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 1.5, 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 1.5, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable19.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable19.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable19.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - BLOB output table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', zeroblob(10), 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', zeroblob(10), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', zeroblob(10), 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', zeroblob(10), 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable2.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable2.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable2.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Int Topology :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable(1, 'db', 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable(1, 'db', 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable(1, 'db', 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable(1, 'db', 'input', 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable20.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable20.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable20.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - NULL tolerance +TopoGeo_SnappedGeoTable - NULL tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1, NULL); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', NULL, 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, NULL) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, NULL, 0.1, 1) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable21.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable21.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable21.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - text tolerance +TopoGeo_SnappedGeoTable - text tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1, 'tolerance'); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 'tolerance', 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, 'tolerance') +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 'tolerance', 0.1, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable22.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable22.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable22.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - BLOB tolerance +TopoGeo_SnappedGeoTable - BLOB tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1, zeroblob(10)); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', zeroblob(10), 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, zeroblob(10)) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', zeroblob(10), 0.1, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable23.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable23.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable23.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - Double tolerance +TopoGeo_SnappedGeoTable - Double tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1, 0.001); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.001, 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, 0.001) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.001, 0.1, 1) SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/snappedgeotable24.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable24.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable24.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - NULL iterate :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', NULL, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', NULL); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', NULL, 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', NULL) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable25.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable25.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable25.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - text iterate :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 'iterate', 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 'iterate'); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 'iterate', 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 'iterate') SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable26.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable26.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable26.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - BLOB iterate :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', zeroblob(5), 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', zeroblob(5)); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', zeroblob(5), 1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', zeroblob(5)) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable27.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable27.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable27.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - NULL remove-vertices +TopoGeo_SnappedGeoTable - NULL tolerance_removal :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, NULL); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.1, NULL, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, NULL) -SQL/MM Spatial exception - null argument. +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.1, NULL, 1) +SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/snappedgeotable28.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable28.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable28.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - Text remove-vertices +TopoGeo_SnappedGeoTable - Text tolerance_removal :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 'remove'); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.1, 'remove', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 'remove') +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.1, 'remove', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable29.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable29.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable29.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - BLOB remove-vertices +TopoGeo_SnappedGeoTable - BLOB tolerance_removal :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, zeroblob(10)); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.1, zeroblob(10), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, zeroblob(10)) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.1, zeroblob(10), 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable3.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable3.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable3.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Double Topology :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable(1.5, 'db', 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable(1.5, 'db', 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable(1.5, 'db', 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable(1.5, 'db', 'input', 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable30.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable30.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable30.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - Double remove-vertices +TopoGeo_SnappedGeoTable - long form NULL iterate :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1.2); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.1, 0.2, NULL); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1.2) -SQL/MM Spatial exception - invalid argument. +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.1, 0.2, NULL) +SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable31.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable31.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable31.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - Int remove-vertices +TopoGeo_SnappedGeoTable - long form Text iterate :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.1, 0.1, 'no'); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1) -SQL/MM Spatial exception - invalid topology name. +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.1, 0.1, 'no') +SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable32.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable32.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable32.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - Int NEGATIVE tolerance +TopoGeo_SnappedGeoTable - Int NEGATIVE tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1, -1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', -1, 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, -1) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', -1, 0.1, 1) SQL/MM Spatial exception - illegal negative tolerance. Index: test/sql_stmt_rttopo_tests/snappedgeotable33.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable33.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable33.testcase @@ -1,7 +1,7 @@ -TopoGeo_SnappedGeoTable - Double NEGATIVE tolerance +TopoGeo_SnappedGeoTable - Double NEGATIVE tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, 1, -0.001); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', -0.001, 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, -0.001) +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, -0.001, 0.1, 1) SQL/MM Spatial exception - illegal negative tolerance. ADDED test/sql_stmt_rttopo_tests/snappedgeotable34.testcase Index: test/sql_stmt_rttopo_tests/snappedgeotable34.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable34.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable34.testcase @@ -0,0 +1,7 @@ +TopoGeo_SnappedGeoTable - long form Double iterate +:memory: #use in-memory database +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.1, 0.1, 1.6); +1 # rows (not including the header row) +1 # columns +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.1, 0.1, 1.6) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/snappedgeotable35.testcase Index: test/sql_stmt_rttopo_tests/snappedgeotable35.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable35.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable35.testcase @@ -0,0 +1,7 @@ +TopoGeo_SnappedGeoTable - long form BLOB iterate +:memory: #use in-memory database +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.1, 0.1, zeroblob(3)); +1 # rows (not including the header row) +1 # columns +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 0.1, 0.1, zeroblob(3)) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/snappedgeotable36.testcase Index: test/sql_stmt_rttopo_tests/snappedgeotable36.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable36.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable36.testcase @@ -0,0 +1,7 @@ +TopoGeo_SnappedGeoTable - Int NEGATIVE tolerance_removal +:memory: #use in-memory database +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 1, -1, 1); +1 # rows (not including the header row) +1 # columns +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, -1, 1) +SQL/MM Spatial exception - illegal negative tolerance. ADDED test/sql_stmt_rttopo_tests/snappedgeotable37.testcase Index: test/sql_stmt_rttopo_tests/snappedgeotable37.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable37.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable37.testcase @@ -0,0 +1,7 @@ +TopoGeo_SnappedGeoTable - Double NEGATIVE tolerance_removal +:memory: #use in-memory database +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.001, -0.1, 1); +1 # rows (not including the header row) +1 # columns +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, 0.001, -0.1, 1) +SQL/MM Spatial exception - illegal negative tolerance. ADDED test/sql_stmt_rttopo_tests/snappedgeotable38.testcase Index: test/sql_stmt_rttopo_tests/snappedgeotable38.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable38.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable38.testcase @@ -0,0 +1,7 @@ +TopoGeo_SnappedGeoTable - valid lon form +:memory: #use in-memory database +SELECT TopoGeo_SnappedGeoTable('topo', 'db', 'input','geom', 'output', 0.001, 0.1, 1); +1 # rows (not including the header row) +1 # columns +TopoGeo_SnappedGeoTable('topo', 'db', 'input', 'geom', 'output', 1, 1, 0.001, 0.1, 1) +SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/snappedgeotable4.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable4.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable4.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - BLOB Topology :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable(zeroblob(10), 'db', 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable(zeroblob(10), 'db', 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable(zeroblob(10), 'db', 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable(zeroblob(10), 'db', 'input', 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable5.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable5.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable5.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - NULL DB-prefix :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', NULL, 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', NULL, 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', NULL, 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', NULL, 'input', 'geom', 'output', 1) SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/snappedgeotable6.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable6.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable6.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Int DB-prefix :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 1, 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 1, 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 1, 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 1, 'input', 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable7.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable7.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable7.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - Double DB-prefix :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 1.5, 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 1.5, 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 1.5, 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 1.5, 'input', 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable8.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable8.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable8.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - BLOB DB-prefix :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', zeroblob(10), 'input', 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', zeroblob(10), 'input', 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', zeroblob(10), 'input', 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', zeroblob(10), 'input', 'geom', 'output', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/snappedgeotable9.testcase ================================================================== --- test/sql_stmt_rttopo_tests/snappedgeotable9.testcase +++ test/sql_stmt_rttopo_tests/snappedgeotable9.testcase @@ -1,7 +1,7 @@ TopoGeo_SnappedGeoTable - NULL input table :memory: #use in-memory database -SELECT TopoGeo_SnappedGeoTable('topo', 'db', NULL, 'geom', 'output', 1, 1); +SELECT TopoGeo_SnappedGeoTable('topo', 'db', NULL, 'geom', 'output', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_SnappedGeoTable('topo', 'db', NULL, 'geom', 'output', 1, 1) +TopoGeo_SnappedGeoTable('topo', 'db', NULL, 'geom', 'output', 1) SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/topogeodisambiguate1.testcase Index: test/sql_stmt_rttopo_tests/topogeodisambiguate1.testcase ================================================================== --- test/sql_stmt_rttopo_tests/topogeodisambiguate1.testcase +++ test/sql_stmt_rttopo_tests/topogeodisambiguate1.testcase @@ -0,0 +1,7 @@ +TopoGeo_DisambiguateSegmentEdges - NULL Topology +:memory: #use in-memory database +SELECT TopoGeo_DisambiguateSegmentEdges(NULL); +1 # rows (not including the header row) +1 # columns +TopoGeo_DisambiguateSegmentEdges(NULL) +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/topogeodisambiguate2.testcase Index: test/sql_stmt_rttopo_tests/topogeodisambiguate2.testcase ================================================================== --- test/sql_stmt_rttopo_tests/topogeodisambiguate2.testcase +++ test/sql_stmt_rttopo_tests/topogeodisambiguate2.testcase @@ -0,0 +1,7 @@ +TopoGeo_DisambiguateSegmentEdges - Int Topology +:memory: #use in-memory database +SELECT TopoGeo_DisambiguateSegmentEdges(1); +1 # rows (not including the header row) +1 # columns +TopoGeo_DisambiguateSegmentEdges(1) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/topogeodisambiguate3.testcase Index: test/sql_stmt_rttopo_tests/topogeodisambiguate3.testcase ================================================================== --- test/sql_stmt_rttopo_tests/topogeodisambiguate3.testcase +++ test/sql_stmt_rttopo_tests/topogeodisambiguate3.testcase @@ -0,0 +1,7 @@ +TopoGeo_DisambiguateSegmentEdges - Double Topology +:memory: #use in-memory database +SELECT TopoGeo_DisambiguateSegmentEdges(1.5); +1 # rows (not including the header row) +1 # columns +TopoGeo_DisambiguateSegmentEdges(1.5) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/topogeodisambiguate4.testcase Index: test/sql_stmt_rttopo_tests/topogeodisambiguate4.testcase ================================================================== --- test/sql_stmt_rttopo_tests/topogeodisambiguate4.testcase +++ test/sql_stmt_rttopo_tests/topogeodisambiguate4.testcase @@ -0,0 +1,7 @@ +TopoGeo_DisambiguateSegmentEdges - Blob Topology +:memory: #use in-memory database +SELECT TopoGeo_DisambiguateSegmentEdges(zeroblob(4)); +1 # rows (not including the header row) +1 # columns +TopoGeo_DisambiguateSegmentEdges(zeroblob(4)) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/topogeodisambiguate5.testcase Index: test/sql_stmt_rttopo_tests/topogeodisambiguate5.testcase ================================================================== --- test/sql_stmt_rttopo_tests/topogeodisambiguate5.testcase +++ test/sql_stmt_rttopo_tests/topogeodisambiguate5.testcase @@ -0,0 +1,7 @@ +TopoGeo_DisambiguateSegmentEdges - Text Topology +:memory: #use in-memory database +SELECT TopoGeo_DisambiguateSegmentEdges('topology'); +1 # rows (not including the header row) +1 # columns +TopoGeo_DisambiguateSegmentEdges('topology') +SQL/MM Spatial exception - invalid topology name. ADDED test/sql_stmt_rttopo_tests/toponetdisambiguate1.testcase Index: test/sql_stmt_rttopo_tests/toponetdisambiguate1.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toponetdisambiguate1.testcase +++ test/sql_stmt_rttopo_tests/toponetdisambiguate1.testcase @@ -0,0 +1,7 @@ +TopoNet_DisambiguateSegmentLinks - NULL Network +:memory: #use in-memory database +SELECT TopoNet_DisambiguateSegmentLinks(NULL); +1 # rows (not including the header row) +1 # columns +TopoNet_DisambiguateSegmentLinks(NULL) +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/toponetdisambiguate2.testcase Index: test/sql_stmt_rttopo_tests/toponetdisambiguate2.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toponetdisambiguate2.testcase +++ test/sql_stmt_rttopo_tests/toponetdisambiguate2.testcase @@ -0,0 +1,7 @@ +TopoNet_DisambiguateSegmentLinks - Int Network +:memory: #use in-memory database +SELECT TopoNet_DisambiguateSegmentLinks(1); +1 # rows (not including the header row) +1 # columns +TopoNet_DisambiguateSegmentLinks(1) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/toponetdisambiguate3.testcase Index: test/sql_stmt_rttopo_tests/toponetdisambiguate3.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toponetdisambiguate3.testcase +++ test/sql_stmt_rttopo_tests/toponetdisambiguate3.testcase @@ -0,0 +1,7 @@ +TopoNet_DisambiguateSegmentLinks - Double Network +:memory: #use in-memory database +SELECT TopoNet_DisambiguateSegmentLinks(1.5); +1 # rows (not including the header row) +1 # columns +TopoNet_DisambiguateSegmentLinks(1.5) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/toponetdisambiguate4.testcase Index: test/sql_stmt_rttopo_tests/toponetdisambiguate4.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toponetdisambiguate4.testcase +++ test/sql_stmt_rttopo_tests/toponetdisambiguate4.testcase @@ -0,0 +1,7 @@ +TopoNet_DisambiguateSegmentLinks - Blob Network +:memory: #use in-memory database +SELECT TopoNet_DisambiguateSegmentLinks(zeroblob(4)); +1 # rows (not including the header row) +1 # columns +TopoNet_DisambiguateSegmentLinks(zeroblob(4)) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/toponetdisambiguate5.testcase Index: test/sql_stmt_rttopo_tests/toponetdisambiguate5.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toponetdisambiguate5.testcase +++ test/sql_stmt_rttopo_tests/toponetdisambiguate5.testcase @@ -0,0 +1,7 @@ +TopoNet_DisambiguateSegmentLinks - Text Network +:memory: #use in-memory database +SELECT TopoNet_DisambiguateSegmentLinks('network'); +1 # rows (not including the header row) +1 # columns +TopoNet_DisambiguateSegmentLinks('network') +SQL/MM Spatial exception - invalid network name. Index: test/sql_stmt_rttopo_tests/toposnap1.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap1.testcase +++ test/sql_stmt_rttopo_tests/toposnap1.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - NULL Topology :memory: #use in-memory database -SELECT TopoGeo_TopoSnap(NULL, MakePoint(1, 2, 4326), 1, 1); +SELECT TopoGeo_TopoSnap(NULL, MakePoint(1, 2, 4326), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap(NULL, MakePoint(1, 2, 4326), 1, 1) +TopoGeo_TopoSnap(NULL, MakePoint(1, 2, 4326), 1) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/toposnap10.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap10.testcase +++ test/sql_stmt_rttopo_tests/toposnap10.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - NULL tolerance +TopoGeo_TopoSnap - NULL tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, NULL); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), NULL, 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, NULL) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), NULL, 0.1, 1) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/toposnap11.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap11.testcase +++ test/sql_stmt_rttopo_tests/toposnap11.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - Text tolerance +TopoGeo_TopoSnap - Text tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, 'tolerance'); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 'snap', 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, 'tolerance') +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 'snap', 0.1, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap12.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap12.testcase +++ test/sql_stmt_rttopo_tests/toposnap12.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - BLOB tolerance +TopoGeo_TopoSnap - BLOB tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, zeroblob(12)); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), zeroblob(12), 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, zeroblob(12)) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), zeroblob(12), 0.1, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap13.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap13.testcase +++ test/sql_stmt_rttopo_tests/toposnap13.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - NULL iterate :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), NULL, 1); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), NULL); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), NULL, 1) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), NULL) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/toposnap14.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap14.testcase +++ test/sql_stmt_rttopo_tests/toposnap14.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - Text iterate :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 'iterate', 1); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 'iterate'); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 'iterate', 1) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 'iterate') SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap15.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap15.testcase +++ test/sql_stmt_rttopo_tests/toposnap15.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - DOUBLE iterate :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1.5, 1); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1.5); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1.5, 1) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1.5) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap16.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap16.testcase +++ test/sql_stmt_rttopo_tests/toposnap16.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - BLOB iterate :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), zeroblob(4), 1); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), zeroblob(4)); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), zeroblob(4), 1) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), zeroblob(4)) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap17.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap17.testcase +++ test/sql_stmt_rttopo_tests/toposnap17.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - NULL remove_vertices +TopoGeo_TopoSnap - NULL tolerance_removal :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, NULL); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.1, NULL, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, NULL) -SQL/MM Spatial exception - null argument. +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.1, NULL, 1) +SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/toposnap18.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap18.testcase +++ test/sql_stmt_rttopo_tests/toposnap18.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - DOUBLE remove_vertices +TopoGeo_TopoSnap - Text tolerance_removal :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1.5); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.1, 'tolerance', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1.5) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.1, 'tolerance', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap19.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap19.testcase +++ test/sql_stmt_rttopo_tests/toposnap19.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - BLOB remove_vertices +TopoGeo_TopoSnap - BLOB tolerance_removal :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, zeroblob(4)); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.1, zeroblob(4), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, zeroblob(4)) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.1, zeroblob(4), 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap2.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap2.testcase +++ test/sql_stmt_rttopo_tests/toposnap2.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - Int Topology :memory: #use in-memory database -SELECT TopoGeo_TopoSnap(1, MakePoint(1, 2, 4326), 1, 1); +SELECT TopoGeo_TopoSnap(1, MakePoint(1, 2, 4326), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap(1, MakePoint(1, 2, 4326), 1, 1) +TopoGeo_TopoSnap(1, MakePoint(1, 2, 4326), 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap20.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap20.testcase +++ test/sql_stmt_rttopo_tests/toposnap20.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - non-existing topology :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1) SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/toposnap21.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap21.testcase +++ test/sql_stmt_rttopo_tests/toposnap21.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - TEXT remove_vertices +TopoGeo_TopoSnap - Int NEGATIVE tolerance_removal :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 'remove'); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, -1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 'remove') -SQL/MM Spatial exception - invalid argument. +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, -1, 1) +SQL/MM Spatial exception - illegal negative tolerance. Index: test/sql_stmt_rttopo_tests/toposnap22.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap22.testcase +++ test/sql_stmt_rttopo_tests/toposnap22.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - Double tolerance +TopoGeo_TopoSnap - double NEGATIVE tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, 0.01); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, -0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, 0.01) -SQL/MM Spatial exception - invalid topology name. +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, -0.1, 1) +SQL/MM Spatial exception - illegal negative tolerance. Index: test/sql_stmt_rttopo_tests/toposnap23.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap23.testcase +++ test/sql_stmt_rttopo_tests/toposnap23.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - Int NEGATIVE tolerance +TopoGeo_TopoSnap - Int NEGATIVE tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, -1); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), -1, 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, -1) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), -1, 0.1, 1) SQL/MM Spatial exception - illegal negative tolerance. Index: test/sql_stmt_rttopo_tests/toposnap24.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap24.testcase +++ test/sql_stmt_rttopo_tests/toposnap24.testcase @@ -1,7 +1,7 @@ -TopoGeo_TopoSnap - Double NEGATIVE tolerance +TopoGeo_TopoSnap - Double NEGATIVE tolerance_snap :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, -0.01); +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), -0.01, 0.1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 1, 1, -0.01) +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), -0.01, 0.1, 1) SQL/MM Spatial exception - illegal negative tolerance. ADDED test/sql_stmt_rttopo_tests/toposnap25.testcase Index: test/sql_stmt_rttopo_tests/toposnap25.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap25.testcase +++ test/sql_stmt_rttopo_tests/toposnap25.testcase @@ -0,0 +1,7 @@ +TopoGeo_TopoSnap - long form NULL iterate +:memory: #use in-memory database +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, NULL); +1 # rows (not including the header row) +1 # columns +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, NULL) +SQL/MM Spatial exception - null argument. ADDED test/sql_stmt_rttopo_tests/toposnap26.testcase Index: test/sql_stmt_rttopo_tests/toposnap26.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap26.testcase +++ test/sql_stmt_rttopo_tests/toposnap26.testcase @@ -0,0 +1,7 @@ +TopoGeo_TopoSnap - long form Text iterate +:memory: #use in-memory database +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, 'no'); +1 # rows (not including the header row) +1 # columns +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, 'no') +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/toposnap27.testcase Index: test/sql_stmt_rttopo_tests/toposnap27.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap27.testcase +++ test/sql_stmt_rttopo_tests/toposnap27.testcase @@ -0,0 +1,7 @@ +TopoGeo_TopoSnap - long form Double iterate +:memory: #use in-memory database +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, 0.1); +1 # rows (not including the header row) +1 # columns +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, 0.1) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/toposnap28.testcase Index: test/sql_stmt_rttopo_tests/toposnap28.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap28.testcase +++ test/sql_stmt_rttopo_tests/toposnap28.testcase @@ -0,0 +1,7 @@ +TopoGeo_TopoSnap - long form BLOB iterate +:memory: #use in-memory database +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, zeroblob(4)); +1 # rows (not including the header row) +1 # columns +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, zeroblob(4)) +SQL/MM Spatial exception - invalid argument. ADDED test/sql_stmt_rttopo_tests/toposnap29.testcase Index: test/sql_stmt_rttopo_tests/toposnap29.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap29.testcase +++ test/sql_stmt_rttopo_tests/toposnap29.testcase @@ -0,0 +1,7 @@ +TopoGeo_TopoSnap - long form Int iterate +:memory: #use in-memory database +SELECT TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, 1); +1 # rows (not including the header row) +1 # columns +TopoGeo_TopoSnap('topo', MakePoint(1, 2, 4326), 0.01, 0.1, 1) +SQL/MM Spatial exception - invalid topology name. Index: test/sql_stmt_rttopo_tests/toposnap3.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap3.testcase +++ test/sql_stmt_rttopo_tests/toposnap3.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - Double Topology :memory: #use in-memory database -SELECT TopoGeo_TopoSnap(1.5, MakePoint(1, 2, 4326), 1, 1); +SELECT TopoGeo_TopoSnap(1.5, MakePoint(1, 2, 4326), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap(1.5, MakePoint(1, 2, 4326), 1, 1) +TopoGeo_TopoSnap(1.5, MakePoint(1, 2, 4326), 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap4.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap4.testcase +++ test/sql_stmt_rttopo_tests/toposnap4.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - BLOB Topology :memory: #use in-memory database -SELECT TopoGeo_TopoSnap(zeroblob(10), MakePoint(1, 2, 4326), 1, 1); +SELECT TopoGeo_TopoSnap(zeroblob(10), MakePoint(1, 2, 4326), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap(zeroblob(10), MakePoint(1, 2, 4326), 1, 1) +TopoGeo_TopoSnap(zeroblob(10), MakePoint(1, 2, 4326), 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap5.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap5.testcase +++ test/sql_stmt_rttopo_tests/toposnap5.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - NULL Geometry :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', NULL, 1, 1); +SELECT TopoGeo_TopoSnap('topo', NULL, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', NULL, 1, 1) +TopoGeo_TopoSnap('topo', NULL, 1) SQL/MM Spatial exception - null argument. Index: test/sql_stmt_rttopo_tests/toposnap6.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap6.testcase +++ test/sql_stmt_rttopo_tests/toposnap6.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - Int Geometry :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', 1, 1, 1); +SELECT TopoGeo_TopoSnap('topo', 1, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', 1, 1, 1) +TopoGeo_TopoSnap('topo', 1, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap7.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap7.testcase +++ test/sql_stmt_rttopo_tests/toposnap7.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - Int Geometry :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', 1-5, 1, 1); +SELECT TopoGeo_TopoSnap('topo', 1-5, 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', 1.5, 1, 1) +TopoGeo_TopoSnap('topo', 1.5, 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap8.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap8.testcase +++ test/sql_stmt_rttopo_tests/toposnap8.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - Text Geometry :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', 'geom', 1, 1); +SELECT TopoGeo_TopoSnap('topo', 'geom', 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', 'geom', 1, 1) +TopoGeo_TopoSnap('topo', 'geom', 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_rttopo_tests/toposnap9.testcase ================================================================== --- test/sql_stmt_rttopo_tests/toposnap9.testcase +++ test/sql_stmt_rttopo_tests/toposnap9.testcase @@ -1,7 +1,7 @@ TopoGeo_TopoSnap - Invalid BLOB Geometry :memory: #use in-memory database -SELECT TopoGeo_TopoSnap('topo', zeroblob(100), 1, 1); +SELECT TopoGeo_TopoSnap('topo', zeroblob(100), 1); 1 # rows (not including the header row) 1 # columns -TopoGeo_TopoSnap('topo', zeroblob(100), 1, 1) +TopoGeo_TopoSnap('topo', zeroblob(100), 1) SQL/MM Spatial exception - invalid argument. Index: test/sql_stmt_security_tests/Makefile.am ================================================================== --- test/sql_stmt_security_tests/Makefile.am +++ test/sql_stmt_security_tests/Makefile.am @@ -150,6 +150,18 @@ isXblob1.testcase \ isXblob2.testcase \ isXblob3.testcase \ isXblob4.testcase \ isXblob8.testcase \ - isXblob9.testcase + isXblob9.testcase \ + sp_fromfile1.testcase \ + sp_fromfile2.testcase \ + sp_fromfile3.testcase \ + sp_fromfile4.testcase \ + sp_fromfile5.testcase \ + sp_fromfile6.testcase \ + sp_fromfile7.testcase \ + sp_fromfile8.testcase \ + sp_fromfile9.testcase \ + sp_fromfile10.testcase \ + sp_fromfile11.testcase \ + sp_fromfile12.testcase Index: test/sql_stmt_security_tests/Makefile.in ================================================================== --- test/sql_stmt_security_tests/Makefile.in +++ test/sql_stmt_security_tests/Makefile.in @@ -402,11 +402,23 @@ isXblob1.testcase \ isXblob2.testcase \ isXblob3.testcase \ isXblob4.testcase \ isXblob8.testcase \ - isXblob9.testcase + isXblob9.testcase \ + sp_fromfile1.testcase \ + sp_fromfile2.testcase \ + sp_fromfile3.testcase \ + sp_fromfile4.testcase \ + sp_fromfile5.testcase \ + sp_fromfile6.testcase \ + sp_fromfile7.testcase \ + sp_fromfile8.testcase \ + sp_fromfile9.testcase \ + sp_fromfile10.testcase \ + sp_fromfile11.testcase \ + sp_fromfile12.testcase all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) ADDED test/sql_stmt_security_tests/sp_fromfile1.testcase Index: test/sql_stmt_security_tests/sp_fromfile1.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile1.testcase +++ test/sql_stmt_security_tests/sp_fromfile1.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - NULL filepath +:memory: #use in-memory database +SELECT SqlProc_FromFile(NULL); +1 # rows (not including the header row) +1 # columns +SqlProc_FromFile(NULL) +SqlProc exception - illegal File Path argument. ADDED test/sql_stmt_security_tests/sp_fromfile10.testcase Index: test/sql_stmt_security_tests/sp_fromfile10.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile10.testcase +++ test/sql_stmt_security_tests/sp_fromfile10.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - DOUBLE charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromFile('./sqlproc_sample.txt', zeroblob(10))); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromFile('./sqlproc_sample.txt', zeroblob(10))) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_security_tests/sp_fromfile11.testcase Index: test/sql_stmt_security_tests/sp_fromfile11.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile11.testcase +++ test/sql_stmt_security_tests/sp_fromfile11.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - valid charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromFile('./sqlproc_sample.txt', 'ASCII')); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromFile('./sqlproc_sample.txt', 'ASCII')) +00CD0187030087040087636F6C3187010087040087636F6C32870100870500877461626C658701008723008753454C4543542040636F6C31402C2040636F6C32402046524F4D20407461626C65400ADC ADDED test/sql_stmt_security_tests/sp_fromfile12.testcase Index: test/sql_stmt_security_tests/sp_fromfile12.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile12.testcase +++ test/sql_stmt_security_tests/sp_fromfile12.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - undefined charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromFile('./sqlproc_sample.txt', 'abcdefghi')); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromFile('./sqlproc_sample.txt', 'abcdefghi')) +SqlProc exception - unable to parse the external File. ADDED test/sql_stmt_security_tests/sp_fromfile2.testcase Index: test/sql_stmt_security_tests/sp_fromfile2.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile2.testcase +++ test/sql_stmt_security_tests/sp_fromfile2.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - INT filepath +:memory: #use in-memory database +SELECT SqlProc_FromFile(2); +1 # rows (not including the header row) +1 # columns +SqlProc_FromFile(2) +SqlProc exception - illegal File Path argument. ADDED test/sql_stmt_security_tests/sp_fromfile3.testcase Index: test/sql_stmt_security_tests/sp_fromfile3.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile3.testcase +++ test/sql_stmt_security_tests/sp_fromfile3.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - DOUBLE filepath +:memory: #use in-memory database +SELECT SqlProc_FromFile(2.5); +1 # rows (not including the header row) +1 # columns +SqlProc_FromFile(2.5) +SqlProc exception - illegal File Path argument. ADDED test/sql_stmt_security_tests/sp_fromfile4.testcase Index: test/sql_stmt_security_tests/sp_fromfile4.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile4.testcase +++ test/sql_stmt_security_tests/sp_fromfile4.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - BLOB filepath +:memory: #use in-memory database +SELECT SqlProc_FromFile(zeroblob(10)); +1 # rows (not including the header row) +1 # columns +SqlProc_FromFile(zeroblob(10)) +SqlProc exception - illegal File Path argument. ADDED test/sql_stmt_security_tests/sp_fromfile5.testcase Index: test/sql_stmt_security_tests/sp_fromfile5.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile5.testcase +++ test/sql_stmt_security_tests/sp_fromfile5.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - not existing filepath +:memory: #use in-memory database +SELECT SqlProc_FromFile('not_existing.file'); +1 # rows (not including the header row) +1 # columns +SqlProc_FromFile('not_existing.file') +SqlProc exception - unable to parse the external File. ADDED test/sql_stmt_security_tests/sp_fromfile6.testcase Index: test/sql_stmt_security_tests/sp_fromfile6.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile6.testcase +++ test/sql_stmt_security_tests/sp_fromfile6.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - valid filepath +:memory: #use in-memory database +SELECT Hex(SqlProc_FromFile('./sqlproc_sample.txt')); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromFile('./sqlproc_sample.txt')) +00CD0187030087040087636F6C3187010087040087636F6C32870100870500877461626C658701008723008753454C4543542040636F6C31402C2040636F6C32402046524F4D20407461626C65400ADC ADDED test/sql_stmt_security_tests/sp_fromfile7.testcase Index: test/sql_stmt_security_tests/sp_fromfile7.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile7.testcase +++ test/sql_stmt_security_tests/sp_fromfile7.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - NULL charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromFile('./sqlproc_sample.txt', NULL)); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromFile('./sqlproc_sample.txt', NULL)) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_security_tests/sp_fromfile8.testcase Index: test/sql_stmt_security_tests/sp_fromfile8.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile8.testcase +++ test/sql_stmt_security_tests/sp_fromfile8.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - INT charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromFile('./sqlproc_sample.txt', 1)); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromFile('./sqlproc_sample.txt', 1)) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_security_tests/sp_fromfile9.testcase Index: test/sql_stmt_security_tests/sp_fromfile9.testcase ================================================================== --- test/sql_stmt_security_tests/sp_fromfile9.testcase +++ test/sql_stmt_security_tests/sp_fromfile9.testcase @@ -0,0 +1,7 @@ +SqlProc_FromFile - DOUBLE charset +:memory: #use in-memory database +SELECT Hex(SqlProc_FromFile('./sqlproc_sample.txt', 1.5)); +1 # rows (not including the header row) +1 # columns +Hex(SqlProc_FromFile('./sqlproc_sample.txt', 1.5)) +SqlProc exception - illegal Charset Encodind argument. ADDED test/sql_stmt_tests/Makefile Index: test/sql_stmt_tests/Makefile ================================================================== --- test/sql_stmt_tests/Makefile +++ test/sql_stmt_tests/Makefile @@ -0,0 +1,3285 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# test/sql_stmt_tests/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/libspatialite +pkgincludedir = $(includedir)/libspatialite +pkglibdir = $(libdir)/libspatialite +pkglibexecdir = $(libexecdir)/libspatialite +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +subdir = test/sql_stmt_tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_$(V)) +am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY)) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = aclocal-1.15 +AMTAR = $${TAR-tar} +AM_DEFAULT_VERBOSITY = 1 +AR = ar +AS = as +AUTOCONF = autoconf +AUTOHEADER = autoheader +AUTOMAKE = automake-1.15 +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 +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DLLTOOL = dlltool +DSYMUTIL = +DUMPBIN = +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /usr/bin/grep -E +EXEEXT = +FGREP = /usr/bin/grep -F +GEOSCONFIG = /usr/bin/geos-config +GEOS_CFLAGS = -I/usr/include +GEOS_LDFLAGS = -L/usr/lib64 +GREP = /usr/bin/grep +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = $(install_sh) -c -s +LD = /usr/bin/ld -m elf_x86_64 +LDFLAGS = +LIBOBJS = +LIBS = -lrttopo -lfreexl -lproj -lsqlite3 -lz -lsqlite3 -L/usr/lib64 -lgeos_c +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LIBXML2_CFLAGS = -I/usr/include/libxml2 +LIBXML2_LIBS = -lxml2 +LIPO = +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAKEINFO = makeinfo +MANIFEST_TOOL = : +MKDIR_P = /usr/bin/mkdir -p +NM = /usr/bin/nm -B +NMEDIT = +OBJDUMP = objdump +OBJEXT = o +OTOOL = +OTOOL64 = +PACKAGE = libspatialite +PACKAGE_BUGREPORT = a.furieri@lqt.it +PACKAGE_NAME = libspatialite +PACKAGE_STRING = libspatialite 5.0.0-devel +PACKAGE_TARNAME = libspatialite +PACKAGE_URL = +PACKAGE_VERSION = 5.0.0-devel +PATH_SEPARATOR = : +PKG_CONFIG = /usr/bin/pkg-config +PKG_CONFIG_LIBDIR = +PKG_CONFIG_PATH = +RANLIB = ranlib +SED = /usr/bin/sed +SET_MAKE = +SHELL = /bin/sh +STRIP = strip +VERSION = 5.0.0-devel +abs_builddir = /home/sandro/fossil/libspatialite/test/sql_stmt_tests +abs_srcdir = /home/sandro/fossil/libspatialite/test/sql_stmt_tests +abs_top_builddir = /home/sandro/fossil/libspatialite +abs_top_srcdir = /home/sandro/fossil/libspatialite +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_DUMPBIN = +am__include = include +am__leading_dot = . +am__quote = +am__tar = $${TAR-tar} chof - "$$tardir" +am__untar = $${TAR-tar} xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +builddir = . +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dvidir = ${docdir} +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = ${SHELL} /home/sandro/fossil/libspatialite/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = $(MKDIR_P) +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +srcdir = . +sysconfdir = ${prefix}/etc +target_alias = +top_build_prefix = ../../ +top_builddir = ../.. +top_srcdir = ../.. +EXTRA_DIST = addpoint10.testcase \ + addpoint11.testcase \ + addpoint12.testcase \ + addpoint13.testcase \ + addpoint14.testcase \ + addpoint15.testcase \ + addpoint16.testcase \ + addpoint17.testcase \ + addpoint18.testcase \ + addpoint19.testcase \ + addpoint1.testcase \ + addpoint20.testcase \ + addpoint21.testcase \ + addpoint22.testcase \ + addpoint23.testcase \ + addpoint24.testcase \ + addpoint25.testcase \ + addpoint26.testcase \ + addpoint27.testcase \ + addpoint28.testcase \ + addpoint2.testcase \ + addpoint3.testcase \ + addpoint4.testcase \ + addpoint5.testcase \ + addpoint6.testcase \ + addpoint7.testcase \ + addpoint8.testcase \ + addpoint9.testcase \ + addmeasure1.testcase \ + addmeasure2.testcase \ + addmeasure3.testcase \ + addmeasure4.testcase \ + addmeasure5.testcase \ + addmeasure6.testcase \ + addmeasure7.testcase \ + addmeasure8.testcase \ + addmeasure9.testcase \ + addmeasure10.testcase \ + addmeasure11.testcase \ + addmeasure12.testcase \ + addmeasure13.testcase \ + addmeasure14.testcase \ + addmeasure15.testcase \ + asbinary10.testcase \ + asbinary11.testcase \ + asbinary12.testcase \ + asbinary13.testcase \ + asbinary14.testcase \ + asbinary15.testcase \ + asbinary16.testcase \ + asbinary17.testcase \ + asbinary1.testcase \ + asbinary2.testcase \ + asbinary3.testcase \ + asbinary4.testcase \ + asbinary5.testcase \ + asbinary6.testcase \ + asbinary7.testcase \ + asbinary8.testcase \ + asbinary9.testcase \ + asewkb10.testcase \ + asewkb11.testcase \ + asewkb12.testcase \ + asewkb13.testcase \ + asewkb14.testcase \ + asewkb15.testcase \ + asewkb16.testcase \ + asewkb17.testcase \ + asewkb1.testcase \ + asewkb2.testcase \ + asewkb3.testcase \ + asewkb4.testcase \ + asewkb5.testcase \ + asewkb6.testcase \ + asewkb7.testcase \ + asewkb8.testcase \ + asewkb9.testcase \ + asfgf1.testcase \ + asfgf2.testcase \ + asfgf3.testcase \ + asfgf4.testcase \ + asfgf5.testcase \ + asfgf6.testcase \ + asfgf7.testcase \ + asfgf8.testcase \ + asfgf9.testcase \ + asgeojson1.testcase \ + asgeojson2.testcase \ + asgeojson3.testcase \ + asgeojson4.testcase \ + asgeojson5.testcase \ + asgeojson6.testcase \ + asgeojson7.testcase \ + asgeojson8.testcase \ + asgml10.testcase \ + asgml11.testcase \ + asgml1.testcase \ + asgml2.testcase \ + asgml3.testcase \ + asgml4.testcase \ + asgml5.testcase \ + asgml6.testcase \ + asgml7.testcase \ + asgml8.testcase \ + asgml9.testcase \ + assvg17.testcase \ + assvg18.testcase \ + assvg19.testcase \ + assvg1.testcase \ + assvg20.testcase \ + assvg21.testcase \ + assvg22.testcase \ + assvg23.testcase \ + assvg24.testcase \ + assvg25.testcase \ + assvg26.testcase \ + assvg2.testcase \ + assvg3.testcase \ + assvg4.testcase \ + assvg5.testcase \ + assvg6.testcase \ + assvg7.testcase \ + assvg8.testcase \ + assvg9.testcase \ + aswkt-text.testcase \ + atmastext1.testcase \ + atmastext2.testcase \ + atmastext3.testcase \ + atmastext4.testcase \ + atmastext5.testcase \ + atmastext6.testcase \ + atmcreate1.testcase \ + atmcreate2.testcase \ + atmcreate3.testcase \ + atmcreate4.testcase \ + atmcreate5.testcase \ + atmcreate6.testcase \ + atmcreate7.testcase \ + atmcreate8.testcase \ + atmcreate9.testcase \ + atmcreate10.testcase \ + atmcreate11.testcase \ + atmcreate12.testcase \ + atmcreate13.testcase \ + atmcreate14.testcase \ + atmcreate15.testcase \ + atmcreate16.testcase \ + atmcreate17.testcase \ + atmcreate18.testcase \ + atmcreate19.testcase \ + atmcreate20.testcase \ + atmcreate21.testcase \ + atmcreate22.testcase \ + atmcreate23.testcase \ + atmcreatescale1.testcase \ + atmcreatescale2.testcase \ + atmcreatescale3.testcase \ + atmcreatescale4.testcase \ + atmcreatescale5.testcase \ + atmcreatescale6.testcase \ + atmcreatescale7.testcase \ + atmcreatescale8.testcase \ + atmcreatescale9.testcase \ + atmcreatetrans1.testcase \ + atmcreatetrans2.testcase \ + atmcreatetrans3.testcase \ + atmcreatetrans4.testcase \ + atmcreatetrans5.testcase \ + atmcreatetrans6.testcase \ + atmcreatetrans7.testcase \ + atmcreatetrans8.testcase \ + atmcreatetrans9.testcase \ + atmcreatexroll1.testcase \ + atmcreatexroll2.testcase \ + atmcreatexroll3.testcase \ + atmcreateyroll1.testcase \ + atmcreateyroll2.testcase \ + atmcreateyroll3.testcase \ + atmcreatezroll1.testcase \ + atmcreatezroll2.testcase \ + atmcreatezroll3.testcase \ + atmdeterminant1.testcase \ + atmdeterminant2.testcase \ + atmdeterminant3.testcase \ + atmdeterminant4.testcase \ + atminvert1.testcase \ + atminvert2.testcase \ + atminvert3.testcase \ + atminvert4.testcase \ + atmisinvert1.testcase \ + atmisinvert2.testcase \ + atmisinvert3.testcase \ + atmisinvert4.testcase \ + atmisvalid1.testcase \ + atmisvalid2.testcase \ + atmisvalid3.testcase \ + atmisvalid4.testcase \ + atmisvalid5.testcase \ + atmisvalid6.testcase \ + atmmultiply1.testcase \ + atmmultiply2.testcase \ + atmmultiply3.testcase \ + atmmultiply4.testcase \ + atmmultiply5.testcase \ + atmscale1.testcase \ + atmscale2.testcase \ + atmscale3.testcase \ + atmscale4.testcase \ + atmscale5.testcase \ + atmscale6.testcase \ + atmscale7.testcase \ + atmscale8.testcase \ + atmscale9.testcase \ + atmscale10.testcase \ + atmscale11.testcase \ + atmscale12.testcase \ + atmscale13.testcase \ + atmtrans1.testcase \ + atmtrans2.testcase \ + atmtrans3.testcase \ + atmtrans4.testcase \ + atmtrans5.testcase \ + atmtrans6.testcase \ + atmtrans7.testcase \ + atmtrans8.testcase \ + atmtrans9.testcase \ + atmtrans10.testcase \ + atmtrans11.testcase \ + atmtrans12.testcase \ + atmtrans13.testcase \ + atmtransform1.testcase \ + atmtransform2.testcase \ + atmtransform3.testcase \ + atmtransform4.testcase \ + atmtransform5.testcase \ + atmtransform6.testcase \ + atmtransform7.testcase \ + atmtransform8.testcase \ + atmxroll1.testcase \ + atmxroll2.testcase \ + atmxroll3.testcase \ + atmxroll4.testcase \ + atmxroll5.testcase \ + atmyroll1.testcase \ + atmyroll2.testcase \ + atmyroll3.testcase \ + atmyroll4.testcase \ + atmyroll5.testcase \ + atmzroll1.testcase \ + atmzroll2.testcase \ + atmzroll3.testcase \ + atmzroll4.testcase \ + atmzroll5.testcase \ + badEWKT1.testcase \ + badEWKT2.testcase \ + badEWKT3.testcase \ + badEWKT4.testcase \ + badEWKT5.testcase \ + badEWKT6.testcase \ + badEWKT7.testcase \ + badEWKT8.testcase \ + badGeoJSON1.testcase \ + badGeoJSON2.testcase \ + badGeoJSON3.testcase \ + badGeoJSON4.testcase \ + badGeoJSON5.testcase \ + badGeoJSON6.testcase \ + badGeoJSON7.testcase \ + badGML1.testcase \ + badGML2.testcase \ + badGML3.testcase \ + badGML4.testcase \ + badGML5.testcase \ + badGML6.testcase \ + badGML7.testcase \ + badKML1.testcase \ + badKML2.testcase \ + badKML3.testcase \ + badKML4.testcase \ + badKML5.testcase \ + badKML6.testcase \ + badKML7.testcase \ + badwkt1.testcase \ + badwkt2.testcase \ + badwkt3.testcase \ + badwkt4.testcase \ + badwkt5.testcase \ + badwkt6.testcase \ + badwkt7.testcase \ + badwkt8.testcase \ + badwkt9.testcase \ + buildcirclembr10.testcase \ + buildcirclembr11.testcase \ + buildcirclembr12.testcase \ + buildcirclembr1.testcase \ + buildcirclembr2.testcase \ + buildcirclembr3.testcase \ + buildcirclembr4.testcase \ + buildcirclembr5.testcase \ + buildcirclembr6.testcase \ + buildcirclembr7.testcase \ + buildcirclembr8.testcase \ + buildcirclembr9.testcase \ + buildmbr10.testcase \ + buildmbr11.testcase \ + buildmbr12.testcase \ + buildmbr13.testcase \ + buildmbr14.testcase \ + buildmbr1.testcase \ + buildmbr2.testcase \ + buildmbr3.testcase \ + buildmbr4.testcase \ + buildmbr5.testcase \ + buildmbr6.testcase \ + buildmbr7.testcase \ + buildmbr8.testcase \ + buildmbr9.testcase \ + casttoblob10.testcase \ + casttoblob12.testcase \ + casttoblob13.testcase \ + casttoblob14.testcase \ + casttoblob1.testcase \ + casttoblob2.testcase \ + casttoblob3.testcase \ + casttoblob4.testcase \ + casttoblob5.testcase \ + casttoblob6.testcase \ + casttoblob7.testcase \ + casttoblob8.testcase \ + casttoblob9.testcase \ + casttodouble1.testcase \ + casttodouble2.testcase \ + casttodouble3.testcase \ + casttodouble4.testcase \ + casttodouble5.testcase \ + casttodouble6.testcase \ + casttodouble7.testcase \ + casttogeometrycollection2.testcase \ + casttogeometrycollection3.testcase \ + casttogeometrycollection4.testcase \ + casttogeometrycollection5.testcase \ + casttogeometrycollection6.testcase \ + casttogeometrycollection.testcase \ + casttoint1.testcase \ + casttoint2.testcase \ + casttoint3.testcase \ + casttoint4.testcase \ + casttoint5.testcase \ + casttoint6.testcase \ + casttoint7.testcase \ + casttolinestring1.testcase \ + casttolinestring2.testcase \ + casttolinestring3.testcase \ + casttolinestring4.testcase \ + casttolinestring5.testcase \ + casttolinestring6.testcase \ + casttolinestring7.testcase \ + casttolinestring8.testcase \ + casttomulti11.testcase \ + casttomulti1.testcase \ + casttomulti2.testcase \ + casttomulti3.testcase \ + casttomulti4.testcase \ + casttomulti5.testcase \ + casttomulti6.testcase \ + casttomulti7.testcase \ + casttomulti8.testcase \ + casttomultilinestring1.testcase \ + casttomultilinestring2.testcase \ + casttomultilinestring3.testcase \ + casttomultilinestring4.testcase \ + casttomultilinestring5.testcase \ + casttomultilinestring6.testcase \ + casttomultilinestring7.testcase \ + casttomultipoint1.testcase \ + casttomultipoint2.testcase \ + casttomultipoint3.testcase \ + casttomultipoint4.testcase \ + casttomultipoint5.testcase \ + casttomultipoint6.testcase \ + casttomultipoint7.testcase \ + casttomultipoint8.testcase \ + casttomultipoint9.testcase \ + casttomultipolygon1.testcase \ + casttomultipolygon2.testcase \ + casttomultipolygon3.testcase \ + casttomultipolygon4.testcase \ + casttomultipolygon5.testcase \ + casttopoint1.testcase \ + casttopoint2.testcase \ + casttopoint3.testcase \ + casttopoint4.testcase \ + casttopoint5.testcase \ + casttopoint6.testcase \ + casttopoint7.testcase \ + casttopoint8.testcase \ + casttopoly1.testcase \ + casttopoly2.testcase \ + casttopoly3.testcase \ + casttopoly4.testcase \ + casttopoly5.testcase \ + casttopoly6.testcase \ + casttopoly7.testcase \ + casttopoly8.testcase \ + casttosingle10.testcase \ + casttosingle12.testcase \ + casttosingle1.testcase \ + casttosingle2.testcase \ + casttosingle3.testcase \ + casttosingle4.testcase \ + casttosingle5.testcase \ + casttosingle6.testcase \ + casttosingle7.testcase \ + casttosingle8.testcase \ + casttosingle9.testcase \ + casttotext10.testcase \ + casttotext11.testcase \ + casttotext12.testcase \ + casttotext13.testcase \ + casttotext14.testcase \ + casttotext15.testcase \ + casttotext1.testcase \ + casttotext2.testcase \ + casttotext3.testcase \ + casttotext4.testcase \ + casttotext5.testcase \ + casttotext6.testcase \ + casttotext7.testcase \ + casttotext8.testcase \ + casttotext9.testcase \ + casttoxy1.testcase \ + casttoxy2.testcase \ + casttoxy3.testcase \ + casttoxym1.testcase \ + casttoxym2.testcase \ + casttoxym3.testcase \ + casttoxym4.testcase \ + casttoxym5.testcase \ + casttoxym6.testcase \ + casttoxyz1.testcase \ + casttoxyz2.testcase \ + casttoxyz3.testcase \ + casttoxyz4.testcase \ + casttoxyz5.testcase \ + casttoxyz6.testcase \ + casttoxyzm1.testcase \ + casttoxyzm2.testcase \ + casttoxyzm3.testcase \ + casttoxyzm4.testcase \ + casttoxyzm5.testcase \ + casttoxyzm6.testcase \ + checkdupl1.testcase \ + checkdupl2.testcase \ + checkspatialmetadata1.testcase \ + checkspatialmetadata2.testcase \ + checkspatialmetadata3.testcase \ + checkspatialmetadata4.testcase \ + checkspatialmetadata5.testcase \ + checkspatialmetadata6.testcase \ + checkspatialmetadata7.testcase \ + checkspatialmetadata8.testcase \ + clonetable1.testcase \ + clonetable2.testcase \ + clonetable3.testcase \ + clonetable4.testcase \ + clonetable5.testcase \ + clonetable6.testcase \ + clonetable7.testcase \ + clonetable8.testcase \ + clonetable9.testcase \ + clonetable10.testcase \ + clonetable11.testcase \ + clonetable12.testcase \ + clonetable13.testcase \ + clonetable14.testcase \ + clonetable15.testcase \ + createclonetable1.testcase \ + createclonetable2.testcase \ + createclonetable3.testcase \ + createclonetable4.testcase \ + createclonetable5.testcase \ + createclonetable6.testcase \ + createclonetable7.testcase \ + createclonetable8.testcase \ + createclonetable9.testcase \ + createclonetable10.testcase \ + createclonetable11.testcase \ + createclonetable12.testcase \ + createclonetable13.testcase \ + createclonetable14.testcase \ + createclonetable15.testcase \ + ch_m.testcase \ + cm_m.testcase \ + collect10.testcase \ + collect11.testcase \ + collect12.testcase \ + collect13.testcase \ + collect14.testcase \ + collect15.testcase \ + collect16.testcase \ + collect17.testcase \ + collect18.testcase \ + collect19.testcase \ + collect1.testcase \ + collect20.testcase \ + collect21.testcase \ + collect23.testcase \ + collect24.testcase \ + collect25.testcase \ + collect26.testcase \ + collect27.testcase \ + collect28.testcase \ + collect29.testcase \ + collect2.testcase \ + collect30.testcase \ + collect31.testcase \ + collect32.testcase \ + collect33.testcase \ + collect34.testcase \ + collect35.testcase \ + collect36.testcase \ + collect37.testcase \ + collect38.testcase \ + collect39.testcase \ + collect3.testcase \ + collect40.testcase \ + collect41.testcase \ + collect42.testcase \ + collect43.testcase \ + collect44.testcase \ + collect45.testcase \ + collect46.testcase \ + collect47.testcase \ + collect48.testcase \ + collect49.testcase \ + collect4.testcase \ + collect50.testcase \ + collect51.testcase \ + collect52.testcase \ + collect53.testcase \ + collect54.testcase \ + collect55.testcase \ + collect56.testcase \ + collect57.testcase \ + collect58.testcase \ + collect59.testcase \ + collect5.testcase \ + collect6.testcase \ + collect7.testcase \ + collect8.testcase \ + collect9.testcase \ + collectextract10.testcase \ + collectextract11.testcase \ + collectextract12.testcase \ + collectextract13.testcase \ + collectextract14.testcase \ + collectextract15.testcase \ + collectextract16.testcase \ + collectextract17.testcase \ + collectextract18.testcase \ + collectextract19.testcase \ + collectextract1.testcase \ + collectextract20.testcase \ + collectextract21.testcase \ + collectextract22.testcase \ + collectextract23.testcase \ + collectextract24.testcase \ + collectextract25.testcase \ + collectextract2.testcase \ + collectextract3.testcase \ + collectextract4.testcase \ + collectextract5.testcase \ + collectextract6.testcase \ + collectextract7.testcase \ + collectextract8.testcase \ + collectextract9.testcase \ + compressgeometry10.testcase \ + compressgeometry11.testcase \ + compressgeometry12.testcase \ + compressgeometry13.testcase \ + compressgeometry14.testcase \ + compressgeometry15.testcase \ + compressgeometry17.testcase \ + compressgeometry18.testcase \ + compressgeometry19.testcase \ + compressgeometry1.testcase \ + compressgeometry20.testcase \ + compressgeometry21.testcase \ + compressgeometry22.testcase \ + compressgeometry23.testcase \ + compressgeometry24.testcase \ + compressgeometry25.testcase \ + compressgeometry26.testcase \ + compressgeometry27.testcase \ + compressgeometry28.testcase \ + compressgeometry29.testcase \ + compressgeometry2.testcase \ + compressgeometry30.testcase \ + compressgeometry31.testcase \ + compressgeometry32.testcase \ + compressgeometry33.testcase \ + compressgeometry34.testcase \ + compressgeometry35.testcase \ + compressgeometry36.testcase \ + compressgeometry37.testcase \ + compressgeometry38.testcase \ + compressgeometry39.testcase \ + compressgeometry3.testcase \ + compressgeometry40.testcase \ + compressgeometry41.testcase \ + compressgeometry42.testcase \ + compressgeometry43.testcase \ + compressgeometry44.testcase \ + compressgeometry45.testcase \ + compressgeometry46.testcase \ + compressgeometry47.testcase \ + compressgeometry48.testcase \ + compressgeometry49.testcase \ + compressgeometry4.testcase \ + compressgeometry50.testcase \ + compressgeometry51.testcase \ + compressgeometry52.testcase \ + compressgeometry53.testcase \ + compressgeometry54.testcase \ + compressgeometry55.testcase \ + compressgeometry56.testcase \ + compressgeometry57.testcase \ + compressgeometry58.testcase \ + compressgeometry59.testcase \ + compressgeometry5.testcase \ + compressgeometry60.testcase \ + compressgeometry61.testcase \ + compressgeometry62.testcase \ + compressgeometry63.testcase \ + compressgeometry64.testcase \ + compressgeometry65.testcase \ + compressgeometry66.testcase \ + compressgeometry67.testcase \ + compressgeometry68.testcase \ + compressgeometry69.testcase \ + compressgeometry6.testcase \ + compressgeometry7.testcase \ + compressgeometry8.testcase \ + compressgeometry9.testcase \ + createrastercoverages.testcase \ + createuuid1.testcase \ + datalic_register1.testcase \ + datalic_register2.testcase \ + datalic_register3.testcase \ + datalic_register4.testcase \ + datalic_register5.testcase \ + datalic_register6.testcase \ + datalic_register7.testcase \ + datalic_register8.testcase \ + datalic_register9.testcase \ + datalic_register10.testcase \ + datalic_rename1.testcase \ + datalic_rename2.testcase \ + datalic_rename3.testcase \ + datalic_rename4.testcase \ + datalic_rename5.testcase \ + datalic_rename6.testcase \ + datalic_rename7.testcase \ + datalic_rename8.testcase \ + datalic_rename9.testcase \ + datalic_seturl1.testcase \ + datalic_seturl2.testcase \ + datalic_seturl3.testcase \ + datalic_seturl4.testcase \ + datalic_seturl5.testcase \ + datalic_seturl6.testcase \ + datalic_seturl7.testcase \ + datalic_seturl8.testcase \ + datalic_seturl9.testcase \ + datalic_unregister1.testcase \ + datalic_unregister2.testcase \ + datalic_unregister3.testcase \ + datalic_unregister4.testcase \ + datalic_unregister5.testcase \ + dirfrompath1.testcase \ + dirfrompath2.testcase \ + dirfrompath3.testcase \ + dirfrompath4.testcase \ + dirfrompath5.testcase \ + dimension1.testcase \ + dimension2.testcase \ + dimension3.testcase \ + dimension4.testcase \ + dimension5.testcase \ + dimension6.testcase \ + dimension7.testcase \ + dimension8.testcase \ + dissolve10.testcase \ + dissolve11.testcase \ + dissolve12.testcase \ + dissolve13.testcase \ + dissolve14.testcase \ + dissolve15.testcase \ + dissolve16.testcase \ + dissolve17.testcase \ + dissolve18.testcase \ + dissolve19.testcase \ + dissolve1.testcase \ + dissolve20.testcase \ + dissolve21.testcase \ + dissolve22.testcase \ + dissolve23.testcase \ + dissolve24.testcase \ + dissolve25.testcase \ + dissolve26.testcase \ + dissolve27.testcase \ + dissolve28.testcase \ + dissolve29.testcase \ + dissolve2.testcase \ + dissolve30.testcase \ + dissolve3.testcase \ + dissolve4.testcase \ + dissolve5.testcase \ + dissolve6.testcase \ + dissolve7.testcase \ + dissolve8.testcase \ + dissolve9.testcase \ + dm_m.testcase \ + DSC_1467.JPG \ + DSCN0042.JPG \ + dropgeo1.testcase \ + dropgeo2.testcase \ + dropgeo3.testcase \ + dropgeo4.testcase \ + dropgeo5.testcase \ + dropgeo6.testcase \ + dropgeo7.testcase \ + dropgeo8.testcase \ + dropgeo9.testcase \ + elemgeo1.testcase \ + elemgeo2.testcase \ + elemgeo3.testcase \ + elemgeo4.testcase \ + elemgeo5.testcase \ + elemgeo6.testcase \ + elemgeo7.testcase \ + elemgeo8.testcase \ + elemgeo9.testcase \ + elemgeo10.testcase \ + elemgeo11.testcase \ + elemgeo12.testcase \ + elemgeo13.testcase \ + elemgeo14.testcase \ + elemgeo15.testcase \ + elemgeo16.testcase \ + elemgeo17.testcase \ + elemgeo18.testcase \ + elemgeo19.testcase \ + emptyfile.txt \ + endpoint1.testcase \ + ensureclosedrings1.testcase \ + ensureclosedrings2.testcase \ + ensureclosedrings3.testcase \ + ensureclosedrings4.testcase \ + ensureclosedrings5.testcase \ + ensureclosedrings6.testcase \ + ensureclosedrings7.testcase \ + ensureclosedrings8.testcase \ + ensureclosedrings9.testcase \ + ensureclosedrings10.testcase \ + envelope1.testcase \ + envelope2.testcase \ + envelope3.testcase \ + envelope4.testcase \ + envelope5.testcase \ + envelope6.testcase \ + envelope7.testcase \ + envintersects10.testcase \ + envintersects1.testcase \ + envintersects2.testcase \ + envintersects3.testcase \ + envintersects4.testcase \ + envintersects5.testcase \ + envintersects6.testcase \ + envintersects7.testcase \ + envintersects8.testcase \ + envintersects9.testcase \ + ewkb10.testcase \ + ewkb11.testcase \ + ewkb12.testcase \ + ewkb1.testcase \ + ewkb2.testcase \ + ewkb3.testcase \ + ewkb4.testcase \ + ewkb5.testcase \ + ewkb6.testcase \ + ewkb7.testcase \ + ewkb8.testcase \ + ewkb9.testcase \ + expand1.testcase \ + expand2.testcase \ + expand3.testcase \ + expand4.testcase \ + expand5.testcase \ + expand6.testcase \ + expand7.testcase \ + extfrompath1.testcase \ + extfrompath2.testcase \ + extfrompath3.testcase \ + extfrompath4.testcase \ + extfrompath5.testcase \ + extent1.testcase \ + extractmultilinestring1.testcase \ + extractmultilinestring2.testcase \ + extractmultilinestring3.testcase \ + extractmultipoint1.testcase \ + extractmultipoint2.testcase \ + extractmultipoint3.testcase \ + extractmultipolygon1.testcase \ + extractmultipolygon2.testcase \ + extractmultipolygon3.testcase \ + fath_m.testcase \ + fdo_ogr1.testcase \ + fdo_ogr2.testcase \ + fdo_ogr3.testcase \ + fdo_ogr4.testcase \ + fdo_ogr5.testcase \ + fdo_ogr6.testcase \ + fdo_ogr7.testcase \ + fdo_ogr8.testcase \ + fdo-wkb.sqlite_RO \ + forcenull10.testcase \ + forcenull11.testcase \ + forcenull12.testcase \ + forcenull13.testcase \ + forcenull14.testcase \ + forcenull15.testcase \ + forcenull16.testcase \ + forcenull17.testcase \ + forcenull18.testcase \ + forcenull19.testcase \ + forcenull1.testcase \ + forcenull20.testcase \ + forcenull21.testcase \ + forcenull22.testcase \ + forcenull23.testcase \ + forcenull24.testcase \ + forcenull25.testcase \ + forcenull26.testcase \ + forcenull27.testcase \ + forcenull28.testcase \ + forcenull2.testcase \ + forcenull3.testcase \ + forcenull4.testcase \ + forcenull5.testcase \ + forcenull6.testcase \ + forcenull7.testcase \ + forcenull8.testcase \ + forcenull9.testcase \ + fromewkt10.testcase \ + fromewkt11.testcase \ + fromewkt12.testcase \ + fromewkt13.testcase \ + fromewkt14.testcase \ + fromewkt15.testcase \ + fromewkt16.testcase \ + fromewkt17.testcase \ + fromewkt18.testcase \ + fromewkt19.testcase \ + fromewkt1.testcase \ + fromewkt20.testcase \ + fromewkt22.testcase \ + fromewkt23.testcase \ + fromewkt24.testcase \ + fromewkt25.testcase \ + fromewkt26.testcase \ + fromewkt27.testcase \ + fromewkt28.testcase \ + fromewkt29.testcase \ + fromewkt2.testcase \ + fromewkt30.testcase \ + fromewkt31.testcase \ + fromewkt32.testcase \ + fromewkt33.testcase \ + fromewkt34.testcase \ + fromewkt35.testcase \ + fromewkt36.testcase \ + fromewkt37.testcase \ + fromewkt38.testcase \ + fromewkt39.testcase \ + fromewkt3.testcase \ + fromewkt4.testcase \ + fromewkt5.testcase \ + fromewkt6.testcase \ + fromewkt7.testcase \ + fromewkt8.testcase \ + fromewkt9.testcase \ + fromgeojson10.testcase \ + fromgeojson11.testcase \ + fromgeojson12.testcase \ + fromgeojson13.testcase \ + fromgeojson14.testcase \ + fromgeojson15.testcase \ + fromgeojson16.testcase \ + fromgeojson17.testcase \ + fromgeojson18.testcase \ + fromgeojson19.testcase \ + fromgeojson1.testcase \ + fromgeojson20.testcase \ + fromgeojson21.testcase \ + fromgeojson22.testcase \ + fromgeojson23.testcase \ + fromgeojson24.testcase \ + fromgeojson25.testcase \ + fromgeojson26.testcase \ + fromgeojson27.testcase \ + fromgeojson28.testcase \ + fromgeojson29.testcase \ + fromgeojson2.testcase \ + fromgeojson30.testcase \ + fromgeojson31.testcase \ + fromgeojson32.testcase \ + fromgeojson3.testcase \ + fromgeojson4.testcase \ + fromgeojson5.testcase \ + fromgeojson6.testcase \ + fromgeojson7.testcase \ + fromgeojson8.testcase \ + fromgeojson9.testcase \ + fromgeojsonmix1.testcase \ + fromgeojsonmix2.testcase \ + fromgeojsonmix3.testcase \ + fromgeojsonmix4.testcase \ + fromgeojsonmix5.testcase \ + fromgeojsonmix6.testcase \ + fromgeojsonmix7.testcase \ + fromgeojsonmix8.testcase \ + fromgeojsonmix9.testcase \ + fromgeojsonpt10.testcase \ + fromgeojsonpt11.testcase \ + fromgeojsonpt12.testcase \ + fromgeojsonpt13.testcase \ + fromgeojsonpt14.testcase \ + fromgeojsonpt15.testcase \ + fromgeojsonpt16.testcase \ + fromgeojsonpt17.testcase \ + fromgeojsonpt18.testcase \ + fromgeojsonpt19.testcase \ + fromgeojsonpt1.testcase \ + fromgeojsonpt20.testcase \ + fromgeojsonpt21.testcase \ + fromgeojsonpt22.testcase \ + fromgeojsonpt23.testcase \ + fromgeojsonpt24.testcase \ + fromgeojsonpt25.testcase \ + fromgeojsonpt26.testcase \ + fromgeojsonpt27.testcase \ + fromgeojsonpt28.testcase \ + fromgeojsonpt29.testcase \ + fromgeojsonpt2.testcase \ + fromgeojsonpt30.testcase \ + fromgeojsonpt31.testcase \ + fromgeojsonpt32.testcase \ + fromgeojsonpt33.testcase \ + fromgeojsonpt34.testcase \ + fromgeojsonpt35.testcase \ + fromgeojsonpt36.testcase \ + fromgeojsonpt37.testcase \ + fromgeojsonpt38.testcase \ + fromgeojsonpt3.testcase \ + fromgeojsonpt4.testcase \ + fromgeojsonpt5.testcase \ + fromgeojsonpt6.testcase \ + fromgeojsonpt7.testcase \ + fromgeojsonpt8.testcase \ + fromgeojsonpt9.testcase \ + fromgml10.testcase \ + fromgml11.testcase \ + fromgml12.testcase \ + fromgml13.testcase \ + fromgml14.testcase \ + fromgml15.testcase \ + fromgml16.testcase \ + fromgml17.testcase \ + fromgml18.testcase \ + fromgml19.testcase \ + fromgml1.testcase \ + fromgml20.testcase \ + fromgml21.testcase \ + fromgml22.testcase \ + fromgml23.testcase \ + fromgml24.testcase \ + fromgml25.testcase \ + fromgml26.testcase \ + fromgml27.testcase \ + fromgml28.testcase \ + fromgml29.testcase \ + fromgml2.testcase \ + fromgml30.testcase \ + fromgml31.testcase \ + fromgml32.testcase \ + fromgml33.testcase \ + fromgml34.testcase \ + fromgml35.testcase \ + fromgml36.testcase \ + fromgml37.testcase \ + fromgml38.testcase \ + fromgml39.testcase \ + fromgml3.testcase \ + fromgml40.testcase \ + fromgml41.testcase \ + fromgml43.testcase \ + fromgml44.testcase \ + fromgml45.testcase \ + fromgml46.testcase \ + fromgml47.testcase \ + fromgml48.testcase \ + fromgml49.testcase \ + fromgml4.testcase \ + fromgml50.testcase \ + fromgml51.testcase \ + fromgml52.testcase \ + fromgml53.testcase \ + fromgml54.testcase \ + fromgml55.testcase \ + fromgml56.testcase \ + fromgml57.testcase \ + fromgml58.testcase \ + fromgml59.testcase \ + fromgml5.testcase \ + fromgml60.testcase \ + fromgml61.testcase \ + fromgml6.testcase \ + fromgml7.testcase \ + fromgml8.testcase \ + fromgml9.testcase \ + fromgmlexp1.testcase \ + fromgmlexp2.testcase \ + fromgmlexp3.testcase \ + fromgmlexp4.testcase \ + fromgmlexp5.testcase \ + fromgmlexp6.testcase \ + fromgmlexp7.testcase \ + fromgmlexp8.testcase \ + fromgmlexp9.testcase \ + fromWkb10.testcase \ + fromWkb11.testcase \ + fromWkb12.testcase \ + fromWkb13.testcase \ + fromWkb14.testcase \ + fromWkb15.testcase \ + fromWkb16.testcase \ + fromWkb17.testcase \ + fromWkb18.testcase \ + fromWkb19.testcase \ + fromWkb1.testcase \ + fromWkb20.testcase \ + fromWkb21.testcase \ + fromWkb22.testcase \ + fromWkb23.testcase \ + fromWkb24.testcase \ + fromWkb25.testcase \ + fromWkb26.testcase \ + fromWkb2.testcase \ + fromWkb3.testcase \ + fromWkb4.testcase \ + fromWkb5.testcase \ + fromWkb6.testcase \ + fromWkb7.testcase \ + fromWkb8.testcase \ + fromWkb9.testcase \ + fromgeojsonexp1.testcase \ + fromgeojsonexp2.testcase \ + fromgeojsonexp3.testcase \ + fromgeojsonexp4.testcase \ + fromgeojsonexp5.testcase \ + fromgeojsonexp6.testcase \ + fromgeojsonexp7.testcase \ + fromgeojsonexp8.testcase \ + fromgeojsonexp9.testcase \ + fromwktexp1.testcase \ + fromwktexp2.testcase \ + fromwktexp3.testcase \ + fromwktexp4.testcase \ + fromwktexp5.testcase \ + fromwktexp6.testcase \ + fromwktexp7.testcase \ + fromwktexp8.testcase \ + fromwktexp9.testcase \ + fromewktexp1.testcase \ + fromewktexp2.testcase \ + fromewktexp3.testcase \ + fromewktexp4.testcase \ + fromewktexp5.testcase \ + fromewktexp6.testcase \ + fromewktexp7.testcase \ + fromewktexp8.testcase \ + fromewktexp9.testcase \ + ft_m.testcase \ + fullnamefrompath1.testcase \ + fullnamefrompath2.testcase \ + fullnamefrompath3.testcase \ + fullnamefrompath4.testcase \ + fullnamefrompath5.testcase \ + garsmbr10.testcase \ + garsmbr11.testcase \ + garsmbr12.testcase \ + garsmbr13.testcase \ + garsmbr14.testcase \ + garsmbr15.testcase \ + garsmbr16.testcase \ + garsmbr17.testcase \ + garsmbr18.testcase \ + garsmbr1.testcase \ + garsmbr20.testcase \ + garsmbr21.testcase \ + garsmbr22.testcase \ + garsmbr23.testcase \ + garsmbr24.testcase \ + garsmbr25.testcase \ + garsmbr26.testcase \ + garsmbr27.testcase \ + garsmbr28.testcase \ + garsmbr29.testcase \ + garsmbr2.testcase \ + garsmbr30.testcase \ + garsmbr31.testcase \ + garsmbr32.testcase \ + garsmbr33.testcase \ + garsmbr34.testcase \ + garsmbr35.testcase \ + garsmbr36.testcase \ + garsmbr3.testcase \ + garsmbr4.testcase \ + garsmbr5.testcase \ + garsmbr6.testcase \ + garsmbr7.testcase \ + garsmbr8.testcase \ + garsmbr9.testcase \ + geodesic-len1.testcase \ + geodesic-len2.testcase \ + geodesic-len3.testcase \ + geodesic-len4.testcase \ + geodesic-len5.testcase \ + geodesic-len6.testcase \ + geodesic-len7.testcase \ + geodesic-len8.testcase \ + geojson1.testcase \ + geojson2.testcase \ + geojson3.testcase \ + geojson4.testcase \ + geojson5.testcase \ + geojson6.testcase \ + geomcollfromtext1.testcase \ + geomcollfromtext2.testcase \ + geomconstraints10.testcase \ + geomconstraints11.testcase \ + geomconstraints12.testcase \ + geomconstraints13.testcase \ + geomconstraints14.testcase \ + geomconstraints15.testcase \ + geomconstraints16.testcase \ + geomconstraints17.testcase \ + geomconstraints18.testcase \ + geomconstraints19.testcase \ + geomconstraints1.testcase \ + geomconstraints20.testcase \ + geomconstraints21.testcase \ + geomconstraints22.testcase \ + geomconstraints23.testcase \ + geomconstraints24.testcase \ + geomconstraints25.testcase \ + geomconstraints26.testcase \ + geomconstraints27.testcase \ + geomconstraints28.testcase \ + geomconstraints2.testcase \ + geomconstraints3.testcase \ + geomconstraints4.testcase \ + geomconstraints5.testcase \ + geomconstraints6.testcase \ + geomconstraints7.testcase \ + geomconstraints8.testcase \ + geomconstraints9.testcase \ + geometryn10.testcase \ + geometryn11.testcase \ + geometryn12.testcase \ + geometryn13.testcase \ + geometryn14.testcase \ + geometryn15.testcase \ + geometryn16.testcase \ + geometryn17.testcase \ + geometryn18.testcase \ + geometryn19.testcase \ + geometryn1.testcase \ + geometryn20.testcase \ + geometryn2.testcase \ + geometryn3.testcase \ + geometryn4.testcase \ + geometryn5.testcase \ + geometryn6.testcase \ + geometryn7.testcase \ + geometryn8.testcase \ + geometryn9.testcase \ + geometryn.testcase \ + geomfromewkb1.testcase \ + geomfromewkb2.testcase \ + geomfromkml10.testcase \ + geomfromkml11.testcase \ + geomfromkml12.testcase \ + geomfromkml13.testcase \ + geomfromkml14.testcase \ + geomfromkml15.testcase \ + geomfromkml16.testcase \ + geomfromkml17.testcase \ + geomfromkml18.testcase \ + geomfromkml19.testcase \ + geomfromkml1.testcase \ + geomfromkml20.testcase \ + geomfromkml21.testcase \ + geomfromkml22.testcase \ + geomfromkml23.testcase \ + geomfromkml2.testcase \ + geomfromkml3.testcase \ + geomfromkml4.testcase \ + geomfromkml5.testcase \ + geomfromkml6.testcase \ + geomfromkml7.testcase \ + geomfromkml8.testcase \ + geomfromkml9.testcase \ + geomfromkmlexp1.testcase \ + geomfromkmlexp2.testcase \ + geomfromkmlexp3.testcase \ + geomfromkmlexp4.testcase \ + geomfromkmlexp5.testcase \ + geomfromkmlexp6.testcase \ + geomfromkmlexp7.testcase \ + geomfromkmlexp8.testcase \ + geomfromkmlexp9.testcase \ + geomfromtext10.testcase \ + geomfromtext11.testcase \ + geomfromtext12.testcase \ + geomfromtext13.testcase \ + geomfromtext14.testcase \ + geomfromtext15.testcase \ + geomfromtext16.testcase \ + geomfromtext17.testcase \ + geomfromtext18.testcase \ + geomfromtext19.testcase \ + geomfromtext1.testcase \ + geomfromtext20.testcase \ + geomfromtext21.testcase \ + geomfromtext22.testcase \ + geomfromtext23.testcase \ + geomfromtext24.testcase \ + geomfromtext25.testcase \ + geomfromtext26.testcase \ + geomfromtext27.testcase \ + geomfromtext28.testcase \ + geomfromtext29.testcase \ + geomfromtext2.testcase \ + geomfromtext30.testcase \ + geomfromtext31.testcase \ + geomfromtext32.testcase \ + geomfromtext33.testcase \ + geomfromtext34.testcase \ + geomfromtext35.testcase \ + geomfromtext36.testcase \ + geomfromtext37.testcase \ + geomfromtext38.testcase \ + geomfromtext39.testcase \ + geomfromtext3.testcase \ + geomfromtext40.testcase \ + geomfromtext41.testcase \ + geomfromtext42.testcase \ + geomfromtext43.testcase \ + geomfromtext44.testcase \ + geomfromtext45.testcase \ + geomfromtext4.testcase \ + geomfromtext5.testcase \ + geomfromtext6.testcase \ + geomfromtext7.testcase \ + geomfromtext8.testcase \ + geomfromtext9.testcase \ + geomtype10.testcase \ + geomtype11.testcase \ + geomtype12.testcase \ + geomtype13.testcase \ + geomtype14.testcase \ + geomtype15.testcase \ + geomtype16.testcase \ + geomtype17.testcase \ + geomtype18.testcase \ + geomtype19.testcase \ + geomtype1.testcase \ + geomtype20.testcase \ + geomtype21.testcase \ + geomtype22.testcase \ + geomtype23.testcase \ + geomtype24.testcase \ + geomtype25.testcase \ + geomtype26.testcase \ + geomtype27.testcase \ + geomtype28.testcase \ + geomtype29.testcase \ + geomtype2.testcase \ + geomtype30.testcase \ + geomtype31.testcase \ + geomtype32.testcase \ + geomtype33.testcase \ + geomtype34.testcase \ + geomtype35.testcase \ + geomtype36.testcase \ + geomtype37.testcase \ + geomtype38.testcase \ + geomtype39.testcase \ + geomtype3.testcase \ + geomtype40.testcase \ + geomtype41.testcase \ + geomtype42.testcase \ + geomtype43.testcase \ + geomtype44.testcase \ + geomtype45.testcase \ + geomtype46.testcase \ + geomtype47.testcase \ + geomtype48.testcase \ + geomtype49.testcase \ + geomtype4.testcase \ + geomtype50.testcase \ + geomtype51.testcase \ + geomtype52.testcase \ + geomtype53.testcase \ + geomtype54.testcase \ + geomtype55.testcase \ + geomtype56.testcase \ + geomtype57.testcase \ + geomtype58.testcase \ + geomtype59.testcase \ + geomtype5.testcase \ + geomtype60.testcase \ + geomtype61.testcase \ + geomtype62.testcase \ + geomtype63.testcase \ + geomtype64.testcase \ + geomtype65.testcase \ + geomtype66.testcase \ + geomtype67.testcase \ + geomtype68.testcase \ + geomtype69.testcase \ + geomtype6.testcase \ + geomtype7.testcase \ + geomtype8.testcase \ + geomtype9.testcase \ + getmimetype1.testcase \ + getmimetype2.testcase \ + getmimetype3.testcase \ + getmimetype4.testcase \ + getmimetype5.testcase \ + getshapefileextent1.testcase \ + getshapefileextent2.testcase \ + getshapefileextent3.testcase \ + getshapefileextent4.testcase \ + getshapefileextent5.testcase \ + gml10.testcase \ + gml11.testcase \ + gml12.testcase \ + gml13.testcase \ + gml14.testcase \ + gml15.testcase \ + gml16.testcase \ + gml1.testcase \ + gml2.testcase \ + gml3.testcase \ + gml4.testcase \ + gml5.testcase \ + gml6.testcase \ + gml7.testcase \ + gml8.testcase \ + gml9.testcase \ + greatcircle-badblob.testcase \ + greatcircle-poly2.testcase \ + greatcircle-poly3.testcase \ + greatcircle-poly4.testcase \ + greatcircle-poly5.testcase \ + greatcircle-poly6.testcase \ + greatcircle-poly7.testcase \ + greatcircle-poly.testcase \ + greatcircle.testcase \ + greatcircle-text.testcase \ + ind_ch_m.testcase \ + ind_ft_m.testcase \ + ind_yd_m.testcase \ + in_m.testcase \ + is3d1.testcase \ + is3d2.testcase \ + is3d3.testcase \ + is3d4.testcase \ + is3d5.testcase \ + is3d6.testcase \ + isempty2.testcase \ + isempty3.testcase \ + isempty4.testcase \ + isempty.testcase \ + ismeasured1.testcase \ + ismeasured2.testcase \ + ismeasured3.testcase \ + ismeasured4.testcase \ + ismeasured5.testcase \ + ispolygccw1.testcase \ + ispolygccw2.testcase \ + ispolygccw3.testcase \ + ispolygccw4.testcase \ + ispolygccw5.testcase \ + ispolygcw1.testcase \ + ispolygcw2.testcase \ + ispolygcw3.testcase \ + ispolygcw4.testcase \ + ispolygcw5.testcase \ + ispopulatedcoverage1.testcase \ + ispopulatedcoverage2.testcase \ + ispopulatedcoverage3.testcase \ + checkfontfacename1.testcase \ + checkfontfacename2.testcase \ + checkfontfacename3.testcase \ + getfontfamily.testcase \ + isfontbold.testcase \ + isfontitalic.testcase \ + islowascii1.testcase \ + islowascii2.testcase \ + islowascii3.testcase \ + islowascii4.testcase \ + islowascii5.testcase \ + islowascii6.testcase \ + isvalidfont1.testcase \ + isvalidfont2.testcase \ + isvalidnodata1.testcase \ + isvalidnodata2.testcase \ + isvalidnodata3.testcase \ + isvalidnodata4.testcase \ + isvalidpalette1.testcase \ + isvalidpalette2.testcase \ + isvalidpalette3.testcase \ + isvalidrasterstats1.testcase \ + isvalidrasterstats2.testcase \ + isvalidrasterstats3.testcase \ + isvalidrasterstats4.testcase \ + isvalidrasterstats5.testcase \ + isvalidrasterstats6.testcase \ + isvalidrasterstats7.testcase \ + isvalidrasterstats8.testcase \ + isvalidrastertile1.testcase \ + isvalidrastertile2.testcase \ + isvalidrastertile3.testcase \ + isvalidrastertile4.testcase \ + isvalidrastertile5.testcase \ + isvalidrastertile6.testcase \ + isvalidrastertile7.testcase \ + isvalidrastertile8.testcase \ + isvalidrastertile9.testcase \ + isXblob6.testcase \ + isXblob7.testcase \ + k3b-icon.png \ + km_m.testcase \ + ktorrent_grad1.jpg \ + ktorrent_sidebar.gif \ + La_folla_durante_il_Palio.jpg \ + lhr1.testcase \ + lhr2.testcase \ + lhr3.testcase \ + lhr4.testcase \ + lhr5.testcase \ + lhr6.testcase \ + linefromtext1.testcase \ + linefromtext2.testcase \ + linesfromrings1.testcase \ + linesfromrings2.testcase \ + linesfromrings3.testcase \ + linesfromrings4.testcase \ + linesfromrings5.testcase \ + linesfromrings6.testcase \ + linesfromrings7.testcase \ + link_m.testcase \ + locatemeasure10.testcase \ + locatemeasure11.testcase \ + locatemeasure12.testcase \ + locatemeasure13.testcase \ + locatemeasure14.testcase \ + locatemeasure15.testcase \ + locatemeasure16.testcase \ + locatemeasure17.testcase \ + locatemeasure18.testcase \ + locatemeasure19.testcase \ + locatemeasure1.testcase \ + locatemeasure2.testcase \ + locatemeasure3.testcase \ + locatemeasure4.testcase \ + locatemeasure5.testcase \ + locatemeasure6.testcase \ + locatemeasure7.testcase \ + locatemeasure8.testcase \ + locatemeasure9.testcase \ + makeline10.testcase \ + makeline11.testcase \ + makeline12.testcase \ + makeline13.testcase \ + makeline14.testcase \ + makeline15.testcase \ + makeline16.testcase \ + makeline17.testcase \ + makeline18.testcase \ + makeline19.testcase \ + makeline20.testcase \ + makeline21.testcase \ + makeline22.testcase \ + makeline23.testcase \ + makeline24.testcase \ + makeline25.testcase \ + makeline26.testcase \ + makeline27.testcase \ + makeline28.testcase \ + makeline29.testcase \ + makeline2.testcase \ + makeline3.testcase \ + makeline30.testcase \ + makeline31.testcase \ + makeline32.testcase \ + makeline4.testcase \ + makeline5.testcase \ + makeline6.testcase \ + makeline7.testcase \ + makeline8.testcase \ + makeline9.testcase \ + makeline.testcase \ + makepoint10.testcase \ + makepoint11.testcase \ + makepoint12.testcase \ + makepoint13.testcase \ + makepoint14.testcase \ + makepoint15.testcase \ + makepoint1.testcase \ + makepoint2.testcase \ + makepoint3.testcase \ + makepoint4.testcase \ + makepoint5.testcase \ + makepoint6.testcase \ + makepoint7.testcase \ + makepoint8.testcase \ + makepoint9.testcase \ + makepointm-null1.testcase \ + makepointm-null2.testcase \ + makepointm-null3.testcase \ + makepointm-null4.testcase \ + makepointm-null5.testcase \ + makepointm-null6.testcase \ + makepointm-null7.testcase \ + makepointm-null8.testcase \ + makepoint-null1.testcase \ + makepoint-null2.testcase \ + makepoint-null3.testcase \ + makepoint-null4.testcase \ + makepoint-null5.testcase \ + makepoint-null6.testcase \ + makepoint-null7.testcase \ + makepointzm-null10.testcase \ + makepointzm-null1.testcase \ + makepointzm-null2.testcase \ + makepointzm-null3.testcase \ + makepointzm-null4.testcase \ + makepointzm-null5.testcase \ + makepointzm-null6.testcase \ + makepointzm-null7.testcase \ + makepointzm-null8.testcase \ + makepointzm-null9.testcase \ + makepointz-null1.testcase \ + makepointz-null2.testcase \ + makepointz-null3.testcase \ + makepointz-null4.testcase \ + makepointz-null5.testcase \ + makepointz-null6.testcase \ + makepointz-null7.testcase \ + makepointz-null8.testcase \ + makepointz-null9.testcase \ + makecircle1.testcase \ + makecircle2.testcase \ + makecircle3.testcase \ + makecircle4.testcase \ + makecircle5.testcase \ + makecircle6.testcase \ + makecircle7.testcase \ + makecircle8.testcase \ + makecircle9.testcase \ + makeellipse1.testcase \ + makeellipse2.testcase \ + makeellipse3.testcase \ + makeellipse4.testcase \ + makeellipse5.testcase \ + makeellipse6.testcase \ + makeellipse7.testcase \ + makeellipse8.testcase \ + makeellipse9.testcase \ + makeellipse10.testcase \ + makeellipse11.testcase \ + makeellipse12.testcase \ + makeellipse14.testcase \ + makeellipse15.testcase \ + makeellipse16.testcase \ + makeellipse18.testcase \ + makeellipse19.testcase \ + makeellipse20.testcase \ + makearc1.testcase \ + makearc2.testcase \ + makearc3.testcase \ + makearc4.testcase \ + makearc5.testcase \ + makearc6.testcase \ + makearc7.testcase \ + makearc8.testcase \ + makearc9.testcase \ + makearc10.testcase \ + makearc11.testcase \ + makearc12.testcase \ + makearc13.testcase \ + makearc14.testcase \ + makearc16.testcase \ + makearc17.testcase \ + makearc18.testcase \ + makearc20.testcase \ + makearc21.testcase \ + makearc22.testcase \ + makeellipticarc1.testcase \ + makeellipticarc2.testcase \ + makeellipticarc3.testcase \ + makeellipticarc4.testcase \ + makeellipticarc5.testcase \ + makeellipticarc6.testcase \ + makeellipticarc7.testcase \ + makeellipticarc8.testcase \ + makeellipticarc9.testcase \ + makeellipticarc10.testcase \ + makeellipticarc11.testcase \ + makeellipticarc12.testcase \ + makeellipticarc13.testcase \ + makeellipticarc14.testcase \ + makeellipticarc15.testcase \ + makeellipticarc16.testcase \ + makeellipticarc17.testcase \ + makeellipticarc19.testcase \ + makeellipticarc20.testcase \ + makeellipticarc21.testcase \ + makeellipticarc23.testcase \ + makeellipticarc24.testcase \ + makeellipticarc25.testcase \ + makecircularsector1.testcase \ + makecircularsector2.testcase \ + makecircularsector3.testcase \ + makecircularsector4.testcase \ + makecircularsector5.testcase \ + makecircularsector6.testcase \ + makecircularsector7.testcase \ + makecircularsector8.testcase \ + makecircularsector9.testcase \ + makecircularsector10.testcase \ + makecircularsector11.testcase \ + makecircularsector12.testcase \ + makecircularsector13.testcase \ + makecircularsector14.testcase \ + makecircularsector16.testcase \ + makecircularsector17.testcase \ + makecircularsector18.testcase \ + makecircularsector20.testcase \ + makecircularsector21.testcase \ + makecircularsector22.testcase \ + makecircularstripe1.testcase \ + makecircularstripe2.testcase \ + makecircularstripe3.testcase \ + makecircularstripe4.testcase \ + makecircularstripe5.testcase \ + makecircularstripe6.testcase \ + makecircularstripe7.testcase \ + makecircularstripe8.testcase \ + makecircularstripe9.testcase \ + makecircularstripe10.testcase \ + makecircularstripe11.testcase \ + makecircularstripe12.testcase \ + makecircularstripe13.testcase \ + makecircularstripe14.testcase \ + makecircularstripe16.testcase \ + makecircularstripe17.testcase \ + makecircularstripe18.testcase \ + makecircularstripe20.testcase \ + makecircularstripe21.testcase \ + makecircularstripe22.testcase \ + makecircularstripe24.testcase \ + makecircularstripe25.testcase \ + makecircularstripe26.testcase \ + makeellipticsector1.testcase \ + makeellipticsector2.testcase \ + makeellipticsector3.testcase \ + makeellipticsector4.testcase \ + makeellipticsector5.testcase \ + makeellipticsector6.testcase \ + makeellipticsector7.testcase \ + makeellipticsector8.testcase \ + makeellipticsector9.testcase \ + makeellipticsector10.testcase \ + makeellipticsector11.testcase \ + makeellipticsector12.testcase \ + makeellipticsector13.testcase \ + makeellipticsector14.testcase \ + makeellipticsector15.testcase \ + makeellipticsector16.testcase \ + makeellipticsector17.testcase \ + makeellipticsector19.testcase \ + makeellipticsector20.testcase \ + makeellipticsector21.testcase \ + makeellipticsector23.testcase \ + makeellipticsector24.testcase \ + makeellipticsector25.testcase \ + maxm1.testcase \ + maxm2.testcase \ + maxm3.testcase \ + maxm4.testcase \ + maxm5.testcase \ + maxm6.testcase \ + maxm7.testcase \ + maxz1.testcase \ + maxz2.testcase \ + maxz3.testcase \ + maxz4.testcase \ + maxz5.testcase \ + maxz6.testcase \ + maxz7.testcase \ + mbr10.testcase \ + mbr11.testcase \ + mbr12.testcase \ + mbr13.testcase \ + mbr14.testcase \ + mbr15.testcase \ + mbr16.testcase \ + mbr17.testcase \ + mbr18.testcase \ + mbr19.testcase \ + mbr1.testcase \ + mbr20.testcase \ + mbr21.testcase \ + mbr22.testcase \ + mbr23.testcase \ + mbr24.testcase \ + mbr25.testcase \ + mbr26.testcase \ + mbr27.testcase \ + mbr28.testcase \ + mbr29.testcase \ + mbr2.testcase \ + mbr30.testcase \ + mbr31.testcase \ + mbr32.testcase \ + mbr3.testcase \ + mbr4.testcase \ + mbr5.testcase \ + mbr6.testcase \ + mbr7.testcase \ + mbr8.testcase \ + mbr9.testcase \ + mbrminmax1.testcase \ + mbrminmax2.testcase \ + mbrminmax3.testcase \ + mbrminmax4.testcase \ + mbrminmax5.testcase \ + mbrminmax6.testcase \ + mbrminmax7.testcase \ + mbrminmax8.testcase \ + m_ch.testcase \ + m_cm.testcase \ + m_dm.testcase \ + m_fath.testcase \ + m_ft.testcase \ + m_ft-text.testcase \ + mi_m.testcase \ + m_ind_ch.testcase \ + m_ind_ft.testcase \ + m_ind_yd.testcase \ + minm1.testcase \ + minm2.testcase \ + minm3.testcase \ + minm4.testcase \ + minm5.testcase \ + minm6.testcase \ + m_in.testcase \ + m_in_us.testcase \ + minz1.testcase \ + minz2.testcase \ + minz3.testcase \ + minz4.testcase \ + minz5.testcase \ + minz6.testcase \ + m_km.testcase \ + mlinefromtext1.testcase \ + mlinefromtext2.testcase \ + m_ln.testcase \ + m_mi.testcase \ + m_mm.testcase \ + mm_m.testcase \ + m_nm.testcase \ + mpointfromtext1.testcase \ + mpointfromtext2.testcase \ + mpolygonfromtext1.testcase \ + mpolygonfromtext2.testcase \ + m_us_ch.testcase \ + m_us_ft.testcase \ + m_usmi.testcase \ + m_yd.testcase \ + m_yd_us.testcase \ + namefrompath1.testcase \ + namefrompath2.testcase \ + namefrompath3.testcase \ + namefrompath4.testcase \ + namefrompath5.testcase \ + ndims1.testcase \ + ndims2.testcase \ + ndims3.testcase \ + ndims4.testcase \ + ndims5.testcase \ + ndims6.testcase \ + nm_m.testcase \ + normalizelonlat10.testcase \ + normalizelonlat11.testcase \ + normalizelonlat12.testcase \ + normalizelonlat13.testcase \ + normalizelonlat14.testcase \ + normalizelonlat15.testcase \ + normalizelonlat16.testcase \ + normalizelonlat17.testcase \ + normalizelonlat18.testcase \ + normalizelonlat19.testcase \ + normalizelonlat1.testcase \ + normalizelonlat20.testcase \ + normalizelonlat21.testcase \ + normalizelonlat22.testcase \ + normalizelonlat23.testcase \ + normalizelonlat24.testcase \ + normalizelonlat25.testcase \ + normalizelonlat26.testcase \ + normalizelonlat27.testcase \ + normalizelonlat2.testcase \ + normalizelonlat3.testcase \ + normalizelonlat4.testcase \ + normalizelonlat5.testcase \ + normalizelonlat6.testcase \ + normalizelonlat7.testcase \ + normalizelonlat8.testcase \ + normalizelonlat9.testcase \ + npoints1.testcase \ + npoints2.testcase \ + npoints3.testcase \ + npoints4.testcase \ + npoints5.testcase \ + npoints6.testcase \ + nrings1.testcase \ + nrings2.testcase \ + nrings3.testcase \ + nrings4.testcase \ + nrings5.testcase \ + nrings6.testcase \ + numgeometries1.testcase \ + numgeometries2.testcase \ + numgeometries3.testcase \ + numgeometries4.testcase \ + numgeometries5.testcase \ + numgeometries6.testcase \ + NumPoints2.testcase \ + NumPoints3.testcase \ + NumPoints4.testcase \ + NumPoints5.testcase \ + NumPoints6.testcase \ + NumPoints7.testcase \ + NumPoints.testcase \ + pointfromtext1.testcase \ + pointfromtext2.testcase \ + pointn10.testcase \ + pointn11.testcase \ + pointn12.testcase \ + pointn13.testcase \ + pointn14.testcase \ + pointn15.testcase \ + pointn1.testcase \ + pointn2.testcase \ + pointn3.testcase \ + pointn4.testcase \ + pointn5.testcase \ + pointn6.testcase \ + pointn7.testcase \ + pointn8.testcase \ + pointn9.testcase \ + polygccw1.testcase \ + polygccw2.testcase \ + polygccw3.testcase \ + polygccw4.testcase \ + polygccw5.testcase \ + polygccw6.testcase \ + polygcw1.testcase \ + polygcw2.testcase \ + polygcw3.testcase \ + polygcw4.testcase \ + polygcw5.testcase \ + polygcw6.testcase \ + polygonfromtext1.testcase \ + polygonfromtext2.testcase \ + reflectcoords10.testcase \ + reflectcoords11.testcase \ + reflectcoords12.testcase \ + reflectcoords13.testcase \ + reflectcoords14.testcase \ + reflectcoords15.testcase \ + reflectcoords16.testcase \ + reflectcoords17.testcase \ + reflectcoords1.testcase \ + reflectcoords2.testcase \ + reflectcoords3.testcase \ + reflectcoords4.testcase \ + reflectcoords5.testcase \ + reflectcoords6.testcase \ + reflectcoords7.testcase \ + reflectcoords8.testcase \ + reflectcoords9.testcase \ + removedupl1.testcase \ + removedupl2.testcase \ + removedupl3.testcase \ + removedupl4.testcase \ + removepoint10.testcase \ + removepoint11.testcase \ + removepoint12.testcase \ + removepoint13.testcase \ + removepoint14.testcase \ + removepoint15.testcase \ + removepoint16.testcase \ + removepoint1.testcase \ + removepoint2.testcase \ + removepoint3.testcase \ + removepoint4.testcase \ + removepoint5.testcase \ + removepoint6.testcase \ + removepoint7.testcase \ + removepoint8.testcase \ + removepoint9.testcase \ + repeatedpoints1.testcase \ + repeatedpoints2.testcase \ + repeatedpoints3.testcase \ + repeatedpoints4.testcase \ + repeatedpoints5.testcase \ + repeatedpoints6.testcase \ + repeatedpoints7.testcase \ + repeatedpoints8.testcase \ + repeatedpoints9.testcase \ + repeatedpoints10.testcase \ + repeatedpoints11.testcase \ + repeatedpoints12.testcase \ + repeatedpoints13.testcase \ + repeatedpoints14.testcase \ + reverse1.testcase \ + reverse2.testcase \ + reverse3.testcase \ + reverse4.testcase \ + reverse5.testcase \ + reverse6.testcase \ + ring10.testcase \ + ring11.testcase \ + ring12.testcase \ + ring13.testcase \ + ring14.testcase \ + ring15.testcase \ + ring16.testcase \ + ring17.testcase \ + ring18.testcase \ + ring19.testcase \ + ring1.testcase \ + ring20.testcase \ + ring21.testcase \ + ring22.testcase \ + ring23.testcase \ + ring24.testcase \ + ring25.testcase \ + ring26.testcase \ + ring27.testcase \ + ring28.testcase \ + ring2.testcase \ + ring3.testcase \ + ring4.testcase \ + ring5.testcase \ + ring6.testcase \ + ring7.testcase \ + ring8.testcase \ + ring9.testcase \ + rotatecoords10.testcase \ + rotatecoords11.testcase \ + rotatecoords12.testcase \ + rotatecoords13.testcase \ + rotatecoords14.testcase \ + rotatecoords1.testcase \ + rotatecoords2.testcase \ + rotatecoords3.testcase \ + rotatecoords4.testcase \ + rotatecoords5.testcase \ + rotatecoords6.testcase \ + rotatecoords7.testcase \ + rotatecoords8.testcase \ + rotatecoords9.testcase \ + routing1.testcase \ + routing2.testcase \ + routing3.testcase \ + routing4.testcase \ + routing5.testcase \ + rtreealign1.testcase \ + rtreealign2.testcase \ + rtreealign3.testcase \ + rtreealign4.testcase \ + sandro.jpg \ + sanitizeGeometry10.testcase \ + sanitizeGeometry11.testcase \ + sanitizeGeometry12.testcase \ + sanitizeGeometry13.testcase \ + sanitizeGeometry14.testcase \ + sanitizeGeometry15.testcase \ + sanitizeGeometry16.testcase \ + sanitizeGeometry1.testcase \ + sanitizeGeometry2.testcase \ + sanitizeGeometry3.testcase \ + sanitizeGeometry4.testcase \ + sanitizeGeometry5.testcase \ + sanitizeGeometry6.testcase \ + sanitizeGeometry7.testcase \ + sanitizeGeometry8.testcase \ + sanitizeGeometry9.testcase \ + scalecoords10.testcase \ + scalecoords11.testcase \ + scalecoords12.testcase \ + scalecoords13.testcase \ + scalecoords1.testcase \ + scalecoords2.testcase \ + scalecoords3.testcase \ + scalecoords4.testcase \ + scalecoords5.testcase \ + scalecoords6.testcase \ + scalecoords7.testcase \ + scalecoords8.testcase \ + scalecoords9.testcase \ + seconds.wav \ + setpoint10.testcase \ + setpoint11.testcase \ + setpoint12.testcase \ + setpoint13.testcase \ + setpoint14.testcase \ + setpoint15.testcase \ + setpoint16.testcase \ + setpoint17.testcase \ + setpoint18.testcase \ + setpoint19.testcase \ + setpoint1.testcase \ + setpoint20.testcase \ + setpoint21.testcase \ + setpoint22.testcase \ + setpoint23.testcase \ + setpoint2.testcase \ + setpoint3.testcase \ + setpoint4.testcase \ + setpoint5.testcase \ + setpoint6.testcase \ + setpoint7.testcase \ + setpoint8.testcase \ + setpoint9.testcase \ + setendpoint10.testcase \ + setendpoint11.testcase \ + setendpoint12.testcase \ + setendpoint13.testcase \ + setendpoint14.testcase \ + setendpoint15.testcase \ + setendpoint16.testcase \ + setendpoint1.testcase \ + setendpoint2.testcase \ + setendpoint3.testcase \ + setendpoint4.testcase \ + setendpoint5.testcase \ + setendpoint6.testcase \ + setendpoint7.testcase \ + setendpoint8.testcase \ + setendpoint9.testcase \ + setstartpoint10.testcase \ + setstartpoint11.testcase \ + setstartpoint12.testcase \ + setstartpoint13.testcase \ + setstartpoint14.testcase \ + setstartpoint15.testcase \ + setstartpoint16.testcase \ + setstartpoint1.testcase \ + setstartpoint2.testcase \ + setstartpoint3.testcase \ + setstartpoint4.testcase \ + setstartpoint5.testcase \ + setstartpoint6.testcase \ + setstartpoint7.testcase \ + setstartpoint8.testcase \ + setstartpoint9.testcase \ + shiftcoords10.testcase \ + shiftcoords11.testcase \ + shiftcoords12.testcase \ + shiftcoords13.testcase \ + shiftcoords14.testcase \ + shiftcoords15.testcase \ + shiftcoords1.testcase \ + shiftcoords2.testcase \ + shiftcoords3.testcase \ + shiftcoords4.testcase \ + shiftcoords5.testcase \ + shiftcoords6.testcase \ + shiftcoords7.testcase \ + shiftcoords8.testcase \ + shiftcoords9.testcase \ + shiftlongitude10.testcase \ + shiftlongitude11.testcase \ + shiftlongitude12.testcase \ + shiftlongitude13.testcase \ + shiftlongitude14.testcase \ + shiftlongitude15.testcase \ + shiftlongitude16.testcase \ + shiftlongitude17.testcase \ + shiftlongitude18.testcase \ + shiftlongitude19.testcase \ + shiftlongitude1.testcase \ + shiftlongitude20.testcase \ + shiftlongitude21.testcase \ + shiftlongitude22.testcase \ + shiftlongitude23.testcase \ + shiftlongitude24.testcase \ + shiftlongitude25.testcase \ + shiftlongitude26.testcase \ + shiftlongitude2.testcase \ + shiftlongitude3.testcase \ + shiftlongitude4.testcase \ + shiftlongitude5.testcase \ + shiftlongitude6.testcase \ + shiftlongitude7.testcase \ + shiftlongitude8.testcase \ + shiftlongitude9.testcase \ + spatialindex.testcase \ + srid10.testcase \ + srid11.testcase \ + srid1.testcase \ + srid2.testcase \ + srid3.testcase \ + srid4.testcase \ + srid5.testcase \ + srid6.testcase \ + srid7.testcase \ + srid8.testcase \ + srid9.testcase \ + SridFromAuthCRS2.testcase \ + SridFromAuthCRS3.testcase \ + SridFromAuthCRS4.testcase \ + SridFromAuthCRS5.testcase \ + SridFromAuthCRS6.testcase \ + SridFromAuthCRS.testcase \ + startpoint1.testcase \ + startpoint2.testcase \ + startpoint3.testcase \ + st_m1.testcase \ + st_m2.testcase \ + st_m3.testcase \ + st_m4.testcase \ + st_m5.testcase \ + st_m6.testcase \ + st_m8.testcase \ + st_x1.testcase \ + st_x2.testcase \ + st_x3.testcase \ + st_x4.testcase \ + st_x5.testcase \ + st_x6.testcase \ + st_x7.testcase \ + st_x8.testcase \ + st_x9.testcase \ + st_y1.testcase \ + st_y2.testcase \ + st_y3.testcase \ + st_y4.testcase \ + st_y5.testcase \ + st_y7.testcase \ + st_y8.testcase \ + st_y9.testcase \ + st_z1.testcase \ + st_z2.testcase \ + st_z3.testcase \ + st_z4.testcase \ + st_z5.testcase \ + st_z6.testcase \ + st_z7.testcase \ + st_z8.testcase \ + st_z9.testcase \ + swapcoords10.testcase \ + swapcoords11.testcase \ + swapcoords1.testcase \ + swapcoords2.testcase \ + swapcoords3.testcase \ + swapcoords4.testcase \ + swapcoords5.testcase \ + swapcoords6.testcase \ + swapcoords7.testcase \ + swapcoords8.testcase \ + swapcoords9.testcase \ + testdb1.sqlite \ + testFDO.sqlite \ + testFGF.sqlite \ + test.webp \ + togars10.testcase \ + togars11.testcase \ + togars12.testcase \ + togars13.testcase \ + togars1.testcase \ + togars2.testcase \ + togars3.testcase \ + togars4.testcase \ + togars5.testcase \ + togars6.testcase \ + togars7.testcase \ + togars8.testcase \ + togars9.testcase \ + translate10.testcase \ + translate11.testcase \ + translate12.testcase \ + translate13.testcase \ + translate14.testcase \ + translate15.testcase \ + translate16.testcase \ + translate17.testcase \ + translate18.testcase \ + translate19.testcase \ + translate1.testcase \ + translate2.testcase \ + translate3.testcase \ + translate4.testcase \ + translate5.testcase \ + translate6.testcase \ + translate7.testcase \ + translate8.testcase \ + translate9.testcase \ + trivial.sqlite_RO \ + uncompressgeom1.testcase \ + uncompressgeom2.testcase \ + uncompressgeom3.testcase \ + unsafeTriggers1.testcase \ + us_ch_m.testcase \ + us_ft_m.testcase \ + us_in_m.testcase \ + us_mi_m.testcase \ + us_yd_m.testcase \ + wkb10.testcase \ + wkb11.testcase \ + wkb12.testcase \ + wkb13.testcase \ + wkb14.testcase \ + wkb15.testcase \ + wkb16.testcase \ + wkb17.testcase \ + wkb18.testcase \ + wkb19.testcase \ + wkb1.testcase \ + wkb20.testcase \ + wkb21.testcase \ + wkb22.testcase \ + wkb23.testcase \ + wkb24.testcase \ + wkb25.testcase \ + wkb26.testcase \ + wkb27.testcase \ + wkb28.testcase \ + wkb29.testcase \ + wkb2.testcase \ + wkb30.testcase \ + wkb31.testcase \ + wkb32.testcase \ + wkb33.testcase \ + wkb34.testcase \ + wkb35.testcase \ + wkb36.testcase \ + wkb3.testcase \ + wkb4.testcase \ + wkb5.testcase \ + wkb6.testcase \ + wkb7.testcase \ + wkb8.testcase \ + wkb9.testcase \ + wkbtosql1.testcase \ + wkbtosql2.testcase \ + wkbtosql3.testcase \ + wkttosql1.testcase \ + wkttosql2.testcase \ + wkttosql3.testcase \ + yd_m.testcase \ + getlayerextent1.testcase \ + getlayerextent2.testcase \ + getlayerextent3.testcase \ + getlayerextent4.testcase \ + getlayerextent5.testcase \ + getlayerextent6.testcase \ + getlayerextent7.testcase \ + getlayerextent8.testcase \ + getlayerextent9.testcase \ + getlayerextent10.testcase \ + getlayerextent11.testcase \ + getlayerextent12.testcase \ + getlayerextent13.testcase \ + getlayerextent14.testcase \ + invalidatestats1.testcase \ + invalidatestats2.testcase \ + invalidatestats3.testcase \ + invalidatestats4.testcase \ + invalidatestats5.testcase \ + invalidatestats6.testcase \ + invalidatestats7.testcase \ + invalidatestats8.testcase \ + invalidatestats9.testcase \ + invalidatestats10.testcase \ + updatestats1.testcase \ + updatestats2.testcase \ + updatestats3.testcase \ + updatestats4.testcase \ + updatestats5.testcase \ + updatestats6.testcase \ + updatestats7.testcase \ + updatestats8.testcase \ + updatestats9.testcase \ + updatestats10.testcase \ + makepolygon1.testcase \ + makepolygon2.testcase \ + makepolygon3.testcase \ + makepolygon4.testcase \ + makepolygon5.testcase \ + makepolygon7.testcase \ + makepolygon8.testcase \ + makepolygon9.testcase \ + makepolygon10.testcase \ + makepolygon11.testcase \ + makepolygon12.testcase \ + makepolygon13.testcase \ + makepolygon14.testcase \ + makepolygon15.testcase \ + makepolygon16.testcase \ + makepolygon17.testcase \ + makepolygon18.testcase \ + makepolygon19.testcase \ + makepolygon20.testcase \ + makepolygon21.testcase \ + makepolygon22.testcase \ + makepolygon23.testcase \ + makepolygon24.testcase \ + makepolygon25.testcase \ + makepolygon26.testcase \ + todms1.testcase \ + todms2.testcase \ + todms3.testcase \ + todms4.testcase \ + todms5.testcase \ + todms6.testcase \ + todms7.testcase \ + todms8.testcase \ + todms9.testcase \ + todms10.testcase \ + todms11.testcase \ + todms12.testcase \ + todms13.testcase \ + fromdms1.testcase \ + fromdms2.testcase \ + fromdms3.testcase \ + fromdms4.testcase \ + fromdms5.testcase \ + fromdms6.testcase \ + fromdms7.testcase \ + fromdms8.testcase \ + fromdms9.testcase \ + sridisgeographic1.testcase \ + sridisgeographic2.testcase \ + sridisgeographic3.testcase \ + sridisgeographic4.testcase \ + sridisgeographic5.testcase \ + sridisgeographic6.testcase \ + sridisgeographic7.testcase \ + sridisprojected1.testcase \ + sridisprojected2.testcase \ + sridisprojected3.testcase \ + sridisprojected4.testcase \ + sridisprojected5.testcase \ + sridisprojected6.testcase \ + sridisprojected7.testcase \ + sridflipped1.testcase \ + sridflipped2.testcase \ + sridflipped3.testcase \ + sridflipped4.testcase \ + sridflipped5.testcase \ + sridflipped6.testcase \ + sridflipped7.testcase \ + sridspheroid1.testcase \ + sridspheroid2.testcase \ + sridspheroid3.testcase \ + sridspheroid4.testcase \ + sridspheroid5.testcase \ + sridspheroid6.testcase \ + sridprimem1.testcase \ + sridprimem2.testcase \ + sridprimem3.testcase \ + sridprimem4.testcase \ + sridprimem5.testcase \ + sridprimem6.testcase \ + sriddatum1.testcase \ + sriddatum2.testcase \ + sriddatum3.testcase \ + sriddatum4.testcase \ + sriddatum5.testcase \ + sriddatum6.testcase \ + sridunit1.testcase \ + sridunit2.testcase \ + sridunit3.testcase \ + sridunit4.testcase \ + sridunit5.testcase \ + sridunit6.testcase \ + sridprojection1.testcase \ + sridprojection2.testcase \ + sridprojection3.testcase \ + sridprojection4.testcase \ + sridprojection5.testcase \ + sridprojection6.testcase \ + sridax1name1.testcase \ + sridax1name2.testcase \ + sridax1name3.testcase \ + sridax1name4.testcase \ + sridax1name5.testcase \ + sridax1name6.testcase \ + sridax1orient1.testcase \ + sridax1orient2.testcase \ + sridax1orient3.testcase \ + sridax1orient4.testcase \ + sridax1orient5.testcase \ + sridax1orient6.testcase \ + sridax2name1.testcase \ + sridax2name2.testcase \ + sridax2name3.testcase \ + sridax2name4.testcase \ + sridax2name5.testcase \ + sridax2name6.testcase \ + sridax2orient1.testcase \ + sridax2orient2.testcase \ + sridax2orient3.testcase \ + sridax2orient4.testcase \ + sridax2orient5.testcase \ + sridax2orient6.testcase \ + wms_defaultsetting1.testcase \ + wms_defaultsetting2.testcase \ + wms_defaultsetting3.testcase \ + wms_defaultsetting4.testcase \ + wms_defaultsetting5.testcase \ + wms_defaultsetting6.testcase \ + wms_defaultsetting7.testcase \ + wms_defaultsetting8.testcase \ + wms_defaultsetting9.testcase \ + wms_defaultsetting10.testcase \ + wms_defaultsetting11.testcase \ + wms_defaultsetting12.testcase \ + wms_defaultsetting13.testcase \ + wms_defaultsetting14.testcase \ + wms_defaultsetting15.testcase \ + wms_defaultsetting16.testcase \ + wms_defaultsetting17.testcase \ + wms_defaultsrs1.testcase \ + wms_defaultsrs2.testcase \ + wms_defaultsrs3.testcase \ + wms_defaultsrs4.testcase \ + wms_defaultsrs5.testcase \ + wms_defaultsrs6.testcase \ + wms_defaultsrs7.testcase \ + wms_defaultsrs8.testcase \ + wms_defaultsrs9.testcase \ + wms_defaultsrs10.testcase \ + wms_defaultsrs11.testcase \ + wms_defaultsrs12.testcase \ + wms_defaultsrs13.testcase \ + wms_getmapoptions1.testcase \ + wms_getmapoptions2.testcase \ + wms_getmapoptions3.testcase \ + wms_getmapoptions4.testcase \ + wms_getmapoptions5.testcase \ + wms_getmapoptions6.testcase \ + wms_getmapoptions7.testcase \ + wms_getmapoptions8.testcase \ + wms_getmapoptions9.testcase \ + wms_getmapoptions10.testcase \ + wms_getmapoptions11.testcase \ + wms_getmapoptions12.testcase \ + wms_getmapoptions13.testcase \ + wms_getmapoptions14.testcase \ + wms_getmapoptions15.testcase \ + wms_getmapoptions16.testcase \ + wms_getmapoptions17.testcase \ + wms_getmapoptions18.testcase \ + wms_getmapoptions19.testcase \ + wms_getmapoptions20.testcase \ + wms_getmapoptions21.testcase \ + wms_getmapoptions22.testcase \ + wms_getmapoptions23.testcase \ + wms_getmapoptions24.testcase \ + wms_getmapoptions25.testcase \ + wms_getmapoptions26.testcase \ + wms_getmapoptions27.testcase \ + wms_getmapoptions28.testcase \ + wms_getmapoptions29.testcase \ + wms_getmapoptions30.testcase \ + wms_getmapoptions31.testcase \ + wms_getmapoptions32.testcase \ + wms_getmapoptions33.testcase \ + wms_getmapoptions34.testcase \ + wms_getmapoptions35.testcase \ + wms_getmapoptions36.testcase \ + wms_getmapoptions37.testcase \ + wms_getmapoptions38.testcase \ + wms_getmapoptions39.testcase \ + wms_getmapoptions40.testcase \ + wms_getmapoptions41.testcase \ + wms_getmapoptions42.testcase \ + wms_getmapoptions43.testcase \ + wms_getmapoptions44.testcase \ + wms_getinfo_url1.testcase \ + wms_getinfo_url2.testcase \ + wms_getinfo_url3.testcase \ + wms_getinfo_url4.testcase \ + wms_getinfo_url5.testcase \ + wms_getinfo_url6.testcase \ + wms_getinfo_url7.testcase \ + wms_getinfo_url8.testcase \ + wms_getinfo_url9.testcase \ + wms_getinfo_url10.testcase \ + wms_getinfo_url11.testcase \ + wms_getinfo_url12.testcase \ + wms_getinfo_url13.testcase \ + wms_getinfo_url14.testcase \ + wms_getinfo_url15.testcase \ + wms_getinfo_url16.testcase \ + wms_getinfo_url17.testcase \ + wms_getinfo_url18.testcase \ + wms_getinfo_url19.testcase \ + wms_getinfo_url20.testcase \ + wms_getinfo_url21.testcase \ + wms_getinfo_url22.testcase \ + wms_getinfo_url23.testcase \ + wms_getinfo_url24.testcase \ + wms_getinfo_url25.testcase \ + wms_getinfo_url26.testcase \ + wms_getinfo_url27.testcase \ + wms_getinfo_url28.testcase \ + wms_getinfo_url29.testcase \ + wms_getinfo_url30.testcase \ + wms_getinfo_url31.testcase \ + wms_getinfo_url32.testcase \ + wms_getinfo_url33.testcase \ + wms_getinfo_url34.testcase \ + wms_getinfo_url35.testcase \ + wms_getinfo_url36.testcase \ + wms_getinfo_url37.testcase \ + wms_getinfo_url38.testcase \ + wms_getinfo_url39.testcase \ + wms_getinfo_url40.testcase \ + wms_getinfo_url41.testcase \ + wms_getinfo_url42.testcase \ + wms_getmap_url1.testcase \ + wms_getmap_url2.testcase \ + wms_getmap_url3.testcase \ + wms_getmap_url4.testcase \ + wms_getmap_url5.testcase \ + wms_getmap_url6.testcase \ + wms_getmap_url7.testcase \ + wms_getmap_url8.testcase \ + wms_getmap_url9.testcase \ + wms_getmap_url10.testcase \ + wms_getmap_url11.testcase \ + wms_getmap_url12.testcase \ + wms_getmap_url13.testcase \ + wms_getmap_url14.testcase \ + wms_getmap_url15.testcase \ + wms_getmap_url16.testcase \ + wms_getmap_url17.testcase \ + wms_getmap_url18.testcase \ + wms_getmap_url19.testcase \ + wms_getmap_url20.testcase \ + wms_getmap_url21.testcase \ + wms_getmap_url22.testcase \ + wms_getmap_url23.testcase \ + wms_getmap_url24.testcase \ + wms_getmap_url25.testcase \ + wms_getmap_url26.testcase \ + wms_getmap_url27.testcase \ + wms_getmap_url28.testcase \ + wms_getmap_url29.testcase \ + wms_getmap_url30.testcase \ + wms_registergetcapab1.testcase \ + wms_registergetcapab2.testcase \ + wms_registergetcapab3.testcase \ + wms_registergetcapab4.testcase \ + wms_registergetcapab5.testcase \ + wms_registergetcapab6.testcase \ + wms_registergetcapab7.testcase \ + wms_registergetcapab8.testcase \ + wms_registergetcapab9.testcase \ + wms_registergetcapab10.testcase \ + wms_registergetcapab11.testcase \ + wms_registergetcapab12.testcase \ + wms_registergetcapab13.testcase \ + wms_registergetmap1.testcase \ + wms_registergetmap2.testcase \ + wms_registergetmap3.testcase \ + wms_registergetmap4.testcase \ + wms_registergetmap5.testcase \ + wms_registergetmap6.testcase \ + wms_registergetmap7.testcase \ + wms_registergetmap8.testcase \ + wms_registergetmap9.testcase \ + wms_registergetmap10.testcase \ + wms_registergetmap11.testcase \ + wms_registergetmap12.testcase \ + wms_registergetmap13.testcase \ + wms_registergetmap14.testcase \ + wms_registergetmap15.testcase \ + wms_registergetmap16.testcase \ + wms_registergetmap17.testcase \ + wms_registergetmap18.testcase \ + wms_registergetmap19.testcase \ + wms_registergetmap20.testcase \ + wms_registergetmap21.testcase \ + wms_registergetmap22.testcase \ + wms_registergetmap23.testcase \ + wms_registergetmap24.testcase \ + wms_registergetmap25.testcase \ + wms_registergetmap26.testcase \ + wms_registergetmap27.testcase \ + wms_registergetmap28.testcase \ + wms_registergetmap29.testcase \ + wms_registergetmap30.testcase \ + wms_registergetmap31.testcase \ + wms_registergetmap32.testcase \ + wms_registergetmap33.testcase \ + wms_registergetmap34.testcase \ + wms_registergetmap35.testcase \ + wms_registergetmap36.testcase \ + wms_registergetmap37.testcase \ + wms_registergetmap38.testcase \ + wms_registergetmap39.testcase \ + wms_registergetmap40.testcase \ + wms_registergetmap41.testcase \ + wms_registergetmap42.testcase \ + wms_registergetmap43.testcase \ + wms_registergetmap44.testcase \ + wms_registergetmap45.testcase \ + wms_registergetmap46.testcase \ + wms_registergetmap47.testcase \ + wms_registergetmap48.testcase \ + wms_registergetmap49.testcase \ + wms_registergetmap50.testcase \ + wms_registergetmap51.testcase \ + wms_registergetmap52.testcase \ + wms_registergetmap53.testcase \ + wms_registergetmap54.testcase \ + wms_registergetmap55.testcase \ + wms_registergetmap56.testcase \ + wms_registergetmap57.testcase \ + wms_registergetmap58.testcase \ + wms_registergetmap59.testcase \ + wms_registergetmap60.testcase \ + wms_registergetmap61.testcase \ + wms_registergetmap62.testcase \ + wms_registergetmap63.testcase \ + wms_registergetmap64.testcase \ + wms_registergetmap65.testcase \ + wms_registergetmap66.testcase \ + wms_registergetmap67.testcase \ + wms_registergetmap68.testcase \ + wms_registergetmap69.testcase \ + wms_registergetmap70.testcase \ + wms_registergetmap71.testcase \ + wms_registergetmap72.testcase \ + wms_registergetmap73.testcase \ + wms_registergetmap74.testcase \ + wms_registergetmap75.testcase \ + wms_registergetmap76.testcase \ + wms_registergetmap77.testcase \ + wms_registergetmap78.testcase \ + wms_registergetmap79.testcase \ + wms_registergetmap80.testcase \ + wms_registergetmap81.testcase \ + wms_registergetmap82.testcase \ + wms_registergetmap83.testcase \ + wms_registergetmap84.testcase \ + wms_registergetmap85.testcase \ + wms_registergetmap86.testcase \ + wms_registersetting1.testcase \ + wms_registersetting2.testcase \ + wms_registersetting3.testcase \ + wms_registersetting4.testcase \ + wms_registersetting5.testcase \ + wms_registersetting6.testcase \ + wms_registersetting7.testcase \ + wms_registersetting8.testcase \ + wms_registersetting9.testcase \ + wms_registersetting10.testcase \ + wms_registersetting11.testcase \ + wms_registersetting12.testcase \ + wms_registersetting13.testcase \ + wms_registersetting14.testcase \ + wms_registersetting15.testcase \ + wms_registersetting16.testcase \ + wms_registersetting17.testcase \ + wms_registersetting18.testcase \ + wms_registersetting19.testcase \ + wms_registersetting20.testcase \ + wms_registersetting21.testcase \ + wms_registersetting22.testcase \ + wms_registersrs1.testcase \ + wms_registersrs2.testcase \ + wms_registersrs3.testcase \ + wms_registersrs4.testcase \ + wms_registersrs5.testcase \ + wms_registersrs6.testcase \ + wms_registersrs7.testcase \ + wms_registersrs8.testcase \ + wms_registersrs9.testcase \ + wms_registersrs10.testcase \ + wms_registersrs11.testcase \ + wms_registersrs12.testcase \ + wms_registersrs13.testcase \ + wms_registersrs14.testcase \ + wms_registersrs15.testcase \ + wms_registersrs16.testcase \ + wms_registersrs17.testcase \ + wms_registersrs18.testcase \ + wms_registersrs19.testcase \ + wms_registersrs20.testcase \ + wms_registersrs21.testcase \ + wms_registersrs22.testcase \ + wms_registersrs23.testcase \ + wms_registersrs24.testcase \ + wms_registersrs25.testcase \ + wms_registersrs26.testcase \ + wms_registersrs27.testcase \ + wms_registersrs28.testcase \ + wms_registersrs29.testcase \ + wms_setgetcapabinfo1.testcase \ + wms_setgetcapabinfo2.testcase \ + wms_setgetcapabinfo3.testcase \ + wms_setgetcapabinfo4.testcase \ + wms_setgetcapabinfo5.testcase \ + wms_setgetcapabinfo6.testcase \ + wms_setgetcapabinfo7.testcase \ + wms_setgetcapabinfo8.testcase \ + wms_setgetcapabinfo9.testcase \ + wms_setgetcapabinfo10.testcase \ + wms_setgetcapabinfo11.testcase \ + wms_setgetcapabinfo12.testcase \ + wms_setgetcapabinfo13.testcase \ + wms_setcopyright1.testcase \ + wms_setcopyright2.testcase \ + wms_setcopyright3.testcase \ + wms_setcopyright4.testcase \ + wms_setcopyright5.testcase \ + wms_setcopyright6.testcase \ + wms_setcopyright7.testcase \ + wms_setcopyright8.testcase \ + wms_setcopyright9.testcase \ + wms_setcopyright10.testcase \ + wms_setcopyright11.testcase \ + wms_setcopyright12.testcase \ + wms_setcopyright13.testcase \ + wms_setcopyright14.testcase \ + wms_setcopyright15.testcase \ + wms_setcopyright16.testcase \ + wms_setcopyright17.testcase \ + wms_setcopyright18.testcase \ + wms_setcopyright19.testcase \ + wms_setgetmapinfo1.testcase \ + wms_setgetmapinfo2.testcase \ + wms_setgetmapinfo3.testcase \ + wms_setgetmapinfo4.testcase \ + wms_setgetmapinfo5.testcase \ + wms_setgetmapinfo6.testcase \ + wms_setgetmapinfo7.testcase \ + wms_setgetmapinfo8.testcase \ + wms_setgetmapinfo9.testcase \ + wms_setgetmapinfo10.testcase \ + wms_setgetmapinfo11.testcase \ + wms_setgetmapinfo12.testcase \ + wms_setgetmapinfo13.testcase \ + wms_setgetmapinfo14.testcase \ + wms_setgetmapinfo15.testcase \ + wms_setgetmapinfo16.testcase \ + wms_setgetmapinfo17.testcase \ + wms_unregistergetcapab1.testcase \ + wms_unregistergetcapab2.testcase \ + wms_unregistergetcapab3.testcase \ + wms_unregistergetcapab4.testcase \ + wms_unregistergetcapab5.testcase \ + wms_unregistergetmap1.testcase \ + wms_unregistergetmap2.testcase \ + wms_unregistergetmap3.testcase \ + wms_unregistergetmap4.testcase \ + wms_unregistergetmap5.testcase \ + wms_unregistergetmap6.testcase \ + wms_unregistergetmap7.testcase \ + wms_unregistergetmap8.testcase \ + wms_unregistergetmap9.testcase \ + wms_unregistersetting1.testcase \ + wms_unregistersetting2.testcase \ + wms_unregistersetting3.testcase \ + wms_unregistersetting4.testcase \ + wms_unregistersetting5.testcase \ + wms_unregistersetting6.testcase \ + wms_unregistersetting7.testcase \ + wms_unregistersetting8.testcase \ + wms_unregistersetting9.testcase \ + wms_unregistersetting10.testcase \ + wms_unregistersetting11.testcase \ + wms_unregistersetting12.testcase \ + wms_unregistersetting13.testcase \ + wms_unregistersetting14.testcase \ + wms_unregistersetting15.testcase \ + wms_unregistersetting16.testcase \ + wms_unregistersetting17.testcase \ + wms_unregistersrs1.testcase \ + wms_unregistersrs2.testcase \ + wms_unregistersrs3.testcase \ + wms_unregistersrs4.testcase \ + wms_unregistersrs5.testcase \ + wms_unregistersrs6.testcase \ + wms_unregistersrs7.testcase \ + wms_unregistersrs8.testcase \ + wms_unregistersrs9.testcase \ + wms_unregistersrs10.testcase \ + wms_unregistersrs11.testcase \ + wms_unregistersrs12.testcase \ + wms_unregistersrs13.testcase + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/sql_stmt_tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/sql_stmt_tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: test/sql_stmt_tests/Makefile.am ================================================================== --- test/sql_stmt_tests/Makefile.am +++ test/sql_stmt_tests/Makefile.am @@ -25,10 +25,25 @@ addpoint5.testcase \ addpoint6.testcase \ addpoint7.testcase \ addpoint8.testcase \ addpoint9.testcase \ + addmeasure1.testcase \ + addmeasure2.testcase \ + addmeasure3.testcase \ + addmeasure4.testcase \ + addmeasure5.testcase \ + addmeasure6.testcase \ + addmeasure7.testcase \ + addmeasure8.testcase \ + addmeasure9.testcase \ + addmeasure10.testcase \ + addmeasure11.testcase \ + addmeasure12.testcase \ + addmeasure13.testcase \ + addmeasure14.testcase \ + addmeasure15.testcase \ asbinary10.testcase \ asbinary11.testcase \ asbinary12.testcase \ asbinary13.testcase \ asbinary14.testcase \ @@ -433,17 +448,20 @@ casttoxyzm2.testcase \ casttoxyzm3.testcase \ casttoxyzm4.testcase \ casttoxyzm5.testcase \ casttoxyzm6.testcase \ + checkdupl1.testcase \ + checkdupl2.testcase \ checkspatialmetadata1.testcase \ checkspatialmetadata2.testcase \ checkspatialmetadata3.testcase \ - checkdupl1.testcase \ - checkdupl2.testcase \ checkspatialmetadata4.testcase \ checkspatialmetadata5.testcase \ + checkspatialmetadata6.testcase \ + checkspatialmetadata7.testcase \ + checkspatialmetadata8.testcase \ clonetable1.testcase \ clonetable2.testcase \ clonetable3.testcase \ clonetable4.testcase \ clonetable5.testcase \ @@ -624,17 +642,44 @@ compressgeometry6.testcase \ compressgeometry7.testcase \ compressgeometry8.testcase \ compressgeometry9.testcase \ createrastercoverages.testcase \ - createvectorcoverages.testcase \ createuuid1.testcase \ - decodeurl1.testcase \ - decodeurl2.testcase \ - decodeurl3.testcase \ - decodeurl4.testcase \ - decodeurl5.testcase \ + datalic_register1.testcase \ + datalic_register2.testcase \ + datalic_register3.testcase \ + datalic_register4.testcase \ + datalic_register5.testcase \ + datalic_register6.testcase \ + datalic_register7.testcase \ + datalic_register8.testcase \ + datalic_register9.testcase \ + datalic_register10.testcase \ + datalic_rename1.testcase \ + datalic_rename2.testcase \ + datalic_rename3.testcase \ + datalic_rename4.testcase \ + datalic_rename5.testcase \ + datalic_rename6.testcase \ + datalic_rename7.testcase \ + datalic_rename8.testcase \ + datalic_rename9.testcase \ + datalic_seturl1.testcase \ + datalic_seturl2.testcase \ + datalic_seturl3.testcase \ + datalic_seturl4.testcase \ + datalic_seturl5.testcase \ + datalic_seturl6.testcase \ + datalic_seturl7.testcase \ + datalic_seturl8.testcase \ + datalic_seturl9.testcase \ + datalic_unregister1.testcase \ + datalic_unregister2.testcase \ + datalic_unregister3.testcase \ + datalic_unregister4.testcase \ + datalic_unregister5.testcase \ dirfrompath1.testcase \ dirfrompath2.testcase \ dirfrompath3.testcase \ dirfrompath4.testcase \ dirfrompath5.testcase \ @@ -694,16 +739,22 @@ elemgeo4.testcase \ elemgeo5.testcase \ elemgeo6.testcase \ elemgeo7.testcase \ elemgeo8.testcase \ + elemgeo9.testcase \ + elemgeo10.testcase \ + elemgeo11.testcase \ + elemgeo12.testcase \ + elemgeo13.testcase \ + elemgeo14.testcase \ + elemgeo15.testcase \ + elemgeo16.testcase \ + elemgeo17.testcase \ + elemgeo18.testcase \ + elemgeo19.testcase \ emptyfile.txt \ - encodeurl1.testcase \ - encodeurl2.testcase \ - encodeurl3.testcase \ - encodeurl4.testcase \ - encodeurl5.testcase \ endpoint1.testcase \ ensureclosedrings1.testcase \ ensureclosedrings2.testcase \ ensureclosedrings3.testcase \ ensureclosedrings4.testcase \ @@ -765,10 +816,16 @@ extractmultipolygon2.testcase \ extractmultipolygon3.testcase \ fath_m.testcase \ fdo_ogr1.testcase \ fdo_ogr2.testcase \ + fdo_ogr3.testcase \ + fdo_ogr4.testcase \ + fdo_ogr5.testcase \ + fdo_ogr6.testcase \ + fdo_ogr7.testcase \ + fdo_ogr8.testcase \ fdo-wkb.sqlite_RO \ forcenull10.testcase \ forcenull11.testcase \ forcenull12.testcase \ forcenull13.testcase \ @@ -1292,10 +1349,15 @@ getmimetype1.testcase \ getmimetype2.testcase \ getmimetype3.testcase \ getmimetype4.testcase \ getmimetype5.testcase \ + getshapefileextent1.testcase \ + getshapefileextent2.testcase \ + getshapefileextent3.testcase \ + getshapefileextent4.testcase \ + getshapefileextent5.testcase \ gml10.testcase \ gml11.testcase \ gml12.testcase \ gml13.testcase \ gml14.testcase \ @@ -1337,19 +1399,35 @@ ismeasured1.testcase \ ismeasured2.testcase \ ismeasured3.testcase \ ismeasured4.testcase \ ismeasured5.testcase \ - ismeasured6.testcase \ + ispolygccw1.testcase \ + ispolygccw2.testcase \ + ispolygccw3.testcase \ + ispolygccw4.testcase \ + ispolygccw5.testcase \ + ispolygcw1.testcase \ + ispolygcw2.testcase \ + ispolygcw3.testcase \ + ispolygcw4.testcase \ + ispolygcw5.testcase \ ispopulatedcoverage1.testcase \ ispopulatedcoverage2.testcase \ + ispopulatedcoverage3.testcase \ checkfontfacename1.testcase \ checkfontfacename2.testcase \ checkfontfacename3.testcase \ getfontfamily.testcase \ isfontbold.testcase \ isfontitalic.testcase \ + islowascii1.testcase \ + islowascii2.testcase \ + islowascii3.testcase \ + islowascii4.testcase \ + islowascii5.testcase \ + islowascii6.testcase \ isvalidfont1.testcase \ isvalidfont2.testcase \ isvalidnodata1.testcase \ isvalidnodata2.testcase \ isvalidnodata3.testcase \ @@ -1362,17 +1440,20 @@ isvalidrasterstats3.testcase \ isvalidrasterstats4.testcase \ isvalidrasterstats5.testcase \ isvalidrasterstats6.testcase \ isvalidrasterstats7.testcase \ + isvalidrasterstats8.testcase \ isvalidrastertile1.testcase \ isvalidrastertile2.testcase \ isvalidrastertile3.testcase \ isvalidrastertile4.testcase \ isvalidrastertile5.testcase \ isvalidrastertile6.testcase \ - isXblob5.testcase \ + isvalidrastertile7.testcase \ + isvalidrastertile8.testcase \ + isvalidrastertile9.testcase \ isXblob6.testcase \ isXblob7.testcase \ k3b-icon.png \ km_m.testcase \ ktorrent_grad1.jpg \ @@ -1804,10 +1885,22 @@ pointn5.testcase \ pointn6.testcase \ pointn7.testcase \ pointn8.testcase \ pointn9.testcase \ + polygccw1.testcase \ + polygccw2.testcase \ + polygccw3.testcase \ + polygccw4.testcase \ + polygccw5.testcase \ + polygccw6.testcase \ + polygcw1.testcase \ + polygcw2.testcase \ + polygcw3.testcase \ + polygcw4.testcase \ + polygcw5.testcase \ + polygcw6.testcase \ polygonfromtext1.testcase \ polygonfromtext2.testcase \ reflectcoords10.testcase \ reflectcoords11.testcase \ reflectcoords12.testcase \ @@ -2660,10 +2753,29 @@ wms_setgetcapabinfo9.testcase \ wms_setgetcapabinfo10.testcase \ wms_setgetcapabinfo11.testcase \ wms_setgetcapabinfo12.testcase \ wms_setgetcapabinfo13.testcase \ + wms_setcopyright1.testcase \ + wms_setcopyright2.testcase \ + wms_setcopyright3.testcase \ + wms_setcopyright4.testcase \ + wms_setcopyright5.testcase \ + wms_setcopyright6.testcase \ + wms_setcopyright7.testcase \ + wms_setcopyright8.testcase \ + wms_setcopyright9.testcase \ + wms_setcopyright10.testcase \ + wms_setcopyright11.testcase \ + wms_setcopyright12.testcase \ + wms_setcopyright13.testcase \ + wms_setcopyright14.testcase \ + wms_setcopyright15.testcase \ + wms_setcopyright16.testcase \ + wms_setcopyright17.testcase \ + wms_setcopyright18.testcase \ + wms_setcopyright19.testcase \ wms_setgetmapinfo1.testcase \ wms_setgetmapinfo2.testcase \ wms_setgetmapinfo3.testcase \ wms_setgetmapinfo4.testcase \ wms_setgetmapinfo5.testcase \ Index: test/sql_stmt_tests/Makefile.in ================================================================== --- test/sql_stmt_tests/Makefile.in +++ test/sql_stmt_tests/Makefile.in @@ -277,10 +277,25 @@ addpoint5.testcase \ addpoint6.testcase \ addpoint7.testcase \ addpoint8.testcase \ addpoint9.testcase \ + addmeasure1.testcase \ + addmeasure2.testcase \ + addmeasure3.testcase \ + addmeasure4.testcase \ + addmeasure5.testcase \ + addmeasure6.testcase \ + addmeasure7.testcase \ + addmeasure8.testcase \ + addmeasure9.testcase \ + addmeasure10.testcase \ + addmeasure11.testcase \ + addmeasure12.testcase \ + addmeasure13.testcase \ + addmeasure14.testcase \ + addmeasure15.testcase \ asbinary10.testcase \ asbinary11.testcase \ asbinary12.testcase \ asbinary13.testcase \ asbinary14.testcase \ @@ -685,17 +700,20 @@ casttoxyzm2.testcase \ casttoxyzm3.testcase \ casttoxyzm4.testcase \ casttoxyzm5.testcase \ casttoxyzm6.testcase \ + checkdupl1.testcase \ + checkdupl2.testcase \ checkspatialmetadata1.testcase \ checkspatialmetadata2.testcase \ checkspatialmetadata3.testcase \ - checkdupl1.testcase \ - checkdupl2.testcase \ checkspatialmetadata4.testcase \ checkspatialmetadata5.testcase \ + checkspatialmetadata6.testcase \ + checkspatialmetadata7.testcase \ + checkspatialmetadata8.testcase \ clonetable1.testcase \ clonetable2.testcase \ clonetable3.testcase \ clonetable4.testcase \ clonetable5.testcase \ @@ -876,17 +894,44 @@ compressgeometry6.testcase \ compressgeometry7.testcase \ compressgeometry8.testcase \ compressgeometry9.testcase \ createrastercoverages.testcase \ - createvectorcoverages.testcase \ createuuid1.testcase \ - decodeurl1.testcase \ - decodeurl2.testcase \ - decodeurl3.testcase \ - decodeurl4.testcase \ - decodeurl5.testcase \ + datalic_register1.testcase \ + datalic_register2.testcase \ + datalic_register3.testcase \ + datalic_register4.testcase \ + datalic_register5.testcase \ + datalic_register6.testcase \ + datalic_register7.testcase \ + datalic_register8.testcase \ + datalic_register9.testcase \ + datalic_register10.testcase \ + datalic_rename1.testcase \ + datalic_rename2.testcase \ + datalic_rename3.testcase \ + datalic_rename4.testcase \ + datalic_rename5.testcase \ + datalic_rename6.testcase \ + datalic_rename7.testcase \ + datalic_rename8.testcase \ + datalic_rename9.testcase \ + datalic_seturl1.testcase \ + datalic_seturl2.testcase \ + datalic_seturl3.testcase \ + datalic_seturl4.testcase \ + datalic_seturl5.testcase \ + datalic_seturl6.testcase \ + datalic_seturl7.testcase \ + datalic_seturl8.testcase \ + datalic_seturl9.testcase \ + datalic_unregister1.testcase \ + datalic_unregister2.testcase \ + datalic_unregister3.testcase \ + datalic_unregister4.testcase \ + datalic_unregister5.testcase \ dirfrompath1.testcase \ dirfrompath2.testcase \ dirfrompath3.testcase \ dirfrompath4.testcase \ dirfrompath5.testcase \ @@ -946,16 +991,22 @@ elemgeo4.testcase \ elemgeo5.testcase \ elemgeo6.testcase \ elemgeo7.testcase \ elemgeo8.testcase \ + elemgeo9.testcase \ + elemgeo10.testcase \ + elemgeo11.testcase \ + elemgeo12.testcase \ + elemgeo13.testcase \ + elemgeo14.testcase \ + elemgeo15.testcase \ + elemgeo16.testcase \ + elemgeo17.testcase \ + elemgeo18.testcase \ + elemgeo19.testcase \ emptyfile.txt \ - encodeurl1.testcase \ - encodeurl2.testcase \ - encodeurl3.testcase \ - encodeurl4.testcase \ - encodeurl5.testcase \ endpoint1.testcase \ ensureclosedrings1.testcase \ ensureclosedrings2.testcase \ ensureclosedrings3.testcase \ ensureclosedrings4.testcase \ @@ -1017,10 +1068,16 @@ extractmultipolygon2.testcase \ extractmultipolygon3.testcase \ fath_m.testcase \ fdo_ogr1.testcase \ fdo_ogr2.testcase \ + fdo_ogr3.testcase \ + fdo_ogr4.testcase \ + fdo_ogr5.testcase \ + fdo_ogr6.testcase \ + fdo_ogr7.testcase \ + fdo_ogr8.testcase \ fdo-wkb.sqlite_RO \ forcenull10.testcase \ forcenull11.testcase \ forcenull12.testcase \ forcenull13.testcase \ @@ -1544,10 +1601,15 @@ getmimetype1.testcase \ getmimetype2.testcase \ getmimetype3.testcase \ getmimetype4.testcase \ getmimetype5.testcase \ + getshapefileextent1.testcase \ + getshapefileextent2.testcase \ + getshapefileextent3.testcase \ + getshapefileextent4.testcase \ + getshapefileextent5.testcase \ gml10.testcase \ gml11.testcase \ gml12.testcase \ gml13.testcase \ gml14.testcase \ @@ -1589,19 +1651,35 @@ ismeasured1.testcase \ ismeasured2.testcase \ ismeasured3.testcase \ ismeasured4.testcase \ ismeasured5.testcase \ - ismeasured6.testcase \ + ispolygccw1.testcase \ + ispolygccw2.testcase \ + ispolygccw3.testcase \ + ispolygccw4.testcase \ + ispolygccw5.testcase \ + ispolygcw1.testcase \ + ispolygcw2.testcase \ + ispolygcw3.testcase \ + ispolygcw4.testcase \ + ispolygcw5.testcase \ ispopulatedcoverage1.testcase \ ispopulatedcoverage2.testcase \ + ispopulatedcoverage3.testcase \ checkfontfacename1.testcase \ checkfontfacename2.testcase \ checkfontfacename3.testcase \ getfontfamily.testcase \ isfontbold.testcase \ isfontitalic.testcase \ + islowascii1.testcase \ + islowascii2.testcase \ + islowascii3.testcase \ + islowascii4.testcase \ + islowascii5.testcase \ + islowascii6.testcase \ isvalidfont1.testcase \ isvalidfont2.testcase \ isvalidnodata1.testcase \ isvalidnodata2.testcase \ isvalidnodata3.testcase \ @@ -1614,17 +1692,20 @@ isvalidrasterstats3.testcase \ isvalidrasterstats4.testcase \ isvalidrasterstats5.testcase \ isvalidrasterstats6.testcase \ isvalidrasterstats7.testcase \ + isvalidrasterstats8.testcase \ isvalidrastertile1.testcase \ isvalidrastertile2.testcase \ isvalidrastertile3.testcase \ isvalidrastertile4.testcase \ isvalidrastertile5.testcase \ isvalidrastertile6.testcase \ - isXblob5.testcase \ + isvalidrastertile7.testcase \ + isvalidrastertile8.testcase \ + isvalidrastertile9.testcase \ isXblob6.testcase \ isXblob7.testcase \ k3b-icon.png \ km_m.testcase \ ktorrent_grad1.jpg \ @@ -2056,10 +2137,22 @@ pointn5.testcase \ pointn6.testcase \ pointn7.testcase \ pointn8.testcase \ pointn9.testcase \ + polygccw1.testcase \ + polygccw2.testcase \ + polygccw3.testcase \ + polygccw4.testcase \ + polygccw5.testcase \ + polygccw6.testcase \ + polygcw1.testcase \ + polygcw2.testcase \ + polygcw3.testcase \ + polygcw4.testcase \ + polygcw5.testcase \ + polygcw6.testcase \ polygonfromtext1.testcase \ polygonfromtext2.testcase \ reflectcoords10.testcase \ reflectcoords11.testcase \ reflectcoords12.testcase \ @@ -2912,10 +3005,29 @@ wms_setgetcapabinfo9.testcase \ wms_setgetcapabinfo10.testcase \ wms_setgetcapabinfo11.testcase \ wms_setgetcapabinfo12.testcase \ wms_setgetcapabinfo13.testcase \ + wms_setcopyright1.testcase \ + wms_setcopyright2.testcase \ + wms_setcopyright3.testcase \ + wms_setcopyright4.testcase \ + wms_setcopyright5.testcase \ + wms_setcopyright6.testcase \ + wms_setcopyright7.testcase \ + wms_setcopyright8.testcase \ + wms_setcopyright9.testcase \ + wms_setcopyright10.testcase \ + wms_setcopyright11.testcase \ + wms_setcopyright12.testcase \ + wms_setcopyright13.testcase \ + wms_setcopyright14.testcase \ + wms_setcopyright15.testcase \ + wms_setcopyright16.testcase \ + wms_setcopyright17.testcase \ + wms_setcopyright18.testcase \ + wms_setcopyright19.testcase \ wms_setgetmapinfo1.testcase \ wms_setgetmapinfo2.testcase \ wms_setgetmapinfo3.testcase \ wms_setgetmapinfo4.testcase \ wms_setgetmapinfo5.testcase \ ADDED test/sql_stmt_tests/addmeasure1.testcase Index: test/sql_stmt_tests/addmeasure1.testcase ================================================================== --- test/sql_stmt_tests/addmeasure1.testcase +++ test/sql_stmt_tests/addmeasure1.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - NULL geometry +:memory: #use in-memory database +SELECT ST_AddMeasure(NULL, 10.0, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(NULL, 10.0, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure10.testcase Index: test/sql_stmt_tests/addmeasure10.testcase ================================================================== --- test/sql_stmt_tests/addmeasure10.testcase +++ test/sql_stmt_tests/addmeasure10.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - BLOB M-start +:memory: #use in-memory database +SELECT ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), zeroblob(10), 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), zeroblob(10), 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure11.testcase Index: test/sql_stmt_tests/addmeasure11.testcase ================================================================== --- test/sql_stmt_tests/addmeasure11.testcase +++ test/sql_stmt_tests/addmeasure11.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - NULL M-end +:memory: #use in-memory database +SELECT ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 10.0, NULL) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 10.0, NULL) +(NULL) ADDED test/sql_stmt_tests/addmeasure12.testcase Index: test/sql_stmt_tests/addmeasure12.testcase ================================================================== --- test/sql_stmt_tests/addmeasure12.testcase +++ test/sql_stmt_tests/addmeasure12.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Text M-end +:memory: #use in-memory database +SELECT ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 10.0, 'end') +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 10.0, 'end') +(NULL) ADDED test/sql_stmt_tests/addmeasure13.testcase Index: test/sql_stmt_tests/addmeasure13.testcase ================================================================== --- test/sql_stmt_tests/addmeasure13.testcase +++ test/sql_stmt_tests/addmeasure13.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - BLOB M-end +:memory: #use in-memory database +SELECT ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 10.0, zeroblob(10)) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 10.0, zeroblob(10)) +(NULL) ADDED test/sql_stmt_tests/addmeasure14.testcase Index: test/sql_stmt_tests/addmeasure14.testcase ================================================================== --- test/sql_stmt_tests/addmeasure14.testcase +++ test/sql_stmt_tests/addmeasure14.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Double M-start and M-end +:memory: #use in-memory database +SELECT ST_AsText(ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 100.0, 400.0)) +1 # rows (not including the header row) +1 # columns +ST_AsText(ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 100.0, 400.0)) +LINESTRING M(0 0 100, 1 0 200, 1 1 300, 0 1 400) ADDED test/sql_stmt_tests/addmeasure15.testcase Index: test/sql_stmt_tests/addmeasure15.testcase ================================================================== --- test/sql_stmt_tests/addmeasure15.testcase +++ test/sql_stmt_tests/addmeasure15.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Int M-start and M-end +:memory: #use in-memory database +SELECT ST_AsText(ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 100, 400)) +1 # rows (not including the header row) +1 # columns +ST_AsText(ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 100, 400)) +LINESTRING M(0 0 100, 1 0 200, 1 1 300, 0 1 400) ADDED test/sql_stmt_tests/addmeasure2.testcase Index: test/sql_stmt_tests/addmeasure2.testcase ================================================================== --- test/sql_stmt_tests/addmeasure2.testcase +++ test/sql_stmt_tests/addmeasure2.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Int geometry +:memory: #use in-memory database +SELECT ST_AddMeasure(1, 10.0, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(1, 10.0, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure3.testcase Index: test/sql_stmt_tests/addmeasure3.testcase ================================================================== --- test/sql_stmt_tests/addmeasure3.testcase +++ test/sql_stmt_tests/addmeasure3.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Double geometry +:memory: #use in-memory database +SELECT ST_AddMeasure(1.5, 10.0, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(1.5, 10.0, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure4.testcase Index: test/sql_stmt_tests/addmeasure4.testcase ================================================================== --- test/sql_stmt_tests/addmeasure4.testcase +++ test/sql_stmt_tests/addmeasure4.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Text geometry +:memory: #use in-memory database +SELECT ST_AddMeasure('geom', 10.0, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure('geom', 10.0, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure5.testcase Index: test/sql_stmt_tests/addmeasure5.testcase ================================================================== --- test/sql_stmt_tests/addmeasure5.testcase +++ test/sql_stmt_tests/addmeasure5.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Invalid Blob geometry +:memory: #use in-memory database +SELECT ST_AddMeasure(zeroblob(10), 10.0, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(zeroblob(10), 10.0, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure6.testcase Index: test/sql_stmt_tests/addmeasure6.testcase ================================================================== --- test/sql_stmt_tests/addmeasure6.testcase +++ test/sql_stmt_tests/addmeasure6.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Invalid Point geometry +:memory: #use in-memory database +SELECT ST_AddMeasure(MakePoint(1, 2), 10.0, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(MakePoint(1, 2), 10.0, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure7.testcase Index: test/sql_stmt_tests/addmeasure7.testcase ================================================================== --- test/sql_stmt_tests/addmeasure7.testcase +++ test/sql_stmt_tests/addmeasure7.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Invalid Polygon geometry +:memory: #use in-memory database +SELECT ST_AddMeasure(GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'), 10.0, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(GeomFromText('POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'), 10.0, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure8.testcase Index: test/sql_stmt_tests/addmeasure8.testcase ================================================================== --- test/sql_stmt_tests/addmeasure8.testcase +++ test/sql_stmt_tests/addmeasure8.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - NULL M-start +:memory: #use in-memory database +SELECT ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), NULL, 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), NULL, 20.0) +(NULL) ADDED test/sql_stmt_tests/addmeasure9.testcase Index: test/sql_stmt_tests/addmeasure9.testcase ================================================================== --- test/sql_stmt_tests/addmeasure9.testcase +++ test/sql_stmt_tests/addmeasure9.testcase @@ -0,0 +1,7 @@ +ST_AddMeasure() - Text M-start +:memory: #use in-memory database +SELECT ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 'start', 20.0) +1 # rows (not including the header row) +1 # columns +ST_AddMeasure(GeomFromText('LINESTRING(0 0, 1 0, 1 1, 0 1)'), 'start', 20.0) +(NULL) ADDED test/sql_stmt_tests/checkspatialmetadata6.testcase Index: test/sql_stmt_tests/checkspatialmetadata6.testcase ================================================================== --- test/sql_stmt_tests/checkspatialmetadata6.testcase +++ test/sql_stmt_tests/checkspatialmetadata6.testcase @@ -0,0 +1,7 @@ +checkspatialmetadata +:memory: #use in-memory database +SELECT CheckSpatialMetaData('main') +1 # rows (not including the header row) +1 # columns +CheckSpatialMetaData('main') +3 ADDED test/sql_stmt_tests/checkspatialmetadata7.testcase Index: test/sql_stmt_tests/checkspatialmetadata7.testcase ================================================================== --- test/sql_stmt_tests/checkspatialmetadata7.testcase +++ test/sql_stmt_tests/checkspatialmetadata7.testcase @@ -0,0 +1,7 @@ +checkspatialmetadata +:memory: #use in-memory database +SELECT CheckSpatialMetaData(1) +1 # rows (not including the header row) +1 # columns +CheckSpatialMetaData(1) +-1 ADDED test/sql_stmt_tests/checkspatialmetadata8.testcase Index: test/sql_stmt_tests/checkspatialmetadata8.testcase ================================================================== --- test/sql_stmt_tests/checkspatialmetadata8.testcase +++ test/sql_stmt_tests/checkspatialmetadata8.testcase @@ -0,0 +1,7 @@ +checkspatialmetadata - FDO +sql_stmt_tests/fdo-wkb.sqlite_RO #use special test database, read only +SELECT CheckSpatialMetaData('main') +1 # rows (not including the header row) +1 # columns +CheckSpatialMetaData('main') +2 DELETED test/sql_stmt_tests/createvectorcoverages.testcase Index: test/sql_stmt_tests/createvectorcoverages.testcase ================================================================== --- test/sql_stmt_tests/createvectorcoverages.testcase +++ test/sql_stmt_tests/createvectorcoverages.testcase @@ -1,8 +0,0 @@ -CreateVectorsCoveragesTables -NEW:memory: #use in-memory database -SELECT CreateVectorCoveragesTables(); -1 # rows (not including the header row) -1 # columns -CreateVectorCoveragesTables() -1 - ADDED test/sql_stmt_tests/datalic_register1.testcase Index: test/sql_stmt_tests/datalic_register1.testcase ================================================================== --- test/sql_stmt_tests/datalic_register1.testcase +++ test/sql_stmt_tests/datalic_register1.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - NULL license +:memory: #use in-memory database +SELECT RegisterDataLicense(NULL) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense(NULL) +-1 ADDED test/sql_stmt_tests/datalic_register10.testcase Index: test/sql_stmt_tests/datalic_register10.testcase ================================================================== --- test/sql_stmt_tests/datalic_register10.testcase +++ test/sql_stmt_tests/datalic_register10.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - Text url +:memory: #use in-memory database +SELECT RegisterDataLicense('alicense', 'anurl') +1 # rows (not including the header row) +1 # columns +RegisterDataLicense('alicense', 'anurl') +1 ADDED test/sql_stmt_tests/datalic_register2.testcase Index: test/sql_stmt_tests/datalic_register2.testcase ================================================================== --- test/sql_stmt_tests/datalic_register2.testcase +++ test/sql_stmt_tests/datalic_register2.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - Int license +:memory: #use in-memory database +SELECT RegisterDataLicense(1) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense(1) +-1 ADDED test/sql_stmt_tests/datalic_register3.testcase Index: test/sql_stmt_tests/datalic_register3.testcase ================================================================== --- test/sql_stmt_tests/datalic_register3.testcase +++ test/sql_stmt_tests/datalic_register3.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - Double license +:memory: #use in-memory database +SELECT RegisterDataLicense(1.6) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense(1.6) +-1 ADDED test/sql_stmt_tests/datalic_register4.testcase Index: test/sql_stmt_tests/datalic_register4.testcase ================================================================== --- test/sql_stmt_tests/datalic_register4.testcase +++ test/sql_stmt_tests/datalic_register4.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - BLOB license +:memory: #use in-memory database +SELECT RegisterDataLicense(zeroblob(10)) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense(zeroblob(10)) +-1 ADDED test/sql_stmt_tests/datalic_register5.testcase Index: test/sql_stmt_tests/datalic_register5.testcase ================================================================== --- test/sql_stmt_tests/datalic_register5.testcase +++ test/sql_stmt_tests/datalic_register5.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - Text license +:memory: #use in-memory database +SELECT RegisterDataLicense('some license') +1 # rows (not including the header row) +1 # columns +RegisterDataLicense('some license') +1 ADDED test/sql_stmt_tests/datalic_register6.testcase Index: test/sql_stmt_tests/datalic_register6.testcase ================================================================== --- test/sql_stmt_tests/datalic_register6.testcase +++ test/sql_stmt_tests/datalic_register6.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - NULL url +:memory: #use in-memory database +SELECT RegisterDataLicense('some license', NULL) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense('some license', NULL) +-1 ADDED test/sql_stmt_tests/datalic_register7.testcase Index: test/sql_stmt_tests/datalic_register7.testcase ================================================================== --- test/sql_stmt_tests/datalic_register7.testcase +++ test/sql_stmt_tests/datalic_register7.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - Int url +:memory: #use in-memory database +SELECT RegisterDataLicense('some license', 1) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense('some license', 1) +-1 ADDED test/sql_stmt_tests/datalic_register8.testcase Index: test/sql_stmt_tests/datalic_register8.testcase ================================================================== --- test/sql_stmt_tests/datalic_register8.testcase +++ test/sql_stmt_tests/datalic_register8.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - Double url +:memory: #use in-memory database +SELECT RegisterDataLicense('some license', 1.5) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense('some license', 1.5) +-1 ADDED test/sql_stmt_tests/datalic_register9.testcase Index: test/sql_stmt_tests/datalic_register9.testcase ================================================================== --- test/sql_stmt_tests/datalic_register9.testcase +++ test/sql_stmt_tests/datalic_register9.testcase @@ -0,0 +1,7 @@ +RegisterDataLicense() - BLOB url +:memory: #use in-memory database +SELECT RegisterDataLicense('some license', zeroblob(4)) +1 # rows (not including the header row) +1 # columns +RegisterDataLicense('some license', zeroblob(4)) +-1 ADDED test/sql_stmt_tests/datalic_rename1.testcase Index: test/sql_stmt_tests/datalic_rename1.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename1.testcase +++ test/sql_stmt_tests/datalic_rename1.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - NULL license +:memory: #use in-memory database +SELECT RenameDataLicense(NULL, 'new') +1 # rows (not including the header row) +1 # columns +RenameDataLicense(NULL, 'new') +-1 ADDED test/sql_stmt_tests/datalic_rename2.testcase Index: test/sql_stmt_tests/datalic_rename2.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename2.testcase +++ test/sql_stmt_tests/datalic_rename2.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - Int old-name +:memory: #use in-memory database +SELECT RenameDataLicense(1, 'new') +1 # rows (not including the header row) +1 # columns +RenameDataLicense(1, 'new') +-1 ADDED test/sql_stmt_tests/datalic_rename3.testcase Index: test/sql_stmt_tests/datalic_rename3.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename3.testcase +++ test/sql_stmt_tests/datalic_rename3.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - Double old-name +:memory: #use in-memory database +SELECT RenameDataLicense(1.6, 'new') +1 # rows (not including the header row) +1 # columns +RenameDataLicense(1.6, 'new') +-1 ADDED test/sql_stmt_tests/datalic_rename4.testcase Index: test/sql_stmt_tests/datalic_rename4.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename4.testcase +++ test/sql_stmt_tests/datalic_rename4.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - BLOB old-name +:memory: #use in-memory database +SELECT RenameDataLicense(zeroblob(10), 'new') +1 # rows (not including the header row) +1 # columns +RenameDataLicense(zeroblob(10), 'new') +-1 ADDED test/sql_stmt_tests/datalic_rename5.testcase Index: test/sql_stmt_tests/datalic_rename5.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename5.testcase +++ test/sql_stmt_tests/datalic_rename5.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - valid args +:memory: #use in-memory database +SELECT RenameDataLicense('old', 'new') +1 # rows (not including the header row) +1 # columns +RenameDataLicense('old', 'new') +0 ADDED test/sql_stmt_tests/datalic_rename6.testcase Index: test/sql_stmt_tests/datalic_rename6.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename6.testcase +++ test/sql_stmt_tests/datalic_rename6.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - NULL new-name +:memory: #use in-memory database +SELECT RenameDataLicense('old', NULL) +1 # rows (not including the header row) +1 # columns +RenameDataLicense('old', NULL) +-1 ADDED test/sql_stmt_tests/datalic_rename7.testcase Index: test/sql_stmt_tests/datalic_rename7.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename7.testcase +++ test/sql_stmt_tests/datalic_rename7.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - Int new-name +:memory: #use in-memory database +SELECT RenameDataLicense('old', 1) +1 # rows (not including the header row) +1 # columns +RenameDataLicense('old', 1) +-1 ADDED test/sql_stmt_tests/datalic_rename8.testcase Index: test/sql_stmt_tests/datalic_rename8.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename8.testcase +++ test/sql_stmt_tests/datalic_rename8.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - Double new-name +:memory: #use in-memory database +SELECT RenameDataLicense('old', 1.5) +1 # rows (not including the header row) +1 # columns +RenameDataLicense('old', 1.5) +-1 ADDED test/sql_stmt_tests/datalic_rename9.testcase Index: test/sql_stmt_tests/datalic_rename9.testcase ================================================================== --- test/sql_stmt_tests/datalic_rename9.testcase +++ test/sql_stmt_tests/datalic_rename9.testcase @@ -0,0 +1,7 @@ +RenameDataLicense() - BLOB new-name +:memory: #use in-memory database +SELECT RenameDataLicense('old', zeroblob(4)) +1 # rows (not including the header row) +1 # columns +RenameDataLicense('old', zeroblob(4)) +-1 ADDED test/sql_stmt_tests/datalic_seturl1.testcase Index: test/sql_stmt_tests/datalic_seturl1.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl1.testcase +++ test/sql_stmt_tests/datalic_seturl1.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - NULL license +:memory: #use in-memory database +SELECT SetDataLicenseUrl(NULL, 'anurl') +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl(NULL, 'anurl') +-1 ADDED test/sql_stmt_tests/datalic_seturl2.testcase Index: test/sql_stmt_tests/datalic_seturl2.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl2.testcase +++ test/sql_stmt_tests/datalic_seturl2.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - Int license +:memory: #use in-memory database +SELECT SetDataLicenseUrl(1, 'anurl') +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl(1, 'anurl') +-1 ADDED test/sql_stmt_tests/datalic_seturl3.testcase Index: test/sql_stmt_tests/datalic_seturl3.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl3.testcase +++ test/sql_stmt_tests/datalic_seturl3.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - Double license +:memory: #use in-memory database +SELECT SetDataLicenseUrl(1.6, 'anurl') +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl(1.6, 'anurl') +-1 ADDED test/sql_stmt_tests/datalic_seturl4.testcase Index: test/sql_stmt_tests/datalic_seturl4.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl4.testcase +++ test/sql_stmt_tests/datalic_seturl4.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - BLOB license +:memory: #use in-memory database +SELECT SetDataLicenseUrl(zeroblob(10), 'anurl') +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl(zeroblob(10), 'anurl') +-1 ADDED test/sql_stmt_tests/datalic_seturl5.testcase Index: test/sql_stmt_tests/datalic_seturl5.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl5.testcase +++ test/sql_stmt_tests/datalic_seturl5.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - valid args +:memory: #use in-memory database +SELECT SetDataLicenseUrl('license x', 'anurl') +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl('license x', 'anurl') +0 ADDED test/sql_stmt_tests/datalic_seturl6.testcase Index: test/sql_stmt_tests/datalic_seturl6.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl6.testcase +++ test/sql_stmt_tests/datalic_seturl6.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - NULL url +:memory: #use in-memory database +SELECT SetDataLicenseUrl('some license', NULL) +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl('some license', NULL) +-1 ADDED test/sql_stmt_tests/datalic_seturl7.testcase Index: test/sql_stmt_tests/datalic_seturl7.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl7.testcase +++ test/sql_stmt_tests/datalic_seturl7.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - Int url +:memory: #use in-memory database +SELECT SetDataLicenseUrl('some license', 1) +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl('some license', 1) +-1 ADDED test/sql_stmt_tests/datalic_seturl8.testcase Index: test/sql_stmt_tests/datalic_seturl8.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl8.testcase +++ test/sql_stmt_tests/datalic_seturl8.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - Double url +:memory: #use in-memory database +SELECT SetDataLicenseUrl('some license', 1.5) +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl('some license', 1.5) +-1 ADDED test/sql_stmt_tests/datalic_seturl9.testcase Index: test/sql_stmt_tests/datalic_seturl9.testcase ================================================================== --- test/sql_stmt_tests/datalic_seturl9.testcase +++ test/sql_stmt_tests/datalic_seturl9.testcase @@ -0,0 +1,7 @@ +SetDataLicenseUrl() - BLOB url +:memory: #use in-memory database +SELECT SetDataLicenseUrl('some license', zeroblob(4)) +1 # rows (not including the header row) +1 # columns +SetDataLicenseUrl('some license', zeroblob(4)) +-1 ADDED test/sql_stmt_tests/datalic_unregister1.testcase Index: test/sql_stmt_tests/datalic_unregister1.testcase ================================================================== --- test/sql_stmt_tests/datalic_unregister1.testcase +++ test/sql_stmt_tests/datalic_unregister1.testcase @@ -0,0 +1,7 @@ +UnRegisterDataLicense() - NULL license +:memory: #use in-memory database +SELECT UnRegisterDataLicense(NULL) +1 # rows (not including the header row) +1 # columns +UnRegisterDataLicense(NULL) +-1 ADDED test/sql_stmt_tests/datalic_unregister2.testcase Index: test/sql_stmt_tests/datalic_unregister2.testcase ================================================================== --- test/sql_stmt_tests/datalic_unregister2.testcase +++ test/sql_stmt_tests/datalic_unregister2.testcase @@ -0,0 +1,7 @@ +UnRegisterDataLicense() - Int license +:memory: #use in-memory database +SELECT UnRegisterDataLicense(1) +1 # rows (not including the header row) +1 # columns +UnRegisterDataLicense(1) +-1 ADDED test/sql_stmt_tests/datalic_unregister3.testcase Index: test/sql_stmt_tests/datalic_unregister3.testcase ================================================================== --- test/sql_stmt_tests/datalic_unregister3.testcase +++ test/sql_stmt_tests/datalic_unregister3.testcase @@ -0,0 +1,7 @@ +UnRegisterDataLicense() - Double license +:memory: #use in-memory database +SELECT UnRegisterDataLicense(1.6) +1 # rows (not including the header row) +1 # columns +UnRegisterDataLicense(1.6) +-1 ADDED test/sql_stmt_tests/datalic_unregister4.testcase Index: test/sql_stmt_tests/datalic_unregister4.testcase ================================================================== --- test/sql_stmt_tests/datalic_unregister4.testcase +++ test/sql_stmt_tests/datalic_unregister4.testcase @@ -0,0 +1,7 @@ +UnRegisterDataLicense() - BLOB license +:memory: #use in-memory database +SELECT UnRegisterDataLicense(zeroblob(10)) +1 # rows (not including the header row) +1 # columns +UnRegisterDataLicense(zeroblob(10)) +-1 ADDED test/sql_stmt_tests/datalic_unregister5.testcase Index: test/sql_stmt_tests/datalic_unregister5.testcase ================================================================== --- test/sql_stmt_tests/datalic_unregister5.testcase +++ test/sql_stmt_tests/datalic_unregister5.testcase @@ -0,0 +1,7 @@ +UnRegisterDataLicense() - Text license +:memory: #use in-memory database +SELECT UnRegisterDataLicense('wowlicense') +1 # rows (not including the header row) +1 # columns +UnRegisterDataLicense('wowlicense') +1 DELETED test/sql_stmt_tests/decodeurl1.testcase Index: test/sql_stmt_tests/decodeurl1.testcase ================================================================== --- test/sql_stmt_tests/decodeurl1.testcase +++ test/sql_stmt_tests/decodeurl1.testcase @@ -1,7 +0,0 @@ -DecodeURL - NULL -:memory: #use in-memory database -SELECT DecodeURL(NULL); -1 # rows (not including the header row) -1 # columns -DecodeURL(NULL) -(NULL) DELETED test/sql_stmt_tests/decodeurl2.testcase Index: test/sql_stmt_tests/decodeurl2.testcase ================================================================== --- test/sql_stmt_tests/decodeurl2.testcase +++ test/sql_stmt_tests/decodeurl2.testcase @@ -1,7 +0,0 @@ -DecodeURL - INT -:memory: #use in-memory database -SELECT DecodeURL(1); -1 # rows (not including the header row) -1 # columns -DecodeURL(1) -(NULL) DELETED test/sql_stmt_tests/decodeurl3.testcase Index: test/sql_stmt_tests/decodeurl3.testcase ================================================================== --- test/sql_stmt_tests/decodeurl3.testcase +++ test/sql_stmt_tests/decodeurl3.testcase @@ -1,7 +0,0 @@ -DecodeURL - DOUBLE -:memory: #use in-memory database -SELECT DecodeURL(1.5); -1 # rows (not including the header row) -1 # columns -DecodeURL(1.5) -(NULL) DELETED test/sql_stmt_tests/decodeurl4.testcase Index: test/sql_stmt_tests/decodeurl4.testcase ================================================================== --- test/sql_stmt_tests/decodeurl4.testcase +++ test/sql_stmt_tests/decodeurl4.testcase @@ -1,7 +0,0 @@ -DecodeURL - BLOB -:memory: #use in-memory database -SELECT DecodeURL(zeroblob(4)); -1 # rows (not including the header row) -1 # columns -DecodeURL(zeroblob(4)) -(NULL) DELETED test/sql_stmt_tests/decodeurl5.testcase Index: test/sql_stmt_tests/decodeurl5.testcase ================================================================== --- test/sql_stmt_tests/decodeurl5.testcase +++ test/sql_stmt_tests/decodeurl5.testcase @@ -1,7 +0,0 @@ -DecodeURL - valid -:memory: #use in-memory database -SELECT DecodeURL('http://www.acme.it/search?q1=C+%26+opeator&q2=C%2b%2b+%2a+operator'); -1 # rows (not including the header row) -1 # columns -DecodeURL('http://www.acme.it/search?q1=C+%26+opeator&q2=C%2b%2b+%2a+operator') -http://www.acme.it/search?q1=C & opeator&q2=C++ * operator ADDED test/sql_stmt_tests/elemgeo10.testcase Index: test/sql_stmt_tests/elemgeo10.testcase ================================================================== --- test/sql_stmt_tests/elemgeo10.testcase +++ test/sql_stmt_tests/elemgeo10.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #2 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo11.testcase Index: test/sql_stmt_tests/elemgeo11.testcase ================================================================== --- test/sql_stmt_tests/elemgeo11.testcase +++ test/sql_stmt_tests/elemgeo11.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #3 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo12.testcase Index: test/sql_stmt_tests/elemgeo12.testcase ================================================================== --- test/sql_stmt_tests/elemgeo12.testcase +++ test/sql_stmt_tests/elemgeo12.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #4 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo13.testcase Index: test/sql_stmt_tests/elemgeo13.testcase ================================================================== --- test/sql_stmt_tests/elemgeo13.testcase +++ test/sql_stmt_tests/elemgeo13.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #5 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo14.testcase Index: test/sql_stmt_tests/elemgeo14.testcase ================================================================== --- test/sql_stmt_tests/elemgeo14.testcase +++ test/sql_stmt_tests/elemgeo14.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #6 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo15.testcase Index: test/sql_stmt_tests/elemgeo15.testcase ================================================================== --- test/sql_stmt_tests/elemgeo15.testcase +++ test/sql_stmt_tests/elemgeo15.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #7 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo16.testcase Index: test/sql_stmt_tests/elemgeo16.testcase ================================================================== --- test/sql_stmt_tests/elemgeo16.testcase +++ test/sql_stmt_tests/elemgeo16.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #8 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo17.testcase Index: test/sql_stmt_tests/elemgeo17.testcase ================================================================== --- test/sql_stmt_tests/elemgeo17.testcase +++ test/sql_stmt_tests/elemgeo17.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #9 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', 'opt8', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', 'opt8', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo18.testcase Index: test/sql_stmt_tests/elemgeo18.testcase ================================================================== --- test/sql_stmt_tests/elemgeo18.testcase +++ test/sql_stmt_tests/elemgeo18.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #10 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', 'opt8', 'opt9', NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', 'opt8', 'opt9', NULL) +(NULL) ADDED test/sql_stmt_tests/elemgeo19.testcase Index: test/sql_stmt_tests/elemgeo19.testcase ================================================================== --- test/sql_stmt_tests/elemgeo19.testcase +++ test/sql_stmt_tests/elemgeo19.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - all options +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', 'opt8', 'opt9', 'opt10'); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, 'opt1', 'opt2', 'opt3', 'opt4', 'opt5', 'opt6', 'opt7', 'opt8', 'opt9', 'opt10') +(NULL) ADDED test/sql_stmt_tests/elemgeo9.testcase Index: test/sql_stmt_tests/elemgeo9.testcase ================================================================== --- test/sql_stmt_tests/elemgeo9.testcase +++ test/sql_stmt_tests/elemgeo9.testcase @@ -0,0 +1,7 @@ +ElementaryGeometries() - NULL option #1 +:memory: #use in-memory database +SELECT ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, NULL); +1 # rows (not including the header row) +1 # columns +ElementaryGeometries('in_table', 'geom', 'out_table', 'id', 'old_id', 1, NULL) +(NULL) DELETED test/sql_stmt_tests/encodeurl1.testcase Index: test/sql_stmt_tests/encodeurl1.testcase ================================================================== --- test/sql_stmt_tests/encodeurl1.testcase +++ test/sql_stmt_tests/encodeurl1.testcase @@ -1,7 +0,0 @@ -EncodeURL - NULL -:memory: #use in-memory database -SELECT EncodeURL(NULL); -1 # rows (not including the header row) -1 # columns -EncodeURL(NULL) -(NULL) DELETED test/sql_stmt_tests/encodeurl2.testcase Index: test/sql_stmt_tests/encodeurl2.testcase ================================================================== --- test/sql_stmt_tests/encodeurl2.testcase +++ test/sql_stmt_tests/encodeurl2.testcase @@ -1,7 +0,0 @@ -EncodeURL - INT -:memory: #use in-memory database -SELECT EncodeURL(1); -1 # rows (not including the header row) -1 # columns -EncodeURL(1) -(NULL) DELETED test/sql_stmt_tests/encodeurl3.testcase Index: test/sql_stmt_tests/encodeurl3.testcase ================================================================== --- test/sql_stmt_tests/encodeurl3.testcase +++ test/sql_stmt_tests/encodeurl3.testcase @@ -1,7 +0,0 @@ -EncodeURL - DOUBLE -:memory: #use in-memory database -SELECT EncodeURL(1.5); -1 # rows (not including the header row) -1 # columns -EncodeURL(1.5) -(NULL) DELETED test/sql_stmt_tests/encodeurl4.testcase Index: test/sql_stmt_tests/encodeurl4.testcase ================================================================== --- test/sql_stmt_tests/encodeurl4.testcase +++ test/sql_stmt_tests/encodeurl4.testcase @@ -1,7 +0,0 @@ -EncodeURL - BLOB -:memory: #use in-memory database -SELECT EncodeURL(zeroblob(4)); -1 # rows (not including the header row) -1 # columns -EncodeURL(zeroblob(4)) -(NULL) DELETED test/sql_stmt_tests/encodeurl5.testcase Index: test/sql_stmt_tests/encodeurl5.testcase ================================================================== --- test/sql_stmt_tests/encodeurl5.testcase +++ test/sql_stmt_tests/encodeurl5.testcase @@ -1,7 +0,0 @@ -EncodeURL - valid -:memory: #use in-memory database -SELECT EncodeURL('C++ * operator'); -1 # rows (not including the header row) -1 # columns -EncodeURL('C++ * operator') -C%2b%2b+%2a+operator ADDED test/sql_stmt_tests/fdo_ogr3.testcase Index: test/sql_stmt_tests/fdo_ogr3.testcase ================================================================== --- test/sql_stmt_tests/fdo_ogr3.testcase +++ test/sql_stmt_tests/fdo_ogr3.testcase @@ -0,0 +1,7 @@ +FDO_OGR3 +:memory: #use in-memory database +SELECT AutoFDOStart('a') +1 # rows (not including the header row) +1 # columns +AutoFDOStart('a') +0 ADDED test/sql_stmt_tests/fdo_ogr4.testcase Index: test/sql_stmt_tests/fdo_ogr4.testcase ================================================================== --- test/sql_stmt_tests/fdo_ogr4.testcase +++ test/sql_stmt_tests/fdo_ogr4.testcase @@ -0,0 +1,7 @@ +FDO_OGR4 +:memory: #use in-memory database +SELECT AutoFDOStart(1) +1 # rows (not including the header row) +1 # columns +AutoFDOStart(1) +-1 ADDED test/sql_stmt_tests/fdo_ogr5.testcase Index: test/sql_stmt_tests/fdo_ogr5.testcase ================================================================== --- test/sql_stmt_tests/fdo_ogr5.testcase +++ test/sql_stmt_tests/fdo_ogr5.testcase @@ -0,0 +1,7 @@ +FDO_OGR5 +:memory: #use in-memory database +SELECT AutoFDOStop('a') +1 # rows (not including the header row) +1 # columns +AutoFDOStop('a') +0 ADDED test/sql_stmt_tests/fdo_ogr6.testcase Index: test/sql_stmt_tests/fdo_ogr6.testcase ================================================================== --- test/sql_stmt_tests/fdo_ogr6.testcase +++ test/sql_stmt_tests/fdo_ogr6.testcase @@ -0,0 +1,7 @@ +FDO_OGR6 +:memory: #use in-memory database +SELECT AutoFDOStop(1) +1 # rows (not including the header row) +1 # columns +AutoFDOStop(1) +-1 ADDED test/sql_stmt_tests/fdo_ogr7.testcase Index: test/sql_stmt_tests/fdo_ogr7.testcase ================================================================== --- test/sql_stmt_tests/fdo_ogr7.testcase +++ test/sql_stmt_tests/fdo_ogr7.testcase @@ -0,0 +1,7 @@ +FDO_OGR7 +:memory: #use in-memory database +SELECT AutoFDOStart(NULL) +1 # rows (not including the header row) +1 # columns +AutoFDOStart(NULL) +0 ADDED test/sql_stmt_tests/fdo_ogr8.testcase Index: test/sql_stmt_tests/fdo_ogr8.testcase ================================================================== --- test/sql_stmt_tests/fdo_ogr8.testcase +++ test/sql_stmt_tests/fdo_ogr8.testcase @@ -0,0 +1,7 @@ +FDO_OGR8 +:memory: #use in-memory database +SELECT AutoFDOStop(NULL) +1 # rows (not including the header row) +1 # columns +AutoFDOStop(NULL) +0 Index: test/sql_stmt_tests/fromWkb1.testcase ================================================================== --- test/sql_stmt_tests/fromWkb1.testcase +++ test/sql_stmt_tests/fromWkb1.testcase @@ -1,8 +1,7 @@ fromWkb :memory: #use in-memory database -SELECT Hex(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) +SELECT AsText(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) 1 # rows (not including the header row) 1 # columns -Hex(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) -000100000000000000000000F03F0000000000000040000000000000F03F00000000000000407C01000000000000000000F03F0000000000000040FE - +AsText(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) +POINT(1 2) Index: test/sql_stmt_tests/fromWkb13.testcase ================================================================== --- test/sql_stmt_tests/fromWkb13.testcase +++ test/sql_stmt_tests/fromWkb13.testcase @@ -1,7 +1,7 @@ fromWkb - POINT, 2 arg :memory: #use in-memory database -SELECT Hex(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) +SELECT AsText(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) 1 # rows (not including the header row) 1 # columns -Hex(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) -0001E6100000000000000000F03F0000000000000040000000000000F03F00000000000000407C01000000000000000000F03F0000000000000040FE +AsText(GeomFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) +POINT(1 2) Index: test/sql_stmt_tests/fromWkb14.testcase ================================================================== --- test/sql_stmt_tests/fromWkb14.testcase +++ test/sql_stmt_tests/fromWkb14.testcase @@ -1,7 +1,7 @@ fromWkb - mandatory POINT, 2 arg :memory: #use in-memory database -SELECT Hex(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) +SELECT AsText(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) 1 # rows (not including the header row) 1 # columns -Hex(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) -0001E6100000000000000000F03F0000000000000040000000000000F03F00000000000000407C01000000000000000000F03F0000000000000040FE +AsText(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)), 4326)) +POINT(1 2) Index: test/sql_stmt_tests/fromWkb5.testcase ================================================================== --- test/sql_stmt_tests/fromWkb5.testcase +++ test/sql_stmt_tests/fromWkb5.testcase @@ -1,8 +1,7 @@ fromWkb - mandatory POINT :memory: #use in-memory database -SELECT Hex(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) +SELECT AsText(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) 1 # rows (not including the header row) 1 # columns -Hex(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) -000100000000000000000000F03F0000000000000040000000000000F03F00000000000000407C01000000000000000000F03F0000000000000040FE - +AsText(PointFromWkb(AsBinary(GeomFromText("Point(1 2)", 4326)))) +POINT(1 2) ADDED test/sql_stmt_tests/getshapefileextent1.testcase Index: test/sql_stmt_tests/getshapefileextent1.testcase ================================================================== --- test/sql_stmt_tests/getshapefileextent1.testcase +++ test/sql_stmt_tests/getshapefileextent1.testcase @@ -0,0 +1,7 @@ +GetShapefileExtent() - NULL VirtualTable name +:memory: #use in-memory database +SELECT GetShapefileExtent(NULL) +1 # rows (not including the header row) +1 # columns +GetShapefileExtent(NULL) +(NULL) ADDED test/sql_stmt_tests/getshapefileextent2.testcase Index: test/sql_stmt_tests/getshapefileextent2.testcase ================================================================== --- test/sql_stmt_tests/getshapefileextent2.testcase +++ test/sql_stmt_tests/getshapefileextent2.testcase @@ -0,0 +1,7 @@ +GetShapefileExtent() - Int VirtualTable name +:memory: #use in-memory database +SELECT GetShapefileExtent(1) +1 # rows (not including the header row) +1 # columns +GetShapefileExtent(1) +(NULL) ADDED test/sql_stmt_tests/getshapefileextent3.testcase Index: test/sql_stmt_tests/getshapefileextent3.testcase ================================================================== --- test/sql_stmt_tests/getshapefileextent3.testcase +++ test/sql_stmt_tests/getshapefileextent3.testcase @@ -0,0 +1,7 @@ +GetShapefileExtent() - Double VirtualTable name +:memory: #use in-memory database +SELECT GetShapefileExtent(1.6) +1 # rows (not including the header row) +1 # columns +GetShapefileExtent(1.6) +(NULL) ADDED test/sql_stmt_tests/getshapefileextent4.testcase Index: test/sql_stmt_tests/getshapefileextent4.testcase ================================================================== --- test/sql_stmt_tests/getshapefileextent4.testcase +++ test/sql_stmt_tests/getshapefileextent4.testcase @@ -0,0 +1,7 @@ +GetShapefileExtent() - BLOB VirtualTable name +:memory: #use in-memory database +SELECT GetShapefileExtent(zeroblob(10)) +1 # rows (not including the header row) +1 # columns +GetShapefileExtent(zeroblob(10)) +(NULL) ADDED test/sql_stmt_tests/getshapefileextent5.testcase Index: test/sql_stmt_tests/getshapefileextent5.testcase ================================================================== --- test/sql_stmt_tests/getshapefileextent5.testcase +++ test/sql_stmt_tests/getshapefileextent5.testcase @@ -0,0 +1,7 @@ +GetShapefileExtent() - Text VirtualTable name +:memory: #use in-memory database +SELECT GetShapefileExtent('example'); +1 # rows (not including the header row) +1 # columns +GetShapefileExtent('example') +(NULL) DELETED test/sql_stmt_tests/isXblob5.testcase Index: test/sql_stmt_tests/isXblob5.testcase ================================================================== --- test/sql_stmt_tests/isXblob5.testcase +++ test/sql_stmt_tests/isXblob5.testcase @@ -1,27 +0,0 @@ -isXblob - geom -:memory: #use in-memory database -SELECT Hex(blob), IsPngBlob(blob), IsGifBlob(blob), IsGeometryBlob(blob), IsZipBlob(blob), IsPdfBlob(blob), IsTiffBlob(blob), IsJpegBlob(blob), IsExifBlob(blob), IsExifGpsBlob(blob), IsWebpBlob(blob) FROM (SELECT GeomFromText("POINT(1 3)") as blob) dummy -1 # rows (not including the header row) -11 # columns -Hex(blob) -IsPngBlob(blob) -IsGifBlob(blob) -IsGeometryBlob(blob) -IsZipBlob(blob) -IsPdfBlob(blob) -IsTiffBlob(blob) -IsJpegBlob(blob) -IsExifBlob(blob) -IsExifGpsBlob(blob) -IsWebpBlob(blob) -000100000000000000000000F03F0000000000000840000000000000F03F00000000000008407C01000000000000000000F03F0000000000000840FE -0 -0 -1 -0 -0 -0 -0 -0 -0 -0 ADDED test/sql_stmt_tests/islowascii1.testcase Index: test/sql_stmt_tests/islowascii1.testcase ================================================================== --- test/sql_stmt_tests/islowascii1.testcase +++ test/sql_stmt_tests/islowascii1.testcase @@ -0,0 +1,7 @@ +IsLowASCII() - NULL string +:memory: #use in-memory database +SELECT IsLowASCII(NULL) +1 # rows (not including the header row) +1 # columns +IsLowASCII(NULL) +-1 ADDED test/sql_stmt_tests/islowascii2.testcase Index: test/sql_stmt_tests/islowascii2.testcase ================================================================== --- test/sql_stmt_tests/islowascii2.testcase +++ test/sql_stmt_tests/islowascii2.testcase @@ -0,0 +1,7 @@ +IsLowASCII() - Int string +:memory: #use in-memory database +SELECT IsLowASCII(1) +1 # rows (not including the header row) +1 # columns +IsLowASCII(1) +-1 ADDED test/sql_stmt_tests/islowascii3.testcase Index: test/sql_stmt_tests/islowascii3.testcase ================================================================== --- test/sql_stmt_tests/islowascii3.testcase +++ test/sql_stmt_tests/islowascii3.testcase @@ -0,0 +1,7 @@ +IsLowASCII() - Double string +:memory: #use in-memory database +SELECT IsLowASCII(1.2) +1 # rows (not including the header row) +1 # columns +IsLowASCII(1.2) +-1 ADDED test/sql_stmt_tests/islowascii4.testcase Index: test/sql_stmt_tests/islowascii4.testcase ================================================================== --- test/sql_stmt_tests/islowascii4.testcase +++ test/sql_stmt_tests/islowascii4.testcase @@ -0,0 +1,7 @@ +IsLowASCII() - BLOB string +:memory: #use in-memory database +SELECT IsLowASCII(zeroblob(10)) +1 # rows (not including the header row) +1 # columns +IsLowASCII(zeroblob(10)) +-1 ADDED test/sql_stmt_tests/islowascii5.testcase Index: test/sql_stmt_tests/islowascii5.testcase ================================================================== --- test/sql_stmt_tests/islowascii5.testcase +++ test/sql_stmt_tests/islowascii5.testcase @@ -0,0 +1,7 @@ +IsLowASCII() - valid string - TRUE +:memory: #use in-memory database +SELECT IsLowASCII('The quick brown Fox jumps over the lazy Dog.') +1 # rows (not including the header row) +1 # columns +IsLowASCII('The quick brown Fox jumps over the lazy Dog.') +1 ADDED test/sql_stmt_tests/islowascii6.testcase Index: test/sql_stmt_tests/islowascii6.testcase ================================================================== --- test/sql_stmt_tests/islowascii6.testcase +++ test/sql_stmt_tests/islowascii6.testcase @@ -0,0 +1,7 @@ +IsLowASCII() - valid string - TRUE +:memory: #use in-memory database +SELECT IsLowASCII('Zwölf Boxkämpfer jagen Victor quer über den großen Sylter Deich.') +1 # rows (not including the header row) +1 # columns +IsLowASCII('Zwölf Boxkämpfer jagen Victor quer über den großen Sylter Deich.') +0 ADDED test/sql_stmt_tests/ispolygccw1.testcase Index: test/sql_stmt_tests/ispolygccw1.testcase ================================================================== --- test/sql_stmt_tests/ispolygccw1.testcase +++ test/sql_stmt_tests/ispolygccw1.testcase @@ -0,0 +1,7 @@ +IsPolygonCCW - Invalid Geometry +:memory: #use in-memory database +SELECT ST_IsPolygonCCW(zeroblob(128)); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCCW(zeroblob(128)) +-1 ADDED test/sql_stmt_tests/ispolygccw2.testcase Index: test/sql_stmt_tests/ispolygccw2.testcase ================================================================== --- test/sql_stmt_tests/ispolygccw2.testcase +++ test/sql_stmt_tests/ispolygccw2.testcase @@ -0,0 +1,7 @@ +IsPolygonCCW - True +:memory: #use in-memory database +SELECT ST_IsPolygonCCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,15 10 102 13,13 13 103 13,10 10 101 11),(11 10.5 100 10,13 11.3 102 13,13 10.5 101 11,11 10.5 100 10)),POLYGON ZM((20 20 100 10,22 18 102 13,24.1 20 101 11,20 20 100 10),(21 19.5 101 11,23.1 19.5 102 13,22 18.5 103 13,21 19.5 101 11)))')); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,15 10 102 13,13 13 103 13,10 10 101 11),(11 10.5 100 10,13 11.3 102 13,13 10.5 101 11,11 10.5 100 10)),POLYGON ZM((20 20 100 10,22 18 102 13,24.1 20 101 11,20 20 100 10),(21 19.5 101 11,23.1 19.5 102 13,22 18.5 103 13,21 19.5 101 11)))')); +1 ADDED test/sql_stmt_tests/ispolygccw3.testcase Index: test/sql_stmt_tests/ispolygccw3.testcase ================================================================== --- test/sql_stmt_tests/ispolygccw3.testcase +++ test/sql_stmt_tests/ispolygccw3.testcase @@ -0,0 +1,7 @@ +IsPolygonCCW - False Exterior Ring +:memory: #use in-memory database +SELECT ST_IsPolygonCCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,15 10 102 13,13 13 103 13,10 10 101 11),(11 10.5 100 10,13 11.3 102 13,13 10.5 101 11,11 10.5 100 10)),POLYGON ZM((20 20 100 10,24.1 20 101 11,22 18 102 13,20 20 100 10),(21 19.5 101 11,23.1 19.5 102 13,22 18.5 103 13,21 19.5 101 11)))')); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,15 10 102 13,13 13 103 13,10 10 101 11),(11 10.5 100 10,13 11.3 102 13,13 10.5 101 11,11 10.5 100 10)),POLYGON ZM((20 20 100 10,24.1 20 101 11,22 18 102 13,20 20 100 10),(21 19.5 101 11,23.1 19.5 102 13,22 18.5 103 13,21 19.5 101 11)))')); +0 ADDED test/sql_stmt_tests/ispolygccw4.testcase Index: test/sql_stmt_tests/ispolygccw4.testcase ================================================================== --- test/sql_stmt_tests/ispolygccw4.testcase +++ test/sql_stmt_tests/ispolygccw4.testcase @@ -0,0 +1,7 @@ +IsPolygonCCW - False Interior Ring +:memory: #use in-memory database +SELECT ST_IsPolygonCCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,15 10 102 13,13 13 103 13,10 10 101 11),(11 10.5 100 10,13 11.3 102 13,13 10.5 101 11,11 10.5 100 10)),POLYGON ZM((20 20 100 10,22 18 102 13,24.1 20 101 11,20 20 100 10),(21 19.5 101 11,22 18.5 103 13,23.1 19.5 102 13,21 19.5 101 11)))')); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,15 10 102 13,13 13 103 13,10 10 101 11),(11 10.5 100 10,13 11.3 102 13,13 10.5 101 11,11 10.5 100 10)),POLYGON ZM((20 20 100 10,22 18 102 13,24.1 20 101 11,20 20 100 10),(21 19.5 101 11,22 18.5 103 13,23.1 19.5 102 13,21 19.5 101 11)))')); +0 ADDED test/sql_stmt_tests/ispolygccw5.testcase Index: test/sql_stmt_tests/ispolygccw5.testcase ================================================================== --- test/sql_stmt_tests/ispolygccw5.testcase +++ test/sql_stmt_tests/ispolygccw5.testcase @@ -0,0 +1,7 @@ +IsPolygonCCW - NULL Geometry +:memory: #use in-memory database +SELECT ST_IsPolygonCCW(NULL); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCCW(NULL) +-1 ADDED test/sql_stmt_tests/ispolygcw1.testcase Index: test/sql_stmt_tests/ispolygcw1.testcase ================================================================== --- test/sql_stmt_tests/ispolygcw1.testcase +++ test/sql_stmt_tests/ispolygcw1.testcase @@ -0,0 +1,7 @@ +IsPolygonCW - Invalid Geometry +:memory: #use in-memory database +SELECT ST_IsPolygonCW(zeroblob(128)); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCW(zeroblob(128)) +-1 ADDED test/sql_stmt_tests/ispolygcw2.testcase Index: test/sql_stmt_tests/ispolygcw2.testcase ================================================================== --- test/sql_stmt_tests/ispolygcw2.testcase +++ test/sql_stmt_tests/ispolygcw2.testcase @@ -0,0 +1,7 @@ +IsPolygonCW - True +:memory: #use in-memory database +SELECT ST_IsPolygonCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,13 13 103 13,15 10 102 13,10 10 101 11),(11 10.5 100 10,13 10.5 101 11,13 11.3 102 13,11 10.5 100 10)),POLYGON ZM((20 20 100 10,24.1 20 101 11,22 18 102 13,20 20 100 10),(21 19.5 101 11,22 18.5 103 13,23.1 19.5 102 13,21 19.5 101 11)))')); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,13 13 103 13,15 10 102 13,10 10 101 11),(11 10.5 100 10,13 10.5 101 11,13 11.3 102 13,11 10.5 100 10)),POLYGON ZM((20 20 100 10,24.1 20 101 11,22 18 102 13,20 20 100 10),(21 19.5 101 11,22 18.5 103 13,23.1 19.5 102 13,21 19.5 101 11)))')); +1 ADDED test/sql_stmt_tests/ispolygcw3.testcase Index: test/sql_stmt_tests/ispolygcw3.testcase ================================================================== --- test/sql_stmt_tests/ispolygcw3.testcase +++ test/sql_stmt_tests/ispolygcw3.testcase @@ -0,0 +1,7 @@ +IsPolygonCW - False Exterior Ring +:memory: #use in-memory database +SELECT ST_IsPolygonCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,13 13 103 13,15 10 102 13,10 10 101 11),(11 10.5 100 10,13 10.5 101 11,13 11.3 102 13,11 10.5 100 10)),POLYGON ZM((20 20 100 10,22 18 102 13,24.1 20 101 11,20 20 100 10),(21 19.5 101 11,22 18.5 103 13,23.1 19.5 102 13,21 19.5 101 11)))')); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,13 13 103 13,15 10 102 13,10 10 101 11),(11 10.5 100 10,13 10.5 101 11,13 11.3 102 13,11 10.5 100 10)),POLYGON ZM((20 20 100 10,22 18 102 13,24.1 20 101 11,20 20 100 10),(21 19.5 101 11,22 18.5 103 13,23.1 19.5 102 13,21 19.5 101 11)))')); +0 ADDED test/sql_stmt_tests/ispolygcw4.testcase Index: test/sql_stmt_tests/ispolygcw4.testcase ================================================================== --- test/sql_stmt_tests/ispolygcw4.testcase +++ test/sql_stmt_tests/ispolygcw4.testcase @@ -0,0 +1,7 @@ +IsPolygonCW - False Interior Ring +:memory: #use in-memory database +SELECT ST_IsPolygonCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,13 13 103 13,15 10 102 13,10 10 101 11),(11 10.5 100 10,13 10.5 101 11,13 11.3 102 13,11 10.5 100 10)),POLYGON ZM((20 20 100 10,24.1 20 101 11,22 18 102 13,20 20 100 10),(21 19.5 101 11,23.1 19.5 102 13,22 18.5 103 13,21 19.5 101 11)))')); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCW(GeomFromText('GEOMETRYCOLLECTION ZM(POINT ZM(1 2 100 10),LINESTRING ZM(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON ZM((10 10 101 11,13 13 103 13,15 10 102 13,10 10 101 11),(11 10.5 100 10,13 10.5 101 11,13 11.3 102 13,11 10.5 100 10)),POLYGON ZM((20 20 100 10,24.1 20 101 11,22 18 102 13,20 20 100 10),(21 19.5 101 11,23.1 19.5 102 13,22 18.5 103 13,21 19.5 101 11)))')); +0 ADDED test/sql_stmt_tests/ispolygcw5.testcase Index: test/sql_stmt_tests/ispolygcw5.testcase ================================================================== --- test/sql_stmt_tests/ispolygcw5.testcase +++ test/sql_stmt_tests/ispolygcw5.testcase @@ -0,0 +1,7 @@ +IsPolygonCW - NULL Geometry +:memory: #use in-memory database +SELECT ST_IsPolygonCW(NULL); +1 # rows (not including the header row) +1 # columns +ST_IsPolygonCW(NULL) +-1 Index: test/sql_stmt_tests/ispopulatedcoverage1.testcase ================================================================== --- test/sql_stmt_tests/ispopulatedcoverage1.testcase +++ test/sql_stmt_tests/ispopulatedcoverage1.testcase @@ -1,8 +1,8 @@ IsPopulatedCoverage - standard not existing coverage NEW:memory: #use in-memory database -SELECT IsPopulatedCoverage('alpha'); +SELECT IsPopulatedCoverage(NULL, 'alpha'); 1 # rows (not including the header row) 1 # columns -IsPopulatedCoverage('alpha') +IsPopulatedCoverage(NULL, 'alpha') 0 Index: test/sql_stmt_tests/ispopulatedcoverage2.testcase ================================================================== --- test/sql_stmt_tests/ispopulatedcoverage2.testcase +++ test/sql_stmt_tests/ispopulatedcoverage2.testcase @@ -1,9 +1,9 @@ IsPopulatedCoverage - NULL coverage-name NEW:memory: #use in-memory database -SELECT IsPopulatedCoverage(NULL); +SELECT IsPopulatedCoverage('main', NULL); 1 # rows (not including the header row) 1 # columns -IsPopulatedCoverage(NULL) +IsPopulatedCoverage('main', NULL) -1 ADDED test/sql_stmt_tests/ispopulatedcoverage3.testcase Index: test/sql_stmt_tests/ispopulatedcoverage3.testcase ================================================================== --- test/sql_stmt_tests/ispopulatedcoverage3.testcase +++ test/sql_stmt_tests/ispopulatedcoverage3.testcase @@ -0,0 +1,7 @@ +IsPopulatedCoverage - Int DbPrefix +NEW:memory: #use in-memory database +SELECT IsPopulatedCoverage(1, 'alpha'); +1 # rows (not including the header row) +1 # columns +IsPopulatedCoverage(1, 'alpha') +-1 Index: test/sql_stmt_tests/isvalidrasterstats1.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats1.testcase +++ test/sql_stmt_tests/isvalidrasterstats1.testcase @@ -1,8 +1,8 @@ -IsValidRasterStatistics - standard: 2 args +IsValidRasterStatistics - standard NEW:memory: #use in-memory database -SELECT IsValidRasterStatistics('alpha', zeroblob(4)); +SELECT IsValidRasterStatistics('main', 'alpha', zeroblob(4)); 1 # rows (not including the header row) 1 # columns -IsValidRasterStatistics('alpha', zeroblob(4)) +IsValidRasterStatistics('main', 'alpha', zeroblob(4)) 0 Index: test/sql_stmt_tests/isvalidrasterstats2.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats2.testcase +++ test/sql_stmt_tests/isvalidrasterstats2.testcase @@ -1,8 +1,7 @@ -IsValidRasterStatistics - NULL coverage-name: 2 args +IsValidRasterStatistics - NULL coverage-name NEW:memory: #use in-memory database -SELECT IsValidRasterStatistics(NULL, zeroblob(4)); +SELECT IsValidRasterStatistics('MAIN', NULL, zeroblob(4)); 1 # rows (not including the header row) 1 # columns -IsValidRasterStatistics(NULL, zeroblob(4)) +IsValidRasterStatistics('MAIN', NULL, zeroblob(4)) -1 - Index: test/sql_stmt_tests/isvalidrasterstats3.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats3.testcase +++ test/sql_stmt_tests/isvalidrasterstats3.testcase @@ -1,8 +1,7 @@ -IsValidRasterStatistics - NULL statistics: 2 args +IsValidRasterStatistics - NULL statistics NEW:memory: #use in-memory database -SELECT IsValidRasterStatistics('alpha', NULL); +SELECT IsValidRasterStatistics(NULL, 'alpha', NULL); 1 # rows (not including the header row) 1 # columns -IsValidRasterStatistics('alpha', NULL) +IsValidRasterStatistics(NULL, 'alpha', NULL) -1 - Index: test/sql_stmt_tests/isvalidrasterstats4.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats4.testcase +++ test/sql_stmt_tests/isvalidrasterstats4.testcase @@ -1,8 +1,7 @@ -IsValidRasterStatistics - standard: 3 args +IsValidRasterStatistics - standard NEW:memory: #use in-memory database SELECT IsValidRasterStatistics(zeroblob(4), 'UINT8', 1); 1 # rows (not including the header row) 1 # columns IsValidRasterStatistics(zeroblob(4), 'UINT8', 1) 0 - Index: test/sql_stmt_tests/isvalidrasterstats5.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats5.testcase +++ test/sql_stmt_tests/isvalidrasterstats5.testcase @@ -1,8 +1,7 @@ -IsValidRasterStatistics - NULL statistics: 3 args +IsValidRasterStatistics - NULL statistics NEW:memory: #use in-memory database SELECT IsValidRasterStatistics(NULL, 'UINT8', 1); 1 # rows (not including the header row) 1 # columns IsValidRasterStatistics(NULL, 'UINT8', 1) -1 - Index: test/sql_stmt_tests/isvalidrasterstats6.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats6.testcase +++ test/sql_stmt_tests/isvalidrasterstats6.testcase @@ -1,8 +1,7 @@ -IsValidRasterStatistics - NULL sample-type: 3 args +IsValidRasterStatistics - NULL sample-type NEW:memory: #use in-memory database SELECT IsValidRasterStatistics(zeroblob(4), NULL, 1); 1 # rows (not including the header row) 1 # columns IsValidRasterStatistics(zeroblob(4), NULL, 1) -1 - Index: test/sql_stmt_tests/isvalidrasterstats7.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats7.testcase +++ test/sql_stmt_tests/isvalidrasterstats7.testcase @@ -1,8 +1,7 @@ -IsValidRasterStatistics - NULL #bands: 3 args +IsValidRasterStatistics - NULL #bands NEW:memory: #use in-memory database SELECT IsValidRasterStatistics(zeroblob(4), 'UINT8', NULL); 1 # rows (not including the header row) 1 # columns IsValidRasterStatistics(zeroblob(4), 'UINT8', NULL) -1 - ADDED test/sql_stmt_tests/isvalidrasterstats8.testcase Index: test/sql_stmt_tests/isvalidrasterstats8.testcase ================================================================== --- test/sql_stmt_tests/isvalidrasterstats8.testcase +++ test/sql_stmt_tests/isvalidrasterstats8.testcase @@ -0,0 +1,7 @@ +IsValidRasterStatistics - Int DbPrefix +NEW:memory: #use in-memory database +SELECT IsValidRasterStatistics(1, 'alpha', zeroblob(4)); +1 # rows (not including the header row) +1 # columns +IsValidRasterStatistics(1, 'alpha', zeroblob(4)) +-1 Index: test/sql_stmt_tests/isvalidrastertile1.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile1.testcase +++ test/sql_stmt_tests/isvalidrastertile1.testcase @@ -1,8 +1,8 @@ IsValidRasterTile - standard NEW:memory: #use in-memory database -SELECT IsValidRasterTile('alpha', 0, zeroblob(4), zeroblob(4)); +SELECT IsValidRasterTile('main', 'alpha', 0, zeroblob(4), zeroblob(4)); 1 # rows (not including the header row) 1 # columns -IsValidRasterTile('alpha', 0, zeroblob(4), zeroblob(4)) +IsValidRasterTile('main', 'alpha', 0, zeroblob(4), zeroblob(4)) 0 Index: test/sql_stmt_tests/isvalidrastertile2.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile2.testcase +++ test/sql_stmt_tests/isvalidrastertile2.testcase @@ -1,8 +1,8 @@ IsValidRasterTile - NULL coverage-name NEW:memory: #use in-memory database -SELECT IsValidRasterTile(NULL, 0, zeroblob(4), zeroblob(4)); +SELECT IsValidRasterTile('MAIN', NULL, 0, zeroblob(4), zeroblob(4)); 1 # rows (not including the header row) 1 # columns -IsValidRasterTile(NULL, 0, zeroblob(4), zeroblob(4)) +IsValidRasterTile('MAIN', NULL, 0, zeroblob(4), zeroblob(4)) -1 Index: test/sql_stmt_tests/isvalidrastertile3.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile3.testcase +++ test/sql_stmt_tests/isvalidrastertile3.testcase @@ -1,8 +1,8 @@ IsValidRasterTile - NULL pyramid-level NEW:memory: #use in-memory database -SELECT IsValidRasterTile('alpha', NULL, zeroblob(4), zeroblob(4)); +SELECT IsValidRasterTile(NULL, 'alpha', NULL, zeroblob(4), zeroblob(4)); 1 # rows (not including the header row) 1 # columns -IsValidRasterTile('alpha', NULL, zeroblob(4), zeroblob(4)) +IsValidRasterTile(NULL, 'alpha', NULL, zeroblob(4), zeroblob(4)) -1 Index: test/sql_stmt_tests/isvalidrastertile4.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile4.testcase +++ test/sql_stmt_tests/isvalidrastertile4.testcase @@ -1,8 +1,8 @@ IsValidRasterTile - NULL odd-tile NEW:memory: #use in-memory database -SELECT IsValidRasterTile('alpha', 0, NULL, zeroblob(4)); +SELECT IsValidRasterTile(NULL, 'alpha', 0, NULL, zeroblob(4)); 1 # rows (not including the header row) 1 # columns -IsValidRasterTile('alpha', 0, NULL, zeroblob(4)) +IsValidRasterTile(NULL, 'alpha', 0, NULL, zeroblob(4)) -1 Index: test/sql_stmt_tests/isvalidrastertile5.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile5.testcase +++ test/sql_stmt_tests/isvalidrastertile5.testcase @@ -1,8 +1,8 @@ IsValidRasterTile - TEXT even-tile NEW:memory: #use in-memory database -SELECT IsValidRasterTile('alpha', 0, zeroblob(4), 'beta'); +SELECT IsValidRasterTile(NULL, 'alpha', 0, zeroblob(4), 'beta'); 1 # rows (not including the header row) 1 # columns -IsValidRasterTile('alpha', 0, zeroblob(4), 'beta') +IsValidRasterTile(NULL, 'alpha', 0, zeroblob(4), 'beta') -1 Index: test/sql_stmt_tests/isvalidrastertile6.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile6.testcase +++ test/sql_stmt_tests/isvalidrastertile6.testcase @@ -1,8 +1,8 @@ IsValidRasterTile - standard NULL even-tile NEW:memory: #use in-memory database -SELECT IsValidRasterTile('alpha', 0, zeroblob(4), NULL); +SELECT IsValidRasterTile(NULL, 'alpha', 0, zeroblob(4), NULL); 1 # rows (not including the header row) 1 # columns -IsValidRasterTile('alpha', 0, zeroblob(4), NULL) +IsValidRasterTile(NULL, 'alpha', 0, zeroblob(4), NULL) 0 ADDED test/sql_stmt_tests/isvalidrastertile7.testcase Index: test/sql_stmt_tests/isvalidrastertile7.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile7.testcase +++ test/sql_stmt_tests/isvalidrastertile7.testcase @@ -0,0 +1,7 @@ +IsValidRasterTile - Int DbPrefix +NEW:memory: #use in-memory database +SELECT IsValidRasterTile(1, 'alpha', 0, zeroblob(4), zeroblob(4)); +1 # rows (not including the header row) +1 # columns +IsValidRasterTile(1, 'alpha', 0, zeroblob(4), zeroblob(4)) +-1 ADDED test/sql_stmt_tests/isvalidrastertile8.testcase Index: test/sql_stmt_tests/isvalidrastertile8.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile8.testcase +++ test/sql_stmt_tests/isvalidrastertile8.testcase @@ -0,0 +1,7 @@ +IsValidRasterTile - Double DbPrefix +NEW:memory: #use in-memory database +SELECT IsValidRasterTile(1.2, 'alpha', 0, zeroblob(4), zeroblob(4)); +1 # rows (not including the header row) +1 # columns +IsValidRasterTile(1.2, 'alpha', 0, zeroblob(4), zeroblob(4)) +-1 ADDED test/sql_stmt_tests/isvalidrastertile9.testcase Index: test/sql_stmt_tests/isvalidrastertile9.testcase ================================================================== --- test/sql_stmt_tests/isvalidrastertile9.testcase +++ test/sql_stmt_tests/isvalidrastertile9.testcase @@ -0,0 +1,7 @@ +IsValidRasterTile - BLOB DbPrefix +NEW:memory: #use in-memory database +SELECT IsValidRasterTile(zeroblob(4), 'alpha', 0, zeroblob(4), zeroblob(4)); +1 # rows (not including the header row) +1 # columns +IsValidRasterTile(zeroblob(4), 'alpha', 0, zeroblob(4), zeroblob(4)) +-1 ADDED test/sql_stmt_tests/polygccw1.testcase Index: test/sql_stmt_tests/polygccw1.testcase ================================================================== --- test/sql_stmt_tests/polygccw1.testcase +++ test/sql_stmt_tests/polygccw1.testcase @@ -0,0 +1,7 @@ +forcePolygonCCW - zeroblob +:memory: #use in-memory database +SELECT ST_ForcePolygonCCW(zeroblob(99)); +1 # rows (not including the header row) +1 # columns +ST_ForcePolygonCCW(zeroblob(99)) +(NULL) ADDED test/sql_stmt_tests/polygccw2.testcase Index: test/sql_stmt_tests/polygccw2.testcase ================================================================== --- test/sql_stmt_tests/polygccw2.testcase +++ test/sql_stmt_tests/polygccw2.testcase @@ -0,0 +1,7 @@ +forcePolygonCCW - invalid +:memory: #use in-memory database +SELECT ST_ForcePolygonCCW("alpha"); +1 # rows (not including the header row) +1 # columns +ST_ForcePolygonCCW("alpha") +(NULL) ADDED test/sql_stmt_tests/polygccw3.testcase Index: test/sql_stmt_tests/polygccw3.testcase ================================================================== --- test/sql_stmt_tests/polygccw3.testcase +++ test/sql_stmt_tests/polygccw3.testcase @@ -0,0 +1,7 @@ +forcePolygonCCW - GeometryCollection XY +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTION(POINT(1 2), LINESTRING(3 4, 5 6, 7 8, 9 9), POLYGON((10 10, 15 10, 13 13, 10 10), (11 10.5, 13 10.5, 13 11.3, 11 10.5)), POLYGON((20 20, 24.1 20, 22 18, 20 20), (21 19.5, 23.1 19.5, 22 18.5, 21 19.5)))"))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTION(POINT(1 2), LINESTRING(3 4, 5 6, 7 8, 9 9), POLYGON((10 10, 15 10, 13 13, 10 10), (11 10.5, 13 10.5, 13 11.3, 11 10.5)), POLYGON((20 20, 24.1 20, 22 18, 20 20), (21 19.5, 23.1 19.5, 22 18.5, 21 19.5)))"))) +SRID=0;GEOMETRYCOLLECTION(POINT(1 2),LINESTRING(3 4,5 6,7 8,9 9),POLYGON((10 10,15 10,13 13,10 10),(11 10.5,13 11.3,13 10.5,11 10.5)),POLYGON((20 20,22 18,24.1 20,20 20),(21 19.5,23.1 19.5,22 18.5,21 19.5))) ADDED test/sql_stmt_tests/polygccw4.testcase Index: test/sql_stmt_tests/polygccw4.testcase ================================================================== --- test/sql_stmt_tests/polygccw4.testcase +++ test/sql_stmt_tests/polygccw4.testcase @@ -0,0 +1,7 @@ +forcePolygonCCW - GeometryCollection XYZ +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTIONZ(POINTZ(1 2 100), LINESTRINGZ(3 4 101, 5 6 102, 7 8 103, 9 9 19), POLYGONZ((10 10 101, 15 10 102, 13 13 103, 10 10 101), (11 10.5 100, 13 10.5 101, 13 11.3 102, 11 10.5 100)), POLYGONZ((20 20 100, 24.1 20 101, 22 18 102, 20 20 100), (21 19.5 101, 23.1 19.5 102, 22 18.5 103, 21 19.5 101)))", 4326))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTIONZ(POINTZ(1 2 100), LINESTRINGZ(3 4 101, 5 6 102, 7 8 103, 9 9 19), POLYGONZ((10 10 101, 15 10 102, 13 13 103, 10 10 101), (11 10.5 100, 13 10.5 101, 13 11.3 102, 11 10.5 100)), POLYGONZ((20 20 100, 24.1 20 101, 22 18 102, 20 20 100), (21 19.5 101, 23.1 19.5 102, 22 18.5 103, 21 19.5 101)))", 4326))) +SRID=4326;GEOMETRYCOLLECTION(POINT(1 2 100),LINESTRING(3 4 101,5 6 102,7 8 103,9 9 19),POLYGON((10 10 101,15 10 102,13 13 103,10 10 101),(11 10.5 100,13 11.3 102,13 10.5 101,11 10.5 100)),POLYGON((20 20 100,22 18 102,24.1 20 101,20 20 100),(21 19.5 101,23.1 19.5 102,22 18.5 103,21 19.5 101))) ADDED test/sql_stmt_tests/polygccw5.testcase Index: test/sql_stmt_tests/polygccw5.testcase ================================================================== --- test/sql_stmt_tests/polygccw5.testcase +++ test/sql_stmt_tests/polygccw5.testcase @@ -0,0 +1,7 @@ +forceLHR - GeometryCollection XYM +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTIONM(POINTM(1 2 10), LINESTRINGM(3 4 10, 5 6 11, 7 8 13, 9 9 13), POLYGONM((10 10 11, 15 10 13, 13 13 13, 10 10 11), (11 10.5 10, 13 10.5 11, 13 11.3 13, 11 10.5 10)), POLYGONM((20 20 10, 24.1 20 11, 22 18 13, 20 20 10), (21 19.5 11, 23.1 19.5 13, 22 18.5 13, 21 19.5 11)))", 4326))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTIONM(POINTM(1 2 10), LINESTRINGM(3 4 10, 5 6 11, 7 8 13, 9 9 13), POLYGONM((10 10 11, 15 10 13, 13 13 13, 10 10 11), (11 10.5 10, 13 10.5 11, 13 11.3 13, 11 10.5 10)), POLYGONM((20 20 10, 24.1 20 11, 22 18 13, 20 20 10), (21 19.5 11, 23.1 19.5 13, 22 18.5 13, 21 19.5 11)))", 4326))) +SRID=4326;GEOMETRYCOLLECTIONM(POINTM(1 2 10),LINESTRINGM(3 4 10,5 6 11,7 8 13,9 9 13),POLYGONM((10 10 11,15 10 13,13 13 13,10 10 11),(11 10.5 10,13 11.3 13,13 10.5 11,11 10.5 10)),POLYGONM((20 20 10,22 18 13,24.1 20 11,20 20 10),(21 19.5 11,23.1 19.5 13,22 18.5 13,21 19.5 11))) ADDED test/sql_stmt_tests/polygccw6.testcase Index: test/sql_stmt_tests/polygccw6.testcase ================================================================== --- test/sql_stmt_tests/polygccw6.testcase +++ test/sql_stmt_tests/polygccw6.testcase @@ -0,0 +1,7 @@ +forcePolygonCCW - GeometryCollection XYZM +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTIONZM(POINTZM(1 2 100 10), LINESTRINGZM(3 4 101 10, 5 6 102 11, 7 8 103 13, 9 9 19 13), POLYGONZM((10 10 101 11, 15 10 102 13, 13 13 103 13, 10 10 101 11), (11 10.5 100 10, 13 10.5 101 11, 13 11.3 102 13, 11 10.5 100 10)), POLYGONZM((20 20 100 10, 24.1 20 101 11, 22 18 102 13, 20 20 100 10), (21 19.5 101 11, 23.1 19.5 102 13, 22 18.5 103 13, 21 19.5 101 11)))", 4326))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCCW(GeomFromText("GEOMETRYCOLLECTIONZM(POINTZM(1 2 100 10), LINESTRINGZM(3 4 101 10, 5 6 102 11, 7 8 103 13, 9 9 19 13), POLYGONZM((10 10 101 11, 15 10 102 13, 13 13 103 13, 10 10 101 11), (11 10.5 100 10, 13 10.5 101 11, 13 11.3 102 13, 11 10.5 100 10)), POLYGONZM((20 20 100 10, 24.1 20 101 11, 22 18 102 13, 20 20 100 10), (21 19.5 101 11, 23.1 19.5 102 13, 22 18.5 103 13, 21 19.5 101 11)))", 4326))) +SRID=4326;GEOMETRYCOLLECTION(POINT(1 2 100 10),LINESTRING(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON((10 10 101 11,15 10 102 13,13 13 103 13,10 10 101 11),(11 10.5 100 10,13 11.3 102 13,13 10.5 101 11,11 10.5 100 10)),POLYGON((20 20 100 10,22 18 102 13,24.1 20 101 11,20 20 100 10),(21 19.5 101 11,23.1 19.5 102 13,22 18.5 103 13,21 19.5 101 11))) ADDED test/sql_stmt_tests/polygcw1.testcase Index: test/sql_stmt_tests/polygcw1.testcase ================================================================== --- test/sql_stmt_tests/polygcw1.testcase +++ test/sql_stmt_tests/polygcw1.testcase @@ -0,0 +1,7 @@ +forcePolygonCW - zeroblob +:memory: #use in-memory database +SELECT ST_ForcePolygonCW(zeroblob(99)); +1 # rows (not including the header row) +1 # columns +ST_ForcePolygonCW(zeroblob(99)) +(NULL) ADDED test/sql_stmt_tests/polygcw2.testcase Index: test/sql_stmt_tests/polygcw2.testcase ================================================================== --- test/sql_stmt_tests/polygcw2.testcase +++ test/sql_stmt_tests/polygcw2.testcase @@ -0,0 +1,7 @@ +forcePolygonCW - invalid +:memory: #use in-memory database +SELECT ST_ForcePolygonCW("alpha"); +1 # rows (not including the header row) +1 # columns +ST_ForcePolygonCW("alpha") +(NULL) ADDED test/sql_stmt_tests/polygcw3.testcase Index: test/sql_stmt_tests/polygcw3.testcase ================================================================== --- test/sql_stmt_tests/polygcw3.testcase +++ test/sql_stmt_tests/polygcw3.testcase @@ -0,0 +1,7 @@ +forcePolygonCW - GeometryCollection XY +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTION(POINT(1 2), LINESTRING(3 4, 5 6, 7 8, 9 9), POLYGON((10 10, 15 10, 13 13, 10 10), (11 10.5, 13 10.5, 13 11.3, 11 10.5)), POLYGON((20 20, 24.1 20, 22 18, 20 20), (21 19.5, 23.1 19.5, 22 18.5, 21 19.5)))"))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTION(POINT(1 2), LINESTRING(3 4, 5 6, 7 8, 9 9), POLYGON((10 10, 15 10, 13 13, 10 10), (11 10.5, 13 10.5, 13 11.3, 11 10.5)), POLYGON((20 20, 24.1 20, 22 18, 20 20), (21 19.5, 23.1 19.5, 22 18.5, 21 19.5)))"))) +SRID=0;GEOMETRYCOLLECTION(POINT(1 2),LINESTRING(3 4,5 6,7 8,9 9),POLYGON((10 10,13 13,15 10,10 10),(11 10.5,13 10.5,13 11.3,11 10.5)),POLYGON((20 20,24.1 20,22 18,20 20),(21 19.5,22 18.5,23.1 19.5,21 19.5))) ADDED test/sql_stmt_tests/polygcw4.testcase Index: test/sql_stmt_tests/polygcw4.testcase ================================================================== --- test/sql_stmt_tests/polygcw4.testcase +++ test/sql_stmt_tests/polygcw4.testcase @@ -0,0 +1,7 @@ +forcePolygonCW - GeometryCollection XYZ +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTIONZ(POINTZ(1 2 100), LINESTRINGZ(3 4 101, 5 6 102, 7 8 103, 9 9 19), POLYGONZ((10 10 101, 15 10 102, 13 13 103, 10 10 101), (11 10.5 100, 13 10.5 101, 13 11.3 102, 11 10.5 100)), POLYGONZ((20 20 100, 24.1 20 101, 22 18 102, 20 20 100), (21 19.5 101, 23.1 19.5 102, 22 18.5 103, 21 19.5 101)))", 4326))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTIONZ(POINTZ(1 2 100), LINESTRINGZ(3 4 101, 5 6 102, 7 8 103, 9 9 19), POLYGONZ((10 10 101, 15 10 102, 13 13 103, 10 10 101), (11 10.5 100, 13 10.5 101, 13 11.3 102, 11 10.5 100)), POLYGONZ((20 20 100, 24.1 20 101, 22 18 102, 20 20 100), (21 19.5 101, 23.1 19.5 102, 22 18.5 103, 21 19.5 101)))", 4326))) +SRID=4326;GEOMETRYCOLLECTION(POINT(1 2 100),LINESTRING(3 4 101,5 6 102,7 8 103,9 9 19),POLYGON((10 10 101,13 13 103,15 10 102,10 10 101),(11 10.5 100,13 10.5 101,13 11.3 102,11 10.5 100)),POLYGON((20 20 100,24.1 20 101,22 18 102,20 20 100),(21 19.5 101,22 18.5 103,23.1 19.5 102,21 19.5 101))) ADDED test/sql_stmt_tests/polygcw5.testcase Index: test/sql_stmt_tests/polygcw5.testcase ================================================================== --- test/sql_stmt_tests/polygcw5.testcase +++ test/sql_stmt_tests/polygcw5.testcase @@ -0,0 +1,7 @@ +forceLHR - GeometryCollection XYM +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTIONM(POINTM(1 2 10), LINESTRINGM(3 4 10, 5 6 11, 7 8 13, 9 9 13), POLYGONM((10 10 11, 15 10 13, 13 13 13, 10 10 11), (11 10.5 10, 13 10.5 11, 13 11.3 13, 11 10.5 10)), POLYGONM((20 20 10, 24.1 20 11, 22 18 13, 20 20 10), (21 19.5 11, 23.1 19.5 13, 22 18.5 13, 21 19.5 11)))", 4326))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTIONM(POINTM(1 2 10), LINESTRINGM(3 4 10, 5 6 11, 7 8 13, 9 9 13), POLYGONM((10 10 11, 15 10 13, 13 13 13, 10 10 11), (11 10.5 10, 13 10.5 11, 13 11.3 13, 11 10.5 10)), POLYGONM((20 20 10, 24.1 20 11, 22 18 13, 20 20 10), (21 19.5 11, 23.1 19.5 13, 22 18.5 13, 21 19.5 11)))", 4326))) +SRID=4326;GEOMETRYCOLLECTIONM(POINTM(1 2 10),LINESTRINGM(3 4 10,5 6 11,7 8 13,9 9 13),POLYGONM((10 10 11,13 13 13,15 10 13,10 10 11),(11 10.5 10,13 10.5 11,13 11.3 13,11 10.5 10)),POLYGONM((20 20 10,24.1 20 11,22 18 13,20 20 10),(21 19.5 11,22 18.5 13,23.1 19.5 13,21 19.5 11))) ADDED test/sql_stmt_tests/polygcw6.testcase Index: test/sql_stmt_tests/polygcw6.testcase ================================================================== --- test/sql_stmt_tests/polygcw6.testcase +++ test/sql_stmt_tests/polygcw6.testcase @@ -0,0 +1,7 @@ +forcePolygonCW - GeometryCollection XYZM +:memory: #use in-memory database +SELECT AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTIONZM(POINTZM(1 2 100 10), LINESTRINGZM(3 4 101 10, 5 6 102 11, 7 8 103 13, 9 9 19 13), POLYGONZM((10 10 101 11, 15 10 102 13, 13 13 103 13, 10 10 101 11), (11 10.5 100 10, 13 10.5 101 11, 13 11.3 102 13, 11 10.5 100 10)), POLYGONZM((20 20 100 10, 24.1 20 101 11, 22 18 102 13, 20 20 100 10), (21 19.5 101 11, 23.1 19.5 102 13, 22 18.5 103 13, 21 19.5 101 11)))", 4326))); +1 # rows (not including the header row) +1 # columns +AsEWKT(ST_ForcePolygonCW(GeomFromText("GEOMETRYCOLLECTIONZM(POINTZM(1 2 100 10), LINESTRINGZM(3 4 101 10, 5 6 102 11, 7 8 103 13, 9 9 19 13), POLYGONZM((10 10 101 11, 15 10 102 13, 13 13 103 13, 10 10 101 11), (11 10.5 100 10, 13 10.5 101 11, 13 11.3 102 13, 11 10.5 100 10)), POLYGONZM((20 20 100 10, 24.1 20 101 11, 22 18 102 13, 20 20 100 10), (21 19.5 101 11, 23.1 19.5 102 13, 22 18.5 103 13, 21 19.5 101 11)))", 4326))) +SRID=4326;GEOMETRYCOLLECTION(POINT(1 2 100 10),LINESTRING(3 4 101 10,5 6 102 11,7 8 103 13,9 9 19 13),POLYGON((10 10 101 11,13 13 103 13,15 10 102 13,10 10 101 11),(11 10.5 100 10,13 10.5 101 11,13 11.3 102 13,11 10.5 100 10)),POLYGON((20 20 100 10,24.1 20 101 11,22 18 102 13,20 20 100 10),(21 19.5 101 11,22 18.5 103 13,23.1 19.5 102 13,21 19.5 101 11))) Index: test/sql_stmt_tests/wkbtosql1.testcase ================================================================== --- test/sql_stmt_tests/wkbtosql1.testcase +++ test/sql_stmt_tests/wkbtosql1.testcase @@ -1,7 +1,7 @@ ST_WKBToSQL :memory: #use in-memory database -SELECT Hex(ST_WKBToSQL(AsBinary(GeomFromText("Point(1 2)", 4326)))) +SELECT AsText(ST_WKBToSQL(AsBinary(GeomFromText("Point(1 2)", 4326)))) 1 # rows (not including the header row) 1 # columns -Hex(ST_WKBToSQL(AsBinary(GeomFromText("Point(1 2)", 4326)))) -000100000000000000000000F03F0000000000000040000000000000F03F00000000000000407C01000000000000000000F03F0000000000000040FE +AsText(ST_WKBToSQL(AsBinary(GeomFromText("Point(1 2)", 4326)))) +POINT(1 2) ADDED test/sql_stmt_tests/wms_setcopyright1.testcase Index: test/sql_stmt_tests/wms_setcopyright1.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright1.testcase +++ test/sql_stmt_tests/wms_setcopyright1.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - NULL url +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright(NULL, 'layer', 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright(NULL, 'layer', 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright10.testcase Index: test/sql_stmt_tests/wms_setcopyright10.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright10.testcase +++ test/sql_stmt_tests/wms_setcopyright10.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Text copyright +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 'somebody') +0 ADDED test/sql_stmt_tests/wms_setcopyright11.testcase Index: test/sql_stmt_tests/wms_setcopyright11.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright11.testcase +++ test/sql_stmt_tests/wms_setcopyright11.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Int copyright +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 1) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 1) +-1 ADDED test/sql_stmt_tests/wms_setcopyright12.testcase Index: test/sql_stmt_tests/wms_setcopyright12.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright12.testcase +++ test/sql_stmt_tests/wms_setcopyright12.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Double copyright +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 1.5) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 1.5) +-1 ADDED test/sql_stmt_tests/wms_setcopyright13.testcase Index: test/sql_stmt_tests/wms_setcopyright13.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright13.testcase +++ test/sql_stmt_tests/wms_setcopyright13.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - BLOB copyright +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', zeroblob(4)) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', zeroblob(4)) +-1 ADDED test/sql_stmt_tests/wms_setcopyright14.testcase Index: test/sql_stmt_tests/wms_setcopyright14.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright14.testcase +++ test/sql_stmt_tests/wms_setcopyright14.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - NULL license +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', NULL) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', NULL) +-1 ADDED test/sql_stmt_tests/wms_setcopyright15.testcase Index: test/sql_stmt_tests/wms_setcopyright15.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright15.testcase +++ test/sql_stmt_tests/wms_setcopyright15.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Int license +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', 1) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', 1) +-1 ADDED test/sql_stmt_tests/wms_setcopyright16.testcase Index: test/sql_stmt_tests/wms_setcopyright16.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright16.testcase +++ test/sql_stmt_tests/wms_setcopyright16.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Double license +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', 1.4) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', 1.4) +-1 ADDED test/sql_stmt_tests/wms_setcopyright17.testcase Index: test/sql_stmt_tests/wms_setcopyright17.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright17.testcase +++ test/sql_stmt_tests/wms_setcopyright17.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - BLOB license +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', zeroblob(4)) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', zeroblob(4)) +-1 ADDED test/sql_stmt_tests/wms_setcopyright18.testcase Index: test/sql_stmt_tests/wms_setcopyright18.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright18.testcase +++ test/sql_stmt_tests/wms_setcopyright18.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Text license +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', 'CC0 1.0') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', 'somebody', 'CC0 1.0') +0 ADDED test/sql_stmt_tests/wms_setcopyright19.testcase Index: test/sql_stmt_tests/wms_setcopyright19.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright19.testcase +++ test/sql_stmt_tests/wms_setcopyright19.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Text license, NULL copyright +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', NULL, 'CC0 1.0') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', NULL, 'CC0 1.0') +0 ADDED test/sql_stmt_tests/wms_setcopyright2.testcase Index: test/sql_stmt_tests/wms_setcopyright2.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright2.testcase +++ test/sql_stmt_tests/wms_setcopyright2.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Int url +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright(1, 'layer', 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright(1, 'layer', 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright3.testcase Index: test/sql_stmt_tests/wms_setcopyright3.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright3.testcase +++ test/sql_stmt_tests/wms_setcopyright3.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Double url +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright(1.2, 'layer', 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright(1.2, 'layer', 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright4.testcase Index: test/sql_stmt_tests/wms_setcopyright4.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright4.testcase +++ test/sql_stmt_tests/wms_setcopyright4.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - BLOB url +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright(zeroblob(4), 'layer', 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright(zeroblob(4), 'layer', 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright5.testcase Index: test/sql_stmt_tests/wms_setcopyright5.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright5.testcase +++ test/sql_stmt_tests/wms_setcopyright5.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - NULL layer +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', NULL, 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', NULL, 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright6.testcase Index: test/sql_stmt_tests/wms_setcopyright6.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright6.testcase +++ test/sql_stmt_tests/wms_setcopyright6.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Int layer +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 1, 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 1, 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright7.testcase Index: test/sql_stmt_tests/wms_setcopyright7.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright7.testcase +++ test/sql_stmt_tests/wms_setcopyright7.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - Double layer +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 1.5, 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 1.5, 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright8.testcase Index: test/sql_stmt_tests/wms_setcopyright8.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright8.testcase +++ test/sql_stmt_tests/wms_setcopyright8.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - BLOB layer +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', zeroblob(10), 'somebody') +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', zeroblob(10), 'somebody') +-1 ADDED test/sql_stmt_tests/wms_setcopyright9.testcase Index: test/sql_stmt_tests/wms_setcopyright9.testcase ================================================================== --- test/sql_stmt_tests/wms_setcopyright9.testcase +++ test/sql_stmt_tests/wms_setcopyright9.testcase @@ -0,0 +1,7 @@ +WMS_SetGetMapCopyright() - NULL copyright +:memory: #use in-memory database +SELECT WMS_SetGetMapCopyright('anurl', 'layer', NULL) +1 # rows (not including the header row) +1 # columns +WMS_SetGetMapCopyright('anurl', 'layer', NULL) +1 ADDED test/sql_stmt_tiny_point/Makefile.am Index: test/sql_stmt_tiny_point/Makefile.am ================================================================== --- test/sql_stmt_tiny_point/Makefile.am +++ test/sql_stmt_tiny_point/Makefile.am @@ -0,0 +1,2 @@ + +EXTRA_DIST = isXblob5.testcase ADDED test/sql_stmt_tiny_point/Makefile.in Index: test/sql_stmt_tiny_point/Makefile.in ================================================================== --- test/sql_stmt_tiny_point/Makefile.in +++ test/sql_stmt_tiny_point/Makefile.in @@ -0,0 +1,449 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = test/sql_stmt_tiny_point +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GEOSCONFIG = @GEOSCONFIG@ +GEOS_CFLAGS = @GEOS_CFLAGS@ +GEOS_LDFLAGS = @GEOS_LDFLAGS@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = isXblob5.testcase +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/sql_stmt_tiny_point/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/sql_stmt_tiny_point/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: ADDED test/sql_stmt_tiny_point/isXblob5.testcase Index: test/sql_stmt_tiny_point/isXblob5.testcase ================================================================== --- test/sql_stmt_tiny_point/isXblob5.testcase +++ test/sql_stmt_tiny_point/isXblob5.testcase @@ -0,0 +1,29 @@ +isXblob - geom - TinyPoint +:memory: #use in-memory database +SELECT Hex(blob), IsPngBlob(blob), IsGifBlob(blob), IsGeometryBlob(blob), IsTinyPointBlob(blob), IsZipBlob(blob), IsPdfBlob(blob), IsTiffBlob(blob), IsJpegBlob(blob), IsExifBlob(blob), IsExifGpsBlob(blob), IsWebpBlob(blob) FROM (SELECT GeomFromText("POINT(1 3)") as blob) dummy +1 # rows (not including the header row) +12 # columns +Hex(blob) +IsPngBlob(blob) +IsGifBlob(blob) +IsGeometryBlob(blob) +IsTinyPointBlob(blob) +IsZipBlob(blob) +IsPdfBlob(blob) +IsTiffBlob(blob) +IsJpegBlob(blob) +IsExifBlob(blob) +IsExifGpsBlob(blob) +IsWebpBlob(blob) +00810000000001000000000000F03F0000000000000840FE +0 +0 +0 +1 +0 +0 +0 +0 +0 +0 +0 ADDED test/sqlproc_error.txt Index: test/sqlproc_error.txt ================================================================== --- test/sqlproc_error.txt +++ test/sqlproc_error.txt @@ -0,0 +1,41 @@ +-- +-- creating a table +-- +CREATE TABLE another_test ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + value DOUBLE NOT NULL); + +-- +-- populating the table +-- +INSERT INTO another_test (id, name, value) VALUES (NULL, 'alpha', 1.5); +INSERT INTO another_test (id, name, value) VALUES (NULL, 'beta', 2.5); +INSERT INTO another_test (id, name, value) VALUES (NULL, 'gamma', 3.5); +INSERT INTO another_test (id, name, value) VALUES (NULL, 'delta', 4.5); +INSERT INTO another_test (id, name, value) VALUES (NULL, 'epsilon', 5.5); + +-- +-- first check +-- +SELECT * FROM another_test; + +-- +-- testing update +-- +UPDATE another_test SET name = 'DELTA' WHERE vallue = 4.5; + +-- +-- testing delete +-- +DELETE FROM another_test WHERE name = 'beta'; + +-- +-- second check +-- +SELECT * FROM another_test; + +-- +-- last check +-- +SELECT * FROM another_test WHERE name = 'none'; ADDED test/sqlproc_logfile.txt Index: test/sqlproc_logfile.txt ================================================================== --- test/sqlproc_logfile.txt +++ test/sqlproc_logfile.txt @@ -0,0 +1,41 @@ +-- +-- creating a table +-- +CREATE TABLE my_test ( + id INTEGER PRIMARY KEY, + name TEXT NOT NULL, + value DOUBLE NOT NULL); + +-- +-- populating the table +-- +INSERT INTO my_test (id, name, value) VALUES (NULL, 'alpha', 1.5); +INSERT INTO my_test (id, name, value) VALUES (NULL, 'beta', 2.5); +INSERT INTO my_test (id, name, value) VALUES (NULL, 'gamma', 3.5); +INSERT INTO my_test (id, name, value) VALUES (NULL, 'delta', 4.5); +INSERT INTO my_test (id, name, value) VALUES (NULL, 'epsilon', 5.5); + +-- +-- first check +-- +SELECT * FROM my_test; + +-- +-- testing update +-- +UPDATE my_test SET name = 'DELTA' WHERE value = 4.5; + +-- +-- testing delete +-- +DELETE FROM my_test WHERE name = 'beta'; + +-- +-- second check +-- +SELECT * FROM my_test; + +-- +-- last check +-- +SELECT * FROM my_test WHERE name = 'none'; ADDED test/sqlproc_sample.txt Index: test/sqlproc_sample.txt ================================================================== --- test/sqlproc_sample.txt +++ test/sqlproc_sample.txt @@ -0,0 +1,1 @@ +SELECT @col1@, @col2@ FROM @table@ Index: test/test_helpers.h ================================================================== --- test/test_helpers.h +++ test/test_helpers.h @@ -36,11 +36,11 @@ } return NULL; } #endif -#ifdef __WIN32 +#if defined(__WIN32) && !defined(__MINGW32__) /* * public domain strtok_r() by Charlie Gordon * * from comp.lang.c 9/14/2007 *