Changeset: 22e2a783e750 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/22e2a783e750
Modified Files:
        sql/backends/monet5/sql.c
Branch: Jul2021
Log Message:

Throw GDK error messages and don't forget to unfix


diffs (111 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
@@ -2052,7 +2052,7 @@ DELTAbat(bat *result, const bat *col, co
                throw(MAL, "sql.delta", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
        if ((res = COLcopy(c, c->ttype, true, TRANSIENT)) == NULL) {
                BBPunfix(c->batCacheid);
-               throw(MAL, "sql.delta", SQLSTATE(45002) "Cannot create copy of 
delta structure");
+               throw(MAL, "sql.delta", GDK_EXCEPTION);
        }
        BBPunfix(c->batCacheid);
 
@@ -2071,7 +2071,7 @@ DELTAbat(bat *result, const bat *col, co
                BBPunfix(u_id->batCacheid);
                BBPunfix(u_val->batCacheid);
                BBPunfix(res->batCacheid);
-               throw(MAL, "sql.delta", SQLSTATE(45002) "Cannot access delta 
structure");
+               throw(MAL, "sql.delta", GDK_EXCEPTION);
        }
        BBPunfix(u_id->batCacheid);
        BBPunfix(u_val->batCacheid);
@@ -2109,7 +2109,7 @@ DELTAsub(bat *result, const bat *col, co
                if (!cminu) {
                        BBPunfix(c->batCacheid);
                        BBPunfix(u_id->batCacheid);
-                       throw(MAL, "sql.delta", SQLSTATE(HY013) MAL_MALLOC_FAIL 
" intermediate");
+                       throw(MAL, "sql.delta", GDK_EXCEPTION);
                }
                res = BATproject(cminu, c);
                BBPunfix(c->batCacheid);
@@ -2117,7 +2117,7 @@ DELTAsub(bat *result, const bat *col, co
                cminu = NULL;
                if (!res) {
                        BBPunfix(u_id->batCacheid);
-                       throw(MAL, "sql.delta", SQLSTATE(HY013) MAL_MALLOC_FAIL 
" intermediate" );
+                       throw(MAL, "sql.delta", GDK_EXCEPTION);
                }
                c = res;
 
@@ -2132,7 +2132,7 @@ DELTAsub(bat *result, const bat *col, co
                        BBPunfix(u_id->batCacheid);
                        if (!u) {
                                BBPunfix(c->batCacheid);
-                               throw(MAL, "sql.delta", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+                               throw(MAL, "sql.delta", GDK_EXCEPTION);
                        }
 
                        /* check selected updated values against candidates */
@@ -2148,19 +2148,20 @@ DELTAsub(bat *result, const bat *col, co
                        if (cminu == NULL) {
                                BBPunfix(c->batCacheid);
                                BBPunfix(u->batCacheid);
-                               throw(MAL, "sql.delta", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+                               throw(MAL, "sql.delta", GDK_EXCEPTION);
                        }
                        BAT *nres;
                        if ((nres = COLcopy(res, res->ttype, true, TRANSIENT)) 
== NULL) {
                                BBPunfix(res->batCacheid);
+                               BBPunfix(u->batCacheid);
+                               BBPunfix(cminu->batCacheid);
                                throw(MAL, "sql.delta", GDK_EXCEPTION);
                        }
                        BBPunfix(res->batCacheid);
                        res = nres;
                        ret = BATappend(res, u, cminu, true);
                        BBPunfix(u->batCacheid);
-                       if (cminu)
-                               BBPunfix(cminu->batCacheid);
+                       BBPunfix(cminu->batCacheid);
                        cminu = NULL;
                        if (ret != GDK_SUCCEED) {
                                BBPunfix(res->batCacheid);
@@ -2204,7 +2205,7 @@ DELTAproject(bat *result, const bat *sub
 
        if (tres == NULL) {
                BBPunfix(s->batCacheid);
-               throw(MAL, "sql.projectdelta", SQLSTATE(HY013) MAL_MALLOC_FAIL);
+               throw(MAL, "sql.projectdelta", GDK_EXCEPTION);
        }
        res = tres;
 
@@ -2235,7 +2236,7 @@ DELTAproject(bat *result, const bat *sub
                        BBPunfix(res->batCacheid);
                        BBPunfix(u_id->batCacheid);
                        BBPunfix(u_val->batCacheid);
-                       throw(MAL, "sql.delta", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+                       throw(MAL, "sql.delta", GDK_EXCEPTION);
                }
                /* BATcount(ou) == BATcount(os) */
                if (BATcount(ou) != 0) {
@@ -2246,7 +2247,7 @@ DELTAproject(bat *result, const bat *sub
                        /* os contains the corresponding positions in
                         * res that need to be replaced with those new
                         * values */
-                       if ((res = setwritable(res)) == NULL ||
+                       if (!nu_val || (res = setwritable(res)) == NULL ||
                            BATreplace(res, os, nu_val, false) != GDK_SUCCEED) {
                                if (res)
                                        BBPunfix(res->batCacheid);
@@ -2254,8 +2255,9 @@ DELTAproject(bat *result, const bat *sub
                                BBPunfix(s->batCacheid);
                                BBPunfix(u_id->batCacheid);
                                BBPunfix(u_val->batCacheid);
-                               BBPunfix(nu_val->batCacheid);
-                               throw(MAL, "sql.delta", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+                               if (nu_val)
+                                       BBPunfix(nu_val->batCacheid);
+                               throw(MAL, "sql.delta", GDK_EXCEPTION);
                        }
                        BBPunfix(nu_val->batCacheid);
                } else {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to