Changeset: 08af679bdc31 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/08af679bdc31
Modified Files:
clients/mapiclient/dump.c
clients/mapiclient/mclient.c
Branch: mangled
Log Message:
Cache query result; use fully qualified tables; use sqlname more.
diffs (113 lines):
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -218,14 +218,18 @@ functions_has_sqlname(Mapi mid)
{
bool ret;
MapiHdl hdl;
+ static int answer = -1;
- if ((hdl = mapi_query(mid,
+ if (answer >= 0)
+ return (bool) answer;
+
+ if ((hdl = mapi_query(mid,
"select c.name"
- " from columns c, tables t"
+ " from sys.columns c, sys.tables t"
" where"
" c.table_id = t.id and"
" t.name = 'functions' and"
- " t.schema_id = (select id from schemas where
name = 'sys') and"
+ " t.schema_id = (select id from sys.schemas where
name = 'sys') and"
" c.name = 'sqlname'")) == NULL
|| mapi_error(mid))
goto bailout;
@@ -237,6 +241,7 @@ functions_has_sqlname(Mapi mid)
if (mapi_error(mid))
goto bailout;
mapi_close_handle(hdl);
+ answer = (int) ret;
return ret;
bailout:
@@ -2745,7 +2750,7 @@ dump_database(Mapi mid, stream *toConsol
"AND s.name <> 'tmp' "
"UNION ALL "
"SELECT s.name AS sname, " /* functions and procedures
*/
- "f.name AS name, "
+ "f.%s AS name, "
"f.id AS id, "
"NULL AS query, "
"NULL AS remark " /* emitted separately */
@@ -3119,7 +3124,9 @@ dump_database(Mapi mid, stream *toConsol
hdl = NULL;
/* dump views, functions and triggers */
- if ((hdl = mapi_query(mid, views_functions_triggers)) == NULL ||
+ char function_views[5120];
+ snprintf(function_views, sizeof(function_views),
views_functions_triggers, functions_sqlname);
+ if ((hdl = mapi_query(mid, function_views)) == 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
@@ -178,14 +178,18 @@ functions_has_sqlname(Mapi mid)
{
bool ret;
MapiHdl hdl;
+ static int answer = -1;
- if ((hdl = mapi_query(mid,
+ if (answer >= 0)
+ return (bool) answer;
+
+ if ((hdl = mapi_query(mid,
"select c.name"
- " from columns c, tables t"
+ " from sys.columns c, sys.tables t"
" where"
" c.table_id = t.id and"
" t.name = 'functions' and"
- " t.schema_id = (select id from schemas where
name = 'sys') and"
+ " t.schema_id = (select id from sys.schemas where
name = 'sys') and"
" c.name = 'sqlname'")) == NULL
|| mapi_error(mid))
goto bailout;
@@ -197,6 +201,7 @@ functions_has_sqlname(Mapi mid)
if (mapi_error(mid))
goto bailout;
mapi_close_handle(hdl);
+ answer = (int) ret;
return ret;
bailout:
@@ -2566,7 +2571,7 @@ doFile(Mapi mid, stream *fp, bool useins
} else {
const char* functions_sqlname =
functions_has_sqlname(mid) ? "sqlname" : "name";
-
+
size_t len = 5000 + 400 +
strlen(line);
char *query = malloc(len);
char *q = query, *endq = query
+ len;
@@ -2576,7 +2581,7 @@ doFile(Mapi mid, stream *fp, bool useins
continue;
}
- /* get all object names in
current schema
+ /* get all object names in
current schema
* | LINE | SCHEMA
FILTER | NAME FILTER |
*
|-----------------+---------------+-------------------------------|
* | "" | yes
| - |
@@ -2586,7 +2591,7 @@ doFile(Mapi mid, stream *fp, bool useins
* | "data.my*" | no
| fullname LIKE 'data.my%' |
* | "*a.my*" | no
| fullname LIKE '%a.my%' |
*/
- q += snprintf(q, endq-q,
+ q += snprintf(q, endq-q,
"with describe_all_objects AS (\n"
" SELECT s.name AS sname,\n"
" t.name,\n"
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list