diff --git a/libspatialite-4.1.1-sqlite-3.8.5.patch b/libspatialite-4.1.1-sqlite-3.8.5.patch new file mode 100644 index 0000000..ca45fec --- /dev/null +++ b/libspatialite-4.1.1-sqlite-3.8.5.patch @@ -0,0 +1,123 @@ +diff --git a/src/spatialite/spatialite.c b/src/spatialite/spatialite.c +index 69d592c..feaf495 100644 +--- a/src/spatialite/spatialite.c ++++ b/src/spatialite/spatialite.c +@@ -4513,6 +4513,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; +@@ -4629,93 +4630,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 +- { +- printf ("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\"), " +@@ -4739,6 +4653,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; +@@ -4800,6 +4715,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); diff --git a/libspatialite.spec b/libspatialite.spec index b61e321..f035f7c 100644 --- a/libspatialite.spec +++ b/libspatialite.spec @@ -37,13 +37,17 @@ Name: libspatialite Version: 4.1.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Enables SQLite to support spatial data Group: System Environment/Libraries License: MPLv1.1 or GPLv2+ or LGPLv2+ URL: https://www.gaia-gis.it/fossil/libspatialite Source0: http://www.gaia-gis.it/gaia-sins/%{name}-sources/%{name}-%{version}.tar.gz +# Rtree issue with sqlite 3.8.5 +# https://groups.google.com/forum/#!topic/spatialite-users/hVHjs_iY8io +Patch0: %{name}-4.1.1-sqlite-3.8.5.patch + BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) # EPEL 5 reminiscences are for ELGIS @@ -80,6 +84,7 @@ developing applications that use %{name}. %prep %setup -q +%patch0 -p1 -b .sqlite~ # Remove test failing on 32 bit systems # Contacted the author about it @@ -137,6 +142,9 @@ rm -rf %{buildroot} %changelog +* Tue Jul 29 2014 Volker Fröhlich - 4.1.1-3 +- Solve issue with sqlite 3.8.5's rtree implementation + * Sat Aug 03 2013 Fedora Release Engineering - 4.1.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild @@ -157,7 +165,7 @@ rm -rf %{buildroot} * Thu Feb 14 2013 Fedora Release Engineering - 4.0.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild -* Sun Dec 1 2012 Volker Fröhlich - 4.0.0-1 +* Sat Dec 1 2012 Volker Fröhlich - 4.0.0-1 - New upstream release - Remove arch restrictions, solving BZ 663938 and 846301 - Update conditional for geosadvanced @@ -177,7 +185,7 @@ rm -rf %{buildroot} - Don't run checks if built without advancedgeos - Include examples as documentation -* Wed Jan 14 2012 Volker Fröhlich - 3.0.1-1 +* Sat Jan 14 2012 Volker Fröhlich - 3.0.1-1 - New upstream release - Drop defattr - Run tests