Changeset: 28c70933daa5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=28c70933daa5
Added Files:
sql/test/Tests/hot_snapshot_lz4_lite.py
sql/test/Tests/hot_snapshot_lz4_lite.stable.err
sql/test/Tests/hot_snapshot_lz4_lite.stable.out
Modified Files:
monetdb5/mal/Tests/tst201.malC
monetdb5/modules/mal/pcre.c
sql/test/Tests/All
sql/test/Tests/hot_snapshot.py
Branch: default
Log Message:
merged with jun
diffs (truncated from 741 to 300 lines):
diff --git a/monetdb5/mal/Tests/tst201.malC b/monetdb5/mal/Tests/tst201.malC
--- a/monetdb5/mal/Tests/tst201.malC
+++ b/monetdb5/mal/Tests/tst201.malC
@@ -61,14 +61,14 @@ exit MALException;
v45:= algebra.slice(b,v43,v44);
v46:= io.print(v45);
- v75:= algebra.likeselect(b, nil:bat[:oid], "ox", nil:str, false, false);
+ v75:= algebra.likeselect(b, nil:bat[:oid], "ox", "", false, false);
v76:= io.print(v75);
- v78:= algebra.likeselect(b, nil:bat[:oid], "fo", nil:str, false, false);
+ v78:= algebra.likeselect(b, nil:bat[:oid], "fo", "", false, false);
v79:= io.print(v78);
- v81:= algebra.likeselect(b, nil:bat[:oid], "fox", nil:str, false,
false);
+ v81:= algebra.likeselect(b, nil:bat[:oid], "fox", "", false, false);
v82:= io.print(v81);
- v84:= algebra.likeselect(b, nil:bat[:oid], " fox", nil:str, false,
false);
+ v84:= algebra.likeselect(b, nil:bat[:oid], " fox", "", false, false);
v85:= io.print(v84);
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
@@ -87,13 +87,14 @@ mal_export str ILIKEjoin(bat *r1, bat *r
mal_export str ILIKEjoin1(bat *r1, bat *r2, const bat *lid, const bat *rid,
const bat *slid, const bat *srid, const bit *nil_matches, const lng *estimate);
/* current implementation assumes simple %keyword% [keyw%]* */
-typedef struct RE {
+struct RE {
char *k;
uint32_t *w;
- bool search;
+ bool search:1,
+ atend:1;
size_t len;
struct RE *n;
-} RE;
+};
/* We cannot use strcasecmp and strncasecmp since they work byte for
* byte and don't deal with multibyte encodings (such as UTF-8).
@@ -235,32 +236,32 @@ myucslen(const uint32_t *ucs)
return i;
}
-static inline int
-mywstrncasecmp(const char *restrict s1, const uint32_t *restrict s2, size_t n2)
+static inline bool
+mywstrncaseeq(const char *restrict s1, const uint32_t *restrict s2, size_t n2,
bool atend)
{
uint32_t c1;
while (n2 > 0) {
size_t nn1 = utfc8touc(, s1);
if (nn1 == 0 || nn1 == (size_t) -1)
- return -(*s2 != 0);
+ return (*s2 == 0);
if (*s2 == 0)
- return 1;
+ return false;
if (nn1 == (size_t) -1 || nn1 == (size_t) -2)
- return 0;/* actually an error that shouldn't
happen */
+ return true; /* actually an error that shouldn't
happen */
#if SIZEOF_WCHAR_T == 2
if (c1 > 0x || *s2 > 0x) {
if (c1 != *s2)
- return c1 - *s2;
+ return false;
} else
#endif
if (towlower((wint_t) c1) != towlower((wint_t) *s2))
- return towlower((wint_t) c1) - towlower((wint_t) *s2);
+ return false;
s1 += nn1;
n2--;
s2++;
}
- return 0;
+ return !atend || *s1 == 0;
}
static inline int
@@ -318,12 +319,12 @@ mywstrcasecmp(const char *restrict s1, c
}
static inline const char *
-mywstrcasestr(const char *restrict haystack, const uint32_t *restrict wneedle)
+mywstrcasestr(const char *restrict haystack, const uint32_t *restrict wneedle,
bool atend)
{
size_t nlen = myucslen(wneedle);
if (nlen == 0)
- return haystack;
+ return atend ? haystack + strlen(haystack) : haystack;
size_t hlen = strlen(haystack);
@@ -349,7 +350,7 @@ mywstrcasestr(const char *restrict hayst
break;
h += j;
}
- if (i == nlen)
+ if (i == nlen && (!atend || haystack[h] == 0))
return haystack;
haystack += step;
hlen -= step;
@@ -364,31 +365,44 @@ static bool
re_simple(const char *pat, unsigned char esc)
{
bool escaped = false;
- bool percatend = false;
if (pat == 0)
- return 0;
+ return false;
if (*pat == '%') {
- percatend = true;
pat++;
}
while (*pat) {
- percatend = false;
if (escaped) {