Changeset: bc613f05ab2c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bc613f05ab2c
Modified Files:
        geom/sql/functions/Tests/ST_NumInteriorRings.stable.out
        sql/backends/monet5/sql_result.c
Branch: protocol
Log Message:

Don't add extra quotes to objects that are converted to a string.

This used to be necessary in the old protocol but is not necessary in the new 
protocol.


diffs (74 lines):

diff --git a/geom/sql/functions/Tests/ST_NumInteriorRings.stable.out 
b/geom/sql/functions/Tests/ST_NumInteriorRings.stable.out
--- a/geom/sql/functions/Tests/ST_NumInteriorRings.stable.out
+++ b/geom/sql/functions/Tests/ST_NumInteriorRings.stable.out
@@ -26,25 +26,25 @@ Ready.
 # 14:51:11 >  
 
 #SELECT ST_NumInteriorRings(ST_polygonFromText('POLYGON((1 2, 3 4, 5 6, 1 2), 
(3 4, 5 6, 7 8, 3 4))') ) AS "INTERIOR RINGS";
-% .L1 # table_name
-% INTERIOR RINGS # name
+% .L2 # table_name
+% "INTERIOR RINGS" # name
 % int # type
 % 1 # length
 [ 1    ]
 #SELECT ST_NumInteriorRings(ST_MPolyFromText('MULTIPOLYGON(((1 2, 3 4, 5 6, 1 
2),(10 20, 30 40, 50 60, 10 20), (100 200, 300 400, 500 600, 100 200)), ((1 2, 
3 4, 5 6, 1 2)))') ) AS "INTERIOR RINGS";
-% .L1 # table_name
-% INTERIOR RINGS # name
+% .L2 # table_name
+% "INTERIOR RINGS" # name
 % int # type
 % 1 # length
 [ 2    ]
 #SELECT ST_NumInteriorRings(st_linefromtext('linestring(1 2 3, 4 5 6, 7 8 
9)')) AS "INTERIOR RINGS";
-% .L1 # table_name
-% INTERIOR RINGS # name
+% .L2 # table_name
+% "INTERIOR RINGS" # name
 % int # type
 % 1 # length
 [ 0    ]
 #SELECT id, geom AS "GEOMETRY", ST_NumInteriorRings(geom) AS "INTERIOR RINGS" 
FROM geometries WHERE 5<=id AND id<=10 OR id=18 OR id=23 OR id=26 OR id=27;
-% sys.geometries,      sys.L1, sys.L2 # table_name
+% sys.geometries,      sys.L3, sys.L5 # table_name
 % id,  GEOMETRY,       "INTERIOR RINGS" # name
 % int, geometry,       int # type
 % 2,   0,      1 # length
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -2007,13 +2007,13 @@ int mvc_export_resultset_prot10(mvc *m, 
                        int (*atomCmp) (const void *v1, const void *v2) = 
BATatoms[b->ttype].atomCmp;
                        int (*strConversion) (str*, int*, const void*) = 
BATatoms[b->ttype].atomToStr;
                        BAT *res = COLnew(0, TYPE_str, 0, TRANSIENT);
+                       char *result = NULL;
+                       int length = 0;
                        if (!res) {
                                fres = -1;
                                goto cleanup;
                        }
                        BATloop(b, p, q) {
-                               char *result = NULL;
-                               int length = 0;
                                void *element = (void*) BUNtail(iterators[i], 
p);
                                if (atomCmp(element, atomNull) == 0) {
                                        BUNappend(res, str_nil, FALSE);
@@ -2022,7 +2022,17 @@ int mvc_export_resultset_prot10(mvc *m, 
                                                fres = -1;
                                                goto cleanup;
                                        }
-                                       BUNappend(res, result, FALSE);
+                                       // string conversion functions add 
quotes for the old protocol
+                                       // because obviously adding quotes in 
the string conversion function
+                                       // makes total sense, rather than 
adding the quotes in the protocol
+                                       // thus because of this totally, 100% 
sensical implementation
+                                       // we remove the quotes again here
+                                       if (result[0] == '"') {
+                                               result[strlen(result) - 1] = 
'\0';
+                                               BUNappend(res, result + 1, 
FALSE);
+                                       } else {
+                                               BUNappend(res, result, FALSE);
+                                       }
                                }
                         }
                        // if converting to string, we use str_nil
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to