Changeset: e64693354d5b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e64693354d5b
Modified Files:
        sql/server/rel_optimizer.c
        sql/server/rel_rewriter.h
Branch: properties
Log Message:

Merged with default


diffs (truncated from 3122 to 300 lines):

diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py
--- a/NT/mkodbcwxs.py
+++ b/NT/mkodbcwxs.py
@@ -82,10 +82,10 @@ def main():
     id = 1
     print(r'            <Directory Id="lib" Name="lib">')
     id = comp(features, id, 14,
-              [r'bin\mapi.dll', # r'lib\mapi.pdb',
-               r'lib\MonetODBC.dll', # r'lib\MonetODBC.pdb',
-               r'lib\MonetODBCs.dll', # r'lib\MonetODBCs.pdb',
-               r'bin\stream.dll', # r'lib\stream.pdb',
+              [r'bin\mapi.dll', r'lib\mapi.pdb',
+               r'lib\MonetODBC.dll', r'lib\MonetODBC.pdb',
+               r'lib\MonetODBCs.dll', r'lib\MonetODBCs.pdb',
+               r'bin\stream.dll', r'lib\stream.pdb',
                vcpkg.format(r'bin\iconv-2.dll'),
                vcpkg.format(r'bin\bz2.dll'),
                vcpkg.format(r'bin\charset-1.dll'), # for iconv-2.dll
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -86,7 +86,7 @@ def main():
     print(r'    </Property>')
     print(r'    <Property Id="DEBUGEXISTS">')
     print(r'      <DirectorySearch Id="CheckFileDir1" Path="[INSTALLDIR]\bin" 
Depth="0">')
-    print(r'        <FileSearch Id="CheckFile1" Name="libbat.pdb"/>')
+    print(r'        <FileSearch Id="CheckFile1" Name="mserver5.pdb"/>')
     print(r'      </DirectorySearch>')
     print(r'    </Property>')
     print(r'    <Property Id="INCLUDEEXISTS">')
@@ -161,14 +161,14 @@ def main():
                vcpkg.format(r'bin\lzma.dll'),
                vcpkg.format(r'bin\pcre.dll'),
                vcpkg.format(r'bin\zlib1.dll')])
-    # id = comp(debug, id, 14,
-    #           [r'bin\mclient.pdb',
-    #            r'bin\mserver5.pdb',
-    #            r'bin\msqldump.pdb',
-    #            r'lib\libbat.pdb',
-    #            r'lib\libmapi.pdb',
-    #            r'lib\libmonetdb5.pdb',
-    #            r'lib\libstream.pdb'])
+    id = comp(debug, id, 14,
+              [r'bin\mclient.pdb',
+               r'bin\mserver5.pdb',
+               r'bin\msqldump.pdb',
+               r'lib\bat.pdb',
+               r'lib\mapi.pdb',
+               r'lib\monetdb5.pdb',
+               r'lib\stream.pdb'])
     id = comp(geom, id, 14,
               [vcpkg.format(r'bin\geos_c.dll'),
                vcpkg.format(r'bin\geos.dll')])
diff --git a/clients/examples/C/CMakeLists.txt 
b/clients/examples/C/CMakeLists.txt
--- a/clients/examples/C/CMakeLists.txt
+++ b/clients/examples/C/CMakeLists.txt
@@ -80,6 +80,20 @@ if(TESTING)
     DESTINATION
     ${CMAKE_INSTALL_BINDIR}
     COMPONENT clienttest)
+
+  if(WIN32)
+    install(FILES
+      $<TARGET_PDB_FILE:sample0>
+      $<TARGET_PDB_FILE:sample1>
+      $<TARGET_PDB_FILE:sample4>
+      $<TARGET_PDB_FILE:smack00>
+      $<TARGET_PDB_FILE:smack01>
+      $<TARGET_PDB_FILE:streamcat>
+      $<TARGET_PDB_FILE:bincopydata>
+      $<TARGET_PDB_FILE:bincopyloops>
+      DESTINATION ${CMAKE_INSTALL_BINDIR}
+      OPTIONAL)
+  endif()
 endif()
 
 # vim: set ts=2:sw=2:et
diff --git a/clients/mapiclient/CMakeLists.txt 
b/clients/mapiclient/CMakeLists.txt
--- a/clients/mapiclient/CMakeLists.txt
+++ b/clients/mapiclient/CMakeLists.txt
@@ -95,4 +95,12 @@ install(FILES
   DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
   COMPONENT client)
 
+if(WIN32)
+  install(FILES
+    $<TARGET_PDB_FILE:mclient>
+    $<TARGET_PDB_FILE:msqldump>
+    DESTINATION ${CMAKE_INSTALL_BINDIR}
+    OPTIONAL)
+endif()
+
 # vim: set ts=2:sw=2:et
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -839,7 +839,8 @@ dump_type(Mapi mid, stream *toConsole, c
 
 static int
 dump_column_definition(Mapi mid, stream *toConsole, const char *schema,
-                      const char *tname, const char *tid, bool foreign, bool 
hashge)
+                                          const char *tname, const char *tid, 
bool foreign,
+                                          bool hashge)
 {
        MapiHdl hdl = NULL;
        char *query = NULL;
@@ -876,8 +877,7 @@ dump_column_definition(Mapi mid, stream 
                                "c.type_digits, "       /* 2 */
                                "c.type_scale, "        /* 3 */
                                "c.\"null\", "          /* 4 */
-                               "c.\"default\", "       /* 5 */
-                               "c.number "                     /* 6 */
+                               "c.number "                     /* 5 */
                         "FROM sys._columns c "
                         "WHERE c.table_id = %s "
                         "ORDER BY c.number", tid);
@@ -888,8 +888,7 @@ dump_column_definition(Mapi mid, stream 
                                "c.type_digits, "       /* 2 */
                                "c.type_scale, "        /* 3 */
                                "c.\"null\", "          /* 4 */
-                               "c.\"default\", "       /* 5 */
-                               "c.number "                     /* 6 */
+                               "c.number "                     /* 5 */
                         "FROM sys._columns c, "
                              "sys._tables t, "
                              "sys.schemas s "
@@ -909,7 +908,6 @@ dump_column_definition(Mapi mid, stream 
                char *c_type_digits = strdup(mapi_fetch_field(hdl, 2));
                char *c_type_scale = strdup(mapi_fetch_field(hdl, 3));
                const char *c_null = mapi_fetch_field(hdl, 4);
-               const char *c_default = mapi_fetch_field(hdl, 5);
                int space;
 
                if (mapi_error(mid) || !c_type || !c_type_digits || 
!c_type_scale) {
@@ -918,6 +916,7 @@ dump_column_definition(Mapi mid, stream 
                        free(c_type_scale);
                        goto bailout;
                }
+
                if (cnt)
                        mnstr_printf(toConsole, ",\n");
 
@@ -955,12 +954,9 @@ dump_column_definition(Mapi mid, stream 
                space = dump_type(mid, toConsole, c_type, c_type_digits, 
c_type_scale, hashge);
                if (strcmp(c_null, "false") == 0) {
                        mnstr_printf(toConsole, "%*s NOT NULL",
-                                       CAP(13 - space), "");
+                                                CAP(13 - space), "");
                        space = 13;
                }
-               if (c_default != NULL)
-                       mnstr_printf(toConsole, "%*s DEFAULT %s",
-                                       CAP(13 - space), "", c_default);
 
                cnt++;
                free(c_type);
@@ -973,6 +969,7 @@ dump_column_definition(Mapi mid, stream 
                goto bailout;
        mapi_close_handle(hdl);
        hdl = NULL;
+
        /* presumably we don't need to order on id, since there should
           only be a single primary key, but it doesn't hurt, and the
           code is then close to the code for the uniqueness
@@ -1143,6 +1140,7 @@ describe_table(Mapi mid, const char *sch
        MapiHdl hdl = NULL;
        char *query = NULL, *view = NULL, *remark = NULL, *sname = NULL, *s = 
NULL, *t = NULL;
        int type = 0;
+       int ca = 0;
        size_t maxquerylen;
        bool hashge;
 
@@ -1171,7 +1169,7 @@ describe_table(Mapi mid, const char *sch
                goto bailout;
 
        snprintf(query, maxquerylen,
-                "SELECT t.name, t.query, t.type, t.id, c.remark "
+                "SELECT t.name, t.query, t.type, t.id, c.remark, 
t.commit_action "
                 "FROM sys.schemas s, sys._tables t "
                        "LEFT OUTER JOIN sys.comments c ON t.id = c.id "
                 "WHERE s.name = '%s' "
@@ -1190,6 +1188,7 @@ describe_table(Mapi mid, const char *sch
                view = mapi_fetch_field(hdl, 1);
                table_id = atoi(mapi_fetch_field(hdl, 3));
                remark = mapi_fetch_field(hdl, 4);
+               ca = atoi(mapi_fetch_field(hdl, 5));
        }
        if (mapi_error(mid)) {
                view = NULL;
@@ -1263,17 +1262,23 @@ describe_table(Mapi mid, const char *sch
                }
                /* the table is a real table */
                mnstr_printf(toConsole, "CREATE %sTABLE ",
-                           type == 3 ? "MERGE " :
-                           type == 4 ? "STREAM " :
-                           type == 5 ? "REMOTE " :
-                           type == 6 ? "REPLICA " :
-                           "");
+                                        ca > 0 ? "GLOBAL TEMPORARY " :
+                                        type == 3 ? "MERGE " :
+                                        type == 4 ? "STREAM " :
+                                        type == 5 ? "REMOTE " :
+                                        type == 6 ? "REPLICA " :
+                                        "");
                dquoted_print(toConsole, schema, ".");
                dquoted_print(toConsole, tname, " ");
 
                if (dump_column_definition(mid, toConsole, schema, tname, NULL, 
foreign, hashge))
                        goto bailout;
-               if (type == 5) { /* remote table */
+               if (ca > 0) {                   /* temporary table */
+                       mnstr_printf(toConsole, " ON COMMIT %s",
+                                                ca == 1 /* the default */ ? 
"DELETE ROWS" :
+                                                ca == 2 ? "PRESERVE ROWS" :
+                                                /* ca == 3 */ "DROP");
+               } else if (type == 5) { /* remote table */
                        char *rt_user = NULL;
                        char *rt_hash = NULL;
                        snprintf(query, maxquerylen,
@@ -1810,7 +1815,7 @@ dump_table_data(Mapi mid, const char *sc
                                   certain characters escaped */
                                squoted_print(toConsole, s, '"', noescape);
                        } else if (strcmp(tp, "blob") == 0) {
-                               /* inside blobs, special characters 
+                               /* inside blobs, special characters
                                   don't occur */
                                mnstr_printf(toConsole, "\"%s\"", s);
                        } else
@@ -1867,7 +1872,72 @@ bailout:
 }
 
 static int
-dump_table_alters(Mapi mid, const char *schema, const char *tname, stream 
*toConsole)
+dump_table_storage(Mapi mid, const char *schema, const char *tname, stream 
*toConsole)
+{
+       char *sname = NULL;
+       char *query = NULL;
+       size_t maxquerylen;
+       MapiHdl hdl = NULL;
+       char *s = NULL;
+       char *t = NULL;
+       int rc = 1;
+
+       if (schema == NULL) {
+               if ((sname = strchr(tname, '.')) != NULL) {
+                       size_t len = sname - tname + 1;
+
+                       sname = malloc(len);
+                       if (sname == NULL)
+                               goto bailout;
+                       strcpy_len(sname, tname, len);
+                       tname += len;
+               } else if ((sname = get_schema(mid)) == NULL) {
+                       goto bailout;
+               }
+               schema = sname;
+       }
+
+       maxquerylen = 5120 + 2*strlen(tname) + 2*strlen(schema);
+       query = malloc(maxquerylen);
+       s = sescape(schema);
+       t = sescape(tname);
+       if (query == NULL || s == NULL || t == NULL)
+               goto bailout;
+
+       snprintf(query, maxquerylen,
+                        "SELECT name, storage FROM sys._columns "
+                        "WHERE storage IS NOT NULL "
+                        "AND table_id = (SELECT id FROM sys._tables WHERE name 
= '%s' "
+                        "AND schema_id = (SELECT id FROM sys.schemas WHERE 
name = '%s'))",
+                        t, s);
+       if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid))
+               goto bailout;
+       while ((mapi_fetch_row(hdl)) != 0) {
+               const char *cname = mapi_fetch_field(hdl, 0);
+               const char *storage = mapi_fetch_field(hdl, 1);
+               char *stg = sescape(storage);
+               if (stg == NULL)
+                       goto bailout;
+               mnstr_printf(toConsole, "ALTER TABLE ");
+               dquoted_print(toConsole, schema, ".");
+               dquoted_print(toConsole, tname, " ");
+               mnstr_printf(toConsole, "ALTER COLUMN ");
+               dquoted_print(toConsole, cname, " ");
+               mnstr_printf(toConsole, "SET STORAGE '%s';\n", stg);
+               free(stg);
+       }
+       rc = 0;                                         /* success */
+  bailout:
+       free(query);
+       free(s);
+       free(t);
+       mapi_close_handle(hdl);         /* may be NULL */
+       free(sname);                            /* may be NULL */
+       return rc;
+}
+
+static int
+dump_table_access(Mapi mid, const char *schema, const char *tname, stream 
*toConsole)
 {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to