Changeset: e430465ad921 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e430465ad921 Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out monetdb5/ChangeLog.Apr2019 monetdb5/mal/Tests/tst016.malC monetdb5/mal/Tests/tst016.stable.out monetdb5/modules/atoms/blob.c monetdb5/modules/atoms/blob.mal monetdb5/modules/kernel/Makefile.ag monetdb5/modules/mal/sysmon.c sql/ChangeLog.Apr2019 sql/backends/monet5/sql_cat.c sql/common/sql_types.c sql/server/rel_sequence.c sql/storage/sql_storage.h sql/storage/store.c sql/test/Tests/systemfunctions.stable.out sql/test/Tests/systemfunctions.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out.powerpc64.int128 Branch: default Log Message:
Merge with Apr2019 branch. diffs (truncated from 195961 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 @@ -9128,8 +9128,6 @@ Ready. [ "blob", "nitems", "command blob.nitems(b:blob):int ", "BLOBnitems;", "get the number of bytes in this blob." ] [ "blob", "prelude", "command blob.prelude():void ", "BLOBprelude;", "" ] [ "blob", "toblob", "command blob.toblob(v:str):blob ", "BLOBtoblob;", "store a string as a blob." ] -[ "blob", "tostring", "command blob.tostring(v:blob):str ", "BLOBfromblob;", "get the bytes from blob as a string, till\n\tthe first 0 byte or the end of the blob" ] -[ "blob", "tostring", "command blob.tostring(v:blob, index:int):str ", "BLOBfromidx;", "get the bytes from blob as a string,\n\t starting at byte 'index' till the first\n\t0 byte or the end of the blob." ] [ "bstream", "create", "unsafe command bstream.create(s:streams, bufsize:int):bstream ", "bstream_create_wrapwrap;", "create a buffered stream" ] [ "bstream", "destroy", "unsafe command bstream.destroy(s:bstream):void ", "bstream_destroy_wrapwrap;", "destroy bstream" ] [ "bstream", "read", "unsafe command bstream.read(s:bstream, size:int):int ", "bstream_read_wrapwrap;", "read at least size bytes into the buffer of s" ] 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 @@ -12874,8 +12874,6 @@ Ready. [ "blob", "nitems", "command blob.nitems(b:blob):int ", "BLOBnitems;", "get the number of bytes in this blob." ] [ "blob", "prelude", "command blob.prelude():void ", "BLOBprelude;", "" ] [ "blob", "toblob", "command blob.toblob(v:str):blob ", "BLOBtoblob;", "store a string as a blob." ] -[ "blob", "tostring", "command blob.tostring(v:blob):str ", "BLOBfromblob;", "get the bytes from blob as a string, till\n\tthe first 0 byte or the end of the blob" ] -[ "blob", "tostring", "command blob.tostring(v:blob, index:int):str ", "BLOBfromidx;", "get the bytes from blob as a string,\n\t starting at byte 'index' till the first\n\t0 byte or the end of the blob." ] [ "bstream", "create", "unsafe command bstream.create(s:streams, bufsize:int):bstream ", "bstream_create_wrapwrap;", "create a buffered stream" ] [ "bstream", "destroy", "unsafe command bstream.destroy(s:bstream):void ", "bstream_destroy_wrapwrap;", "destroy bstream" ] [ "bstream", "read", "unsafe command bstream.read(s:bstream, size:int):int ", "bstream_read_wrapwrap;", "read at least size bytes into the buffer of s" ] 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 @@ -851,8 +851,6 @@ str BLOBblob_blob(blob **d, blob **s); str BLOBblob_fromstr(blob **b, const char **d); int BLOBcmp(const blob *l, const blob *r); void BLOBdel(Heap *h, var_t *index); -str BLOBfromblob(str *retval, blob **b); -str BLOBfromidx(str *retval, blob **binp, int *index); ssize_t BLOBfromstr(const char *instr, size_t *l, blob **val, bool external); int BLOBget(Heap *h, int *bun, int *l, blob **val); BUN BLOBhash(const blob *b); diff --git a/monetdb5/ChangeLog.Apr2019 b/monetdb5/ChangeLog.Apr2019 --- a/monetdb5/ChangeLog.Apr2019 +++ b/monetdb5/ChangeLog.Apr2019 @@ -1,6 +1,10 @@ # ChangeLog file for MonetDB5 # This file is updated with Maddlog +* Wed Jan 23 2019 Sjoerd Mullender <[email protected]> +- Removed function blob.tostring() since it cannot guarantee that the + resulting string is properly encoded in UTF-8. + * Tue Jan 22 2019 Sjoerd Mullender <[email protected]> - Removed the type "sqlblob", changed the external format of the type "blob" to be like what "sqlblob" used to be. In other words, the diff --git a/monetdb5/mal/Tests/tst016.malC b/monetdb5/mal/Tests/tst016.malC --- a/monetdb5/mal/Tests/tst016.malC +++ b/monetdb5/mal/Tests/tst016.malC @@ -1,11 +1,12 @@ # handling basic strings a:= "Dit is een test\n"; b:= blob.toblob(a); -c:= blob.tostring(b); +# blob.tostring has been removed since it cannot guarantee UTF-8. +#c:= blob.tostring(b); io.print(a); io.print(b); -io.print(c); +#io.print(c); diff --git a/monetdb5/mal/Tests/tst016.stable.out b/monetdb5/mal/Tests/tst016.stable.out --- a/monetdb5/mal/Tests/tst016.stable.out +++ b/monetdb5/mal/Tests/tst016.stable.out @@ -32,7 +32,6 @@ Ready. #io.print(a); [ "Dit is een test\n" ] [ "4469742069732065656E20746573740A00" ] -[ "Dit is een test\n" ] # 20:08:53 > # 20:08:53 > Done. diff --git a/monetdb5/modules/atoms/blob.c b/monetdb5/modules/atoms/blob.c --- a/monetdb5/modules/atoms/blob.c +++ b/monetdb5/modules/atoms/blob.c @@ -44,8 +44,6 @@ mal_export void BLOBdel(Heap *h, var_t * mal_export size_t BLOBlength(const blob *p); mal_export void BLOBheap(Heap *heap, size_t capacity); mal_export str BLOBtoblob(blob **retval, str *s); -mal_export str BLOBfromblob(str *retval, blob **b); -mal_export str BLOBfromidx(str *retval, blob **binp, int *index); mal_export str BLOBnitems(int *ret, blob **b); mal_export int BLOBget(Heap *h, int *bun, int *l, blob **val); mal_export blob * BLOBread(blob *a, stream *s, size_t cnt); @@ -77,25 +75,6 @@ static blob nullval = { static char hexit[] = "0123456789ABCDEF"; -static str -fromblob_idx(str *retval, blob *b, int *idx) -{ - str s, p = b->data + *idx; - str r, q = b->data + b->nitems; - - for (r = p; r < q; r++) { - if (*r == 0) - break; - } - *retval = s = (str) GDKmalloc(1 + r - p); - if( *retval == NULL) - throw(MAL, "blob.tostring", SQLSTATE(HY001) MAL_MALLOC_FAIL); - for (; p < r; p++, s++) - *s = *p; - *s = 0; - return MAL_SUCCEED; -} - /* * @- Wrapping section * This section contains the wrappers to re-use the implementation @@ -202,20 +181,6 @@ BLOBnitems(int *ret, blob **b) } str -BLOBfromidx(str *retval, blob **binp, int *idx) -{ - return fromblob_idx(retval, *binp, idx); -} - -str -BLOBfromblob(str *retval, blob **b) -{ - int zero = 0; - - return fromblob_idx(retval, *b, &zero); -} - -str BLOBtoblob(blob **retval, str *s) { size_t len = strLen(*s); diff --git a/monetdb5/modules/atoms/blob.mal b/monetdb5/modules/atoms/blob.mal --- a/monetdb5/modules/atoms/blob.mal +++ b/monetdb5/modules/atoms/blob.mal @@ -28,17 +28,10 @@ command blob(s:str):blob address BLOBblob_fromstr; # @+ string functions -# Manipulation functions to extract strings from blobs and vice versa. +# Manipulation function to convert strings to blobs. # Not to be confused with blob parsing and printing. -command tostring(v:blob) :str -address BLOBfromblob -comment "get the bytes from blob as a string, till - the first 0 byte or the end of the blob"; -command tostring(v:blob, index:int ) :str -address BLOBfromidx -comment "get the bytes from blob as a string, - starting at byte 'index' till the first - 0 byte or the end of the blob."; +# Note, a function tostring(b:blob):str is not possible since the +# string would not be guaranteed UTF-8 encoded. command toblob(v:str) :blob address BLOBtoblob comment "store a string as a blob."; diff --git a/monetdb5/modules/kernel/Makefile.ag b/monetdb5/modules/kernel/Makefile.ag --- a/monetdb5/modules/kernel/Makefile.ag +++ b/monetdb5/modules/kernel/Makefile.ag @@ -25,7 +25,7 @@ lib_kernel = { group.c group.h \ logger.c \ microbenchmark.c microbenchmark.h \ - mmath.c mmath.h \ + mmath.c mmath.h mmath_private.h \ status.c status.h } diff --git a/monetdb5/modules/mal/sysmon.c b/monetdb5/modules/mal/sysmon.c --- a/monetdb5/modules/mal/sysmon.c +++ b/monetdb5/modules/mal/sysmon.c @@ -36,7 +36,6 @@ SYSMONqueue(Client cntxt, MalBlkPtr mb, (void) cntxt; (void) mb; - MT_lock_set(&mal_delayLock); tag = COLnew(0, TYPE_lng, 256, TRANSIENT); user = COLnew(0, TYPE_str, 256, TRANSIENT); started = COLnew(0, TYPE_timestamp, 256, TRANSIENT); @@ -46,18 +45,18 @@ SYSMONqueue(Client cntxt, MalBlkPtr mb, oids = COLnew(0, TYPE_oid, 256, TRANSIENT); query = COLnew(0, TYPE_str, 256, TRANSIENT); if ( tag == NULL || user == NULL || query == NULL || started == NULL || estimate == NULL || progress == NULL || activity == NULL || oids == NULL){ - if (tag) BBPunfix(tag->batCacheid); - if (user) BBPunfix(user->batCacheid); - if (query) BBPunfix(query->batCacheid); - if (activity) BBPunfix(activity->batCacheid); - if (started) BBPunfix(started->batCacheid); - if (estimate) BBPunfix(estimate->batCacheid); - if (progress) BBPunfix(progress->batCacheid); - if (oids) BBPunfix(oids->batCacheid); - MT_lock_unset(&mal_delayLock); + BBPreclaim(tag); + BBPreclaim(user); + BBPreclaim(query); + BBPreclaim(activity); + BBPreclaim(started); + BBPreclaim(estimate); + BBPreclaim(progress); + BBPreclaim(oids); throw(MAL, "SYSMONqueue", SQLSTATE(HY001) MAL_MALLOC_FAIL); } + MT_lock_set(&mal_delayLock); for ( i = 0; i< qtop; i++) if( QRYqueue[i].query && (QRYqueue[i].cntxt->idx == 0 || QRYqueue[i].cntxt->user == cntxt->user)) { now= (lng) time(0); diff --git a/sql/ChangeLog.Apr2019 b/sql/ChangeLog.Apr2019 --- a/sql/ChangeLog.Apr2019 +++ b/sql/ChangeLog.Apr2019 @@ -1,6 +1,11 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Wed Jan 23 2019 Sjoerd Mullender <[email protected]> +- Function octet_length now also accepts a BLOB argument and returns + the length of the BLOB (i.e. the same as length when called with a + BLOB argument). + * Tue Jan 22 2019 Sjoerd Mullender <[email protected]> - Implemented length(blob) and comparison between blobs. - Implemented a two argument function log which calculates the logarithm diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -636,7 +636,7 @@ create_seq(mvc *sql, char *sname, char * } else if (!mvc_schema_privs(sql, s)) { throw(SQL,"sql.create_seq", SQLSTATE(42000) "CREATE SEQUENCE: insufficient privileges for '%s' in schema '%s'", stack_get_string(sql, "current_user"), s->base.name); } else if (is_lng_nil(seq->start) || is_lng_nil(seq->minvalue) || is_lng_nil(seq->maxvalue) || - is_lng_nil(seq->increment) || is_lng_nil(seq->cacheinc) || is_lng_nil(seq->cycle)) { + is_lng_nil(seq->increment) || is_lng_nil(seq->cacheinc) || is_bit_nil(seq->cycle)) { throw(SQL,"sql.create_seq", SQLSTATE(42000) "CREATE SEQUENCE: sequence properties must be non-NULL"); } sql_trans_create_sequence(sql->session->tr, s, seq->base.name, seq->start, seq->minvalue, seq->maxvalue, seq->increment, seq->cacheinc, seq->cycle, seq->bedropped); diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -1493,6 +1493,7 @@ sqltypeinit( sql_allocator *sa) BLOB = *t++ = sql_create_type(sa, "BLOB", 0, 0, 0, EC_BLOB, "blob"); sql_create_func(sa, "length", "blob", "nitems", BLOB, NULL, INT, SCALE_NONE); + sql_create_func(sa, "octet_length", "blob", "nitems", BLOB, NULL, INT, SCALE_NONE); if (geomcatalogfix_get() != NULL) { // the geom module is loaded diff --git a/sql/server/rel_sequence.c b/sql/server/rel_sequence.c --- a/sql/server/rel_sequence.c +++ b/sql/server/rel_sequence.c @@ -81,8 +81,8 @@ rel_create_seq( lng min, lng max, lng cache, - int cycle, - int bedropped) + bit cycle, + bit bedropped) { sql_rel *res = NULL; sql_sequence *seq = NULL; @@ -110,8 +110,8 @@ rel_create_seq( if (is_lng_nil(max)) max = 0; if (is_lng_nil(cache)) cache = 1; - seq = create_sql_sequence(sql->sa, s, name, start, min, max, inc, cache, (bit) cycle); - seq->bedropped = (bit) bedropped; + seq = create_sql_sequence(sql->sa, s, name, start, min, max, inc, cache, cycle); + seq->bedropped = bedropped; res = rel_seq(sql->sa, DDL_CREATE_SEQ, s->base.name, seq, NULL, NULL); /* for multi statements we keep the sequence around */ if (res && stack_has_frame(sql, "MUL") != 0) { @@ -136,12 +136,13 @@ list_create_seq( sql_schema *ss, dlist *qname, dlist *options, - int bedropped) + bit bedropped) { dnode *n; sql_subtype* t = NULL; lng start = lng_nil, inc = lng_nil, min = lng_nil, max = lng_nil, cache = lng_nil; - int used = 0, cycle = 0; + unsigned int used = 0; + bit cycle = 0; /* check if no option is given twice */ for (n = options->h; n; n = n->next) { @@ -190,9 +191,7 @@ list_create_seq( if ((used&(1<<SEQ_CYCLE))) return sql_error(sql, 02, SQLSTATE(3F000) "CREATE SEQUENCE: CYCLE or NO CYCLE should be passed as most once"); used |= (1<<SEQ_CYCLE); - if (is_lng_nil(s->data.l_val)) - return sql_error(sql, 02, SQLSTATE(42000) "CREATE SEQUENCE: CYCLE must be non-NULL"); - cycle = s->data.i_val; + cycle = s->data.i_val != 0; _______________________________________________ checkin-list mailing list [email protected] https://www.monetdb.org/mailman/listinfo/checkin-list
