Changeset: 8ca3d772d629 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ca3d772d629 Modified Files: clients/ChangeLog clients/mapiclient/dump.c clients/mapiclient/mclient.c clients/mapiclient/msqldump.h Branch: default Log Message:
Cleanup: remove the test for the sys.schemas.system column. The column was introduced in the Jan2014 branch. diffs (152 lines): diff --git a/clients/ChangeLog b/clients/ChangeLog --- a/clients/ChangeLog +++ b/clients/ChangeLog @@ -2,6 +2,9 @@ # This file is updated with Maddlog * Mon Dec 12 2016 Sjoerd Mullender <[email protected]> +- The mclient and msqldump programs lost compatibility with old + mserver5 versions (pre 2014) which didn't have a "system" column in + the sys.schemas table. - The mclient and msqldump programs lost compatibility with ancient mserver5 versions (pre 2011) which didn't have the sys.systemfunctions table. diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -92,47 +92,6 @@ get_schema(Mapi mid) return NULL; } -/* return TRUE if the sys.schemas table has a column named system */ -int -has_schemas_system(Mapi mid) -{ - MapiHdl hdl; - int ret; - - if ((hdl = mapi_query(mid, - "SELECT c.id " - "FROM sys._columns c, " - "sys._tables t, " - "sys.schemas s " - "WHERE c.name = 'system' AND " - "c.table_id = t.id AND " - "t.name = 'schemas' AND " - "t.schema_id = s.id AND " - "s.name = 'sys'")) == NULL || - mapi_error(mid)) - goto bailout; - ret = mapi_get_row_count(hdl) == 1; - while ((mapi_fetch_row(hdl)) != 0) { - if (mapi_error(mid)) - goto bailout; - } - if (mapi_error(mid)) - goto bailout; - mapi_close_handle(hdl); - return ret; - - bailout: - if (hdl) { - if (mapi_result_error(hdl)) - mapi_explain_result(hdl, stderr); - else - mapi_explain_query(hdl, stderr); - mapi_close_handle(hdl); - } else - mapi_explain(mid, stderr); - return 0; -} - /* return TRUE if the HUGEINT type exists */ static int has_hugeint(Mapi mid) @@ -1435,7 +1394,7 @@ dump_database(Mapi mid, stream *toConsol "FROM sys.schemas s, " "sys.auths a " "WHERE s.\"authorization\" = a.id AND " - "%s " + "s.system = FALSE " "ORDER BY s.name"; /* alternative, but then need to handle NULL in second column: SELECT "s"."name", "a"."name" @@ -1524,7 +1483,6 @@ dump_database(Mapi mid, stream *toConsol MapiHdl hdl; int create_hash_func = 0; int rc = 0; - char query[1024]; /* start a transaction for the dump */ if (!describe) @@ -1595,11 +1553,7 @@ dump_database(Mapi mid, stream *toConsol mapi_close_handle(hdl); /* dump schemas */ - snprintf(query, sizeof(query), schemas, - has_schemas_system(mid) ? - "s.system = FALSE" : - "s.name NOT IN ('sys', 'tmp')"); - if ((hdl = mapi_query(mid, query)) == NULL || + if ((hdl = mapi_query(mid, schemas)) == NULL || mapi_error(mid)) goto bailout; diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -2121,8 +2121,6 @@ showCommands(void) #define MD_FUNC 8 #define MD_SCHEMA 16 -enum hmyesno { UNKNOWN, YES, NO }; - #define READBLOCK 8192 #ifdef HAVE_LIBREADLINE @@ -2195,7 +2193,6 @@ doFile(Mapi mid, stream *fp, int useinse MapiHdl hdl; MapiMsg rc = MOK; int lineno = 1; - enum hmyesno hasschemsys = UNKNOWN; char *prompt = NULL; int prepno = 0; #ifdef HAVE_LIBREADLINE @@ -2457,9 +2454,6 @@ doFile(Mapi mid, stream *fp, int useinse char nameq[128]; char funcq[512]; - if (hasschemsys == UNKNOWN) - hasschemsys = has_schemas_system(mid) ? YES : NO; - if (!*line) { line = "%"; hasSchema = 0; @@ -2544,8 +2538,8 @@ doFile(Mapi mid, stream *fp, int useinse "%s " "UNION " "SELECT NULL AS name, " - "(CASE WHEN %s THEN 'SYSTEM ' ELSE '' END || 'SCHEMA') AS type, " - "%s AS system, " + "(CASE WHEN o.system THEN 'SYSTEM ' ELSE '' END || 'SCHEMA') AS type, " + "o.system AS system, " "o.name AS sname, " "%d AS ntype " "FROM sys.schemas o " @@ -2558,8 +2552,6 @@ doFile(Mapi mid, stream *fp, int useinse nameq, MD_SEQ, nameq, funcq, - hasschemsys ? "o.system" : "o.name LIKE 'sys'", - hasschemsys ? "o.system" : "o.name LIKE 'sys'", MD_SCHEMA, line, x, (wantsSystem ? diff --git a/clients/mapiclient/msqldump.h b/clients/mapiclient/msqldump.h --- a/clients/mapiclient/msqldump.h +++ b/clients/mapiclient/msqldump.h @@ -13,4 +13,3 @@ extern int dump_table(Mapi mid, char *sc extern int dump_functions(Mapi mid, stream *toConsole, const char *sname, const char *fname); extern int dump_database(Mapi mid, stream *toConsole, int describe, const char useInserts); extern void dump_version(Mapi mid, stream *toConsole, const char *prefix); -extern int has_schemas_system(Mapi mid); _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
