Changeset: 16570904cefc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/16570904cefc
Modified Files:
sql/backends/monet5/sql_gencode.c
Branch: Jul2021
Log Message:
Better way to set input variables names
diffs (38 lines):
diff --git a/sql/backends/monet5/sql_gencode.c
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -387,28 +387,16 @@ static int
/* ops */
if (call && call->type == st_list) {
+ char nbuf[IDLENGTH];
+ int i = 0;
+
for (node *n = call->op4.lval->h; n; n = n->next) {
stmt *op = n->data;
sql_subtype *t = tail_type(op);
- int type = t->type->localtype;
- int varid = 0;
- const char *nme =
(op->op3)?op->op3->op4.aval->data.val.sval:op->cname;
- char *buf = SA_NEW_ARRAY(m->sa, char, strlen(nme) + 2),
*dst = buf, *in = (char*) nme;
+ int type = t->type->localtype, varid = 0;
- if (!buf) {
- GDKfree(lname);
- sql_error(m, 001, SQLSTATE(HY013)
MAL_MALLOC_FAIL);
- return -1;
- }
- *dst++ = 'A';
- while (*in) {
- /* TODO double quotes shouldn't be striped */
- if (*in != '"')
- *dst++ = *in;
- in++;
- }
- *dst = '\0';
- if ((varid = newVariable(curBlk, buf, strlen(buf),
type)) < 0) {
+ sprintf(nbuf, "A%d", i++);
+ if ((varid = newVariable(curBlk, nbuf, strlen(nbuf),
type)) < 0) {
GDKfree(lname);
sql_error(m, 003, SQLSTATE(42000) "Internal
error while compiling statement: variable id too long");
return -1;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list