Changeset: 08ae1ed4c190 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=08ae1ed4c190
Modified Files:
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_cat.c
Branch: malerrors
Log Message:

A few more SQLSTATE markers added


diffs (truncated from 1701 to 300 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -288,15 +288,15 @@ create_table_or_view(mvc *sql, char *sna
                return sql_error(sql, 06, "25006!schema statements cannot be 
executed on a readonly database.");
 
        if (!s)
-               return sql_message("3F000!CREATE %s: schema '%s' doesn't 
exist", (t->query) ? "TABLE" : "VIEW", sname);
+               return sql_message("SQLSTATE 3F000 !""CREATE %s: schema '%s' 
doesn't exist", (t->query) ? "TABLE" : "VIEW", sname);
 
        if (mvc_bind_table(sql, s, t->base.name)) {
                char *cd = (temp == SQL_DECLARED_TABLE) ? "DECLARE" : "CREATE";
-               return sql_message("42S01!%s TABLE: name '%s' already in use", 
cd, t->base.name);
+               return sql_message("SQLSTATE 42S0 1""!%s TABLE: name '%s' 
already in use", cd, t->base.name);
        } else if (temp != SQL_DECLARED_TABLE && (!mvc_schema_privs(sql, s) && 
!(isTempSchema(s) && temp == SQL_LOCAL_TEMP))) {
-               return sql_message("42000!CREATE TABLE: insufficient privileges 
for user '%s' in schema '%s'", stack_get_string(sql, "current_user"), 
s->base.name);
+               return sql_message("SQLSTATE 42000 !""CREATE TABLE: 
insufficient privileges for user '%s' in schema '%s'", stack_get_string(sql, 
"current_user"), s->base.name);
        } else if (temp == SQL_DECLARED_TABLE && !list_empty(t->keys.set)) {
-               return sql_message("42000!DECLARE TABLE: '%s' cannot have 
constraints", t->base.name);
+               return sql_message("SQLSTATE 42000 !""DECLARE TABLE: '%s' 
cannot have constraints", t->base.name);
 
        }
 
@@ -466,7 +466,7 @@ SQLcatalog(Client cntxt, MalBlkPtr mb, M
        (void) mb;
        (void) stk;
        (void) pci;
-       return sql_message("25006!deprecated statement");
+       return sql_message("SQLSTATE 25006 !""Deprecated statement");
 }
 
 /* setVariable(int *ret, str *name, any value) */
@@ -1191,15 +1191,15 @@ mvc_delete_wrap(Client cntxt, MalBlkPtr 
        if (tpe > TYPE_any)
                tpe = TYPE_bat;
        if (tpe == TYPE_bat && (b = BATdescriptor(*(int *) ins)) == NULL)
-               throw(SQL, "sql.delete", "Cannot access descriptor");
+               throw(SQL, "sql.delete", "SQLSTATE ----- !""Cannot access 
descriptor");
        if (tpe != TYPE_bat || (b->ttype != TYPE_oid && b->ttype != TYPE_void))
-               throw(SQL, "sql.delete", "Cannot access descriptor");
+               throw(SQL, "sql.delete", "SQLSTATE ----- !""Cannot access 
descriptor");
        s = mvc_bind_schema(m, sname);
        if (s == NULL)
-               throw(SQL, "sql.delete", "3F000!Schema missing");
+               throw(SQL, "sql.delete", "SQLSTATE 3F000 !""Schema missing");
        t = mvc_bind_table(m, s, tname);
        if (t == NULL)
-               throw(SQL, "sql.delete", "42S02!Table missing");
+               throw(SQL, "sql.delete", "SQLSTATE 42S02 !""Table missing");
        if( b && BATcount(b) > 4096 && b->batPersistence == PERSISTENT)
                BATmsync(b);
        store_funcs.delete_tab(m->session->tr, t, b, tpe);
@@ -1250,9 +1250,9 @@ DELTAbat(bat *result, const bat *col, co
        BAT *c, *u_id, *u_val, *i = NULL, *res;
 
        if ((u_id = BBPquickdesc(*uid, 0)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
        if (ins && (i = BBPquickdesc(*ins, 0)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
 
        /* no updates, no inserts */
        if (BATcount(u_id) == 0 && (!i || BATcount(i) == 0)) {
@@ -1261,7 +1261,7 @@ DELTAbat(bat *result, const bat *col, co
        }
 
        if ((c = BBPquickdesc(*col, 0)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
 
        /* bat may change */
        if (i && BATcount(c) == 0 && BATcount(u_id) == 0) {
@@ -1271,15 +1271,15 @@ DELTAbat(bat *result, const bat *col, co
 
        c = BATdescriptor(*col);
        if (c == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
        if ((res = COLcopy(c, c->ttype, TRUE, TRANSIENT)) == NULL) {
                BBPunfix(c->batCacheid);
-               throw(MAL, "sql.delta", OPERATION_FAILED);
+               throw(MAL, "sql.delta", "SQLSTATE ----- !"OPERATION_FAILED);
        }
        BBPunfix(c->batCacheid);
 
        if ((u_val = BATdescriptor(*uval)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
        u_id = BATdescriptor(*uid);
        assert(BATcount(u_id) == BATcount(u_val));
        if (BATcount(u_id) &&
@@ -1287,7 +1287,7 @@ DELTAbat(bat *result, const bat *col, co
                BBPunfix(u_id->batCacheid);
                BBPunfix(u_val->batCacheid);
                BBPunfix(res->batCacheid);
-               throw(MAL, "sql.delta", GDK_EXCEPTION);
+               throw(MAL, "sql.delta", "SQLSTATE ----- !"GDK_EXCEPTION);
        }
        BBPunfix(u_id->batCacheid);
        BBPunfix(u_val->batCacheid);
@@ -1297,7 +1297,7 @@ DELTAbat(bat *result, const bat *col, co
                if (BATappend(res, i, NULL, TRUE) != GDK_SUCCEED) {
                        BBPunfix(res->batCacheid);
                        BBPunfix(i->batCacheid);
-                       throw(MAL, "sql.delta", GDK_EXCEPTION);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"GDK_EXCEPTION);
                }
                BBPunfix(i->batCacheid);
        }
@@ -1313,9 +1313,9 @@ DELTAsub(bat *result, const bat *col, co
        gdk_return ret;
 
        if ((u_id = BBPquickdesc(*uid, 0)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
        if (ins && (i = BBPquickdesc(*ins, 0)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
 
        /* no updates, no inserts */
        if (BATcount(u_id) == 0 && (!i || BATcount(i) == 0)) {
@@ -1324,7 +1324,7 @@ DELTAsub(bat *result, const bat *col, co
        }
 
        if ((c = BBPquickdesc(*col, 0)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
 
        /* bat may change */
        if (i && BATcount(c) == 0 && BATcount(u_id) == 0) {
@@ -1334,19 +1334,19 @@ DELTAsub(bat *result, const bat *col, co
 
        c = BATdescriptor(*col);
        if (c == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
        res = c;
        if (BATcount(u_id)) {
                u_id = BATdescriptor(*uid);
                if (!u_id) {
                        BBPunfix(c->batCacheid);
-                       throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                }
                cminu = BATdiff(c, u_id, NULL, NULL, 0, BUN_NONE);
                if (!cminu) {
                        BBPunfix(c->batCacheid);
                        BBPunfix(u_id->batCacheid);
-                       throw(MAL, "sql.delta", MAL_MALLOC_FAIL " 
intermediate");
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"MAL_MALLOC_FAIL " intermediate");
                }
                res = BATproject(cminu, c);
                BBPunfix(c->batCacheid);
@@ -1354,21 +1354,21 @@ DELTAsub(bat *result, const bat *col, co
                cminu = NULL;
                if (!res) {
                        BBPunfix(u_id->batCacheid);
-                       throw(MAL, "sql.delta", MAL_MALLOC_FAIL " intermediate" 
);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"MAL_MALLOC_FAIL " intermediate" );
                }
                c = res;
 
                if ((u_val = BATdescriptor(*uval)) == NULL) {
                        BBPunfix(c->batCacheid);
                        BBPunfix(u_id->batCacheid);
-                       throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                }
                u = BATproject(u_val, u_id);
                BBPunfix(u_val->batCacheid);
                BBPunfix(u_id->batCacheid);
                if (!u) {
                        BBPunfix(c->batCacheid);
-                       throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                }
                if (BATcount(u)) {      /* check selected updated values 
against candidates */
                        BAT *c_ids = BATdescriptor(*cid);
@@ -1377,14 +1377,14 @@ DELTAsub(bat *result, const bat *col, co
                        if (!c_ids) {
                                BBPunfix(c->batCacheid);
                                BBPunfix(u->batCacheid);
-                               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                        }
                        rc = BATsemijoin(&cminu, NULL, u, c_ids, NULL, NULL, 0, 
BUN_NONE);
                        BBPunfix(c_ids->batCacheid);
                        if (rc != GDK_SUCCEED) {
                                BBPunfix(c->batCacheid);
                                BBPunfix(u->batCacheid);
-                               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                        }
                }
                ret = BATappend(res, u, cminu, TRUE);
@@ -1394,13 +1394,13 @@ DELTAsub(bat *result, const bat *col, co
                cminu = NULL;
                if (ret != GDK_SUCCEED) {
                        BBPunfix(res->batCacheid);
-                       throw(MAL, "sql.delta", GDK_EXCEPTION);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"GDK_EXCEPTION);
                }
 
                ret = BATsort(&u, NULL, NULL, res, NULL, NULL, 0, 0);
                BBPunfix(res->batCacheid);
                if (ret != GDK_SUCCEED) {
-                       throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                }
                res = u;
        }
@@ -1409,21 +1409,21 @@ DELTAsub(bat *result, const bat *col, co
                i = BATdescriptor(*ins);
                if (!i) {
                        BBPunfix(res->batCacheid);
-                       throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                }
                if (BATcount(u_id)) {
                        u_id = BATdescriptor(*uid);
                        if (!u_id) {
                                BBPunfix(res->batCacheid);
                                BBPunfix(i->batCacheid);
-                               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                        }
                        cminu = BATdiff(i, u_id, NULL, NULL, 0, BUN_NONE);
                        BBPunfix(u_id->batCacheid);
                        if (!cminu) {
                                BBPunfix(res->batCacheid);
                                BBPunfix(i->batCacheid);
-                               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                        }
                }
                if (isVIEW(res)) {
@@ -1434,7 +1434,7 @@ DELTAsub(bat *result, const bat *col, co
                                BBPunfix(i->batCacheid);
                                if (cminu)
                                        BBPunfix(cminu->batCacheid);
-                               throw(MAL, "sql.delta", OPERATION_FAILED);
+                               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"OPERATION_FAILED);
                        }
                }
                ret = BATappend(res, i, cminu, TRUE);
@@ -1443,13 +1443,13 @@ DELTAsub(bat *result, const bat *col, co
                        BBPunfix(cminu->batCacheid);
                if (ret != GDK_SUCCEED) {
                        BBPunfix(res->batCacheid);
-                       throw(MAL, "sql.delta", GDK_EXCEPTION);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"GDK_EXCEPTION);
                }
 
                ret = BATsort(&u, NULL, NULL, res, NULL, NULL, 0, 0);
                BBPunfix(res->batCacheid);
                if (ret != GDK_SUCCEED)
-                       throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
                res = u;
        }
        BATkey(res, TRUE);
@@ -1463,11 +1463,11 @@ DELTAproject(bat *result, const bat *sub
        BAT *s, *c, *u_id, *u_val, *i = NULL, *res, *tres;
 
        if ((s = BATdescriptor(*sub)) == NULL)
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
 
        if (ins && (i = BATdescriptor(*ins)) == NULL) {
                BBPunfix(s->batCacheid);
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
        }
 
        if (i && BATcount(s) == 0) {
@@ -1475,7 +1475,7 @@ DELTAproject(bat *result, const bat *sub
                BBPunfix(s->batCacheid);
                BBPunfix(i->batCacheid);
                if (res == NULL)
-                       throw(MAL, "sql.projectdelta", GDK_EXCEPTION);
+                       throw(MAL, "sql.projectdelta", "SQLSTATE ----- 
!"GDK_EXCEPTION);
 
                BBPkeepref(*result = res->batCacheid);
                return MAL_SUCCEED;
@@ -1485,7 +1485,7 @@ DELTAproject(bat *result, const bat *sub
                BBPunfix(s->batCacheid);
                if (i)
                        BBPunfix(i->batCacheid);
-               throw(MAL, "sql.delta", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "sql.delta", "SQLSTATE ----- 
!"RUNTIME_OBJECT_MISSING);
        }
 
        /* projection(sub,col).union(projection(sub,i)) */
@@ -1499,13 +1499,13 @@ DELTAproject(bat *result, const bat *sub
                                BBPunfix(s->batCacheid);
                                BBPunfix(i->batCacheid);
                                BBPunfix(c->batCacheid);
-                               throw(MAL, "sql.projectdelta", 
OPERATION_FAILED);
+                               throw(MAL, "sql.projectdelta", "SQLSTATE ----- 
!"OPERATION_FAILED);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to