Changeset: 5dde9ad307a0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5dde9ad307a0
Modified Files:
        geom/monetdb5/geom.c
        geom/monetdb5/geomBulk.c
        monetdb5/modules/atoms/str.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/mkey.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/remote.c
        sql/backends/monet5/UDF/capi/capi.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_cat.c
        sql/backends/monet5/sql_datetrunc.c
        sql/backends/monet5/sql_rank.c
        sql/backends/monet5/sql_statistics.c
        sql/backends/monet5/sql_subquery.c
        tools/monetdbe/monetdbe.c
Branch: Aug2024
Log Message:

Consistency: use SQLSTATE(HY002) RUNTIME_OBJECT_MISSING whenever appropriate.


diffs (truncated from 1006 to 300 lines):

diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -81,7 +81,7 @@ wkbCollectAggrSubGroupedCand(bat *outid,
        if ((b = BATdescriptor(*bid)) == NULL ||
                (gid && !is_bat_nil(*gid) && (g = BATdescriptor(*gid)) == NULL) 
||
                (sid && !is_bat_nil(*sid) && (s = BATdescriptor(*sid)) == 
NULL)) {
-               msg = createException(MAL, "geom.Collect", 
RUNTIME_OBJECT_MISSING);
+               msg = createException(MAL, "geom.Collect", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto free;
        }
 
@@ -241,7 +241,7 @@ wkbCollectAggr (wkb **out, const bat *bi
        int geomCollectionType = -1;
 
        if ((b = BATdescriptor(*bid)) == NULL) {
-               msg = createException(MAL, "geom.Collect", 
RUNTIME_OBJECT_MISSING);
+               msg = createException(MAL, "geom.Collect", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                return msg;
        }
 
@@ -3506,7 +3506,7 @@ wkbMakeLineAggrSubGroupedCand(bat *outid
        if ((b = BATdescriptor(*bid)) == NULL ||
                (gid && !is_bat_nil(*gid) && (g = BATdescriptor(*gid)) == NULL) 
||
                (sid && !is_bat_nil(*sid) && (s = BATdescriptor(*sid)) == 
NULL)) {
-               msg = createException(MAL, "aggr.MakeLine", 
RUNTIME_OBJECT_MISSING);
+               msg = createException(MAL, "aggr.MakeLine", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto free;
        }
 
@@ -4862,12 +4862,12 @@ pnpoly(int *out, int nvert, dbl *vx, dbl
 
        /*Get the BATs */
        if ((bpx = BATdescriptor(*point_x)) == NULL) {
-               throw(MAL, "geom.point", SQLSTATE(38000) 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "geom.point", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
 
        if ((bpy = BATdescriptor(*point_y)) == NULL) {
                BBPunfix(bpx->batCacheid);
-               throw(MAL, "geom.point", SQLSTATE(38000) 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "geom.point", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
 
        /*Check BATs alignment */
@@ -4931,11 +4931,11 @@ pnpolyWithHoles(bat *out, int nvert, dbl
 
        /*Get the BATs */
        if ((bpx = BATdescriptor(*point_x)) == NULL) {
-               throw(MAL, "geom.point", SQLSTATE(38000) 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "geom.point", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
        if ((bpy = BATdescriptor(*point_y)) == NULL) {
                BBPunfix(bpx->batCacheid);
-               throw(MAL, "geom.point", SQLSTATE(38000) 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "geom.point", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
 
        /*Check BATs alignment */
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -1126,7 +1126,7 @@ wkbCoordinateFromMBR_bat(bat *outBAT_id,
 
        //get the descriptor of the BAT
        if ((inBAT = BATdescriptor(*inBAT_id)) == NULL) {
-               throw(MAL, "batgeom.coordinateFromMBR", SQLSTATE(38000) 
RUNTIME_OBJECT_MISSING);
+               throw(MAL, "batgeom.coordinateFromMBR", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
 
        //create a new BAT for the output
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1874,11 +1874,11 @@ STRselect(MalStkPtr stk, InstrPtr pci,
                with_strimps_anti = false;
 
        if (!(b = BATdescriptor(b_id)))
-               throw(MAL, fname, RUNTIME_OBJECT_MISSING);
+               throw(MAL, fname, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
 
        if (!is_bat_nil(cb_id) && !(cb = BATdescriptor(cb_id))) {
                BBPreclaim(b);
-               throw(MAL, fname, RUNTIME_OBJECT_MISSING);
+               throw(MAL, fname, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
        }
 
        assert(ATOMstorage(b->ttype) == TYPE_str);
@@ -2756,13 +2756,13 @@ STRjoin(bat *rl_id, bat *rr_id, const ba
 
        if (!(l = BATdescriptor(l_id)) || !(r = BATdescriptor(r_id))) {
                BBPnreclaim(2, l, r);
-               throw(MAL, fname, RUNTIME_OBJECT_MISSING);
+               throw(MAL, fname, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
        }
 
        if ((cl_id && !is_bat_nil(cl_id) && (cl = BATdescriptor(cl_id)) == 
NULL) ||
                (cr_id && !is_bat_nil(cr_id) && (cr = BATdescriptor(cr_id)) == 
NULL)) {
                BBPnreclaim(4, l, r, cl, cr);
-               throw(MAL, fname, RUNTIME_OBJECT_MISSING);
+               throw(MAL, fname, SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
        }
 
        rl = COLnew(0, TYPE_oid, BATcount(l), TRANSIENT);
diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -638,7 +638,7 @@ do_join(bat *r1, bat *r2, bat *r3, const
        BAT *candleft = NULL, *candright = NULL;
        BAT *result1 = NULL, *result2 = NULL, *result3 = NULL;
        BUN est;
-       const char *err = RUNTIME_OBJECT_MISSING;
+       const char *err = SQLSTATE(HY002) RUNTIME_OBJECT_MISSING;
 
        assert(r2id == NULL || rangefunc != NULL);
 
diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c
--- a/monetdb5/modules/mal/mal_mapi.c
+++ b/monetdb5/modules/mal/mal_mapi.c
@@ -2017,7 +2017,7 @@ SERVERput(Client cntxt, MalBlkPtr mb, Ma
                size_t len;
 
                if (!b)
-                       throw(MAL, "mapi.put", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "mapi.put", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
 
                /* reconstruct the object */
                ht = getTypeName(TYPE_oid);
diff --git a/monetdb5/modules/mal/mkey.c b/monetdb5/modules/mal/mkey.c
--- a/monetdb5/modules/mal/mkey.c
+++ b/monetdb5/modules/mal/mkey.c
@@ -213,12 +213,12 @@ MKEYbathash(Client cntxt, MalBlkPtr mb, 
        (void) mb;
        if (!(b = BATdescriptor(*bid))) {
                msg = createException(MAL, "batmkey.bathash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
        if (sid1 && !is_bat_nil(*sid1) && !(bs = BATdescriptor(*sid1))) {
                msg = createException(MAL, "batmkey.bathash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
        canditer_init(&ci, b, bs);
@@ -386,7 +386,7 @@ MKEYbulk_rotate_xor_hash(Client cntxt, M
        (void) mb;
        if (!(hb = BATdescriptor(*hid))) {
                msg = createException(MAL, "batmkey.rotate_xor_hash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
        if (!(b = BATdescriptor(*bid))) {
@@ -406,7 +406,7 @@ MKEYbulk_rotate_xor_hash(Client cntxt, M
        if ((sid1 && !is_bat_nil(*sid1) && !(s1 = BATdescriptor(*sid1)))
                || (sid2 && !is_bat_nil(*sid2) && !(s2 = 
BATdescriptor(*sid2)))) {
                msg = createException(MAL, "batmkey.rotate_xor_hash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
 
@@ -546,12 +546,12 @@ MKEYbulkconst_rotate_xor_hash(Client cnt
        (void) cntxt;
        if (!(hb = BATdescriptor(*hid))) {
                msg = createException(MAL, "batmkey.rotate_xor_hash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
        if (sid1 && !is_bat_nil(*sid1) && !(bs = BATdescriptor(*sid1))) {
                msg = createException(MAL, "batmkey.rotate_xor_hash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
        canditer_init(&ci, hb, bs);
@@ -660,12 +660,12 @@ MKEYconstbulk_rotate_xor_hash(Client cnt
        (void) mb;
        if (!(b = BATdescriptor(*bid))) {
                msg = createException(MAL, "batmkey.rotate_xor_hash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
        if (sid1 && !is_bat_nil(*sid1) && !(bs = BATdescriptor(*sid1))) {
                msg = createException(MAL, "batmkey.rotate_xor_hash",
-                                                         SQLSTATE(HY005) 
RUNTIME_OBJECT_MISSING);
+                                                         SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto bailout;
        }
        canditer_init(&ci, b, bs);
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -1017,7 +1017,7 @@ PCREreplacefirst_bat_wrap(bat *res, cons
        BAT *b, *bn = NULL;
        str msg;
        if ((b = BATdescriptor(*bid)) == NULL)
-               throw(MAL, "batpcre.replace_first", RUNTIME_OBJECT_MISSING);
+               throw(MAL, "batpcre.replace_first", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
 
        msg = pcre_replace_bat(&bn, b, *pat, *repl, *flags, false);
        if (msg == MAL_SUCCEED) {
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -1551,7 +1551,7 @@ RMTbincopyto(Client cntxt, MalBlkPtr mb,
                && BATcount(b) < BATcount(BBP_desc(VIEWvtparent(b)))) {
                if ((b = BATdescriptor(bid)) == NULL) {
                        BBPunfix(bid);
-                       throw(MAL, "remote.bincopyto", RUNTIME_OBJECT_MISSING);
+                       throw(MAL, "remote.bincopyto", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                }
                v = COLcopy(b, b->ttype, true, TRANSIENT);
                BBPunfix(b->batCacheid);
diff --git a/sql/backends/monet5/UDF/capi/capi.c 
b/sql/backends/monet5/UDF/capi/capi.c
--- a/sql/backends/monet5/UDF/capi/capi.c
+++ b/sql/backends/monet5/UDF/capi/capi.c
@@ -1046,7 +1046,7 @@ static str CUDFeval(Client cntxt, MalBlk
                                struct cudf_data_struct_oid *t = inputs[index];
                                BAT *ex = 
BBPquickdesc(*getArgReference_bat(stk, pci, i + 1));
                                if (!ex) {
-                                       msg = createException(MAL, "cudf.eval", 
RUNTIME_OBJECT_MISSING);
+                                       msg = createException(MAL, "cudf.eval", 
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
                                        goto wrapup;
                                }
                                t->count = BATcount(ex);
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
@@ -2046,7 +2046,7 @@ mvc_delete_wrap(Client cntxt, MalBlkPtr 
        if (isaBatType(tpe))
                isbat = true;
        if (isbat && (b = BATdescriptor(*(bat *) ins)) == NULL)
-               throw(SQL, "sql.delete", SQLSTATE(HY005) "Cannot access column 
descriptor");
+               throw(SQL, "sql.delete", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        if (!isbat || (b->ttype != TYPE_oid && b->ttype != TYPE_void && 
b->ttype != TYPE_msk)) {
                BBPreclaim(b);
                throw(SQL, "sql.delete", SQLSTATE(HY005) "Cannot access column 
descriptor");
@@ -2467,7 +2467,7 @@ mvc_result_set_wrap( Client cntxt, MalBl
        bid = *getArgReference_bat(stk,pci,6);
        b = BATdescriptor(bid);
        if ( b == NULL) {
-               msg = createException(SQL, "sql.resultSet", SQLSTATE(HY005) 
"Cannot access column descriptor");
+               msg = createException(SQL, "sql.resultSet", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
                goto wrapup_result_set;
        }
        res = *res_id = mvc_result_table(be, mb->tag, pci->argc - (pci->retc + 
5), Q_TABLE);
@@ -2500,7 +2500,7 @@ mvc_result_set_wrap( Client cntxt, MalBl
                tpename = BUNtvar(itertpe,o);
                b = BATdescriptor(bid);
                if ( b == NULL)
-                       msg = createException(SQL, "sql.resultSet", 
SQLSTATE(HY005) "Cannot access column descriptor");
+                       msg = createException(SQL, "sql.resultSet", 
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
                else if (mvc_result_column(be, tblname, colname, tpename, 
*digits++, *scaledigits++, b))
                        msg = createException(SQL, "sql.resultSet", 
SQLSTATE(42000) "Cannot access column descriptor %s.%s",tblname,colname);
                if( b)
@@ -2609,7 +2609,7 @@ mvc_export_table_wrap( Client cntxt, Mal
                tpename = BUNtvar(itertpe,o);
                b = BATdescriptor(bid);
                if ( b == NULL)
-                       msg = createException(SQL, "sql.resultSet", 
SQLSTATE(HY005) "Cannot access column descriptor");
+                       msg = createException(SQL, "sql.resultSet", 
SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
                else if (mvc_result_column(be, tblname, colname, tpename, 
*digits++, *scaledigits++, b))
                        msg = createException(SQL, "sql.resultSet", 
SQLSTATE(42000) "Cannot access column descriptor %s.%s",tblname,colname);
                if( b)
@@ -3252,7 +3252,7 @@ not_unique(bit *ret, const bat *bid)
        BAT *b;
 
        if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(SQL, "not_unique", SQLSTATE(HY005) "Cannot access column 
descriptor");
+               throw(SQL, "not_unique", SQLSTATE(HY002) 
RUNTIME_OBJECT_MISSING);
        }
 
        *ret = FALSE;
@@ -3361,7 +3361,7 @@ SQLbat_alpha_cst(bat *res, const bat *de
                throw(SQL, "SQLbat_alpha", SQLSTATE(42000) "Parameter theta 
should not be nil");
        }
        if ((b = BATdescriptor(*decl)) == NULL) {
-               throw(SQL, "alpha", SQLSTATE(HY005) "Cannot access column 
descriptor");
+               throw(SQL, "alpha", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
        }
        bn = COLnew(b->hseqbase, TYPE_dbl, BATcount(b), TRANSIENT);
        if (bn == NULL) {
@@ -3406,7 +3406,7 @@ SQLcst_alpha_bat(bat *res, const dbl *de
        dbl *thetas;
 
        if ((b = BATdescriptor(*thetabid)) == NULL) {
-               throw(SQL, "alpha", SQLSTATE(HY005) "Cannot access column 
descriptor");
+               throw(SQL, "alpha", SQLSTATE(HY002) RUNTIME_OBJECT_MISSING);
        }
        bn = COLnew(b->hseqbase, TYPE_dbl, BATcount(b), TRANSIENT);
        if (bn == NULL) {
@@ -3863,10 +3863,10 @@ do_sql_rank_grp(bat *rid, const bat *bid
        int c;
 
        if ((b = BATdescriptor(*bid)) == NULL)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to