Changeset: 789906ad338b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=789906ad338b Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out ctest/tools/monetdbe/CMakeLists.txt monetdb5/modules/mal/pcre.c monetdb5/modules/mal/pcre.mal sql/backends/monet5/sql_statement.c tools/monetdbe/monetdbe.c tools/monetdbe/monetdbe.h Branch: default Log Message:
merged diffs (truncated from 698 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -588,10 +588,10 @@ stdout of test 'MAL-signatures` in direc [ "algebra", "groupby", "command algebra.groupby(X_1:bat[:oid], X_2:bat[:lng]):bat[:oid] ", "ALGgroupby;", "" ] [ "algebra", "ilike", "command algebra.ilike(X_1:str, X_2:str):bit ", "PCREilike2;", "" ] [ "algebra", "ilike", "command algebra.ilike(X_1:str, X_2:str, X_3:str):bit ", "PCREilike3;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng):bat[:oid] ", "ILIKEjoin1;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng):bat[:oid] ", "ILIKEjoin_esc1;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin_esc;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] ", "ILIKEjoin1;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit):bat[:oid] ", "ILIKEjoin_esc1;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin_esc;", "" ] [ "algebra", "ilikeselect", "command algebra.ilikeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ", "PCRElikeselect1;", "" ] [ "algebra", "ilikeselect", "command algebra.ilikeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ", "PCRElikeselect4;", "" ] [ "algebra", "intersect", "command algebra.intersect(X_1:bat[:any_1], X_2:bat[:any_1], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:bit, X_7:lng):bat[:oid] ", "ALGintersect;", "" ] @@ -601,10 +601,10 @@ stdout of test 'MAL-signatures` in direc [ "algebra", "leftjoin", "command algebra.leftjoin(X_2:bat[:any_1], X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "ALGleftjoin;", "" ] [ "algebra", "like", "command algebra.like(X_1:str, X_2:str):bit ", "PCRElike2;", "" ] [ "algebra", "like", "command algebra.like(X_1:str, X_2:str, X_3:str):bit ", "PCRElike3;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng):bat[:oid] ", "LIKEjoin1;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng):bat[:oid] ", "LIKEjoin_esc1;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin_esc;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] ", "LIKEjoin1;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit):bat[:oid] ", "LIKEjoin_esc1;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin_esc;", "" ] [ "algebra", "likeselect", "command algebra.likeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:str, X_5:bit, X_6:bit):bat[:oid] ", "PCRElikeselect2;", "" ] [ "algebra", "likeselect", "command algebra.likeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ", "PCRElikeselect3;", "" ] [ "algebra", "likeselect", "command algebra.likeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ", "PCRElikeselect5;", "" ] diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -697,10 +697,10 @@ stdout of test 'MAL-signatures` in direc [ "algebra", "groupby", "command algebra.groupby(X_1:bat[:oid], X_2:bat[:lng]):bat[:oid] ", "ALGgroupby;", "" ] [ "algebra", "ilike", "command algebra.ilike(X_1:str, X_2:str):bit ", "PCREilike2;", "" ] [ "algebra", "ilike", "command algebra.ilike(X_1:str, X_2:str, X_3:str):bit ", "PCREilike3;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng):bat[:oid] ", "ILIKEjoin1;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng):bat[:oid] ", "ILIKEjoin_esc1;", "" ] -[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin_esc;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] ", "ILIKEjoin1;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit):bat[:oid] ", "ILIKEjoin_esc1;", "" ] +[ "algebra", "ilikejoin", "command algebra.ilikejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "ILIKEjoin_esc;", "" ] [ "algebra", "ilikeselect", "command algebra.ilikeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ", "PCRElikeselect1;", "" ] [ "algebra", "ilikeselect", "command algebra.ilikeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ", "PCRElikeselect4;", "" ] [ "algebra", "intersect", "command algebra.intersect(X_1:bat[:any_1], X_2:bat[:any_1], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:bit, X_7:lng):bat[:oid] ", "ALGintersect;", "" ] @@ -710,10 +710,10 @@ stdout of test 'MAL-signatures` in direc [ "algebra", "leftjoin", "command algebra.leftjoin(X_2:bat[:any_1], X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "ALGleftjoin;", "" ] [ "algebra", "like", "command algebra.like(X_1:str, X_2:str):bit ", "PCRElike2;", "" ] [ "algebra", "like", "command algebra.like(X_1:str, X_2:str, X_3:str):bit ", "PCRElike3;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng):bat[:oid] ", "LIKEjoin1;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng):bat[:oid] ", "LIKEjoin_esc1;", "" ] -[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin_esc;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:bat[:oid], X_4:bat[:oid], X_5:bit, X_6:lng, X_7:bit):bat[:oid] ", "LIKEjoin1;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_1:bat[:str], X_2:bat[:str], X_3:str, X_4:bat[:oid], X_5:bat[:oid], X_6:bit, X_7:lng, X_8:bit):bat[:oid] ", "LIKEjoin_esc1;", "" ] +[ "algebra", "likejoin", "command algebra.likejoin(X_2:bat[:str], X_3:bat[:str], X_4:str, X_5:bat[:oid], X_6:bat[:oid], X_7:bit, X_8:lng, X_9:bit) (X_0:bat[:oid], X_1:bat[:oid]) ", "LIKEjoin_esc;", "" ] [ "algebra", "likeselect", "command algebra.likeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:str, X_5:bit, X_6:bit):bat[:oid] ", "PCRElikeselect2;", "" ] [ "algebra", "likeselect", "command algebra.likeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:str, X_5:bit):bat[:oid] ", "PCRElikeselect3;", "" ] [ "algebra", "likeselect", "command algebra.likeselect(X_1:bat[:str], X_2:bat[:oid], X_3:str, X_4:bit):bat[:oid] ", "PCRElikeselect5;", "" ] diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -1315,10 +1315,10 @@ str IDentifier(identifier *retval, str * ssize_t IDfromString(const char *src, size_t *len, identifier *retval, bool external); str IDprelude(void *ret); ssize_t IDtoString(str *retval, size_t *len, const char *handle, bool external); -str ILIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -str ILIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -str ILIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -str ILIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); +str ILIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +str ILIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +str ILIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +str ILIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); str INET_comp_CS(bit *retval, const inet *val1, const inet *val2); str INET_comp_CSE(bit *retval, const inet *val1, const inet *val2); str INET_comp_CW(bit *retval, const inet *val1, const inet *val2); @@ -1423,10 +1423,10 @@ ssize_t JSONtoString(str *s, size_t *len str JSONunfold(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str JSONvalueArray(json *ret, json *arg); str JSONvalueTable(bat *ret, json *j); -str LIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -str LIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -str LIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -str LIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); +str LIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +str LIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +str LIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +str LIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); str MACROprocessor(Client cntxt, MalBlkPtr mb, Symbol t); int MAL_MAXCLIENTS; int MALadmission_claim(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, lng argclaim); diff --git a/ctest/tools/monetdbe/CMakeLists.txt b/ctest/tools/monetdbe/CMakeLists.txt --- a/ctest/tools/monetdbe/CMakeLists.txt +++ b/ctest/tools/monetdbe/CMakeLists.txt @@ -18,7 +18,7 @@ target_link_libraries(example2 PRIVATE monetdb_config_header monetdbe) -add_test(run_example2 example2) +#add_test(run_example2 example2) add_executable(example_temporal example_temporal.c) target_link_libraries(example_temporal 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 @@ -81,14 +81,14 @@ mal_export str PCRElikeselect3(bat *ret, mal_export str PCRElikeselect4(bat *ret, const bat *bid, const bat *cid, const str *pat, const bit *anti); mal_export str PCRElikeselect5(bat *ret, const bat *bid, const bat *sid, const str *pat, const bit *anti); -mal_export str LIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -mal_export str LIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -mal_export str LIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -mal_export str LIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -mal_export str ILIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -mal_export str ILIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -mal_export str ILIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); -mal_export str ILIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate); +mal_export str LIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +mal_export str LIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +mal_export str LIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +mal_export str LIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +mal_export str ILIKEjoin_esc(bat *r1, bat *r2, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +mal_export str ILIKEjoin_esc1(bat *r1, const bat *lid, const bat *rid, const str *esc, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +mal_export str ILIKEjoin(bat *r1, bat *r2, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); +mal_export str ILIKEjoin1(bat *r1, const bat *lid, const bat *rid, const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate, const bit *anti); /* current implementation assumes simple %keyword% [keyw%]* */ struct RE { @@ -2179,9 +2179,179 @@ PCRElikeselect5(bat *ret, const bat *bid #define APPEND(b, o) (((oid *) b->theap.base)[b->batCount++] = (o)) #define VALUE(s, x) (s##vars + VarHeapVal(s##vals, (x), s##width)) +#ifdef HAVE_LIBPCRE +#define PCRE_COMPILE \ + do { \ + pcrere = pcre_compile(pcrepat, pcreopt, &err_p, &errpos, NULL); \ + if (pcrere == NULL) { \ + msg = createException(MAL, "pcre.join", OPERATION_FAILED \ + ": pcre compile of pattern (%s) " \ + "failed at %d with '%s'", \ + pcrepat, errpos, err_p); \ + goto bailout; \ + } \ + pcreex = pcre_study(pcrere, pcrestopt, &err_p); \ + if (err_p != NULL) { \ + msg = createException(MAL, "pcre.join", OPERATION_FAILED \ + ": pcre study of pattern (%s) " \ + "failed with '%s'", pcrepat, err_p); \ + goto bailout; \ + } \ + } while (0) +#else +#define PCRE_COMPILE \ + do { \ + if ((errcode = regcomp(®ex, pcrepat, options)) != 0) { \ + msg = createException(MAL, "pcre.join", OPERATION_FAILED \ + ": pcre compile of pattern (%s)", \ + pcrepat); \ + goto bailout; \ + } \ + pcrere = 1; \ + } while (0) +#endif + +#ifdef HAVE_LIBPCRE +#define PCRE_EXEC \ + do { \ + retval = pcre_exec(pcrere, pcreex, vl, (int) strlen(vl), 0, 0, NULL, 0); \ + } while (0) +#define PCRE_EXEC_COND (retval < 0) +#else + do { \ + retval = regexec(®ex, vl, (size_t) 0, NULL, 0); \ + } while (0) +#define PCRE_EXEC_COND (retval == REG_NOMATCH || retval == REG_ENOSYS) +#endif + +#ifdef HAVE_LIBPCRE +#define PCRE_CLEAN \ + do { \ + pcre_free_study(pcreex); \ + pcre_free(pcrere); \ + pcrere = NULL; \ + pcreex = NULL; \ + } while (0) +#else + do { \ + regfree(®ex); \ + pcrere = 0; \ + } while (0) +#endif + +/* nested loop implementation for PCRE join */ +#define pcre_join_loop(STRCMP, RE_MATCH, PCRE_COND) \ + do { \ + for (BUN ri = 0; ri < rci.ncand; ri++) { \ + ro = canditer_next(&rci); \ + vr = VALUE(r, ro - r->hseqbase); \ + use_re = false; \ + use_strcmp = false; \ + empty = false; \ + if ((msg = choose_like_path(&pcrepat, &use_re, &use_strcmp, &empty, (const str*)&vr, (const str*)&esc))) \ + goto bailout; \ + if (empty) { \ + continue; \ + } else if (use_re) { \ + if (use_strcmp) { \ + if (caseignore && !(wpat = utf8stoucs(vr))) { \ + msg = createException(MAL, "pcre.join", SQLSTATE(HY013) MAL_MALLOC_FAIL); \ + goto bailout; \ + } \ + } else if (!(re = re_create(vr, caseignore, (unsigned char) *esc))) { \ + msg = createException(MAL, "pcre.join", SQLSTATE(HY013) MAL_MALLOC_FAIL); \ + goto bailout; \ + } \ + } else if (pcrepat) { \ + PCRE_COMPILE; \ + GDKfree(pcrepat); \ + pcrepat = NULL; \ + } \ + nl = 0; \ + canditer_reset(&lci); \ + for (BUN li = 0; li < lci.ncand; li++) { \ + lo = canditer_next(&lci); \ + vl = VALUE(l, lo - l->hseqbase); \ + if (strNil(vl)) { \ + continue; \ + } else if (use_re) { \ + if (use_strcmp) { \ + if (STRCMP) \ + continue; \ + } else { \ + assert(re); \ + if (RE_MATCH) \ + continue; \ + } \ + } else { \ + int retval; \ + assert(pcrere); \ + PCRE_EXEC; \ + if (PCRE_COND) \ + continue; \ + } \ + if (BUNlast(r1) == BATcapacity(r1)) { \ + newcap = BATgrows(r1); \ + BATsetcount(r1, BATcount(r1)); \ + if (r2) \ + BATsetcount(r2, BATcount(r2)); \ + if (BATextend(r1, newcap) != GDK_SUCCEED || (r2 && BATextend(r2, newcap) != GDK_SUCCEED)) { \ + msg = createException(MAL, "pcre.join", SQLSTATE(HY013) MAL_MALLOC_FAIL); \ + goto bailout; \ + } \ + assert(!r2 || BATcapacity(r1) == BATcapacity(r2)); \ + } \ + if (BATcount(r1) > 0) { \ + if (lastl + 1 != lo) \ + r1->tseqbase = oid_nil; \ + if (nl == 0) { \ + if (r2) \ + r2->trevsorted = false; \ + if (lastl > lo) { \ + r1->tsorted = false; \ + r1->tkey = false; \ + } else if (lastl < lo) { \ + r1->trevsorted = false; \ + } else { \ + r1->tkey = false; \ + } \ + } \ + } \ + APPEND(r1, lo); \ + if (r2) \ + APPEND(r2, ro); \ + lastl = lo; \ + nl++; \ + } \ + if (re) { \ + re_destroy(re); \ + re = NULL; \ + } \ + if (wpat) { \ + GDKfree(wpat); \ + wpat = NULL; \ + } \ + if (pcrere) { \ + PCRE_CLEAN; \ + } \ + if (r2) { \ + if (nl > 1) { \ + r2->tkey = false; \ + r2->tseqbase = oid_nil; \ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list