Changeset: 5f85aa1b6698 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5f85aa1b6698 Modified Files: sql/backends/monet5/sql.c sql/server/rel_select.c Branch: default Log Message:
fixed compilation (and small layout cleanup) diffs (145 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 @@ -474,12 +474,13 @@ create_table_or_view(mvc *sql, char *sna } str -create_table_from_emit(Client cntxt, char *sname, char *tname, sql_emit_col *columns, size_t ncols) { - size_t i; - sql_table *t; - sql_schema *s; - mvc *sql = NULL; - str msg = MAL_SUCCEED; +create_table_from_emit(Client cntxt, char *sname, char *tname, sql_emit_col *columns, size_t ncols) +{ + size_t i; + sql_table *t; + sql_schema *s; + mvc *sql = NULL; + str msg = MAL_SUCCEED; if ((msg = getSQLContext(cntxt, NULL, &sql, NULL)) != NULL) return msg; @@ -489,7 +490,8 @@ create_table_from_emit(Client cntxt, cha /* for some reason we don't have an allocator here so make one */ sql->sa = sa_create(); - if (!sname) sname = "sys"; + if (!sname) + sname = "sys"; if (!(s = mvc_bind_schema(sql, sname))) { msg = sql_error(sql, 02, "3F000!CREATE TABLE: no such schema '%s'", sname); goto cleanup; @@ -499,45 +501,45 @@ create_table_from_emit(Client cntxt, cha goto cleanup; } - for(i = 0; i < ncols; i++) { - BAT *b = columns[i].b; - sql_subtype *tpe = sql_bind_localtype(ATOMname(b->ttype)); - sql_column *col = NULL; - - if (!tpe) { - msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not find type for column"); + for(i = 0; i < ncols; i++) { + BAT *b = columns[i].b; + sql_subtype *tpe = sql_bind_localtype(ATOMname(b->ttype)); + sql_column *col = NULL; + + if (!tpe) { + msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not find type for column"); + goto cleanup; + } + + col = mvc_create_column(sql, t, columns[i].name, tpe); + if (!col) { + msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not create column %s", columns[i].name); + goto cleanup; + } + } + msg = create_table_or_view(sql, sname, t, 0); + if (msg != MAL_SUCCEED) { goto cleanup; - } - - col = mvc_create_column(sql, t, columns[i].name, tpe); - if (!col) { - msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not create column %s", columns[i].name); - goto cleanup; - } - } - msg = create_table_or_view(sql, sname, t, 0); - if (msg != MAL_SUCCEED) { - goto cleanup; - } - t = mvc_bind_table(sql, s, tname); - if (!t) { + } + t = mvc_bind_table(sql, s, tname); + if (!t) { msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not bind table %s", tname); goto cleanup; - } - for(i = 0; i < ncols; i++) { - BAT *b = columns[i].b; - sql_column *col = NULL; - - col = mvc_bind_column(sql,t, columns[i].name); - if (!col) { - msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not bind column %s", columns[i].name); - goto cleanup; - } - msg = mvc_append_column(sql->session->tr, col, b); - if (msg != MAL_SUCCEED) { - goto cleanup; - } - } + } + for(i = 0; i < ncols; i++) { + BAT *b = columns[i].b; + sql_column *col = NULL; + + col = mvc_bind_column(sql,t, columns[i].name); + if (!col) { + msg = sql_error(sql, 02, "3F000!CREATE TABLE: could not bind column %s", columns[i].name); + goto cleanup; + } + msg = mvc_append_column(sql->session->tr, col, b); + if (msg != MAL_SUCCEED) { + goto cleanup; + } + } cleanup: sa_destroy(sql->sa); diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -575,7 +575,7 @@ rel_named_table_function(mvc *sql, sql_r int nr = 0; list *args = NULL, *nexps, *res; /* list of arguments, named A1 to AN? */ sql_func *f = NULL; - sql_exp *ie, *ae; + sql_exp *ie, *ae = NULL; sql_arg *a; node *n; char *nfname = sa_strdup(sql->sa, fname); @@ -612,6 +612,8 @@ rel_named_table_function(mvc *sql, sql_r nexps = sa_list(sql->sa); /* project the result column, add table.column name */ res = new_exp_list(sql->sa); + if (!ie || !ae || !nexps || !res) + return NULL; for (m = sf->func->res->h; m; m = m->next) { sql_exp *e; sql_arg *a = m->data; @@ -626,6 +628,8 @@ rel_named_table_function(mvc *sql, sql_r /* create sub function for lateral version of the table function */ sf = sql_dup_subfunc(sql->sa, f, tl, NULL); + if (!f->rel || !rel || !sf) + return NULL; } exps = list_dup(exps, NULL); append(exps, tid); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list