[spatialite] 01/01: Imported Upstream version 4.2.0

Bas Couwenberg sebastic at xs4all.nl
Sun Aug 3 21:54:49 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch upstream
in repository spatialite.

commit 039b9e22b2545e78c175a4c11f5b24ac73a5c48e
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Aug 3 14:23:13 2014 +0200

    Imported Upstream version 4.2.0
---
 Android_4.2.0.mk                                 |  23 ++
 Makefile.am                                      |   3 +-
 Makefile.in                                      |   3 +-
 config-msvc.h                                    |  22 +-
 configure                                        |  20 +-
 configure.ac                                     |   2 +-
 makefile.vc                                      |   9 +-
 spatialite-4.2.0.mk                              | 169 ++++++++++++++
 spatialite-sql-latest.html                       |  61 ++++-
 src/Makefile.am                                  |   8 +-
 src/Makefile.in                                  |   8 +-
 src/connection_cache/alloc_cache.c               |   7 +-
 src/dxf/dxf_load_distinct.c                      |   2 +-
 src/dxf/dxf_load_mixed.c                         |   2 +-
 src/dxf/dxf_loader.c                             |   2 +-
 src/dxf/dxf_parser.c                             |  49 +++-
 src/dxf/dxf_private.h                            |   2 +-
 src/dxf/dxf_writer.c                             |   2 +-
 src/gaiaaux/gg_sqlaux.c                          |   2 +-
 src/gaiaaux/gg_utf8.c                            |   2 +-
 src/gaiaexif/gaia_exif.c                         |   3 +-
 src/gaiageo/gg_advanced.c                        |  17 +-
 src/gaiageo/gg_endian.c                          |   2 +-
 src/gaiageo/gg_ewkt.c                            |   2 +-
 src/gaiageo/gg_extras.c                          |   2 +-
 src/gaiageo/gg_geoJSON.c                         |   2 +-
 src/gaiageo/gg_geodesic.c                        |   2 +-
 src/gaiageo/gg_geometries.c                      |   2 +-
 src/gaiageo/gg_geoscvt.c                         |   2 +-
 src/gaiageo/gg_gml.c                             |   2 +-
 src/gaiageo/gg_kml.c                             |   2 +-
 src/gaiageo/gg_lwgeom.c                          |   2 +-
 src/gaiageo/gg_relations.c                       | 172 +++++++++++++-
 src/gaiageo/gg_relations_ext.c                   |   2 +-
 src/gaiageo/gg_shape.c                           |  10 +-
 src/gaiageo/gg_transform.c                       |   3 +-
 src/gaiageo/gg_vanuatu.c                         |   2 +-
 src/gaiageo/gg_voronoj.c                         |   2 +-
 src/gaiageo/gg_wkb.c                             |   2 +-
 src/gaiageo/gg_wkt.c                             |   2 +-
 src/gaiageo/gg_xml.c                             |   2 +-
 src/geopackage/gaia_cvt_gpkg.c                   |   4 +-
 src/headers/spatialite.h                         |   2 +-
 src/headers/spatialite/debug.h                   |   2 +-
 src/headers/spatialite/gaiaaux.h                 |   2 +-
 src/headers/spatialite/gaiaexif.h                |   2 +-
 src/headers/spatialite/gaiageo.h                 |   2 +-
 src/headers/spatialite/geopackage.h              |   2 +
 src/headers/spatialite/gg_advanced.h             |  76 +++++-
 src/headers/spatialite/gg_const.h                |   5 +-
 src/headers/spatialite/gg_core.h                 |   2 +-
 src/headers/spatialite/gg_dxf.h                  |   2 +-
 src/headers/spatialite/gg_dynamic.h              |   2 +-
 src/headers/spatialite/gg_formats.h              |   2 +-
 src/headers/spatialite/gg_mbr.h                  |   2 +-
 src/headers/spatialite/gg_structs.h              |   2 +-
 src/headers/spatialite/gg_wfs.h                  |   2 +-
 src/headers/spatialite/gg_xml.h                  |   2 +-
 src/headers/spatialite/spatialite.h              |   2 +-
 src/headers/spatialite/sqlite.h                  |   2 +-
 src/headers/spatialite_private.h                 |   2 +-
 src/md5/gaia_md5.c                               |   2 +-
 src/shapefiles/shapefiles.c                      |   3 +-
 src/shapefiles/validator.c                       |   2 +-
 src/spatialite/extra_tables.c                    |   4 +
 src/spatialite/mbrcache.c                        |   2 +-
 src/spatialite/metatables.c                      |   2 +-
 src/spatialite/spatialite.c                      | 284 +++++++++++++++--------
 src/spatialite/spatialite_init.c                 |   2 +-
 src/spatialite/statistics.c                      |   2 +-
 src/spatialite/virtualXL.c                       |   2 +-
 src/spatialite/virtualbbox.c                     |   2 +-
 src/spatialite/virtualdbf.c                      |   2 +-
 src/spatialite/virtualfdo.c                      |   2 +-
 src/spatialite/virtualgpkg.c                     |  14 +-
 src/spatialite/virtualnetwork.c                  |   2 +-
 src/spatialite/virtualshape.c                    |   2 +-
 src/spatialite/virtualspatialindex.c             |   2 +-
 src/spatialite/virtualxpath.c                    |   2 +-
 src/srsinit/srs_init.c                           |   2 +-
 src/versioninfo/version.c                        |   2 +-
 src/virtualtext/virtualtext.c                    |   6 +-
 src/wfs/wfs_in.c                                 |   2 +-
 test/check_spatialindex.c                        | 216 +++++++++++++++--
 test/gpkg_test.gpkg                              | Bin 380928 -> 384000 bytes
 test/sql_stmt_geos_tests/Makefile.am             |  10 +
 test/sql_stmt_geos_tests/Makefile.in             |  10 +
 test/sql_stmt_geos_tests/isvaliddetail1.testcase |   7 +
 test/sql_stmt_geos_tests/isvaliddetail2.testcase |   7 +
 test/sql_stmt_geos_tests/isvaliddetail3.testcase |   7 +
 test/sql_stmt_geos_tests/isvaliddetail4.testcase |   7 +
 test/sql_stmt_geos_tests/isvaliddetail5.testcase |   7 +
 test/sql_stmt_geos_tests/isvalidreason1.testcase |   7 +
 test/sql_stmt_geos_tests/isvalidreason2.testcase |   7 +
 test/sql_stmt_geos_tests/isvalidreason3.testcase |   7 +
 test/sql_stmt_geos_tests/isvalidreason4.testcase |   7 +
 test/sql_stmt_geos_tests/isvalidreason5.testcase |   7 +
 test/sql_stmt_tests/Makefile.am                  |   3 +
 test/sql_stmt_tests/Makefile.in                  |   3 +
 test/sql_stmt_tests/collectextract1.testcase     |   2 +-
 test/sql_stmt_tests/collectextract10.testcase    |   2 +-
 test/sql_stmt_tests/collectextract11.testcase    |   2 +-
 test/sql_stmt_tests/collectextract12.testcase    |   2 +-
 test/sql_stmt_tests/collectextract15.testcase    |   2 +-
 test/sql_stmt_tests/collectextract16.testcase    |   2 +-
 test/sql_stmt_tests/collectextract17.testcase    |   2 +-
 test/sql_stmt_tests/collectextract18.testcase    |   2 +-
 test/sql_stmt_tests/collectextract19.testcase    |   2 +-
 test/sql_stmt_tests/collectextract20.testcase    |   2 +-
 test/sql_stmt_tests/collectextract21.testcase    |   2 +-
 test/sql_stmt_tests/collectextract22.testcase    |   2 +-
 test/sql_stmt_tests/collectextract23.testcase    |   7 +
 test/sql_stmt_tests/collectextract24.testcase    |   7 +
 test/sql_stmt_tests/collectextract25.testcase    |   7 +
 114 files changed, 1198 insertions(+), 258 deletions(-)

diff --git a/Android_4.2.0.mk b/Android_4.2.0.mk
new file mode 100644
index 0000000..b7f8bac
--- /dev/null
+++ b/Android_4.2.0.mk
@@ -0,0 +1,23 @@
+# -------------------
+# Android_4.2.0.mk
+# ndk-build clean
+# ndk-build
+# -------------------
+LOCAL_PATH := $(call my-dir)
+JSQLITE_PATH := javasqlite-20120209
+SPATIALITE_PATH := libspatialite-4.2.0-rc1
+GEOS_PATH := geos-3.4.2
+PROJ4_PATH := proj-4.8.0
+SQLITE_PATH := sqlite-amalgamation-3080403
+ICONV_PATH := libiconv-1.13.1
+XML2_PATH := libxml2-2.9.1
+LZMA_PATH := xz-5.1.3alpha
+
+include $(LOCAL_PATH)/iconv-1.13.1.mk
+include $(LOCAL_PATH)/sqlite-3080403.mk
+include $(LOCAL_PATH)/proj4-4.8.0.mk
+include $(LOCAL_PATH)/geos-3.4.2.mk
+include $(LOCAL_PATH)/libxml2-2.9.1.mk
+include $(LOCAL_PATH)/lzma-xz-5.1.3a.mk
+include $(LOCAL_PATH)/spatialite-4.2.0.mk
+include $(LOCAL_PATH)/jsqlite-20120209.mk
diff --git a/Makefile.am b/Makefile.am
index e3d9e5d..e14a393 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,8 @@ ACLOCAL_AMFLAGS = -I m4
 
 AUTOMAKE_OPTIONS = dist-zip
 
-EXTRA_DIST = makefile.vc nmake.opt Android.mk mainpage.doxy README.coverage \
+EXTRA_DIST = makefile.vc nmake.opt Android.mk Android_4.2.0.mk \
+	spatialite-4.2.0.mk mainpage.doxy README.coverage \
 	spatialite-sql-latest.html config-msvc.h
 
 if ENABLE_EXAMPLES
diff --git a/Makefile.in b/Makefile.in
index eb4aee1..8b71414 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -356,7 +356,8 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I m4
 AUTOMAKE_OPTIONS = dist-zip
-EXTRA_DIST = makefile.vc nmake.opt Android.mk mainpage.doxy README.coverage \
+EXTRA_DIST = makefile.vc nmake.opt Android.mk Android_4.2.0.mk \
+	spatialite-4.2.0.mk mainpage.doxy README.coverage \
 	spatialite-sql-latest.html config-msvc.h
 
 @ENABLE_EXAMPLES_TRUE at EXAMPLES = examples
diff --git a/config-msvc.h b/config-msvc.h
index 6ca4b7c..b95d9a6 100644
--- a/config-msvc.h
+++ b/config-msvc.h
@@ -12,13 +12,13 @@
 #define ENABLE_LIBXML2 1
 
 /* Should be defined in order to enable LWGEOM support. */
-#undef ENABLE_LWGEOM
+/* #undef ENABLE_LWGEOM */
 
 /* Should be defined in order to enable GEOS_ADVANCED support. */
 #define GEOS_ADVANCED 1
 
 /* Should be defined in order to enable GEOS_TRUNK experimental support. */
-#undef GEOS_TRUNK
+/* #undef GEOS_TRUNK */
 
 /* Define to 1 if you have the <dlfcn.h> header file. */
 /* #undef HAVE_DLFCN_H */
@@ -59,6 +59,9 @@
 /* Define to 1 if you have the `sqlite3' library (-lsqlite3). */
 #define HAVE_LIBSQLITE3 1
 
+/* Define to 1 if you have the `z' library (-lz). */
+#define HAVE_LIBZ 1
+
 /* Define to 1 if you have the `localtime_r' function. */
 /* #undef HAVE_LOCALTIME_R */
 
@@ -107,7 +110,7 @@
 #define HAVE_STDLIB_H 1
 
 /* Define to 1 if you have the `strcasecmp' function. */
-#define HAVE_STRCASECMP 1
+/* #undef HAVE_STRCASECMP */
 
 /* Define to 1 if you have the `strerror' function. */
 #define HAVE_STRERROR 1
@@ -122,7 +125,7 @@
 #define HAVE_STRING_H 1
 
 /* Define to 1 if you have the `strncasecmp' function. */
-#define HAVE_STRNCASECMP 1
+/* #undef HAVE_STRNCASECMP */
 
 /* Define to 1 if you have the `strstr' function. */
 #define HAVE_STRSTR 1
@@ -139,6 +142,9 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #define HAVE_UNISTD_H 1
 
+/* Define to 1 if you have the <zlib.h> header file. */
+#define HAVE_ZLIB_H 1
+
 /* Define to 1 if `lstat' dereferences a symlink specified with a trailing
    slash. */
 /* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */
@@ -192,9 +198,15 @@
 /* Define to the version of this package. */
 #define PACKAGE_VERSION "4.2.0"
 
+/* Should be defined when linking liblwgeom from PostGIS 2.1 (or later). */
+/* #undef POSTGIS_2_1 1 */
+
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
 
+/* Should contain a text-string describing the intended target CPU */
+#define TARGET_CPU "msvc-32"
+
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #define TIME_WITH_SYS_TIME 1
 
@@ -202,7 +214,7 @@
 /* #undef TM_IN_SYS_TIME */
 
 /* Version number of package */
-#define VERSION "4.1.1"
+#define VERSION "4.2.0-rc2"
 
 /* Must be =64 in order to enable huge-file support. */
 #define _FILE_OFFSET_BITS 64
diff --git a/configure b/configure
index a8ddf26..b8cdd25 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libspatialite 4.2.0-rc1.
+# Generated by GNU Autoconf 2.69 for libspatialite 4.2.0.
 #
 # Report bugs to <a.furieri at lqt.it>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libspatialite'
 PACKAGE_TARNAME='libspatialite'
-PACKAGE_VERSION='4.2.0-rc1'
-PACKAGE_STRING='libspatialite 4.2.0-rc1'
+PACKAGE_VERSION='4.2.0'
+PACKAGE_STRING='libspatialite 4.2.0'
 PACKAGE_BUGREPORT='a.furieri at lqt.it'
 PACKAGE_URL=''
 
@@ -1362,7 +1362,7 @@ 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.2.0-rc1 to adapt to many kinds of systems.
+\`configure' configures libspatialite 4.2.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1432,7 +1432,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libspatialite 4.2.0-rc1:";;
+     short | recursive ) echo "Configuration of libspatialite 4.2.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1566,7 +1566,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libspatialite configure 4.2.0-rc1
+libspatialite configure 4.2.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2110,7 +2110,7 @@ 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.2.0-rc1, which was
+It was created by libspatialite $as_me 4.2.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2981,7 +2981,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libspatialite'
- VERSION='4.2.0-rc1'
+ VERSION='4.2.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19000,7 +19000,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # 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.2.0-rc1, which was
+This file was extended by libspatialite $as_me 4.2.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -19066,7 +19066,7 @@ _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.2.0-rc1
+libspatialite config.status 4.2.0
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index 5db965f..a42cac4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.61)
-AC_INIT(libspatialite, 4.2.0-rc1, a.furieri at lqt.it)
+AC_INIT(libspatialite, 4.2.0, a.furieri at lqt.it)
 AC_LANG(C)
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/makefile.vc b/makefile.vc
index 714d4d1..208f460 100644
--- a/makefile.vc
+++ b/makefile.vc
@@ -14,13 +14,15 @@ LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.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_relations_ext.obj src/connection_cache/alloc_cache.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\spatialite_init.obj \
+	src\spatialite\virtualxpath.obj src\spatialite\virtualbbox.obj \
+	src\spatialite\spatialite_init.obj src\gaiageo\gg_voronoj.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 \
@@ -45,7 +47,10 @@ LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.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_extra.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_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
diff --git a/spatialite-4.2.0.mk b/spatialite-4.2.0.mk
new file mode 100644
index 0000000..13c39f2
--- /dev/null
+++ b/spatialite-4.2.0.mk
@@ -0,0 +1,169 @@
+include $(CLEAR_VARS)
+# ./configure --enable-examples=no --build=x86_64-pc-linux-gnu --host=arm-linux-eabi
+# 2015-06-09: libspatialite-4.2.0-rc1
+LOCAL_MODULE    := spatialite
+
+# SQLite flags copied from ASOP
+common_sqlite_flags := \
+ -DHAVE_USLEEP=1 \
+ -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \
+ -DSQLITE_THREADSAFE=1 \
+ -DNDEBUG=1 \
+ -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \
+ -DSQLITE_DEFAULT_AUTOVACUUM=1 \
+ -DSQLITE_TEMP_STORE=3 \
+ -DSQLITE_ENABLE_FTS3 \
+ -DSQLITE_ENABLE_FTS3_BACKWARDS \
+ -DSQLITE_ENABLE_RTREE=1 \
+ -DSQLITE_DEFAULT_FILE_FORMAT=4
+
+
+# spatialite flags
+# comment out TARGET_CPU in config.h - will be replaced with TARGET_ARCH_ABI
+spatialite_flags := \
+ -DOMIT_FREEXL \
+ -DTARGET_CPU=\"$(TARGET_ARCH_ABI)\" \
+ -Dfdatasync=fsync \
+ -DSQLITE_ENABLE_RTREE=1 \
+ -DSQLITE_OMIT_BUILTIN_TEST=1 
+
+LOCAL_CFLAGS    := \
+ $(common_sqlite_flags) \
+ $(spatialite_flags)
+
+# LOCAL_LDLIBS is always ignored for static libraries
+# LOCAL_LDLIBS    := -llog -lz
+# LOADABLE_EXTENSION must NOT be defined
+# For Spatialite with VirtualShapes,VirtualXL support iconv is needed
+LOCAL_C_INCLUDES := \
+ $(SQLITE_PATH) \
+ $(SPATIALITE_PATH) \
+ $(SPATIALITE_PATH)/src/headers \
+ $(ICONV_PATH)/include \
+ $(ICONV_PATH)/libcharset/include \
+ $(GEOS_PATH)/include \
+ $(GEOS_PATH)/capi \
+ $(PROJ4_PATH)/src \
+ $(LZMA_PATH)/src/liblzma/api \
+ $(XML2_PATH)/include
+LOCAL_SRC_FILES := \
+ $(SPATIALITE_PATH)/src/connection_cache/alloc_cache.c \
+ $(SPATIALITE_PATH)/src/connection_cache/generator/code_generator.c \
+ $(SPATIALITE_PATH)/src/dxf/dxf_load_distinct.c \
+ $(SPATIALITE_PATH)/src/dxf/dxf_loader.c \
+ $(SPATIALITE_PATH)/src/dxf/dxf_load_mixed.c \
+ $(SPATIALITE_PATH)/src/dxf/dxf_parser.c \
+ $(SPATIALITE_PATH)/src/dxf/dxf_writer.c \
+ $(SPATIALITE_PATH)/src/gaiaaux/gg_sqlaux.c \
+ $(SPATIALITE_PATH)/src/gaiaaux/gg_utf8.c \
+ $(SPATIALITE_PATH)/src/gaiaexif/gaia_exif.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_advanced.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_endian.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_ewkt.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_extras.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_geodesic.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_geoJSON.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_geometries.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_geoscvt.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_gml.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_kml.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_lwgeom.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_relations.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_relations_ext.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_shape.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_transform.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_vanuatu.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_voronoj.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_wkb.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_wkt.c \
+ $(SPATIALITE_PATH)/src/gaiageo/gg_xml.c \
+ $(SPATIALITE_PATH)/src/geopackage/gaia_cvt_gpkg.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgAddGeometryColumn.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkg_add_geometry_triggers.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkg_add_spatial_index.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkg_add_tile_triggers.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgBinary.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgCreateBaseTables.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgCreateTilesTable.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgCreateTilesZoomLevel.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgGetImageType.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkg_get_normal_row.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkg_get_normal_zoom.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgInsertEpsgSRID.c \
+ $(SPATIALITE_PATH)/src/geopackage/gpkgMakePoint.c \
+ $(SPATIALITE_PATH)/src/md5/gaia_md5.c \
+ $(SPATIALITE_PATH)/src/md5/md5.c \
+ $(SPATIALITE_PATH)/src/shapefiles/shapefiles.c \
+ $(SPATIALITE_PATH)/src/shapefiles/validator.c \
+ $(SPATIALITE_PATH)/src/spatialite/extra_tables.c \
+ $(SPATIALITE_PATH)/src/spatialite/mbrcache.c \
+ $(SPATIALITE_PATH)/src/spatialite/metatables.c \
+ $(SPATIALITE_PATH)/src/spatialite/spatialite.c \
+ $(SPATIALITE_PATH)/src/spatialite/spatialite_init.c \
+ $(SPATIALITE_PATH)/src/spatialite/statistics.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualbbox.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualdbf.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualfdo.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualgpkg.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualnetwork.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualshape.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualspatialindex.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualXL.c \
+ $(SPATIALITE_PATH)/src/spatialite/virtualxpath.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_00.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_01.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_02.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_03.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_04.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_05.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_06.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_07.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_08.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_09.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_10.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_11.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_12.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_13.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_14.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_15.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_16.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_17.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_18.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_19.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_20.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_21.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_22.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_23.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_24.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_25.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_26.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_27.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_28.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_29.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_30.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_31.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_32.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_33.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_34.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_35.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_36.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_37.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_38.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_39.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_40.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_41.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_42.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_43.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_44.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_45.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_extra.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_prussian.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_wgs84_00.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_inlined_wgs84_01.c \
+ $(SPATIALITE_PATH)/src/srsinit/srs_init.c \
+ $(SPATIALITE_PATH)/src/srsinit/epsg_update/auto_epsg.c \
+ $(SPATIALITE_PATH)/src/versioninfo/version.c \
+ $(SPATIALITE_PATH)/src/virtualtext/virtualtext.c \
+ $(SPATIALITE_PATH)/src/wfs/wfs_in.c
+LOCAL_STATIC_LIBRARIES := iconv proj geos libxml2
+include $(BUILD_STATIC_LIBRARY)
diff --git a/spatialite-sql-latest.html b/spatialite-sql-latest.html
index fb028e7..ca672ba 100644
--- a/spatialite-sql-latest.html
+++ b/spatialite-sql-latest.html
@@ -661,7 +661,6 @@ a Geometry will be returned representing the MBR for the corresponding GARS area
                                 NULL will be returned if any error is encountered.</td></tr>
 			<tr><td><b>MbrMinX</b></td>
 				<td>MbrMinX( geom <i>Geometry</i>) : <i>Double precision</i><hr>
-				    ST_MbrMinX( geom <i>Geometry</i>) : <i>Double precision</i><hr>
 				    ST_MinX( geom <i>Geometry</i>) : <i>Double precision</i></td>
 				<td></td>
 				<td align="center" bgcolor="#d0f0d0">base</td>
@@ -669,7 +668,6 @@ a Geometry will be returned representing the MBR for the corresponding GARS area
                                 NULL will be returned if <i>geom</i> isn't a valid Geometry.</td></tr>
 			<tr><td><b>MbrMinY</b></td>
 				<td>MbrMinY( geom <i>Geometry</i>) : <i>Double precision</i><hr>
-				    ST_MbrMinY( geom <i>Geometry</i>) : <i>Double precision</i><hr>
 				    ST_MinY( geom <i>Geometry</i>) : <i>Double precision</i></td>
 				<td></td>
 				<td align="center" bgcolor="#d0f0d0">base</td>
@@ -677,7 +675,6 @@ a Geometry will be returned representing the MBR for the corresponding GARS area
                                 NULL will be returned if <i>geom</i> isn't a valid Geometry.</td></tr>
 			<tr><td><b>MbrMaxX</b></td>
 				<td>MbrMaxX( geom <i>Geometry</i>) : <i>Double precision</i><hr>
-				    ST_MbrMaxX( geom <i>Geometry</i>) : <i>Double precision</i><hr>
 				    ST_MaxX( geom <i>Geometry</i>) : <i>Double precision</i></td>
 				<td></td>
 				<td align="center" bgcolor="#d0f0d0">base</td>
@@ -685,7 +682,6 @@ a Geometry will be returned representing the MBR for the corresponding GARS area
                                 NULL will be returned if <i>geom</i> isn't a valid Geometry.</td></tr>
 			<tr><td><b>MbrMaxY</b></td>
 				<td>MbrMaxY( geom <i>Geometry</i>) : <i>Double precision</i><hr>
-				    ST_MbrMaxY( geom <i>Geometry</i>) : <i>Double precision</i><hr>
 				    ST_MaxY( geom <i>Geometry</i>) : <i>Double precision</i></td>
 				<td></td>
 				<td align="center" bgcolor="#d0f0d0">base</td>
@@ -1097,6 +1093,20 @@ a Geometry will be returned representing the MBR for the corresponding GARS area
 				<td>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.<hr>
 					TRUE if this geometric object does  not contains any topological error</td></tr>
+			<tr><td><b>IsValidReason</b></td>
+				<td>IsValidReason( geom <i>Geometry</i> ) : <i>String</i><hr>
+					ST_IsValidReason( geom <i>Geometry</i> ) : <i>String</i></td>
+				<td></td>
+				<td align="center" bgcolor="#f0d0d0">GEOS</td>
+				<td>Will return a TEXT string stating if a Geometry is valid and if not valid, a reason why.<hr>
+					NULL will be returned on invalid arguments.</td></tr>
+			<tr><td><b>IsValidDetail</b></td>
+				<td>IsValidDetail( geom <i>Geometry</i> ) : <i>Geometry</i><hr>
+					ST_IsValidDetail( geom <i>Geometry</i> ) : <i>Geometry</i></td>
+				<td></td>
+				<td align="center" bgcolor="#f0d0d0">GEOS</td>
+				<td>Will return a Geometry detail (usually a <b>POINT</b>) causing invalidity.<hr>
+					NULL will be returned on invalid arguments, or in the case of a valid Geometry.</td></tr>
 			<tr><td><b>Boundary</b></td>
 				<td>Boundary( geom <i>Geometry</i> ) : <i>Geometry</i><hr>
 					ST_Boundary( geom <i>Geometry</i> ) : <i>Geometry</i></td>
@@ -1994,14 +2004,36 @@ This function only supports Long/Lat coordinates, and will return NULL for any p
 					ST_CollectionExtract( geom <i>Geometry</i> , type <i>Integer</i> ) : <i>Geometry</i></td>
 				<td></td>
 				<td align="center" bgcolor="#d0f0d0">base</td>
-				<td>Given a GEOMETRYCOLLECTION, returns a MULTI* geometry consisting only of the specified type.
+				<td>Given any arbitrary GEOMETRY will return a derived geometry consisting only of the specified type.
 				Sub-geometries that are not the specified type are ignored.<br>
 				<ul>
 					<li><b>1</b> = POINT-type</li>
 					<li><b>2</b> = LINESTRING-type</li>
 					<li><b>3</b> = POLYGON-type</li>
 				</ul>
-				NULL will be returned if any error is encountered (or when no item of required type is found)</td></tr>
+				NULL will be returned if any error is encountered (or when no item of required type is found)<br>
+				The Type of the returned Geometry could be e.g. <b>POINT</b> or <b>MULTIPOINT</b> depending on actual items count.</td></tr>
+			<tr><td><b>ExtractMultiPoint</b></td>
+				<td>ExtractMultiPoint( geom <i>Geometry</i> ) : <i>Geometry</i></td>
+				<td></td>
+				<td align="center" bgcolor="#d0f0d0">base</td>
+				<td>Given any arbitrary GEOMETRY will return a derived <b>MULTIPOINT</b> geometry.
+				Sub-geometries not being of the <b>POINT</b> type will be ignored.<br>
+				NULL will be returned if any error is encountered (or when no POINT is found).</td></tr>
+			<tr><td><b>ExtractMultiLinestring</b></td>
+				<td>ExtractMultiLinestring( geom <i>Geometry</i> ) : <i>Geometry</i></td>
+				<td></td>
+				<td align="center" bgcolor="#d0f0d0">base</td>
+				<td>Given any arbitrary GEOMETRY will return a derived <b>MULTILINESTRING</b> geometry.
+				Sub-geometries not being of the <b>LINESTRING</b> type will be ignored.<br>
+				NULL will be returned if any error is encountered (or when no LINESTRING is found).</td></tr>
+			<tr><td><b>ExtractMultiPolygon</b></td>
+				<td>ExtractMultiPolygon( geom <i>Geometry</i> ) : <i>Geometry</i></td>
+				<td></td>
+				<td align="center" bgcolor="#d0f0d0">base</td>
+				<td>Given any arbitrary GEOMETRY will return a derived <b>MULTIPOLYGON</b> geometry.
+				Sub-geometries not being of the <b>POLYGON</b> type will be ignored.<br>
+				NULL will be returned if any error is encountered (or when no POLYGON is found).</td></tr>
 			<tr><td><b>LocateAlongMeasure</b></td>
 				<td>ST_Locate_Along_Measure( geom <i>Geometry</i> , m_value <i>Double precision</i> ) : <i>Geometry</i><hr>
 				    ST_LocateAlong( geom <i>Geometry</i> , m_value <i>Double precision</i> ) : <i>Geometry</i></hr></td>
@@ -2385,6 +2417,13 @@ the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE</td
 				<td>Checks if some table has a physical column named "rowid" (caseless) shadowing the real ROWID.<hr>
 the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE<br>
 NULL will be returned if the requested table doesn't exist.</td></tr>
+		<tr><td><b>CheckWithoutRowid</b></td>
+				<td>CheckWithoutRowid( table <i>String</i> ) : <i>Integer</i></td>
+				<td></td>
+				<td align="center" bgcolor="#d0f0d0">base</td>
+				<td>Checks if some table was created by specifying a <b>WITHOUT ROWID</b> clause.<hr>
+the return type is Integer, with a return value of 1 for TRUE or 0 for FALSE<br>
+NULL will be returned if the requested table doesn't exist.</td></tr>
 		<tr><td><b>CheckSpatialIndex</b></td>
 				<td>CheckSpatialIndex( void ) : <i>Integer</i><hr>
 					CheckSpatialIndex( table <i>String</i> , column <i>String</i> ) : <i>Integer</i></td>
@@ -2548,7 +2587,7 @@ the return type is Integer, with a return value of 1 for TRUE (success) or 0 for
 				<ul>
 					<li><b>f_table_name</b> and <b>f_geometry_column</b> must identify an existing Vector Layer.</li>
 					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Vector type.<br>
-					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have succesfully passed a formal XML Schema Validation.</li>
+					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.</li>
 					<li>The same Vector Layer could eventually support more than a single Style; in this case 
 					the optional argument <b>style_id</b> can be explicitly set in order to identify an individual Style.<br>
 					If no <b>style_id</b> argument is specified then a new Styled Layer will be created, and the <b>style_id</b> value will be automatically set so to ensure univocity.</li>
@@ -2564,7 +2603,7 @@ the return type is Integer, with a return value of 1 for TRUE (success) or 0 for
 				<ul>
 					<li><b>coverage_name</b> must identify an existing Raster Layer.</li>
 					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD/SE Style of the Raster type.<br>
-					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have succesfully passed a formal XML Schema Validation.</li>
+					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.</li>
 					<li>The same Raster Layer could eventually support more than a single Style; in this case 
 					the optional argument <b>style_id</b> can be explicitly set in order to identify an individual Style.<br>
 					If no <b>style_id</b> argument is specified then a new Styled Layer will be created, and the <b>style_id</b> value will be automatically set so to ensure univocity.</li>
@@ -2608,7 +2647,7 @@ the return type is Integer, with a return value of 1 for TRUE (success) or 0 for
 				<ul>
 					<li><b>group_name</b> must identify an existing Styled Group.</li>
 					<li><b>style</b> is expected to be an XmlBLOB containing a valid SLD Style.<br>
-					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have succesfully passed a formal XML Schema Validation.</li>
+					If <b>CreatedStylingTables()</b> was invoked without specifying the <i>relaxed</i> option this XmlBLOB is expected to have successfully passed a formal XML Schema Validation.</li>
 					<li>The same Styled Group could eventually support more than a single Style; in this case 
 					the optional argument <b>style_id</b> can be explicitly set in order to identify an individual Style.<br>
 					If no <b>style_id</b> argument is specified then a new Style will be created, and the <b>style_id</b> value will be automatically set so to ensure univocity.</li>
@@ -3087,13 +3126,13 @@ the return type is Integer, with a return value of 1 for TRUE, 0 for FALSE</td><
 				<td>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.</td></tr>
 			<tr><td><b>XB_IsSldSeVectorStyle</b></td>
-				<td>XB_IsSldSVectorStyle( xmlObject <i>XmlBLOB</i> ) : <i>Integer</i></td>
+				<td>XB_IsSldSeVectorStyle( xmlObject <i>XmlBLOB</i> ) : <i>Integer</i></td>
 				<td></td>
 				<td align="center" bgcolor="#99d099">libxml2</td>
 				<td>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.</td></tr>
 			<tr><td><b>XB_IsSldSeRasterStyle</b></td>
-				<td>XB_IsSldSRasterStyle( xmlObject <i>XmlBLOB</i> ) : <i>Integer</i></td>
+				<td>XB_IsSldSeRasterStyle( xmlObject <i>XmlBLOB</i> ) : <i>Integer</i></td>
 				<td></td>
 				<td align="center" bgcolor="#99d099">libxml2</td>
 				<td>The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and –1 for UNKNOWN
diff --git a/src/Makefile.am b/src/Makefile.am
index b1d70ed..4ebad26 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,10 +38,10 @@ if MINGW
 libspatialite_la_LDFLAGS = -version-info 4:2:0 -no-undefined
 else 
 if ANDROID
-libspatialite_la_LDFLAGS = -version-info 6:0:2
+libspatialite_la_LDFLAGS = -version-info 7:0:0
 libspatialite_la_LIBADD += -ldl
 else
-libspatialite_la_LDFLAGS = -version-info 6:0:2
+libspatialite_la_LDFLAGS = -version-info 7:0:0
 libspatialite_la_LIBADD += -lpthread -ldl
 endif
 endif
@@ -70,10 +70,10 @@ if MINGW
 mod_spatialite_la_LDFLAGS = -module -avoid-version -no-undefined
 else 
 if ANDROID
-mod_spatialite_la_LDFLAGS = -module -version-info 6:0:2
+mod_spatialite_la_LDFLAGS = -module -version-info 7:0:0
 mod_spatialite_la_LIBADD += -ldl
 else
-mod_spatialite_la_LDFLAGS = -module -version-info 6:0:2
+mod_spatialite_la_LDFLAGS = -module -version-info 7:0:0
 mod_spatialite_la_LIBADD += -lpthread -ldl
 endif
 endif
diff --git a/src/Makefile.in b/src/Makefile.in
index ac27fcd..0cf7db7 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -415,8 +415,8 @@ libspatialite_la_LIBADD = ./gaiaaux/libgaiaaux.la \
 	./connection_cache/libconnection_cache.la \
 	./virtualtext/libvirtualtext.la ./wfs/libwfs.la @LIBXML2_LIBS@ \
 	$(am__append_1) $(am__append_2)
- at ANDROID_FALSE@@MINGW_FALSE at libspatialite_la_LDFLAGS = -version-info 6:0:2
- at ANDROID_TRUE@@MINGW_FALSE at libspatialite_la_LDFLAGS = -version-info 6:0:2
+ at ANDROID_FALSE@@MINGW_FALSE at libspatialite_la_LDFLAGS = -version-info 7:0:0
+ at ANDROID_TRUE@@MINGW_FALSE at libspatialite_la_LDFLAGS = -version-info 7:0:0
 @MINGW_TRUE at libspatialite_la_LDFLAGS = -version-info 4:2:0 -no-undefined
 mod_spatialite_la_SOURCES = versioninfo/version.c
 mod_spatialite_la_LIBADD = ./gaiaaux/gaiaaux.la ./gaiaexif/gaiaexif.la \
@@ -429,8 +429,8 @@ mod_spatialite_la_LIBADD = ./gaiaaux/gaiaaux.la ./gaiaexif/gaiaexif.la \
 mod_spatialite_la_CPPFLAGS = @CFLAGS@ -I$(top_srcdir)/src/headers -I. \
 	-DLOADABLE_EXTENSION
 mod_spatialite_la_LIBTOOLFLAGS = --tag=disable-static
- at ANDROID_FALSE@@MINGW_FALSE at mod_spatialite_la_LDFLAGS = -module -version-info 6:0:2
- at ANDROID_TRUE@@MINGW_FALSE at mod_spatialite_la_LDFLAGS = -module -version-info 6:0:2
+ at ANDROID_FALSE@@MINGW_FALSE at mod_spatialite_la_LDFLAGS = -module -version-info 7:0:0
+ at ANDROID_TRUE@@MINGW_FALSE at mod_spatialite_la_LDFLAGS = -module -version-info 7:0:0
 @MINGW_TRUE at mod_spatialite_la_LDFLAGS = -module -avoid-version -no-undefined
 MOSTLYCLEANFILES = *.gcna *.gcno *.gcda
 all: all-recursive
diff --git a/src/connection_cache/alloc_cache.c b/src/connection_cache/alloc_cache.c
index 2249013..4d11912 100644
--- a/src/connection_cache/alloc_cache.c
+++ b/src/connection_cache/alloc_cache.c
@@ -1,7 +1,7 @@
 /*
  alloc_cache.c -- Gaia spatial support for SQLite
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -191,7 +191,7 @@ find_free_connection ()
 		return i;
 	    }
       }
-    spatialite_e ("ERROR: Too much connections: max %d\n",
+    spatialite_e ("ERROR: Too many connections: max %d\n",
 		  SPATIALITE_MAX_CONNECTIONS);
     return -1;
 }
@@ -332,7 +332,6 @@ free_internal_cache (struct splite_internal_cache *cache)
     if (handle != NULL)
 	finishGEOS_r (handle);
     cache->GEOS_handle = NULL;
-    finishGEOS ();
     gaiaResetGeosMsg_r (cache);
 #endif
 
@@ -717,7 +716,6 @@ spatialite_initialize (void)
 /* initializes the library */
     if (gaia_already_initialized)
 	return;
-    sqlite3_initialize ();
 
 #ifdef _WIN32
     InitializeCriticalSection (&gaia_cache_semaphore);
@@ -738,7 +736,6 @@ spatialite_shutdown (void)
     int i;
     if (!gaia_already_initialized)
 	return;
-    sqlite3_shutdown ();
 
 #ifdef _WIN32
     DeleteCriticalSection (&gaia_cache_semaphore);
diff --git a/src/dxf/dxf_load_distinct.c b/src/dxf/dxf_load_distinct.c
index 7d1c351..6998709 100644
--- a/src/dxf/dxf_load_distinct.c
+++ b/src/dxf/dxf_load_distinct.c
@@ -3,7 +3,7 @@
  dxf_load_distinct.c -- implements DXF support
  [loding features into the DB - by distinct layers]
 
- version 4.1, 2013 May 14
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/dxf/dxf_load_mixed.c b/src/dxf/dxf_load_mixed.c
index 658d955..e1f12ec 100644
--- a/src/dxf/dxf_load_mixed.c
+++ b/src/dxf/dxf_load_mixed.c
@@ -3,7 +3,7 @@
  dxf_load_mixed.c -- implements DXF support
  [loding features into the DB - mixed layers by geometry type]
 
- version 4.1, 2013 May 14
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/dxf/dxf_loader.c b/src/dxf/dxf_loader.c
index 41f44bd..8d32959 100644
--- a/src/dxf/dxf_loader.c
+++ b/src/dxf/dxf_loader.c
@@ -3,7 +3,7 @@
  dxf_loader.c -- implements DXF support 
  [loding features into the DB - common methods]
 
- version 4.1, 2013 May 14
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/dxf/dxf_parser.c b/src/dxf/dxf_parser.c
index 77b0339..a4665b3 100644
--- a/src/dxf/dxf_parser.c
+++ b/src/dxf/dxf_parser.c
@@ -2,7 +2,7 @@
 
  dxf_parser.c -- implements DXF support [parsing]
 
- version 4.1, 2013 May 14
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -61,6 +61,8 @@ the terms of any one of the MPL, the GPL or the LGPL.
 #include <spatialite/gg_dxf.h>
 #include <spatialite.h>
 
+#include "dxf_private.h"
+
 #ifndef OMIT_GEOS		/* only if GEOS is enabled */
 
 typedef struct dxf_segment
@@ -486,6 +488,41 @@ destroy_dxf_hole (gaiaDxfHolePtr hole)
     free (hole);
 }
 
+static int
+force_closure (gaiaDxfPolylinePtr line)
+{
+/* checking (and eventually forcing) first/last vertex coherency */
+    if (check_unclosed_polyg (line, 1))
+      {
+	  /* not properly closed: forcing the last vertex */
+	  double *ptr_x;
+	  double *ptr_y;
+	  double *ptr_z;
+	  ptr_x = realloc (line->x, sizeof (double) * (line->points + 1));
+	  ptr_y = realloc (line->y, sizeof (double) * (line->points + 1));
+	  ptr_z = realloc (line->z, sizeof (double) * (line->points + 1));
+	  if (ptr_x == NULL || ptr_y == NULL || ptr_z == NULL)
+	    {
+		/* some unexpected error happened - giving up */
+		if (ptr_x == NULL)
+		    free (ptr_x);
+		if (ptr_y == NULL)
+		    free (ptr_y);
+		if (ptr_z == NULL)
+		    free (ptr_z);
+		return 0;
+	    }
+	  line->x = ptr_x;
+	  line->y = ptr_y;
+	  line->z = ptr_z;
+	  *(line->x + line->points) = *(line->x + 0);
+	  *(line->y + line->points) = *(line->y + 0);
+	  *(line->z + line->points) = *(line->z + 0);
+	  line->points += 1;
+      }
+    return 1;
+}
+
 static void
 linked_rings (const void *p_cache, gaiaDxfPolylinePtr line)
 {
@@ -511,6 +548,11 @@ linked_rings (const void *p_cache, gaiaDxfPolylinePtr line)
 	return;
     if (line->points <= 0)
 	return;
+    if (line->is_closed == 0)
+	return;
+
+    if (!force_closure (line))
+	return;
 
     coll = malloc (sizeof (dxfLinkedSegments));
     coll->count = line->points - 1;
@@ -1279,6 +1321,11 @@ unlinked_rings (const void *p_cache, gaiaDxfPolylinePtr line)
 	return;
     if (line->points <= 0)
 	return;
+    if (line->is_closed == 0)
+	return;
+
+    if (!force_closure (line))
+	return;
 
     coll = alloc_dxf_rings ();
     start = 0;
diff --git a/src/dxf/dxf_private.h b/src/dxf/dxf_private.h
index 515f2c6..6b38cfb 100644
--- a/src/dxf/dxf_private.h
+++ b/src/dxf/dxf_private.h
@@ -1,7 +1,7 @@
 /* 
  dxf_private.h -- DXF Import Private API
   
- version 4.1, 2013 May 14
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/dxf/dxf_writer.c b/src/dxf/dxf_writer.c
index 4567d86..413c3f3 100644
--- a/src/dxf/dxf_writer.c
+++ b/src/dxf/dxf_writer.c
@@ -3,7 +3,7 @@
  dxf_writer.c -- implements DXF support
  [exporting a DXF]
 
- version 4.1, 2013 May 27
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiaaux/gg_sqlaux.c b/src/gaiaaux/gg_sqlaux.c
index 471d237..7906f33 100644
--- a/src/gaiaaux/gg_sqlaux.c
+++ b/src/gaiaaux/gg_sqlaux.c
@@ -2,7 +2,7 @@
 
  gg_sqlaux.c -- SQL ancillary functions
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiaaux/gg_utf8.c b/src/gaiaaux/gg_utf8.c
index 70c2efd..a07bf94 100644
--- a/src/gaiaaux/gg_utf8.c
+++ b/src/gaiaaux/gg_utf8.c
@@ -2,7 +2,7 @@
 
  gg_utf8.c -- locale charset handling
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiaexif/gaia_exif.c b/src/gaiaexif/gaia_exif.c
index c15e079..621bb07 100644
--- a/src/gaiaexif/gaia_exif.c
+++ b/src/gaiaexif/gaia_exif.c
@@ -2,7 +2,7 @@
 
  gaia_exif.c -- Gaia EXIF support
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -61,6 +61,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
 
 #include <spatialite/gaiageo.h>
 #include <spatialite/gaiaexif.h>
+#include <spatialite/geopackage.h>
 #include <spatialite.h>
 
 #ifdef _WIN32
diff --git a/src/gaiageo/gg_advanced.c b/src/gaiageo/gg_advanced.c
index 08bbcaa..0c54e5f 100644
--- a/src/gaiageo/gg_advanced.c
+++ b/src/gaiageo/gg_advanced.c
@@ -2,7 +2,7 @@
 
  gg_advanced.c -- Gaia advanced geometric operations
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -1923,7 +1923,10 @@ gaiaExtractPointsFromGeomColl (gaiaGeomCollPtr geom)
 	  pt = pt->Next;
       }
     result->Srid = geom->Srid;
-    result->DeclaredType = GAIA_MULTIPOINT;
+    if (pts == 1)
+	result->DeclaredType = GAIA_POINT;
+    else
+	result->DeclaredType = GAIA_MULTIPOINT;
     return result;
 }
 
@@ -1990,7 +1993,10 @@ gaiaExtractLinestringsFromGeomColl (gaiaGeomCollPtr geom)
 	  ln = ln->Next;
       }
     result->Srid = geom->Srid;
-    result->DeclaredType = GAIA_MULTILINESTRING;
+    if (lns == 1)
+	result->DeclaredType = GAIA_LINESTRING;
+    else
+	result->DeclaredType = GAIA_MULTILINESTRING;
     return result;
 }
 
@@ -2091,6 +2097,9 @@ gaiaExtractPolygonsFromGeomColl (gaiaGeomCollPtr geom)
 	  pg = pg->Next;
       }
     result->Srid = geom->Srid;
-    result->DeclaredType = GAIA_MULTIPOLYGON;
+    if (pgs == 1)
+	result->DeclaredType = GAIA_POLYGON;
+    else
+	result->DeclaredType = GAIA_MULTIPOLYGON;
     return result;
 }
diff --git a/src/gaiageo/gg_endian.c b/src/gaiageo/gg_endian.c
index 8ae2b91..50906a7 100644
--- a/src/gaiageo/gg_endian.c
+++ b/src/gaiageo/gg_endian.c
@@ -2,7 +2,7 @@
 
  gg_endian.c -- Gaia functions for litte/big endian values handling
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_ewkt.c b/src/gaiageo/gg_ewkt.c
index 0b9a101..5ae0a14 100644
--- a/src/gaiageo/gg_ewkt.c
+++ b/src/gaiageo/gg_ewkt.c
@@ -2,7 +2,7 @@
 
  gg_ewkt.c -- EWKT parser/lexer 
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_extras.c b/src/gaiageo/gg_extras.c
index 23712d4..d502ce2 100644
--- a/src/gaiageo/gg_extras.c
+++ b/src/gaiageo/gg_extras.c
@@ -2,7 +2,7 @@
 
  gg_extras.c -- Gaia extra functions support
     
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_geoJSON.c b/src/gaiageo/gg_geoJSON.c
index 461c445..84108f7 100644
--- a/src/gaiageo/gg_geoJSON.c
+++ b/src/gaiageo/gg_geoJSON.c
@@ -2,7 +2,7 @@
 
  gg_geoJSON.c -- GeoJSON parser/lexer 
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_geodesic.c b/src/gaiageo/gg_geodesic.c
index 6b55216..4065639 100644
--- a/src/gaiageo/gg_geodesic.c
+++ b/src/gaiageo/gg_geodesic.c
@@ -2,7 +2,7 @@
 
  gg_geodesic.c -- Gaia functions for geodesic calculations
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_geometries.c b/src/gaiageo/gg_geometries.c
index 2ecfc36..b95b3b1 100644
--- a/src/gaiageo/gg_geometries.c
+++ b/src/gaiageo/gg_geometries.c
@@ -2,7 +2,7 @@
 
  gg_geometries.c -- Gaia geometric objects
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_geoscvt.c b/src/gaiageo/gg_geoscvt.c
index 9dacf00..12bad90 100644
--- a/src/gaiageo/gg_geoscvt.c
+++ b/src/gaiageo/gg_geoscvt.c
@@ -2,7 +2,7 @@
 
  gg_geoscvt.c -- Gaia / GEOS conversion [Geometry]
     
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_gml.c b/src/gaiageo/gg_gml.c
index fba7cc7..66036bb 100644
--- a/src/gaiageo/gg_gml.c
+++ b/src/gaiageo/gg_gml.c
@@ -2,7 +2,7 @@
 
  gg_gml.c -- GML parser/lexer 
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_kml.c b/src/gaiageo/gg_kml.c
index 2cc41e2..9cf48a7 100644
--- a/src/gaiageo/gg_kml.c
+++ b/src/gaiageo/gg_kml.c
@@ -2,7 +2,7 @@
 
  gg_kml.c -- KML parser/lexer 
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_lwgeom.c b/src/gaiageo/gg_lwgeom.c
index a0ba45c..15c9748 100644
--- a/src/gaiageo/gg_lwgeom.c
+++ b/src/gaiageo/gg_lwgeom.c
@@ -2,7 +2,7 @@
 
  gg_lwgeom.c -- Gaia LWGEOM support
     
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_relations.c b/src/gaiageo/gg_relations.c
index 9bad33f..45539d0 100644
--- a/src/gaiageo/gg_relations.c
+++ b/src/gaiageo/gg_relations.c
@@ -2,7 +2,7 @@
 
  gg_relations.c -- Gaia spatial relations
     
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -2641,6 +2641,176 @@ gaiaIsValid_r (const void *p_cache, gaiaGeomCollPtr geom)
     return ret;
 }
 
+GAIAGEO_DECLARE char *
+gaiaIsValidReason (gaiaGeomCollPtr geom)
+{
+/* return a TEXT string stating if a Geometry is valid
+/ and if not valid, a reason why */
+    char *text;
+    int len;
+    const char *str;
+    char *gstr;
+    GEOSGeometry *g;
+    gaiaResetGeosMsg ();
+    if (!geom)
+      {
+	  str = "Invalid: NULL Geometry";
+	  len = strlen (str);
+	  text = malloc (len + 1);
+	  strcpy (text, str);
+	  return text;
+      }
+    if (gaiaIsToxic (geom))
+      {
+	  str = "Invalid: Toxic Geometry ... too few points";
+	  len = strlen (str);
+	  text = malloc (len + 1);
+	  strcpy (text, str);
+	  return text;
+      }
+    if (gaiaIsNotClosedGeomColl (geom))
+      {
+	  str = "Invalid: Unclosed Rings were detected";
+	  len = strlen (str);
+	  text = malloc (len + 1);
+	  strcpy (text, str);
+	  return text;
+      }
+    g = gaiaToGeos (geom);
+    gstr = GEOSisValidReason (g);
+    GEOSGeom_destroy (g);
+    if (gstr == NULL)
+	return NULL;
+    len = strlen (gstr);
+    text = malloc (len + 1);
+    strcpy (text, gstr);
+    GEOSFree (gstr);
+    return text;
+}
+
+GAIAGEO_DECLARE char *
+gaiaIsValidReason_r (const void *p_cache, gaiaGeomCollPtr geom)
+{
+/* return a TEXT string stating if a Geometry is valid
+/ and if not valid, a reason why */
+    char *text;
+    int len;
+    const char *str;
+    char *gstr;
+    GEOSGeometry *g;
+    struct splite_internal_cache *cache =
+	(struct splite_internal_cache *) p_cache;
+    GEOSContextHandle_t handle = NULL;
+    if (cache == NULL)
+	return NULL;
+    if (cache->magic1 != SPATIALITE_CACHE_MAGIC1
+	|| cache->magic2 != SPATIALITE_CACHE_MAGIC2)
+	return NULL;
+    handle = cache->GEOS_handle;
+    if (handle == NULL)
+	return NULL;
+    gaiaResetGeosMsg_r (cache);
+    if (!geom)
+      {
+	  str = "Invalid: NULL Geometry";
+	  len = strlen (str);
+	  text = malloc (len + 1);
+	  strcpy (text, str);
+	  return text;
+      }
+    if (gaiaIsToxic (geom))
+      {
+	  str = "Invalid: Toxic Geometry ... too few points";
+	  len = strlen (str);
+	  text = malloc (len + 1);
+	  strcpy (text, str);
+	  return text;
+      }
+    if (gaiaIsNotClosedGeomColl (geom))
+      {
+	  str = "Invalid: Unclosed Rings were detected";
+	  len = strlen (str);
+	  text = malloc (len + 1);
+	  strcpy (text, str);
+	  return text;
+      }
+    g = gaiaToGeos_r (cache, geom);
+    gstr = GEOSisValidReason_r (handle, g);
+    GEOSGeom_destroy_r (handle, g);
+    if (gstr == NULL)
+	return NULL;
+    len = strlen (gstr);
+    text = malloc (len + 1);
+    strcpy (text, gstr);
+    GEOSFree_r (handle, gstr);
+    return text;
+}
+
+GAIAGEO_DECLARE gaiaGeomCollPtr
+gaiaIsValidDetail (gaiaGeomCollPtr geom)
+{
+/* return a Geometry detail causing a Geometry to be invalid */
+    char *reason = NULL;
+    GEOSGeometry *g;
+    GEOSGeometry *d = NULL;
+    gaiaGeomCollPtr detail;
+    gaiaResetGeosMsg ();
+    if (!geom)
+	return NULL;
+    if (gaiaIsToxic (geom))
+	return NULL;
+    if (gaiaIsNotClosedGeomColl (geom))
+	return NULL;
+    g = gaiaToGeos (geom);
+    GEOSisValidDetail (g, 0, &reason, &d);
+    GEOSGeom_destroy (g);
+    if (reason != NULL)
+	GEOSFree (reason);
+    if (d == NULL)
+	return NULL;
+    detail = gaiaFromGeos_XY (d);
+    GEOSGeom_destroy (d);
+    return detail;
+}
+
+GAIAGEO_DECLARE gaiaGeomCollPtr
+gaiaIsValidDetail_r (const void *p_cache, gaiaGeomCollPtr geom)
+{
+/* return a Geometry detail causing a Geometry to be invalid */
+    char *reason = NULL;
+    GEOSGeometry *g;
+    GEOSGeometry *d = NULL;
+    gaiaGeomCollPtr detail;
+    struct splite_internal_cache *cache =
+	(struct splite_internal_cache *) p_cache;
+    GEOSContextHandle_t handle = NULL;
+    if (cache == NULL)
+	return NULL;
+    if (cache->magic1 != SPATIALITE_CACHE_MAGIC1
+	|| cache->magic2 != SPATIALITE_CACHE_MAGIC2)
+	return NULL;
+    handle = cache->GEOS_handle;
+    if (handle == NULL)
+	return NULL;
+    gaiaResetGeosMsg_r (cache);
+    if (!geom)
+	return NULL;
+    if (gaiaIsToxic (geom))
+	return NULL;
+    if (gaiaIsNotClosedGeomColl (geom))
+	return NULL;
+    g = gaiaToGeos_r (cache, geom);
+    GEOSisValidDetail_r (handle, g, 0, &reason, &d);
+    GEOSGeom_destroy_r (handle, g);
+    if (reason != NULL)
+	GEOSFree_r (handle, reason);
+    if (d == NULL)
+	return NULL;
+    detail = gaiaFromGeos_XY_r (cache, d);
+    GEOSGeom_destroy_r (handle, d);
+    return detail;
+}
+
 GAIAGEO_DECLARE int
 gaiaIsClosedGeom_r (const void *cache, gaiaGeomCollPtr geom)
 {
diff --git a/src/gaiageo/gg_relations_ext.c b/src/gaiageo/gg_relations_ext.c
index d38791a..ba04aea 100644
--- a/src/gaiageo/gg_relations_ext.c
+++ b/src/gaiageo/gg_relations_ext.c
@@ -2,7 +2,7 @@
 
  gg_relations_ext.c -- Gaia spatial relations [advanced]
     
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_shape.c b/src/gaiageo/gg_shape.c
index 3a4b3c4..cff706c 100644
--- a/src/gaiageo/gg_shape.c
+++ b/src/gaiageo/gg_shape.c
@@ -2,7 +2,7 @@
 
  gg_shape.c -- Gaia shapefile handling
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -2387,8 +2387,8 @@ gaiaReadShpEntity (gaiaShapefilePtr shp, int current_row, int srid)
 	      goto error;
 	  n = gaiaImport32 (shp->BufShp, GAIA_LITTLE_ENDIAN, shp->endian_arch);
 	  hasM = 0;
-	  max_size = 38 + (n * 16);	/* size [in 16 bits words !!!] ZM */
-	  min_size = 30 + (n * 12);	/* size [in 16 bits words !!!] Z-only */
+	  max_size = 36 + (n * 16);	/* size [in 16 bits words !!!] ZM */
+	  min_size = 28 + (n * 12);	/* size [in 16 bits words !!!] Z-only */
 	  if (sz < min_size)
 	      goto error;
 	  if (sz == max_size)
@@ -2442,8 +2442,8 @@ gaiaReadShpEntity (gaiaShapefilePtr shp, int current_row, int srid)
 	      goto error;
 	  n = gaiaImport32 (shp->BufShp, GAIA_LITTLE_ENDIAN, shp->endian_arch);
 	  hasM = 0;
-	  max_size = 30 + (n * 12);	/* size [in 16 bits words !!!] M */
-	  min_size = 22 + (n * 8);	/* size [in 16 bits words !!!] no-M */
+	  max_size = 28 + (n * 12);	/* size [in 16 bits words !!!] M */
+	  min_size = 20 + (n * 8);	/* size [in 16 bits words !!!] no-M */
 	  if (sz < min_size)
 	      goto error;
 	  if (sz == max_size)
diff --git a/src/gaiageo/gg_transform.c b/src/gaiageo/gg_transform.c
index 01f0e94..ef0e178 100644
--- a/src/gaiageo/gg_transform.c
+++ b/src/gaiageo/gg_transform.c
@@ -2,7 +2,7 @@
 
  gg_transform.c -- Gaia PROJ.4 wrapping
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -46,6 +46,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
 #include <sys/types.h>
 #include <stdio.h>
 #include <string.h>
+#include <math.h>
 
 #if defined(_WIN32) && !defined(__MINGW32__)
 #include "config-msvc.h"
diff --git a/src/gaiageo/gg_vanuatu.c b/src/gaiageo/gg_vanuatu.c
index 49d6c51..9f7a98c 100644
--- a/src/gaiageo/gg_vanuatu.c
+++ b/src/gaiageo/gg_vanuatu.c
@@ -2,7 +2,7 @@
 
  gg_vanuatu.c -- WKT parser/lexer 
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_voronoj.c b/src/gaiageo/gg_voronoj.c
index 0ad545d..fdc1d83 100644
--- a/src/gaiageo/gg_voronoj.c
+++ b/src/gaiageo/gg_voronoj.c
@@ -2,7 +2,7 @@
 
  gg_voronoj.c -- Voronoj Diagram implementation
     
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_wkb.c b/src/gaiageo/gg_wkb.c
index 473c782..e7c859b 100644
--- a/src/gaiageo/gg_wkb.c
+++ b/src/gaiageo/gg_wkb.c
@@ -2,7 +2,7 @@
 
  gg_wkb.c -- Gaia common support for WKB encoded geometries
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_wkt.c b/src/gaiageo/gg_wkt.c
index 13798fe..0b4b891 100644
--- a/src/gaiageo/gg_wkt.c
+++ b/src/gaiageo/gg_wkt.c
@@ -2,7 +2,7 @@
 
  gg_wkt.c -- Gaia common support for WKT encoded geometries
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/gaiageo/gg_xml.c b/src/gaiageo/gg_xml.c
index e660617..a142673 100644
--- a/src/gaiageo/gg_xml.c
+++ b/src/gaiageo/gg_xml.c
@@ -2,7 +2,7 @@
 
  gg_xml.c -- XML Document implementation
     
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/geopackage/gaia_cvt_gpkg.c b/src/geopackage/gaia_cvt_gpkg.c
index a8ccc08..2702fca 100644
--- a/src/geopackage/gaia_cvt_gpkg.c
+++ b/src/geopackage/gaia_cvt_gpkg.c
@@ -875,9 +875,9 @@ do_insert_content (sqlite3 * handle, const char *table_name,
     xtable = gaiaDoubleQuotedSql (table_name);
     xgeom = gaiaDoubleQuotedSql (geometry_column);
     sql = sqlite3_mprintf ("INSERT INTO gpkg_contents (table_name, data_type, "
-			   "identifier, description, last_change, min_x, min_y, max_x, max_x, srs_id) "
+			   "identifier, description, last_change, min_x, min_y, max_x, max_y, srs_id) "
 			   "SELECT Lower(%Q), 'features', Lower(%Q), ' ', "
-			   "strftime('%%Y-%%m-%%dT%%H:%%M:%%fZ', 'now'), Max(ST_MinX(\"%s\")), "
+			   "strftime('%%Y-%%m-%%dT%%H:%%M:%%fZ', 'now'), Min(ST_MinX(\"%s\")), "
 			   "Min(ST_MinY(\"%s\")), Max(ST_MaxX(\"%s\")), Max(ST_MaxY(\"%s\")), %d "
 			   "FROM \"%s\"", table_name, table_name, xgeom, xgeom,
 			   xgeom, xgeom, srid, xtable);
diff --git a/src/headers/spatialite.h b/src/headers/spatialite.h
index 2ace84e..fdf6091 100644
--- a/src/headers/spatialite.h
+++ b/src/headers/spatialite.h
@@ -1,7 +1,7 @@
 /* 
  spatialite.h -- Gaia spatial support for SQLite 
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/debug.h b/src/headers/spatialite/debug.h
index 5fff7be..8d5a0b0 100644
--- a/src/headers/spatialite/debug.h
+++ b/src/headers/spatialite/debug.h
@@ -1,7 +1,7 @@
 /* 
  debug.h -- abstract defs for standard output functions
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gaiaaux.h b/src/headers/spatialite/gaiaaux.h
index 45c126b..38d8605 100644
--- a/src/headers/spatialite/gaiaaux.h
+++ b/src/headers/spatialite/gaiaaux.h
@@ -1,7 +1,7 @@
 /* 
  gaiaaux.h -- Gaia common utility functions
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gaiaexif.h b/src/headers/spatialite/gaiaexif.h
index 73aa6fa..a62f40a 100644
--- a/src/headers/spatialite/gaiaexif.h
+++ b/src/headers/spatialite/gaiaexif.h
@@ -1,7 +1,7 @@
 /* 
  gaiaexif.h -- Gaia common EXIF Metadata reading functions
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gaiageo.h b/src/headers/spatialite/gaiageo.h
index 86248aa..7ddb412 100644
--- a/src/headers/spatialite/gaiageo.h
+++ b/src/headers/spatialite/gaiageo.h
@@ -1,7 +1,7 @@
 /*
  gaiageo.h -- Gaia common support for geometries
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/geopackage.h b/src/headers/spatialite/geopackage.h
index da20382..e042fc6 100644
--- a/src/headers/spatialite/geopackage.h
+++ b/src/headers/spatialite/geopackage.h
@@ -1,6 +1,8 @@
 /*
 
     GeoPackage extensions for SpatiaLite / SQLite
+     
+    version 4.2, 2014 July 25
  
 Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
diff --git a/src/headers/spatialite/gg_advanced.h b/src/headers/spatialite/gg_advanced.h
index e0b403a..db8014a 100644
--- a/src/headers/spatialite/gg_advanced.h
+++ b/src/headers/spatialite/gg_advanced.h
@@ -1,7 +1,7 @@
 /*
  gg_advanced.h -- Gaia common support for geometries: advanced
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -788,7 +788,7 @@ extern "C"
  \return 0 if false; any other value if true
 
  \sa gaiaIsValid_r,
- gaiaIsSimple, gaiaIsClosed, gaiaIsRing
+ gaiaIsSimple, gaiaIsClosed, gaiaIsRing, gaiaIsValidReason
 
  \note not reentrant and thread unsafe.
 
@@ -797,6 +797,76 @@ extern "C"
     GAIAGEO_DECLARE int gaiaIsValid (gaiaGeomCollPtr geom);
 
 /**
+ return a TEXT string stating if a Geometry is valid and if not 
+ valid, a reason why
+ * 
+ \param geom pointer to the Geometry object to be validated.
+
+ \return a text string.
+
+ \sa gaiaIsValid, gaiaIsValidReason_r, gaiaIsValidDetail
+
+ \note you are responsible to free() the returned text string\n
+ not reentrant and thread unsafe.
+
+ \remark \b GEOS support required.
+ */
+    GAIAGEO_DECLARE char *gaiaIsValidReason (gaiaGeomCollPtr geom);
+
+/**
+ return a TEXT string stating if a Geometry is valid and if not 
+ valid, a reason why
+
+ \param p_cache a memory pointer returned by spatialite_alloc_connection()
+ \param geom pointer to the Geometry object to be validated.
+
+ \return a text string.
+
+ \sa gaiaIsValid_r, gaiaIsValidReason, gaiaIsValidDetail_r
+
+ \note you are responsible to free() the returned text string\n
+ reentrant and thread-safe.
+
+ \remark \b GEOS support required.
+ */
+    GAIAGEO_DECLARE char *gaiaIsValidReason_r (const void *p_cache,
+					       gaiaGeomCollPtr geom);
+
+/**
+ return a Geometry detail causing a Geometry to be invalid
+ * 
+ \param geom pointer to the Geometry object to be validated.
+
+ \return pointer to a Geometry object causing invalidity, or NULL.
+
+ \sa gaiaIsValid, gaiaIsValidReason, gaiaIsValidDetail_r
+
+ \note you are responsible to destroy the returned Geometry\n
+ not reentrant and thread unsafe.
+
+ \remark \b GEOS support required.
+ */
+    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaIsValidDetail (gaiaGeomCollPtr geom);
+
+/**
+ return a Geometry detail causing a Geometry to be invalid
+
+ \param p_cache a memory pointer returned by spatialite_alloc_connection()
+ \param geom pointer to the Geometry object to be validated.
+
+ \return pointer to a Geometry object causing invalidity, or NULL.
+
+ \sa gaiaIsValid_r, gaiaIsValidReason_r, gaiaIsValidDetail
+
+ \note you are responsible to destroy the returned Geometry\n
+ reentrant and thread-safe.
+
+ \remark \b GEOS support required.
+ */
+    GAIAGEO_DECLARE gaiaGeomCollPtr gaiaIsValidDetail_r (const void *p_cache,
+							 gaiaGeomCollPtr geom);
+
+/**
  Checks if a Geometry object represents an OGC Valid Geometry
 
  \param p_cache a memory pointer returned by spatialite_alloc_connection()
@@ -805,7 +875,7 @@ extern "C"
  \return 0 if false; any other value if true
 
  \sa gaiaIsValid,
- gaiaIsSimple, gaiaIsClosed, gaiaIsRing
+ gaiaIsSimple, gaiaIsClosed, gaiaIsRing, gaiaIsValidReason_r
 
  \note reentrant and thread-safe.
 
diff --git a/src/headers/spatialite/gg_const.h b/src/headers/spatialite/gg_const.h
index 415c080..0ad1b5e 100644
--- a/src/headers/spatialite/gg_const.h
+++ b/src/headers/spatialite/gg_const.h
@@ -1,7 +1,7 @@
 /*
  gg_const.h -- Gaia common support for geometries: constants
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -62,6 +62,9 @@ extern "C"
 
 /* constant values for getVectorLayersList modes */
 
+/** mode: FAST (QGIS data-provider) */
+#define GAIA_VECTORS_LIST_FAST	0
+
 /** mode: OPTIMISTIC */
 #define GAIA_VECTORS_LIST_OPTIMISTIC	1
 
diff --git a/src/headers/spatialite/gg_core.h b/src/headers/spatialite/gg_core.h
index 184f419..b543ab7 100644
--- a/src/headers/spatialite/gg_core.h
+++ b/src/headers/spatialite/gg_core.h
@@ -1,7 +1,7 @@
 /*
  gg_core.h -- Gaia common support for geometries: core functions
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gg_dxf.h b/src/headers/spatialite/gg_dxf.h
index cb64231..e741137 100644
--- a/src/headers/spatialite/gg_dxf.h
+++ b/src/headers/spatialite/gg_dxf.h
@@ -1,7 +1,7 @@
 /*
  gg_dxf.h -- Gaia common support for DXF files
   
- version 4.1, 2013 May 14
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gg_dynamic.h b/src/headers/spatialite/gg_dynamic.h
index b978f2d..fd26455 100644
--- a/src/headers/spatialite/gg_dynamic.h
+++ b/src/headers/spatialite/gg_dynamic.h
@@ -1,7 +1,7 @@
 /*
  gg_dynamic.h -- Gaia common support for geometries: DynamicLine functions
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gg_formats.h b/src/headers/spatialite/gg_formats.h
index 26b0911..a3ebcda 100644
--- a/src/headers/spatialite/gg_formats.h
+++ b/src/headers/spatialite/gg_formats.h
@@ -1,7 +1,7 @@
 /*
  gg_formats.h -- Gaia common support for geometries: formats
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gg_mbr.h b/src/headers/spatialite/gg_mbr.h
index 0c9847c..9ff25ca 100644
--- a/src/headers/spatialite/gg_mbr.h
+++ b/src/headers/spatialite/gg_mbr.h
@@ -1,7 +1,7 @@
 /*
  gg_mbr.h -- Gaia common support for geometries: MBR functions
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gg_structs.h b/src/headers/spatialite/gg_structs.h
index 2e660c6..21ab99b 100644
--- a/src/headers/spatialite/gg_structs.h
+++ b/src/headers/spatialite/gg_structs.h
@@ -1,7 +1,7 @@
 /*
  gg_structs.h -- Gaia common support for geometries: structures
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gg_wfs.h b/src/headers/spatialite/gg_wfs.h
index 43ef426..6945c53 100644
--- a/src/headers/spatialite/gg_wfs.h
+++ b/src/headers/spatialite/gg_wfs.h
@@ -1,7 +1,7 @@
 /*
  gg_wfs.h -- Gaia common support for WFS
   
- version 4.1, 2013 May 14
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/gg_xml.h b/src/headers/spatialite/gg_xml.h
index 468532f..7dd3c46 100644
--- a/src/headers/spatialite/gg_xml.h
+++ b/src/headers/spatialite/gg_xml.h
@@ -1,7 +1,7 @@
 /*
  gg_xml.h -- Gaia common support for XML documents
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/spatialite.h b/src/headers/spatialite/spatialite.h
index 7706253..963319d 100644
--- a/src/headers/spatialite/spatialite.h
+++ b/src/headers/spatialite/spatialite.h
@@ -1,7 +1,7 @@
 /* 
  spatialite.h -- Gaia support for SQLite extensions
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite/sqlite.h b/src/headers/spatialite/sqlite.h
index dbab18f..8301f4a 100644
--- a/src/headers/spatialite/sqlite.h
+++ b/src/headers/spatialite/sqlite.h
@@ -1,7 +1,7 @@
 /* 
  sqlite.h -- supporting SQLite headers in a flexible way
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/headers/spatialite_private.h b/src/headers/spatialite_private.h
index 7fa7d0e..4be4aaa 100644
--- a/src/headers/spatialite_private.h
+++ b/src/headers/spatialite_private.h
@@ -1,7 +1,7 @@
 /* 
  spatialite.h -- Gaia spatial support for SQLite 
   
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/md5/gaia_md5.c b/src/md5/gaia_md5.c
index 835e4e4..11c6f17 100644
--- a/src/md5/gaia_md5.c
+++ b/src/md5/gaia_md5.c
@@ -4,7 +4,7 @@
                implementation from Alexander Peslyak 
                (released on the Public Domain)
 
- version 4.1, 2013 June 3
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/shapefiles/shapefiles.c b/src/shapefiles/shapefiles.c
index 075a011..ce53e4a 100644
--- a/src/shapefiles/shapefiles.c
+++ b/src/shapefiles/shapefiles.c
@@ -2,7 +2,7 @@
 
  shapefiles.c -- implements shapefile support [import - export]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -3573,7 +3573,6 @@ load_dbf_ex (sqlite3 * sqlite, char *dbf_path, char *table, char *pk_column,
 	    }
 	  if (!pk_set)
 	      sqlite3_bind_int (stmt, 1, current_row);
-	  sqlite3_bind_int (stmt, 1, current_row);
 	  cnt = 0;
 	  dbf_field = dbf->Dbf->First;
 	  while (dbf_field)
diff --git a/src/shapefiles/validator.c b/src/shapefiles/validator.c
index d7a9b08..1a6fad1 100644
--- a/src/shapefiles/validator.c
+++ b/src/shapefiles/validator.c
@@ -2,7 +2,7 @@
 
  validator.c -- implements geometry validation and repair
 
- version 4.1, 2013 March 19
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/extra_tables.c b/src/spatialite/extra_tables.c
index a49a0e9..f2e1dad 100644
--- a/src/spatialite/extra_tables.c
+++ b/src/spatialite/extra_tables.c
@@ -70,6 +70,10 @@ Regione Toscana - Settore Sistema Informativo Territoriale ed Ambientale
 #include <spatialite_private.h>
 #include <spatialite/gaiaaux.h>
 
+#ifdef _WIN32
+#define strcasecmp	_stricmp
+#endif /* not WIN32 */
+
 static int
 check_splite_metacatalog (sqlite3 * sqlite)
 {
diff --git a/src/spatialite/mbrcache.c b/src/spatialite/mbrcache.c
index b9dda0e..5534127 100644
--- a/src/spatialite/mbrcache.c
+++ b/src/spatialite/mbrcache.c
@@ -2,7 +2,7 @@
 
  mbrcache.c -- SQLite3 extension [MBR CACHE VIRTUAL TABLE]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/metatables.c b/src/spatialite/metatables.c
index 3d4a093..1908b0f 100644
--- a/src/spatialite/metatables.c
+++ b/src/spatialite/metatables.c
@@ -2,7 +2,7 @@
 
  metatables.c -- creating the metadata tables and related triggers
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/spatialite.c b/src/spatialite/spatialite.c
index 7b4c754..ec88f3c 100644
--- a/src/spatialite/spatialite.c
+++ b/src/spatialite/spatialite.c
@@ -2,7 +2,7 @@
 
  spatialite.c -- SQLite3 spatial extension
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -468,7 +468,7 @@ fnct_has_geopackage (sqlite3_context * context, int argc, sqlite3_value ** argv)
 / return 1 if built including GeoPackage support (GPKG); otherwise 0
 */
     GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
-#ifdef ENABLE_GEOPACKAGE		/* GEOPACKAGE is supported */
+#ifdef ENABLE_GEOPACKAGE	/* GEOPACKAGE is supported */
     sqlite3_result_int (context, 1);
 #else
     sqlite3_result_int (context, 0);
@@ -1185,8 +1185,8 @@ is_without_rowid_table (sqlite3 * sqlite, const char *table)
       {
 	  const char *index = results[(i * columns) + 1];
 	  sql = sqlite3_mprintf ("SELECT count(*) FROM sqlite_master WHERE "
-				 "type = 'index' AND tbl_name = %Q AND name = %Q",
-				 table, index);
+				 "type = 'index' AND Lower(tbl_name) = Lower(%Q) "
+				 "AND Lower(name) = Lower(%Q)", table, index);
 	  ret =
 	      sqlite3_get_table (sqlite, sql, &results2, &rows2, &columns2,
 				 &errMsg);
@@ -5052,6 +5052,7 @@ check_spatial_index (sqlite3 * sqlite, const unsigned char *table,
     sqlite3_stmt *stmt;
     sqlite3_int64 count_geom;
     sqlite3_int64 count_rtree;
+    sqlite3_int64 count_rev = 0;
     double g_xmin;
     double g_ymin;
     double g_xmax;
@@ -5188,94 +5189,6 @@ check_spatial_index (sqlite3 * sqlite, const unsigned char *table,
 	  goto mismatching_zero;
       }
 
-/* checking the geometry-table against the corresponding R*Tree */
-    sql_statement =
-	sqlite3_mprintf ("SELECT MbrMinX(g.\"%s\"), MbrMinY(g.\"%s\"), "
-			 "MbrMaxX(g.\"%s\"), MbrMaxY(g.\"%s\"), i.xmin, i.ymin, i.xmax, i.ymax\n"
-			 "FROM \"%s\" AS g\nLEFT JOIN \"%s\" AS i ON (g.ROWID = i.pkid)",
-			 xgeom, xgeom, xgeom, xgeom, xtable, xidx_name);
-    ret = sqlite3_prepare_v2 (sqlite, sql_statement, strlen (sql_statement),
-			      &stmt, NULL);
-    sqlite3_free (sql_statement);
-    if (ret != SQLITE_OK)
-      {
-	  spatialite_e ("CheckSpatialIndex SQL error: %s\n",
-			sqlite3_errmsg (sqlite));
-	  goto err_label;
-      }
-    while (1)
-      {
-	  ret = sqlite3_step (stmt);
-	  if (ret == SQLITE_DONE)
-	      break;
-	  if (ret == SQLITE_ROW)
-	    {
-		/* checking a row */
-		ok_g_xmin = 1;
-		ok_g_ymin = 1;
-		ok_g_xmax = 1;
-		ok_g_ymax = 1;
-		ok_i_xmin = 1;
-		ok_i_ymin = 1;
-		ok_i_xmax = 1;
-		ok_i_ymax = 1;
-		if (sqlite3_column_type (stmt, 0) == SQLITE_NULL)
-		    ok_g_xmin = 0;
-		else
-		    g_xmin = sqlite3_column_double (stmt, 0);
-		if (sqlite3_column_type (stmt, 1) == SQLITE_NULL)
-		    ok_g_ymin = 0;
-		else
-		    g_ymin = sqlite3_column_double (stmt, 1);
-		if (sqlite3_column_type (stmt, 2) == SQLITE_NULL)
-		    ok_g_xmax = 0;
-		else
-		    g_xmax = sqlite3_column_double (stmt, 2);
-		if (sqlite3_column_type (stmt, 3) == SQLITE_NULL)
-		    ok_g_ymax = 0;
-		else
-		    g_ymax = sqlite3_column_double (stmt, 3);
-		if (sqlite3_column_type (stmt, 4) == SQLITE_NULL)
-		    ok_i_xmin = 0;
-		else
-		    i_xmin = sqlite3_column_double (stmt, 4);
-		if (sqlite3_column_type (stmt, 5) == SQLITE_NULL)
-		    ok_i_ymin = 0;
-		else
-		    i_ymin = sqlite3_column_double (stmt, 5);
-		if (sqlite3_column_type (stmt, 6) == SQLITE_NULL)
-		    ok_i_xmax = 0;
-		else
-		    i_xmax = sqlite3_column_double (stmt, 6);
-		if (sqlite3_column_type (stmt, 7) == SQLITE_NULL)
-		    ok_i_ymax = 0;
-		else
-		    i_ymax = sqlite3_column_double (stmt, 7);
-		if (eval_rtree_entry (ok_g_xmin, g_xmin, ok_i_xmin, i_xmin)
-		    == 0)
-		    goto mismatching;
-		if (eval_rtree_entry (ok_g_ymin, g_ymin, ok_i_ymin, i_ymin)
-		    == 0)
-		    goto mismatching;
-		if (eval_rtree_entry (ok_g_xmax, g_xmax, ok_i_xmax, i_xmax)
-		    == 0)
-		    goto mismatching;
-		if (eval_rtree_entry (ok_g_ymax, g_ymax, ok_i_ymax, i_ymax)
-		    == 0)
-		    goto mismatching;
-	    }
-	  else
-	    {
-		spatialite_e ("sqlite3_step() error: %s\n",
-			      sqlite3_errmsg (sqlite));
-		sqlite3_finalize (stmt);
-		goto err_label;
-	    }
-      }
-/* we have now to finalize the query [memory cleanup] */
-    sqlite3_finalize (stmt);
-
-
 /* now we'll check the R*Tree against the corresponding geometry-table */
     sql_statement =
 	sqlite3_mprintf ("SELECT MbrMinX(g.\"%s\"), MbrMinY(g.\"%s\"), "
@@ -5299,6 +5212,7 @@ check_spatial_index (sqlite3 * sqlite, const unsigned char *table,
 	  if (ret == SQLITE_ROW)
 	    {
 		/* checking a row */
+		count_rev++;
 		ok_g_xmin = 1;
 		ok_g_ymin = 1;
 		ok_g_xmax = 1;
@@ -5361,6 +5275,8 @@ check_spatial_index (sqlite3 * sqlite, const unsigned char *table,
 	    }
       }
     sqlite3_finalize (stmt);
+    if (count_geom != count_rev)
+	goto mismatching;
     strcpy (sql, "Check SpatialIndex: is valid");
     updateSpatiaLiteHistory (sqlite, (const char *) table,
 			     (const char *) geom, sql);
@@ -5880,6 +5796,70 @@ fnct_CheckShadowedRowid (sqlite3_context * context, int argc,
 }
 
 static void
+fnct_CheckWithoutRowid (sqlite3_context * context, int argc,
+			sqlite3_value ** argv)
+{
+/* SQL function:
+/ CheckWithoutRowid(table)
+/
+/ checks if some table has been created WITHOUT ROWID
+/ 1 - yes, the table is WITHOUT ROWID
+/ 0 - no, the ROWID should be supported
+/ NULL on failure (e.g. not existing table)
+*/
+    const unsigned char *table;
+    int ret;
+    char sql[128];
+    sqlite3_stmt *stmt;
+    int exists = 0;
+    sqlite3 *sqlite = sqlite3_context_db_handle (context);
+    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
+
+    if (sqlite3_value_type (argv[0]) != SQLITE_TEXT)
+      {
+	  spatialite_e
+	      ("CheckWithoutRowid() error: argument 1 [table_name] is not of the String type\n");
+	  sqlite3_result_null (context);
+	  return;
+      }
+    table = sqlite3_value_text (argv[0]);
+
+/* checking if the table exists */
+    strcpy (sql,
+	    "SELECT name FROM sqlite_master WHERE type = 'table' AND Lower(name) = Lower(?)");
+    ret = sqlite3_prepare_v2 (sqlite, sql, strlen (sql), &stmt, NULL);
+    if (ret != SQLITE_OK)
+      {
+	  spatialite_e ("CheckWithoutRowid: \"%s\"\n", sqlite3_errmsg (sqlite));
+	  sqlite3_result_null (context);
+	  return;
+      }
+    sqlite3_reset (stmt);
+    sqlite3_clear_bindings (stmt);
+    sqlite3_bind_text (stmt, 1, (const char *) table,
+		       strlen ((const char *) table), SQLITE_STATIC);
+    while (1)
+      {
+	  /* scrolling the result set rows */
+	  ret = sqlite3_step (stmt);
+	  if (ret == SQLITE_DONE)
+	      break;		/* end of result set */
+	  if (ret == SQLITE_ROW)
+	      exists = 1;
+      }
+    sqlite3_finalize (stmt);
+    if (!exists)
+	sqlite3_result_null (context);
+    else
+      {
+	  if (is_without_rowid_table (sqlite, (const char *) table))
+	      sqlite3_result_int (context, 1);
+	  else
+	      sqlite3_result_int (context, 0);
+      }
+}
+
+static void
 fnct_CreateSpatialIndex (sqlite3_context * context, int argc,
 			 sqlite3_value ** argv)
 {
@@ -16828,6 +16808,91 @@ fnct_GEOS_GetCriticalPointFromMsg (sqlite3_context * context, int argc,
 }
 
 static void
+fnct_IsValidReason (sqlite3_context * context, int argc, sqlite3_value ** argv)
+{
+/* SQL function:
+/ IsValidReason(geom)
+/ ST_IsValidReason(geom)
+/
+/ return a TEXT string stating if a Geometry is valid
+/ and if not valid, a reason why
+/ return NULL on any other case
+*/
+    unsigned char *p_blob;
+    int n_bytes;
+    int len;
+    gaiaGeomCollPtr geom;
+    char *str;
+    void *data = sqlite3_user_data (context);
+    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
+    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]);
+    geom = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes);
+    if (data != NULL)
+	str = gaiaIsValidReason_r (data, geom);
+    else
+	str = gaiaIsValidReason (geom);
+    if (str == NULL)
+	sqlite3_result_null (context);
+    else
+      {
+	  len = strlen (str);
+	  sqlite3_result_text (context, str, len, free);
+      }
+    if (geom != NULL)
+	gaiaFreeGeomColl (geom);
+}
+
+static void
+fnct_IsValidDetail (sqlite3_context * context, int argc, sqlite3_value ** argv)
+{
+/* SQL function:
+/ IsValidDetail(geom)
+/ ST_IsValidDetail(geom)
+/
+/ return a Geometry detail causing a Geometry to be invalid
+/ return NULL on any other case
+*/
+    unsigned char *p_blob;
+    int n_bytes;
+    int len;
+    gaiaGeomCollPtr geom;
+    gaiaGeomCollPtr detail;
+    unsigned char *p_result = NULL;
+    void *data = sqlite3_user_data (context);
+    GAIA_UNUSED ();		/* LCOV_EXCL_LINE */
+    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]);
+    geom = gaiaFromSpatiaLiteBlobWkb (p_blob, n_bytes);
+    if (data != NULL)
+	detail = gaiaIsValidDetail_r (data, geom);
+    else
+	detail = gaiaIsValidDetail (geom);
+    if (detail == NULL)
+	sqlite3_result_null (context);
+    else
+      {
+	  detail->Srid = geom->Srid;
+	  gaiaToSpatiaLiteBlobWkb (detail, &p_result, &len);
+	  sqlite3_result_blob (context, p_result, len, free);
+      }
+    if (geom != NULL)
+	gaiaFreeGeomColl (geom);
+    if (detail != NULL)
+	gaiaFreeGeomColl (detail);
+}
+
+static void
 fnct_Boundary (sqlite3_context * context, int argc, sqlite3_value ** argv)
 {
 /* SQL function:
@@ -17097,10 +17162,11 @@ length_common (const void *p_cache, sqlite3_context * context, int argc,
 					l = gaiaGeodesicTotalLength (a,
 								     b,
 								     rf,
+								     line->DimensionModel,
+								     line->
+								     Coords,
 								     line->
-								     DimensionModel,
-								     line->Coords,
-								     line->Points);
+								     Points);
 					if (l < 0.0)
 					  {
 					      length = -1.0;
@@ -17122,9 +17188,12 @@ length_common (const void *p_cache, sqlite3_context * context, int argc,
 					      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;
@@ -25879,7 +25948,8 @@ fnct_GeodesicLength (sqlite3_context * context, int argc, sqlite3_value ** argv)
 				  /* interior Rings */
 				  ring = polyg->Interiors + ib;
 				  l = gaiaGeodesicTotalLength (a, b, rf,
-							       ring->DimensionModel,
+							       ring->
+							       DimensionModel,
 							       ring->Coords,
 							       ring->Points);
 				  if (l < 0.0)
@@ -25963,7 +26033,8 @@ fnct_GreatCircleLength (sqlite3_context * context, int argc,
 			    ring = polyg->Exterior;
 			    length +=
 				gaiaGreatCircleTotalLength (a, b,
-							    ring->DimensionModel,
+							    ring->
+							    DimensionModel,
 							    ring->Coords,
 							    ring->Points);
 			    for (ib = 0; ib < polyg->NumInteriors; ib++)
@@ -25972,7 +26043,8 @@ fnct_GreatCircleLength (sqlite3_context * context, int argc,
 				  ring = polyg->Interiors + ib;
 				  length +=
 				      gaiaGreatCircleTotalLength (a, b,
-								  ring->DimensionModel,
+								  ring->
+								  DimensionModel,
 								  ring->Coords,
 								  ring->Points);
 			      }
@@ -28292,6 +28364,8 @@ register_spatialite_sql_functions (void *p_db, const void *p_cache)
 			     fnct_CheckSpatialIndex, 0, 0);
     sqlite3_create_function (db, "CheckShadowedRowid", 1, SQLITE_ANY, 0,
 			     fnct_CheckShadowedRowid, 0, 0);
+    sqlite3_create_function (db, "CheckWithoutRowid", 1, SQLITE_ANY, 0,
+			     fnct_CheckWithoutRowid, 0, 0);
     sqlite3_create_function (db, "CreateSpatialIndex", 2, SQLITE_ANY, 0,
 			     fnct_CreateSpatialIndex, 0, 0);
     sqlite3_create_function (db, "CreateMbrCache", 2, SQLITE_ANY, 0,
@@ -29268,6 +29342,14 @@ register_spatialite_sql_functions (void *p_db, const void *p_cache)
 			     cache, fnct_GEOS_GetCriticalPointFromMsg, 0, 0);
     sqlite3_create_function (db, "GEOS_GetCriticalPointFromMsg", 1, SQLITE_ANY,
 			     cache, fnct_GEOS_GetCriticalPointFromMsg, 0, 0);
+    sqlite3_create_function (db, "IsValidReason", 1, SQLITE_ANY,
+			     cache, fnct_IsValidReason, 0, 0);
+    sqlite3_create_function (db, "ST_IsValidReason", 1, SQLITE_ANY,
+			     cache, fnct_IsValidReason, 0, 0);
+    sqlite3_create_function (db, "IsValidDetail", 1, SQLITE_ANY,
+			     cache, fnct_IsValidDetail, 0, 0);
+    sqlite3_create_function (db, "ST_IsValidDetail", 1, SQLITE_ANY,
+			     cache, fnct_IsValidDetail, 0, 0);
 
     sqlite3_create_function (db, "Boundary", 1, SQLITE_ANY, cache,
 			     fnct_Boundary, 0, 0);
diff --git a/src/spatialite/spatialite_init.c b/src/spatialite/spatialite_init.c
index c835b24..befbc68 100644
--- a/src/spatialite/spatialite_init.c
+++ b/src/spatialite/spatialite_init.c
@@ -2,7 +2,7 @@
 
  spatialite_init.c -- SQLite3 spatial extension
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/statistics.c b/src/spatialite/statistics.c
index b579705..e6652b2 100644
--- a/src/spatialite/statistics.c
+++ b/src/spatialite/statistics.c
@@ -2,7 +2,7 @@
 
  statistics.c -- helper functions updating internal statistics
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualXL.c b/src/spatialite/virtualXL.c
index a8c443b..9bde0f4 100644
--- a/src/spatialite/virtualXL.c
+++ b/src/spatialite/virtualXL.c
@@ -2,7 +2,7 @@
 
  virtualXLc -- SQLite3 extension [VIRTUAL TABLE accessing .XLS]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualbbox.c b/src/spatialite/virtualbbox.c
index e31e440..f70fce2 100644
--- a/src/spatialite/virtualbbox.c
+++ b/src/spatialite/virtualbbox.c
@@ -2,7 +2,7 @@
 
  virtualbbox.c -- SQLite3 extension [VIRTUAL TABLE accessing BoundingBox tables]
 
- version 4.1, 2013 July 15
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualdbf.c b/src/spatialite/virtualdbf.c
index af421b5..44bfcb1 100644
--- a/src/spatialite/virtualdbf.c
+++ b/src/spatialite/virtualdbf.c
@@ -2,7 +2,7 @@
 
  virtualdbf.c -- SQLite3 extension [VIRTUAL TABLE accessing DBF]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualfdo.c b/src/spatialite/virtualfdo.c
index d522eff..d08d335 100644
--- a/src/spatialite/virtualfdo.c
+++ b/src/spatialite/virtualfdo.c
@@ -2,7 +2,7 @@
 
  virtualfdo.c -- SQLite3 extension [VIRTUAL TABLE accessing FDO-OGR tables]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualgpkg.c b/src/spatialite/virtualgpkg.c
index e04521d..d1cbe04 100644
--- a/src/spatialite/virtualgpkg.c
+++ b/src/spatialite/virtualgpkg.c
@@ -2,7 +2,7 @@
 
  virtualgpkg.c -- SQLite3 extension [VIRTUAL TABLE accessing GPKG tables]
 
- version 4.2, 2013 May 18
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -328,14 +328,14 @@ vgpkg_insert_row (VirtualGPKGPtr p_vt, sqlite3_int64 * rowid, int argc,
 	    {
 		/* this is the geometry column */
 		sql = sqlite3_mprintf ("%sAsGPB(?)", prefix);
-	  gaiaAppendToOutBuffer (&sql_statement, sql);
-	  sqlite3_free (sql);
+		gaiaAppendToOutBuffer (&sql_statement, sql);
+		sqlite3_free (sql);
 	    }
 	  else
-	  {
-	      sprintf (buf, "%s?", prefix);
-	  gaiaAppendToOutBuffer (&sql_statement, buf);
-  }
+	    {
+		sprintf (buf, "%s?", prefix);
+		gaiaAppendToOutBuffer (&sql_statement, buf);
+	    }
       }
     gaiaAppendToOutBuffer (&sql_statement, ")");
     if (sql_statement.Error == 0 && sql_statement.Buffer != NULL)
diff --git a/src/spatialite/virtualnetwork.c b/src/spatialite/virtualnetwork.c
index 1301280..5591e94 100644
--- a/src/spatialite/virtualnetwork.c
+++ b/src/spatialite/virtualnetwork.c
@@ -2,7 +2,7 @@
 
  virtualnetwork.c -- SQLite3 extension [VIRTUAL TABLE Routing - shortest path]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualshape.c b/src/spatialite/virtualshape.c
index c5b5b94..04fd607 100644
--- a/src/spatialite/virtualshape.c
+++ b/src/spatialite/virtualshape.c
@@ -2,7 +2,7 @@
 
  virtualshape.c -- SQLite3 extension [VIRTUAL TABLE accessing Shapefile]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualspatialindex.c b/src/spatialite/virtualspatialindex.c
index 207db96..604742d 100644
--- a/src/spatialite/virtualspatialindex.c
+++ b/src/spatialite/virtualspatialindex.c
@@ -2,7 +2,7 @@
 
  virtualspatialindex.c -- SQLite3 extension [VIRTUAL TABLE RTree metahandler]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/spatialite/virtualxpath.c b/src/spatialite/virtualxpath.c
index 7cb1a5b..5630643 100644
--- a/src/spatialite/virtualxpath.c
+++ b/src/spatialite/virtualxpath.c
@@ -2,7 +2,7 @@
 
  virtualxpath.c -- SQLite3 extension [VIRTUAL XPath handler]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/srsinit/srs_init.c b/src/srsinit/srs_init.c
index 0af52b7..59111ad 100644
--- a/src/srsinit/srs_init.c
+++ b/src/srsinit/srs_init.c
@@ -2,7 +2,7 @@
 
  srs_init.c -- populating the SPATIAL_REF_SYS table
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/versioninfo/version.c b/src/versioninfo/version.c
index 3dfe07c..71ba154 100644
--- a/src/versioninfo/version.c
+++ b/src/versioninfo/version.c
@@ -1,7 +1,7 @@
 /*
  version.c -- Gaia spatial support for SQLite
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/src/virtualtext/virtualtext.c b/src/virtualtext/virtualtext.c
index 1ac284c..c5f05ee 100644
--- a/src/virtualtext/virtualtext.c
+++ b/src/virtualtext/virtualtext.c
@@ -2,7 +2,7 @@
 
  virtualtext.c -- SQLite3 extension [VIRTUAL TABLE accessing CSV/TXT]
 
- version 4.1, 2013 May 8
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
@@ -970,9 +970,9 @@ sqlite3VirtualTextInit (sqlite3 * db)
 }
 
 SPATIALITE_PRIVATE int
-virtualtext_extension_init (void * xdb)
+virtualtext_extension_init (void *xdb)
 {
-sqlite3 * db = (sqlite3 *)xdb;
+    sqlite3 *db = (sqlite3 *) xdb;
     return sqlite3VirtualTextInit (db);
 }
 
diff --git a/src/wfs/wfs_in.c b/src/wfs/wfs_in.c
index c4519ac..34116c7 100644
--- a/src/wfs/wfs_in.c
+++ b/src/wfs/wfs_in.c
@@ -2,7 +2,7 @@
 
  wfs_in.c -- implements WFS support [import]
 
- version 4.1, 2013 April 22
+ version 4.2, 2014 July 25
 
  Author: Sandro Furieri a.furieri at lqt.it
 
diff --git a/test/check_spatialindex.c b/test/check_spatialindex.c
index 3aeab3c..1463fe9 100644
--- a/test/check_spatialindex.c
+++ b/test/check_spatialindex.c
@@ -52,9 +52,9 @@ the terms of any one of the MPL, the GPL or the LGPL.
 #include "spatialite.h"
 
 int
-do_test_without_rowid (sqlite3 * handle)
+do_test_without_rowid_true (sqlite3 * handle)
 {
-/* testing WITHOUT ROWID */
+/* testing WITHOUT ROWID - true */
     char *err_msg = NULL;
     char **results;
     int rows;
@@ -195,22 +195,196 @@ do_test_without_rowid (sqlite3 * handle)
 	  return -326;
       }
     sqlite3_free_table (results);
+
+    ret =
+	sqlite3_get_table (handle,
+			   "SELECT CheckWithoutRowid('without_rowid')",
+			   &results, &rows, &columns, &err_msg);
+    if (ret != SQLITE_OK)
+      {
+	  fprintf (stderr, "CheckWithoutRowid(without_rowid) error: %s\n",
+		   err_msg);
+	  sqlite3_free (err_msg);
+	  return -327;
+      }
+    if ((rows != 1) || (columns != 1))
+      {
+	  fprintf (stderr,
+		   "Unexpected error: CheckWithoutRowid(without_rowid) bad result: %i/%i.\n",
+		   rows, columns);
+	  sqlite3_free_table (results);
+	  return -328;
+      }
+    if (strcmp (results[1], "1") != 0)
+      {
+	  fprintf (stderr,
+		   "unexpected result CheckWithoutRowid(without_rowid): %s\n",
+		   results[1]);
+	  sqlite3_free_table (results);
+	  return -329;
+      }
+    sqlite3_free_table (results);
     return 0;
+}
 
-/*
+int
+do_test_without_rowid_false (sqlite3 * handle)
+{
+/* testing WITHOUT ROWID - false */
+    char *err_msg = NULL;
+    char **results;
+    int rows;
+    int columns;
+    int ret = sqlite3_exec (handle,
+			    "CREATE TABLE not_without_rowid ("
+			    "id INTEGER NOT NULL PRIMARY KEY,"
+			    "name TEXT NOT NULL)",
+			    NULL, NULL, &err_msg);
+    if (ret != SQLITE_OK)
+      {
+	  fprintf (stderr, "CREATE TABLE not_without_rowid error: %s\n",
+		   err_msg);
+	  sqlite3_free (err_msg);
+	  return -327;
+      }
+    ret = sqlite3_exec (handle,
+			"CREATE INDEX idx_NAME on NOT_WITHOUT_ROWID(NAME)",
+			NULL, NULL, &err_msg);
+    if (ret != SQLITE_OK)
+      {
+	  fprintf (stderr, "CREATE TABLE not_without_rowid error: %s\n",
+		   err_msg);
+	  sqlite3_free (err_msg);
+	  return -328;
+      }
     ret =
-	sqlite3_exec (handle,
-		      "SELECT RecoverGeometryColumn(1, 'geom', 23032, 'MULTIPOLYGON', 'XY')",
-		      NULL, NULL, &err_msg);
+	sqlite3_get_table (handle,
+			   "SELECT AddGeometryColumn('NOT_WITHOUT_ROWID', 'geom', 4326, 'POINT', 'XY')",
+			   &results, &rows, &columns, &err_msg);
     if (ret != SQLITE_OK)
       {
-	  fprintf (stderr, "RecoverGeometryColumn(bad_councils) error: %s\n",
+	  fprintf (stderr, "AddGeometryColumn(NOT_WITHOUT_ROWID) error: %s\n",
 		   err_msg);
 	  sqlite3_free (err_msg);
-	  return -54;
+	  return -329;
+      }
+    if ((rows != 1) || (columns != 1))
+      {
+	  fprintf (stderr,
+		   "Unexpected error: AddGeometryColumn(NOT_WITHOUT_ROWID) bad result: %i/%i.\n",
+		   rows, columns);
+	  sqlite3_free_table (results);
+	  return -330;
+      }
+    if (strcmp (results[1], "0") != 1)
+      {
+	  fprintf (stderr,
+		   "unexpected result AddGeometryColumn(NOT_WITHOUT_ROWID): %s\n",
+		   results[1]);
+	  sqlite3_free_table (results);
+	  return -331;
+      }
+    sqlite3_free_table (results);
+
+
+    ret = sqlite3_exec (handle,
+			"ALTER TABLE NOT_WITHOUT_ROWID ADD COLUMN geom2 BLOB",
+			NULL, NULL, &err_msg);
+    if (ret != SQLITE_OK)
+      {
+	  fprintf (stderr, "ALTER TABLE NOT_WITHOUT_ROWID error: %s\n",
+		   err_msg);
+	  sqlite3_free (err_msg);
+	  return -332;
+      }
+    ret =
+	sqlite3_get_table (handle,
+			   "SELECT RecoverGeometryColumn('NOT_WITHOUT_ROWID', 'geom2', 4326, 'POINT', 'XY')",
+			   &results, &rows, &columns, &err_msg);
+    if (ret != SQLITE_OK)
+      {
+	  fprintf (stderr,
+		   "RecoverGeometryColumn(NOT_WITHOUT_ROWID) error: %s\n",
+		   err_msg);
+	  sqlite3_free (err_msg);
+	  return -333;
+      }
+    if ((rows != 1) || (columns != 1))
+      {
+	  fprintf (stderr,
+		   "Unexpected error: RecoverGeometryColumn(NOT_WITHOUT_ROWID) bad result: %i/%i.\n",
+		   rows, columns);
+	  sqlite3_free_table (results);
+	  return -319;
+      }
+    if (strcmp (results[1], "0") != 1)
+      {
+	  fprintf (stderr,
+		   "unexpected result RecoverGeometryColumn(NOT_WITHOUT_ROWID): %s\n",
+		   results[1]);
+	  sqlite3_free_table (results);
+	  return -334;
       }
-    return -113;
-    */
+    sqlite3_free_table (results);
+
+    ret =
+	sqlite3_get_table (handle,
+			   "SELECT CheckWithoutRowid('NOT_WITHOUT_ROWID')",
+			   &results, &rows, &columns, &err_msg);
+    if (ret != SQLITE_OK)
+      {
+	  fprintf (stderr, "CheckWithoutRowid(NOT_WITHOUT_ROWID) error: %s\n",
+		   err_msg);
+	  sqlite3_free (err_msg);
+	  return -335;
+      }
+    if ((rows != 1) || (columns != 1))
+      {
+	  fprintf (stderr,
+		   "Unexpected error: CheckWithoutRowid(NOT_WITHOUT_ROWID) bad result: %i/%i.\n",
+		   rows, columns);
+	  sqlite3_free_table (results);
+	  return -336;
+      }
+    if (strcmp (results[1], "0") != 0)
+      {
+	  fprintf (stderr,
+		   "unexpected result CheckWithoutRowid(NOT_WITHOUT_ROWID): %s\n",
+		   results[1]);
+	  sqlite3_free_table (results);
+	  return -337;
+      }
+    sqlite3_free_table (results);
+
+    ret =
+	sqlite3_get_table (handle,
+			   "SELECT CheckWithoutRowid('not_existing_table')",
+			   &results, &rows, &columns, &err_msg);
+    if (ret != SQLITE_OK)
+      {
+	  fprintf (stderr, "CheckWithoutRowid(not_existing_table) error: %s\n",
+		   err_msg);
+	  sqlite3_free (err_msg);
+	  return -338;
+      }
+    if ((rows != 1) || (columns != 1))
+      {
+	  fprintf (stderr,
+		   "Unexpected error: CheckWithoutRowid(not_existing_table) bad result: %i/%i.\n",
+		   rows, columns);
+	  sqlite3_free_table (results);
+	  return -339;
+      }
+    if (results[1] != NULL)
+      {
+	  fprintf (stderr,
+		   "unexpected result CheckWithoutRowid(not_existing_table): %s\n",
+		   results[1]);
+	  sqlite3_free_table (results);
+	  return -340;
+      }
+    sqlite3_free_table (results);
+    return 0;
 }
 
 int
@@ -1537,14 +1711,21 @@ main (int argc, char *argv[])
     if (strcmp (sqlite3_libversion (), "3.8.2") >= 0)
       {
 	  /* testing WITHOUT ROWID (requires SQLIte 3.8.2 or later) */
-	  ret = do_test_without_rowid (handle);
+	  ret = do_test_without_rowid_true (handle);
 	  if (ret != 0)
 	    {
 		fprintf (stderr,
-			 "error while testing current style metadata layout (WITHOUT ROWID)\n");
+			 "error while testing current style metadata layout (WITHOUT ROWID / true)\n");
 		return ret;
 	    }
       }
+    ret = do_test_without_rowid_false (handle);
+    if (ret != 0)
+      {
+	  fprintf (stderr,
+		   "error while testing current style metadata layout (WITHOUT ROWID / false)\n");
+	  return ret;
+      }
 
     ret = sqlite3_close (handle);
     if (ret != SQLITE_OK)
@@ -1590,14 +1771,21 @@ main (int argc, char *argv[])
     if (strcmp (sqlite3_libversion (), "3.8.2") >= 0)
       {
 	  /* testing WITHOUT ROWID (requires SQLIte 3.8.2 or later) */
-	  ret = do_test_without_rowid (handle);
+	  ret = do_test_without_rowid_true (handle);
 	  if (ret != 0)
 	    {
 		fprintf (stderr,
-			 "error while testing legacy style metadata layout (WITHOUT ROWID)\n");
+			 "error while testing legacy style metadata layout (WITHOUT ROWID / true)\n");
 		return ret;
 	    }
       }
+    ret = do_test_without_rowid_false (handle);
+    if (ret != 0)
+      {
+	  fprintf (stderr,
+		   "error while testing current style metadata layout (WITHOUT ROWID / false)\n");
+	  return ret;
+      }
 
     ret = sqlite3_close (handle);
     if (ret != SQLITE_OK)
diff --git a/test/gpkg_test.gpkg b/test/gpkg_test.gpkg
index 78a04af..427b370 100644
Binary files a/test/gpkg_test.gpkg and b/test/gpkg_test.gpkg differ
diff --git a/test/sql_stmt_geos_tests/Makefile.am b/test/sql_stmt_geos_tests/Makefile.am
index 95103ed..ba7b130 100644
--- a/test/sql_stmt_geos_tests/Makefile.am
+++ b/test/sql_stmt_geos_tests/Makefile.am
@@ -184,6 +184,16 @@ EXTRA_DIST = bdmpolyfromtext10.testcase \
 	isvalid7.testcase \
 	isvalid8.testcase \
 	isvalid9.testcase \
+	isvaliddetail1.testcase \
+	isvaliddetail2.testcase \
+	isvaliddetail3.testcase \
+	isvaliddetail4.testcase \
+	isvaliddetail5.testcase \
+	isvalidreason1.testcase \
+	isvalidreason2.testcase \
+	isvalidreason3.testcase \
+	isvalidreason4.testcase \
+	isvalidreason5.testcase \
 	pointonsurface1.testcase \
 	pointonsurface2.testcase \
 	pointonsurface3.testcase \
diff --git a/test/sql_stmt_geos_tests/Makefile.in b/test/sql_stmt_geos_tests/Makefile.in
index 59ea9d5..9279b26 100644
--- a/test/sql_stmt_geos_tests/Makefile.in
+++ b/test/sql_stmt_geos_tests/Makefile.in
@@ -426,6 +426,16 @@ EXTRA_DIST = bdmpolyfromtext10.testcase \
 	isvalid7.testcase \
 	isvalid8.testcase \
 	isvalid9.testcase \
+	isvaliddetail1.testcase \
+	isvaliddetail2.testcase \
+	isvaliddetail3.testcase \
+	isvaliddetail4.testcase \
+	isvaliddetail5.testcase \
+	isvalidreason1.testcase \
+	isvalidreason2.testcase \
+	isvalidreason3.testcase \
+	isvalidreason4.testcase \
+	isvalidreason5.testcase \
 	pointonsurface1.testcase \
 	pointonsurface2.testcase \
 	pointonsurface3.testcase \
diff --git a/test/sql_stmt_geos_tests/isvaliddetail1.testcase b/test/sql_stmt_geos_tests/isvaliddetail1.testcase
new file mode 100644
index 0000000..9a65f17
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvaliddetail1.testcase
@@ -0,0 +1,7 @@
+isvaliddetail1
+:memory: #use in-memory database
+SELECT IsValidDetail(zeroblob(10));
+1 # rows (not including the header row)
+1 # columns
+IsValidDetail(zeroblob(10))
+(NULL)
diff --git a/test/sql_stmt_geos_tests/isvaliddetail2.testcase b/test/sql_stmt_geos_tests/isvaliddetail2.testcase
new file mode 100644
index 0000000..814e046
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvaliddetail2.testcase
@@ -0,0 +1,7 @@
+isvaliddetail2
+:memory: #use in-memory database
+SELECT IsValidDetail(GeomFromText("LINESTRINGZ(136 -35 635.2, 135.2 -34.5 675.1)"));
+1 # rows (not including the header row)
+1 # columns
+IsValidDetail(GeomFromText("LINESTRINGZ(136 -35 635.2, 135.2 -34.5 675.1)"))
+(NULL)
diff --git a/test/sql_stmt_geos_tests/isvaliddetail3.testcase b/test/sql_stmt_geos_tests/isvaliddetail3.testcase
new file mode 100644
index 0000000..51220d4
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvaliddetail3.testcase
@@ -0,0 +1,7 @@
+isvaliddetail3
+:memory: #use in-memory database
+SELECT IsValidDetail(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35))"));
+1 # rows (not including the header row)
+1 # columns
+IsValidDetail(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35))"))
+(NULL)
diff --git a/test/sql_stmt_geos_tests/isvaliddetail4.testcase b/test/sql_stmt_geos_tests/isvaliddetail4.testcase
new file mode 100644
index 0000000..9c8377a
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvaliddetail4.testcase
@@ -0,0 +1,7 @@
+isvaliddetail4
+:memory: #use in-memory database
+SELECT IsValidDetail(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5))"));
+1 # rows (not including the header row)
+1 # columns
+IsValidDetail(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5))"))
+(NULL)
diff --git a/test/sql_stmt_geos_tests/isvaliddetail5.testcase b/test/sql_stmt_geos_tests/isvaliddetail5.testcase
new file mode 100644
index 0000000..f39c312
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvaliddetail5.testcase
@@ -0,0 +1,7 @@
+isvaliddetail5
+:memory: #use in-memory database
+SELECT AsText(IsValidDetail(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5, 136 -35))")));
+1 # rows (not including the header row)
+1 # columns
+AsText(IsValidDetail(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5, 136 -35))")))
+POINT(135.2 -34.5)
diff --git a/test/sql_stmt_geos_tests/isvalidreason1.testcase b/test/sql_stmt_geos_tests/isvalidreason1.testcase
new file mode 100644
index 0000000..f2235ca
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvalidreason1.testcase
@@ -0,0 +1,7 @@
+isvalidreason1
+:memory: #use in-memory database
+SELECT IsValidReason(zeroblob(10));
+1 # rows (not including the header row)
+1 # columns
+IsValidReason(zeroblob(10))
+Invalid: NULL Geometry
diff --git a/test/sql_stmt_geos_tests/isvalidreason2.testcase b/test/sql_stmt_geos_tests/isvalidreason2.testcase
new file mode 100644
index 0000000..1050a30
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvalidreason2.testcase
@@ -0,0 +1,7 @@
+isvalidreason2
+:memory: #use in-memory database
+SELECT IsValidReason(GeomFromText("LINESTRINGZ(136 -35 635.2, 135.2 -34.5 675.1)"));
+1 # rows (not including the header row)
+1 # columns
+IsValidReason(GeomFromText("LINESTRINGZ(136 -35 635.2, 135.2 -34.5 675.1)"))
+Valid Geometry
diff --git a/test/sql_stmt_geos_tests/isvalidreason3.testcase b/test/sql_stmt_geos_tests/isvalidreason3.testcase
new file mode 100644
index 0000000..ce0d158
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvalidreason3.testcase
@@ -0,0 +1,7 @@
+isvalidreason3
+:memory: #use in-memory database
+SELECT IsValidReason(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35))"));
+1 # rows (not including the header row)
+1 # columns
+IsValidReason(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35))"))
+Valid Geometry
diff --git a/test/sql_stmt_geos_tests/isvalidreason4.testcase b/test/sql_stmt_geos_tests/isvalidreason4.testcase
new file mode 100644
index 0000000..f5675e1
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvalidreason4.testcase
@@ -0,0 +1,7 @@
+isvalidreason4
+:memory: #use in-memory database
+SELECT IsValidReason(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5))"));
+1 # rows (not including the header row)
+1 # columns
+IsValidReason(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5))"))
+Invalid: Unclosed Rings were detected
diff --git a/test/sql_stmt_geos_tests/isvalidreason5.testcase b/test/sql_stmt_geos_tests/isvalidreason5.testcase
new file mode 100644
index 0000000..a73343b
--- /dev/null
+++ b/test/sql_stmt_geos_tests/isvalidreason5.testcase
@@ -0,0 +1,7 @@
+isvalidreason5
+:memory: #use in-memory database
+SELECT IsValidReason(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5, 136 -35))"));
+1 # rows (not including the header row)
+1 # columns
+IsValidReason(GeomFromText("POLYGON((136 -35, 135.2 -34.5, 136 -35.2, 136 -35, 135.2 -34.5, 136 -35))"))
+Self-intersection[135.2 -34.5]
diff --git a/test/sql_stmt_tests/Makefile.am b/test/sql_stmt_tests/Makefile.am
index a667d49..7806e31 100644
--- a/test/sql_stmt_tests/Makefile.am
+++ b/test/sql_stmt_tests/Makefile.am
@@ -386,6 +386,9 @@ EXTRA_DIST = addpoint10.testcase \
 	collectextract20.testcase \
 	collectextract21.testcase \
 	collectextract22.testcase \
+	collectextract23.testcase \
+	collectextract24.testcase \
+	collectextract25.testcase \
 	collectextract2.testcase \
 	collectextract3.testcase \
 	collectextract4.testcase \
diff --git a/test/sql_stmt_tests/Makefile.in b/test/sql_stmt_tests/Makefile.in
index db157bf..226b566 100644
--- a/test/sql_stmt_tests/Makefile.in
+++ b/test/sql_stmt_tests/Makefile.in
@@ -627,6 +627,9 @@ EXTRA_DIST = addpoint10.testcase \
 	collectextract20.testcase \
 	collectextract21.testcase \
 	collectextract22.testcase \
+	collectextract23.testcase \
+	collectextract24.testcase \
+	collectextract25.testcase \
 	collectextract2.testcase \
 	collectextract3.testcase \
 	collectextract4.testcase \
diff --git a/test/sql_stmt_tests/collectextract1.testcase b/test/sql_stmt_tests/collectextract1.testcase
index 40af387..5cdf1ce 100644
--- a/test/sql_stmt_tests/collectextract1.testcase
+++ b/test/sql_stmt_tests/collectextract1.testcase
@@ -4,5 +4,5 @@ SELECT AsText(CollectionExtract(GeomFromText("POINT(1 2)"), 1));
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POINT(1 2)"), 1))
-MULTIPOINT(1 2)
+POINT(1 2)
 
diff --git a/test/sql_stmt_tests/collectextract10.testcase b/test/sql_stmt_tests/collectextract10.testcase
index 5498990..99a3375 100644
--- a/test/sql_stmt_tests/collectextract10.testcase
+++ b/test/sql_stmt_tests/collectextract10.testcase
@@ -4,5 +4,5 @@ SELECT AsText(CollectionExtract(GeomFromText("POINTZ(1 2 3)"), 1));
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POINTZ(1 2 3)"), 1))
-MULTIPOINT Z(1 2 3)
+POINT Z(1 2 3)
 
diff --git a/test/sql_stmt_tests/collectextract11.testcase b/test/sql_stmt_tests/collectextract11.testcase
index f1a163c..0c3707f 100644
--- a/test/sql_stmt_tests/collectextract11.testcase
+++ b/test/sql_stmt_tests/collectextract11.testcase
@@ -4,5 +4,5 @@ SELECT AsText(CollectionExtract(GeomFromText("POINTZM(1 2 3 4)"), 1));
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POINTZM(1 2 3 4)"), 1))
-MULTIPOINT ZM(1 2 3 4)
+POINT ZM(1 2 3 4)
 
diff --git a/test/sql_stmt_tests/collectextract12.testcase b/test/sql_stmt_tests/collectextract12.testcase
index e264d6f..e587dd6 100644
--- a/test/sql_stmt_tests/collectextract12.testcase
+++ b/test/sql_stmt_tests/collectextract12.testcase
@@ -4,5 +4,5 @@ SELECT AsText(CollectionExtract(GeomFromText("POINTM(1 2 4)"), 1));
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POINTM(1 2 4)"), 1))
-MULTIPOINT M(1 2 4)
+POINT M(1 2 4)
 
diff --git a/test/sql_stmt_tests/collectextract15.testcase b/test/sql_stmt_tests/collectextract15.testcase
index 0d6a652..498f7b9 100644
--- a/test/sql_stmt_tests/collectextract15.testcase
+++ b/test/sql_stmt_tests/collectextract15.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("LINESTRING(1 2, 4 3)"), 2));
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("LINESTRING(1 2, 4 3)"), 2))
-MULTILINESTRING((1 2, 4 3))
+LINESTRING(1 2, 4 3)
 
 
diff --git a/test/sql_stmt_tests/collectextract16.testcase b/test/sql_stmt_tests/collectextract16.testcase
index 826a7a8..c5fb97b 100644
--- a/test/sql_stmt_tests/collectextract16.testcase
+++ b/test/sql_stmt_tests/collectextract16.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("LINESTRINGZ(1 2 4, 4 3 1)"), 2));
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("LINESTRINGZ(1 2 4, 4 3 1)"), 2))
-MULTILINESTRING Z((1 2 4, 4 3 1))
+LINESTRING Z(1 2 4, 4 3 1)
 
 
diff --git a/test/sql_stmt_tests/collectextract17.testcase b/test/sql_stmt_tests/collectextract17.testcase
index 4d6f21d..70696db 100644
--- a/test/sql_stmt_tests/collectextract17.testcase
+++ b/test/sql_stmt_tests/collectextract17.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("LINESTRINGM(1 2 4, 4 3 1)"), 2));
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("LINESTRINGM(1 2 4, 4 3 1)"), 2))
-MULTILINESTRING M((1 2 4, 4 3 1))
+LINESTRING M(1 2 4, 4 3 1)
 
 
diff --git a/test/sql_stmt_tests/collectextract18.testcase b/test/sql_stmt_tests/collectextract18.testcase
index d0a1c9d..b908b79 100644
--- a/test/sql_stmt_tests/collectextract18.testcase
+++ b/test/sql_stmt_tests/collectextract18.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("LINESTRINGZM(1 2 4 1, 4 3 1 2)"),
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("LINESTRINGZM(1 2 4 1, 4 3 1 2)"), 2))
-MULTILINESTRING ZM((1 2 4 1, 4 3 1 2))
+LINESTRING ZM(1 2 4 1, 4 3 1 2)
 
 
diff --git a/test/sql_stmt_tests/collectextract19.testcase b/test/sql_stmt_tests/collectextract19.testcase
index e30ad1d..8c22487 100644
--- a/test/sql_stmt_tests/collectextract19.testcase
+++ b/test/sql_stmt_tests/collectextract19.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("POLYGONZM((0 0 1 3, 10 0 2 3, 10 1
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POLYGONZM((0 0 1 3, 10 0 2 3, 10 10 1 6, 0 0 1 3),(1 2 4 1, 4 3 1 2, 1 1 1 6, 1 2 4 1))"), 3))
-MULTIPOLYGON ZM(((0 0 1 3, 10 0 2 3, 10 10 1 6, 0 0 1 3), (1 2 4 1, 4 3 1 2, 1 1 1 6, 1 2 4 1)))
+POLYGON ZM((0 0 1 3, 10 0 2 3, 10 10 1 6, 0 0 1 3), (1 2 4 1, 4 3 1 2, 1 1 1 6, 1 2 4 1))
 
 
diff --git a/test/sql_stmt_tests/collectextract20.testcase b/test/sql_stmt_tests/collectextract20.testcase
index 352fe56..4e01c37 100644
--- a/test/sql_stmt_tests/collectextract20.testcase
+++ b/test/sql_stmt_tests/collectextract20.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("POLYGONZ((0 0 1, 10 0 2, 10 10 1,
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POLYGONZ((0 0 1, 10 0 2, 10 10 1, 0 0 1),(1 2 4, 4 3 1, 1 1 1, 1 2 4))"), 3))
-MULTIPOLYGON Z(((0 0 1, 10 0 2, 10 10 1, 0 0 1), (1 2 4, 4 3 1, 1 1 1, 1 2 4)))
+POLYGON Z((0 0 1, 10 0 2, 10 10 1, 0 0 1), (1 2 4, 4 3 1, 1 1 1, 1 2 4))
 
 
diff --git a/test/sql_stmt_tests/collectextract21.testcase b/test/sql_stmt_tests/collectextract21.testcase
index 212d37c..2f380f2 100644
--- a/test/sql_stmt_tests/collectextract21.testcase
+++ b/test/sql_stmt_tests/collectextract21.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("POLYGONM((0 0 1, 10 0 2, 10 10 1,
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POLYGONM((0 0 1, 10 0 2, 10 10 1, 0 0 1),(1 2 4, 4 3 1, 1 1 1, 1 2 4))"), 3))
-MULTIPOLYGON M(((0 0 1, 10 0 2, 10 10 1, 0 0 1), (1 2 4, 4 3 1, 1 1 1, 1 2 4)))
+POLYGON M((0 0 1, 10 0 2, 10 10 1, 0 0 1), (1 2 4, 4 3 1, 1 1 1, 1 2 4))
 
 
diff --git a/test/sql_stmt_tests/collectextract22.testcase b/test/sql_stmt_tests/collectextract22.testcase
index 30461ce..f519bd5 100644
--- a/test/sql_stmt_tests/collectextract22.testcase
+++ b/test/sql_stmt_tests/collectextract22.testcase
@@ -4,6 +4,6 @@ SELECT AsText(CollectionExtract(GeomFromText("POLYGON((0 0, 10 0, 10 10, 0 0),(1
 1 # rows (not including the header row)
 1 # columns
 AsText(CollectionExtract(GeomFromText("POLYGON((0 0, 10 0, 10 10, 0 0),(1 2, 4 3, 1 1, 1 2))"), 3))
-MULTIPOLYGON(((0 0, 10 0, 10 10, 0 0), (1 2, 4 3, 1 1, 1 2)))
+POLYGON((0 0, 10 0, 10 10, 0 0), (1 2, 4 3, 1 1, 1 2))
 
 
diff --git a/test/sql_stmt_tests/collectextract23.testcase b/test/sql_stmt_tests/collectextract23.testcase
new file mode 100644
index 0000000..4e1c8ef
--- /dev/null
+++ b/test/sql_stmt_tests/collectextract23.testcase
@@ -0,0 +1,7 @@
+Collection Extract - Extract MULTIPOINT
+:memory: #use in-memory database
+SELECT AsText(CollectionExtract(GeomFromText("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 1 0, 1 1, 0 1, 0 0)), POINT(1 1), LINESTRING(1 1, 2 2), POLYGON((1 1, 2 1, 2 2, 1 2, 1 1)))"), 1));
+1 # rows (not including the header row)
+1 # columns
+AsText(CollectionExtract(GeomFromText("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 1 0, 1 1, 0 1, 0 0)), POINT(1 1), LINESTRING(1 1, 2 2), POLYGON((1 1, 2 1, 2 2, 1 2, 1 1)))"), 1))
+MULTIPOINT(0 0, 1 1)
diff --git a/test/sql_stmt_tests/collectextract24.testcase b/test/sql_stmt_tests/collectextract24.testcase
new file mode 100644
index 0000000..4b1ac86
--- /dev/null
+++ b/test/sql_stmt_tests/collectextract24.testcase
@@ -0,0 +1,7 @@
+Collection Extract - Extract MULTILINESTRING
+:memory: #use in-memory database
+SELECT AsText(CollectionExtract(GeomFromText("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 1 0, 1 1, 0 1, 0 0)), POINT(1 1), LINESTRING(1 1, 2 2), POLYGON((1 1, 2 1, 2 2, 1 2, 1 1)))"), 2));
+1 # rows (not including the header row)
+1 # columns
+AsText(CollectionExtract(GeomFromText("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 1 0, 1 1, 0 1, 0 0)), POINT(1 1), LINESTRING(1 1, 2 2), POLYGON((1 1, 2 1, 2 2, 1 2, 1 1)))"), 2))
+MULTILINESTRING((0 0, 1 1), (1 1, 2 2))
diff --git a/test/sql_stmt_tests/collectextract25.testcase b/test/sql_stmt_tests/collectextract25.testcase
new file mode 100644
index 0000000..9e4b3cb
--- /dev/null
+++ b/test/sql_stmt_tests/collectextract25.testcase
@@ -0,0 +1,7 @@
+Collection Extract - Extract MULTILINESTRING
+:memory: #use in-memory database
+SELECT AsText(CollectionExtract(GeomFromText("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 1 0, 1 1, 0 1, 0 0)), POINT(1 1), LINESTRING(1 1, 2 2), POLYGON((1 1, 2 1, 2 2, 1 2, 1 1)))"), 3));
+1 # rows (not including the header row)
+1 # columns
+AsText(CollectionExtract(GeomFromText("GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 1 1), POLYGON((0 0, 1 0, 1 1, 0 1, 0 0)), POINT(1 1), LINESTRING(1 1, 2 2), POLYGON((1 1, 2 1, 2 2, 1 2, 1 1)))"), 3))
+MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((1 1, 2 1, 2 2, 1 2, 1 1)))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/spatialite.git



More information about the Pkg-grass-devel mailing list