Changeset: 01a7a9eed03e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=01a7a9eed03e
Modified Files:
        sql/storage/bat/bat_logger.c
Branch: geo
Log Message:

handle upgrade of null values correctly


diffs (76 lines):

diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -208,6 +208,11 @@ bl_postversion( void *lg)
                                isGeom = true;
                                digits = wkbLineString;
                                scale = 0;
+                       } else if (strcmp(toLower(type), "curve") == 0) {
+                               type = "geometry";
+                               isGeom = true;
+                               digits = wkbLineString;
+                               scale = 0;
                        } else if (strcmp(toLower(type), "linearring") == 0) {
                                type = "geometry";
                                isGeom = true;
@@ -218,6 +223,11 @@ bl_postversion( void *lg)
                                isGeom = true;
                                digits = wkbPolygon;
                                scale = 0;
+                       } else if (strcmp(toLower(type), "surface") == 0) {
+                               type = "geometry";
+                               isGeom = true;
+                               digits = wkbPolygon;
+                               scale = 0;
                        } else if (strcmp(toLower(type), "multipoint") == 0) {
                                type = "geometry";
                                isGeom = true;
@@ -228,11 +238,26 @@ bl_postversion( void *lg)
                                isGeom = true;
                                digits = wkbMultiLineString;
                                scale = 0;
+                       } else if (strcmp(toLower(type), "multicurve") == 0) {
+                               type = "geometry";
+                               isGeom = true;
+                               digits = wkbMultiLineString;
+                               scale = 0;
                        } else if (strcmp(toLower(type), "multipolygon") == 0) {
                                type = "geometry";
                                isGeom = true;
                                digits = wkbMultiPolygon;
                                scale = 0;
+                       } else if (strcmp(toLower(type), "multisurface") == 0) {
+                               type = "geometry";
+                               isGeom = true;
+                               digits = wkbMultiPolygon;
+                               scale = 0;
+                       } else if (strcmp(toLower(type), "geomcollection") == 
0) {
+                               type = "geometry";
+                               isGeom = true;
+                               digits = wkbGeometryCollection;
+                               scale = 0;
                        } else if (strcmp(toLower(type), "geometrycollection") 
== 0) {
                                type = "geometry";
                                isGeom = true;
@@ -273,11 +298,17 @@ bl_postversion( void *lg)
                                BATseqbase(gn, g->hseqbase);
                                for(k=BUNfirst(g), l=BUNlast(g); k<l; k++) {
                                        wkb_old *wo = (wkb_old*)BUNtail(gi, k);
-                                       wkb *wn = GDKmalloc(sizeof(wkb) - 1 + 
wo->len);
-                                       wn->len = wo->len;
+                                       wkb *wn;
+                                       if (wo->len == ~0) {
+                                               wn = GDKmalloc(sizeof(wkb));
+                                               wn->len = ~(int)0;
+                                               (wn->data)[0] = 0;
+                                       } else {
+                                               wn  = GDKmalloc(sizeof(wkb) - 1 
+ wo->len);
+                                               wn->len = wo->len;
+                                               memcpy(wn->data, wo->data, 
wn->len);
+                                       }
                                        wn->srid = 0;// we did not save the 
srid in the past
-                                       if (wo->len >= 0)
-                                               memcpy(wn->data, wo->data, 
wn->len);
                                        BUNappend(gn, wn, TRUE);
                                }
                                BATsetaccess(gn, BAT_READ);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to