Changeset: 341f36410403 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=341f36410403 Modified Files: sql/backends/monet5/sql_upgrades.c Branch: trails Log Message:
Streaming tables information SQL upgrade diffs (49 lines): diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -964,6 +964,33 @@ sql_update_default_geom(Client c, mvc *s return err; /* usually MAL_SUCCEED */ } +static str +sql_update_timetrails(Client c, mvc *sql) +{ + int i; + size_t bufsize = 10000, pos = 0; + char *buf = GDKmalloc(bufsize), *err = NULL; + char *schema = stack_get_string(sql, "current_schema"); + char *schemas_to_set[2] = {"sys", "tmp"}; + + if( buf== NULL) + throw(SQL, "sql_update_timetrails", SQLSTATE(HY001) MAL_MALLOC_FAIL); + + for(i = 0; i < 2; i++) { + pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", schemas_to_set[i]); + pos += snprintf(buf + pos, bufsize - pos, + "create table _streams (id int, table_id int, window int, stride int);\n"); + } + if (schema) + pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", schema); + + assert(pos < bufsize); + printf("Running database upgrade commands:\n%s\n", buf); + err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL); + GDKfree(buf); + return err; /* usually MAL_SUCCEED */ +} + void SQLupgrades(Client c, mvc *m) { @@ -1074,4 +1101,11 @@ SQLupgrades(Client c, mvc *m) freeException(err); } } + + if (mvc_bind_table(m, s, "_streams") == NULL) { + if ((err = sql_update_timetrails(c, m)) != NULL) { + fprintf(stderr, "!%s\n", err); + freeException(err); + } + } } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list