Update of /cvsroot/monetdb/clients/src/mapiclient
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv21501/src/mapiclient

Modified Files:
        dump.c 
Log Message:
propagated changes of Wednesday Jun 06 2007 - Wednesday Jun 06 2007
from the Clients_1-18 branch to the development trunk



Index: dump.c
===================================================================
RCS file: /cvsroot/monetdb/clients/src/mapiclient/dump.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dump.c      22 Mar 2007 09:15:35 -0000      1.3
+++ dump.c      6 Jun 2007 19:38:34 -0000       1.4
@@ -37,6 +37,15 @@
        putc('"', f);
 }
 
+static char *actions[] = {
+       0,
+       "CASCADE",
+       "RESTRICT",
+       "SET NULL",
+       "SET DEFAULT",
+};
+#define NR_ACTIONS     ((int) (sizeof(actions) / sizeof(actions[0])))
+
 int
 dump_table(Mapi mid, char *tname, FILE *toConsole)
 {
@@ -302,7 +311,8 @@
                        "\"pkkc\".\"column\","          /* 1 */
                        "\"fkkc\".\"column\","          /* 2 */
                        "\"fkkc\".\"nr\","              /* 3 */
-                       "\"fkk\".\"name\""              /* 4 */
+                       "\"fkk\".\"name\","             /* 4 */
+                       "\"fkk\".\"action\""            /* 5 */
                 "FROM \"tables\" \"fkt\","
                      "\"keycolumns\" \"fkkc\","
                      "\"keys\" \"fkk\","
@@ -333,6 +343,7 @@
                char *c_fcolumn = mapi_fetch_field(hdl, 2);
                char *c_nr = mapi_fetch_field(hdl, 3);
                char *c_fkname = mapi_fetch_field(hdl, 4);
+               char *c_faction = mapi_fetch_field(hdl, 5);
                char **fkeys, **pkeys;
                int nkeys = 0;
 
@@ -379,6 +390,16 @@
                fprintf(toConsole, ")");
                free(fkeys);
                free(pkeys);
+               if (c_faction) {
+                       int action = atoi(c_faction);
+                       int on_update = (action >> 8) & 255;
+                       int on_delete = action & 255;
+
+                       if (0 < on_delete && on_delete < NR_ACTIONS)
+                               fprintf(toConsole, " ON DELETE %s", 
actions[on_delete]);
+                       if (0 < on_update && on_update < NR_ACTIONS)
+                               fprintf(toConsole, " ON UPDATE %s", 
actions[on_update]);
+               }
        }
        if (mapi_error(mid)) {
                mapi_explain_query(hdl, stderr);


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to