Changeset: c422cd43e169 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c422cd43e169
Modified Files:
        clients/mapiclient/mclient.c
Branch: default
Log Message:

Merged with Jan2022


diffs (133 lines):

diff --git a/clients/ChangeLog.Jan2022 b/clients/ChangeLog.Jan2022
--- a/clients/ChangeLog.Jan2022
+++ b/clients/ChangeLog.Jan2022
@@ -1,3 +1,10 @@
 # ChangeLog file for clients
 # This file is updated with Maddlog
 
+* Wed Feb 16 2022 Sjoerd Mullender <sjo...@acm.org>
+- Improved the handling of the \r command in mclient.  It now properly
+  counts the header of table, and when a (very) long table is being
+  printed and aborted part way in the built-in pager, not all data is
+  transferred to the client (and then discarded).  Instead at most 1000
+  rows are transferred.
+
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1320,9 +1320,10 @@ RAWrenderer(MapiHdl hdl)
        }
 }
 
-static void
+static int
 SQLheader(MapiHdl hdl, int *len, int fields, char more)
 {
+       int rows = 1;                           /* start with the separator row 
*/
        SQLseparator(len, fields, '-');
        if (mapi_get_name(hdl, 0)) {
                int i;
@@ -1339,11 +1340,13 @@ SQLheader(MapiHdl hdl, int *len, int fie
                        names[i] = mapi_get_name(hdl, i);
                        numeric[i] = 0;
                }
-               SQLrow(len, numeric, names, fields, 1, more);
+               rows += SQLrow(len, numeric, names, fields, 1, more);
+               rows++;                                 /* add a separator row 
*/
                SQLseparator(len, fields, '=');
                free(names);
                free(numeric);
        }
+       return rows;
 }
 
 static void
@@ -1560,7 +1563,7 @@ SQLrenderer(MapiHdl hdl)
                        break;
        }
 
-       SQLheader(hdl, len, printfields, fields != printfields);
+       rows = SQLheader(hdl, len, printfields, fields != printfields);
 
        while ((rfields = fetch_row(hdl)) != 0) {
                if (mnstr_errnr(toConsole))
@@ -1603,8 +1606,10 @@ SQLrenderer(MapiHdl hdl)
                if (ps > 0 && rows >= ps && fromConsole != NULL) {
                        SQLpagemove(len, printfields, &ps, &silent);
                        rows = 0;
-                       if (silent)
-                               continue;
+                       if (silent) {
+                               mapi_finish(hdl);
+                               break;
+                       }
                }
 
                rows += SQLrow(len, numeric, rest, printfields, 2, 0);
@@ -3502,7 +3507,7 @@ main(int argc, char **argv)
                exit(2);
        }
 
-       mapi_cache_limit(mid, -1);
+       mapi_cache_limit(mid, 1000);
        mapi_setAutocommit(mid, autocommit);
        if (mode == SQL && !settz)
                mapi_set_time_zone(mid, 0);
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -3591,7 +3591,6 @@ mapi_param_store(MapiHdl hdl)
                                                free(val);
                                                return;
                                        }
-                                       hdl->query = q;
                                }
                                snprintf(hdl->query + k, lim - k, "'%s'", val);
                                free(val);
@@ -3608,7 +3607,6 @@ mapi_param_store(MapiHdl hdl)
                                                free(val);
                                                return;
                                        }
-                                       hdl->query = q;
                                }
                                snprintf(hdl->query + k, lim - k, "'%s'", val);
                                free(val);
diff --git a/geom/sql/pg_regression/Tests/All b/geom/sql/pg_regression/Tests/All
--- a/geom/sql/pg_regression/Tests/All
+++ b/geom/sql/pg_regression/Tests/All
@@ -83,7 +83,7 @@ HAVE_GEOM?regress_ogc_cover
 
 #HAVE_GEOM?regress_management #Functions not applicable in MOnetDB
 
-HAVE_GEOM?dump #Unknown Types: TRIANGLE, TIN (queries for those types 
commented out)
+HAVE_GEOM&GEOS_VERSION>=3.10?dump #Unknown Types: TRIANGLE, TIN (queries for 
those types commented out)
 
 HAVE_GEOM?dumppoints #Uknown Types: TRIANGLE, TIN, CURVEPOLYGON (queries for 
these types commented out)
 
diff --git a/geom/sql/pg_regression/Tests/dump.test 
b/geom/sql/pg_regression/Tests/dump.test
--- a/geom/sql/pg_regression/Tests/dump.test
+++ b/geom/sql/pg_regression/Tests/dump.test
@@ -89,10 +89,12 @@ FROM ST_Dump(ST_WKTToSQL('
                MULTILINESTRING EMPTY,
                MULTIPOLYGON EMPTY,
                GEOMETRYCOLLECTION (GEOMETRYCOLLECTION EMPTY))'))
-WHERE id <> '7' OFFSET 1 -- avoid difference between geos libraries < 3.10 vs. 
>= 3.10
 ----
 t11
 1
+GEOMETRYCOLLECTION (GEOMETRYCOLLECTION EMPTY, LINESTRING EMPTY, POLYGON EMPTY, 
MULTIPOINT EMPTY, MULTILINESTRING EMPTY, MULTIPOLYGON EMPTY, GEOMETRYCOLLECTION 
(GEOMETRYCOLLECTION EMPTY))
+t11
+1
 GEOMETRYCOLLECTION EMPTY
 t11
 2
@@ -110,6 +112,9 @@ t11
 6
 MULTIPOLYGON EMPTY
 t11
+7
+GEOMETRYCOLLECTION (GEOMETRYCOLLECTION EMPTY)
+t11
 7,1
 GEOMETRYCOLLECTION EMPTY
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to