Changeset: b6a14ff69952 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b6a14ff69952
Modified Files:
        clients/mapiclient/dump.c
        clients/mapiclient/mclient.c
        clients/mapiclient/msqldump.h
Branch: Aug2018
Log Message:

Minor tweaks.


diffs (94 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -876,7 +876,7 @@ dump_column_definition(Mapi mid, stream 
 
 int
 describe_table(Mapi mid, const char *schema, const char *tname,
-              stream *toConsole, int foreign)
+              stream *toConsole, bool foreign)
 {
        int cnt;
        MapiHdl hdl = NULL;
@@ -1481,7 +1481,7 @@ dump_table_data(Mapi mid, const char *sc
 
 int
 dump_table(Mapi mid, const char *schema, const char *tname, stream *toConsole,
-          int describe, int foreign, bool useInserts)
+          bool describe, bool foreign, bool useInserts)
 {
        int rc;
 
@@ -1807,7 +1807,7 @@ dump_functions(Mapi mid, stream *toConso
 }
 
 int
-dump_database(Mapi mid, stream *toConsole, int describe, bool useInserts)
+dump_database(Mapi mid, stream *toConsole, bool describe, bool useInserts)
 {
        const char *start = "START TRANSACTION";
        const char *end = "ROLLBACK";
@@ -2039,17 +2039,12 @@ dump_database(Mapi mid, stream *toConsol
                        const char *pwhash = mapi_fetch_field(hdl, 2);
                        const char *sname = mapi_fetch_field(hdl, 3);
 
-                       mnstr_printf(toConsole, "CREATE USER \"%s\" ", uname);
-                       if (describe)
-                               mnstr_printf(toConsole,
-                                            "WITH ENCRYPTED PASSWORD '%s' "
-                                            "NAME '%s' SCHEMA \"%s\";\n",
-                                            pwhash, fullname, sname);
-                       else
-                               mnstr_printf(toConsole,
-                                            "WITH ENCRYPTED PASSWORD '%s' "
-                                            "NAME '%s' SCHEMA \"sys\";\n",
-                                            pwhash, fullname);
+                       mnstr_printf(toConsole,
+                                    "CREATE USER \"%s\" "
+                                    "WITH ENCRYPTED PASSWORD '%s' "
+                                    "NAME '%s' SCHEMA \"%s\";\n",
+                                    uname, pwhash, fullname,
+                                    describe ? sname : "sys");
                }
                if (mapi_error(mid))
                        goto bailout;
@@ -2187,7 +2182,7 @@ dump_database(Mapi mid, stream *toConsol
                }
                schema = strdup(schema);
                tname = strdup(tname);
-               rc = dump_table(mid, schema, tname, toConsole, type == 3 || 
type == 5 ? 1 : describe, describe, useInserts);
+               rc = dump_table(mid, schema, tname, toConsole, type == 3 || 
type == 5 || describe, describe, useInserts);
                free(schema);
                free(tname);
        }
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -2704,7 +2704,7 @@ doFile(Mapi mid, stream *fp, bool useins
 #endif
                                        if (*line) {
                                                mnstr_printf(toConsole, "START 
TRANSACTION;\n");
-                                               dump_table(mid, NULL, line, 
toConsole, 0, 1, useinserts);
+                                               dump_table(mid, NULL, line, 
toConsole, false, true, useinserts);
                                                mnstr_printf(toConsole, 
"COMMIT;\n");
                                        } else
                                                dump_database(mid, toConsole, 
0, useinserts);
diff --git a/clients/mapiclient/msqldump.h b/clients/mapiclient/msqldump.h
--- a/clients/mapiclient/msqldump.h
+++ b/clients/mapiclient/msqldump.h
@@ -6,12 +6,12 @@
  * Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V.
  */
 
-extern int describe_table(Mapi mid, const char *schema, const char *tname, 
stream *toConsole, int foreign);
+extern int describe_table(Mapi mid, const char *schema, const char *tname, 
stream *toConsole, bool foreign);
 extern int describe_sequence(Mapi mid, const char *schema, const char *sname, 
stream *toConsole);
 extern int describe_schema(Mapi mid, const char *sname, stream *toConsole);
-extern int dump_table(Mapi mid, const char *schema, const char *tname, stream 
*toConsole, int describe, int foreign, bool useInserts);
+extern int dump_table(Mapi mid, const char *schema, const char *tname, stream 
*toConsole, bool describe, bool foreign, bool useInserts);
 extern int dump_functions(Mapi mid, stream *toConsole, char set_schema, const 
char *sname, const char *fname, const char *id);
-extern int dump_database(Mapi mid, stream *toConsole, int describe, bool 
useInserts);
+extern int dump_database(Mapi mid, stream *toConsole, bool describe, bool 
useInserts);
 extern void dump_version(Mapi mid, stream *toConsole, const char *prefix);
 
 /* used for backward compatibility with older server versions */
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to