Changeset: aee5a3c6af72 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/aee5a3c6af72
Modified Files:
        clients/mapiclient/dump.c
Branch: ustr
Log Message:

Dump creation of DISTINCT STRING COLUMNs.


diffs (32 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -2822,6 +2822,8 @@ dump_database(Mapi mid, stream *sqlf, co
                "ORDER BY sch.name, seq.name";
        static const char sequences2[] =
                "SELECT * FROM sys.describe_sequences ORDER BY sch, seq";
+       static const char ustrs[] =
+               "SELECT s.name, o.name FROM sys.objects o, sys.schemas s WHERE 
o.nr = s.id ORDER BY s.name, o.name";
        static const char tables[] =
                "SELECT t.id AS id, "
                           "s.name AS sname, "
@@ -3112,6 +3114,19 @@ dump_database(Mapi mid, stream *sqlf, co
        mapi_close_handle(hdl);
        hdl = NULL;
 
+       if ((hdl = mapi_query(mid, ustrs)) == NULL || mapi_error(mid))
+               goto bailout;
+
+       while (rc == 0 &&
+                  mnstr_errnr(sqlf) == MNSTR_NO__ERROR &&
+              mapi_fetch_row(hdl) != 0) {
+               const char *sname = mapi_fetch_field(hdl, 0);
+               const char *uname = mapi_fetch_field(hdl, 1);
+               mnstr_printf(sqlf, "CREATE DISTINCT STRING COLUMN ");
+               dquoted_print(sqlf, sname, ".");
+               dquoted_print(sqlf, uname, ";\n");
+       }
+
        /* Tables, views, triggers, and functions can all reference each
         * other, so we need to be very careful in how we dump them.  We
         * first dump the tables (all types), including data, but without
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to