Changeset: 491b5d96c2fe for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=491b5d96c2fe
Added Files:
geom/BugTracker/Tests/copy_into_mbr.3492.modules
geom/BugTracker/Tests/copy_into_mbr.3492.sql
geom/BugTracker/Tests/copy_into_mbr.3492.stable.err
geom/BugTracker/Tests/copy_into_mbr.3492.stable.out
Modified Files:
MonetDB.spec
clients/odbc/driver/ODBCConvert.c
clients/odbc/driver/ODBCUtil.h
geom/BugTracker/Tests/All
geom/monetdb5/geom.c
Branch: transaction-replication
Log Message:
Merge with default branch
diffs (261 lines):
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -501,11 +501,13 @@ fi
# %exclude %{_libdir}/monetdb5/rdf.mal
%exclude %{_libdir}/monetdb5/sql.mal
%{_libdir}/monetdb5/*.mal
-# %{_libdir}/monetdb5/autoload/*_fits.mal
-%{_libdir}/monetdb5/autoload/*_lsst.mal
-%{_libdir}/monetdb5/autoload/*_opt_sql_append.mal
-%{_libdir}/monetdb5/autoload/*_udf.mal
-%{_libdir}/monetdb5/autoload/*_vault.mal
+%if %{?with_geos:1}%{!?with_geos:0}
+%exclude %{_libdir}/monetdb5/autoload/*_geom.mal
+%endif
+%exclude %{_libdir}/monetdb5/autoload/*_gsl.mal
+# %exclude %{_libdir}/monetdb5/autoload/*_rdf.mal
+%exclude %{_libdir}/monetdb5/autoload/*_sql.mal
+%{_libdir}/monetdb5/autoload/*.mal
%if %{?with_geos:1}%{!?with_geos:0}
%exclude %{_libdir}/monetdb5/lib_geom.so
%endif
diff --git a/clients/odbc/driver/ODBCConvert.c
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -2880,6 +2880,13 @@ ODBCStore(ODBCStmt *stmt,
case SQL_C_WCHAR:
slen = strlen_or_ind_ptr ? *strlen_or_ind_ptr : SQL_NTS;
fixWcharIn((SQLWCHAR *) ptr, slen, char, sval, addStmtError,
stmt, return SQL_ERROR);
+ if (sval == NULL) {
+ sval = strdup("");
+ if (sval == NULL) {
+ addStmtError(stmt, "HY001", NULL, 0);
+ return SQL_ERROR;
+ }
+ }
slen = strlen(sval);
break;
case SQL_C_BIT:
diff --git a/clients/odbc/driver/ODBCUtil.h b/clients/odbc/driver/ODBCUtil.h
--- a/clients/odbc/driver/ODBCUtil.h
+++ b/clients/odbc/driver/ODBCUtil.h
@@ -110,10 +110,6 @@ extern char *ODBCutf82wchar(const SQLCHA
do { \
char *e; \
(s) = (t *) ODBCwchar2utf8((ws), (wsl), &e); \
- if ((s) == NULL) { \
- errfunc((hdl), "HY001", NULL, 0); \
- exit; \
- } \
if (e) { \
/* General error */ \
errfunc((hdl), \
diff --git a/geom/BugTracker/Tests/All b/geom/BugTracker/Tests/All
--- a/geom/BugTracker/Tests/All
+++ b/geom/BugTracker/Tests/All
@@ -3,6 +3,7 @@
X_crash.SF-1971632
copy_into_crash.SF-1975402
+copy_into_mbr.3492
# tests related to bug reports:
# <descriptive-name>.Bug-<bug-report-id>
diff --git a/geom/BugTracker/Tests/copy_into_mbr.3492.modules
b/geom/BugTracker/Tests/copy_into_mbr.3492.modules
new file mode 100644
--- /dev/null
+++ b/geom/BugTracker/Tests/copy_into_mbr.3492.modules
@@ -0,0 +1,1 @@
+geom
diff --git a/geom/BugTracker/Tests/copy_into_mbr.3492.sql
b/geom/BugTracker/Tests/copy_into_mbr.3492.sql
new file mode 100644
--- /dev/null
+++ b/geom/BugTracker/Tests/copy_into_mbr.3492.sql
@@ -0,0 +1,13 @@
+CREATE TABLE geom (id INTEGER, g GEOMETRY, b MBR);
+INSERT INTO geom values (1, 'POLYGON((1 2, 3 2, 3 4, 1 4, 1 2))', NULL);
+INSERT INTO geom values (2, 'POLYGON((1 2, 3 2, 3 4, 1 4, 1 2))', 'BOX(1 2,3
4)');
+INSERT INTO geom values (3, 'POLYGON((1 2, 3 2, 3 4, 1 4, 1 2))', 'BOX (1 2,3
4)');
+INSERT INTO geom values (4, NULL, NULL);
+SELECT * FROM geom ORDER BY id;
+UPDATE geom SET b = MBR(g);
+SELECT * FROM geom ORDER BY id;
+CREATE TABLE newgeom (id INTEGER, g GEOMETRY, b MBR);
+INSERT INTO newgeom SELECT * FROM geom ORDER BY id;
+SELECT * FROM newgeom ORDER BY id;
+DROP TABLE geom;
+DROP TABLE newgeom;
diff --git a/geom/BugTracker/Tests/copy_into_mbr.3492.stable.err
b/geom/BugTracker/Tests/copy_into_mbr.3492.stable.err
new file mode 100644
--- /dev/null
+++ b/geom/BugTracker/Tests/copy_into_mbr.3492.stable.err
@@ -0,0 +1,35 @@
+stderr of test 'copy_into_mbr.3492` in directory 'geom/BugTracker` itself:
+
+
+# 15:46:48 >
+# 15:46:48 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=38234" "--set"
"mapi_usock=/var/tmp/mtest-5384/.s.monetdb.38234" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/kostis/INSTALL/MonetDB/var/MonetDB/mTests_geom_BugTracker"
"--set" "mal_listing=0"
+# 15:46:48 >
+
+# builtin opt gdk_dbpath =
/home/kostis/INSTALL/MonetDB/var/monetdb5/dbfarm/demo
+# builtin opt gdk_debug = 0
+# builtin opt gdk_vmtrim = no
+# builtin opt monet_prompt = >
+# builtin opt monet_daemon = no
+# builtin opt mapi_port = 50000
+# builtin opt mapi_open = false
+# builtin opt mapi_autosense = false
+# builtin opt sql_optimizer = default_pipe
+# builtin opt sql_debug = 0
+# cmdline opt gdk_nr_threads = 0
+# cmdline opt mapi_open = true
+# cmdline opt mapi_port = 38234
+# cmdline opt mapi_usock = /var/tmp/mtest-5384/.s.monetdb.38234
+# cmdline opt monet_prompt =
+# cmdline opt mal_listing = 2
+# cmdline opt gdk_dbpath =
/home/kostis/INSTALL/MonetDB/var/MonetDB/mTests_geom_BugTracker
+# cmdline opt mal_listing = 0
+
+# 15:46:48 >
+# 15:46:48 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-5384" "--port=38234"
+# 15:46:48 >
+
+
+# 15:46:48 >
+# 15:46:48 > "Done."
+# 15:46:48 >
+
diff --git a/geom/BugTracker/Tests/copy_into_mbr.3492.stable.out
b/geom/BugTracker/Tests/copy_into_mbr.3492.stable.out
new file mode 100644
--- /dev/null
+++ b/geom/BugTracker/Tests/copy_into_mbr.3492.stable.out
@@ -0,0 +1,79 @@
+stdout of test 'copy_into_mbr.3492` in directory 'geom/BugTracker` itself:
+
+
+# 15:46:48 >
+# 15:46:48 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set"
"mapi_open=true" "--set" "mapi_port=38234" "--set"
"mapi_usock=/var/tmp/mtest-5384/.s.monetdb.38234" "--set" "monet_prompt="
"--forcemito" "--set" "mal_listing=2"
"--dbpath=/home/kostis/INSTALL/MonetDB/var/MonetDB/mTests_geom_BugTracker"
"--set" "mal_listing=0"
+# 15:46:48 >
+
+# MonetDB 5 server v11.17.18
+# This is an unreleased version
+# Serving database 'mTests_geom_BugTracker', using 4 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically
linked
+# Found 7.497 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://leninovo:38234/
+# Listening for UNIX domain connection requests on
mapi:monetdb:///var/tmp/mtest-5384/.s.monetdb.38234
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+
+Ready.
+#Bulk operator required for geom.mbr
+#Bulk operator required for geom.mbr
+#Bulk operator required for geom.mbr
+#Bulk operator required for geom.mbr
+
+# 15:46:48 >
+# 15:46:48 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-5384" "--port=38234"
+# 15:46:48 >
+
+#CREATE TABLE geom (id INTEGER, g GEOMETRY, b MBR);
+#INSERT INTO geom values (1, 'POLYGON((1 2, 3 2, 3 4, 1 4, 1 2))', NULL);
+[ 1 ]
+#INSERT INTO geom values (2, 'POLYGON((1 2, 3 2, 3 4, 1 4, 1 2))', 'BOX(1 2,3
4)');
+[ 1 ]
+#INSERT INTO geom values (3, 'POLYGON((1 2, 3 2, 3 4, 1 4, 1 2))', 'BOX (1 2,3
4)');
+[ 1 ]
+#INSERT INTO geom values (4, NULL, NULL);
+[ 1 ]
+#SELECT * FROM geom ORDER BY id;
+% sys.geom, sys.geom, sys.geom # table_name
+% id, g, b # name
+% int, geometry, mbr # type
+% 1, 0, 0 # length
+[ 1, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", NULL ]
+[ 2, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 3, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 4, NULL, NULL ]
+#UPDATE geom SET b = MBR(g);
+[ 4 ]
+#SELECT * FROM geom ORDER BY id;
+% sys.geom, sys.geom, sys.geom # table_name
+% id, g, b # name
+% int, geometry, mbr # type
+% 1, 0, 0 # length
+[ 1, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 2, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 3, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 4, NULL, NULL ]
+#CREATE TABLE newgeom (id INTEGER, g GEOMETRY, b MBR);
+#INSERT INTO newgeom SELECT * FROM geom ORDER BY id;
+[ 4 ]
+#SELECT * FROM newgeom ORDER BY id;
+% sys.newgeom, sys.newgeom, sys.newgeom # table_name
+% id, g, b # name
+% int, geometry, mbr # type
+% 1, 0, 0 # length
+[ 1, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 2, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 3, "POLYGON ((1 2, 3 2, 3 4, 1 4, 1 2))", "BOX (1 2, 3 4)" ]
+[ 4, NULL, NULL ]
+#DROP TABLE geom;
+#DROP TABLE newgeom;
+
+# 15:46:48 >
+# 15:46:48 > "Done."
+# 15:46:48 >
+
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -157,11 +157,24 @@ mbrFROMSTR(char *src, int *len, mbr **at
int nil = 0;
int nchars = 0; /* The number of characters parsed; the return value. */
GEOSGeom geosMbr = NULL; /* The geometry object that is parsed from the
src string. */
+ double xmin = 0, ymin = 0, xmax = 0, ymax = 0;
+ char *c;
if (strcmp(src, str_nil) == 0)
nil = 1;
- if (!nil && (geosMbr = GEOSGeomFromWKT(src)) == NULL)
+ if (!nil && strstr(src,"BOX") == src && (c = strstr(src,"(")) != NULL)
{
+ /* Parse the mbr */
+ if ((c - src) != 3 && (c - src) != 4) {
+ GDKerror("ParseException: Expected a string like 'BOX(0
0,1 1)' or 'BOX (0 0,1 1)'");
+ return 0;
+ }
+
+ if (sscanf(c,"(%lf %lf,%lf %lf)", &xmin, &ymin, &xmax, &ymax)
!= 4) {
+ return 0;
+ GDKerror("ParseException: Not enough coordinates.");
+ }
+ } else if (!nil && (geosMbr = GEOSGeomFromWKT(src)) == NULL)
return 0;
if (*len < (int) sizeof(mbr)) {
@@ -172,6 +185,19 @@ mbrFROMSTR(char *src, int *len, mbr **at
if (nil) {
nchars = 3;
**atom = *mbrNULL();
+ } else if (geosMbr == NULL) {
+ size_t l;
+ assert(GDK_flt_min <= xmin && xmin <= GDK_flt_max);
+ assert(GDK_flt_min <= xmax && xmax <= GDK_flt_max);
+ assert(GDK_flt_min <= ymin && ymin <= GDK_flt_max);
+ assert(GDK_flt_min <= ymax && ymax <= GDK_flt_max);
+ (*atom)->xmin = (float) xmin;
+ (*atom)->ymin = (float) ymin;
+ (*atom)->xmax = (float) xmax;
+ (*atom)->ymax = (float) ymax;
+ l = strlen(src);
+ assert(l <= GDK_int_max);
+ nchars = (int) l;
} else if (getMbrGeos(*atom, geosMbr)) {
size_t l = strlen(src);
assert(l <= GDK_int_max);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list