Changeset: 52b7b18fc058 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=52b7b18fc058
Modified Files:
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_result.c
        sql/backends/monet5/sql_scenario.c
Branch: Nov2019
Log Message:

Properly convert int to BUN.


diffs (39 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -2904,7 +2904,8 @@ mvc_export_chunk_wrap(Client cntxt, MalB
        (void) mb;              /* NOT USED */
        if (pci->argc == 5) {
                offset = (BUN) *getArgReference_int(stk, pci, 3);
-               nr = (BUN) *getArgReference_int(stk, pci, 4);
+               int cnt = *getArgReference_int(stk, pci, 4);
+               nr = cnt < 0 ? BUN_NONE : (BUN) cnt;
        }
 
        if ((msg = checkSQLContext(cntxt)) != NULL)
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
@@ -2563,7 +2563,7 @@ mvc_export_chunk(backend *b, stream *s, 
                cnt = BATcount(order);
        if (offset >= BATcount(order))
                cnt = 0;
-       if (offset + cnt > BATcount(order))
+       if (cnt == BUN_NONE || offset + cnt > BATcount(order))
                cnt = BATcount(order) - offset;
 
        if (b->client->protocol != PROTOCOL_10) {
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1104,7 +1104,9 @@ SQLparser(Client c)
                        n = sscanf(in->buf + in->pos + 7, "%d %d %d", &v, &off, 
&len);
 
                if (n == 2 || n == 3) {
-                       if (mvc_export_chunk(be, out, v, off, n == 3 ? len : 
m->reply_size)) {
+                       if (n == 2)
+                               len = m->reply_size;
+                       if (mvc_export_chunk(be, out, v, off, len < 0 ? 
BUN_NONE : (BUN) len)) {
                                msg = createException(SQL, "SQLparser", 
SQLSTATE(45000) "Result set construction failed");
                                goto finalize;
                        }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to