Changeset: 656b1d89808c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=656b1d89808c Added Files: monetdb5/modules/atoms/strptime.c sql/test/miscellaneous/Tests/simple_selects.sql sql/test/miscellaneous/Tests/simple_selects.stable.err sql/test/miscellaneous/Tests/simple_selects.stable.out Removed Files: common/utils/strptime.cpp Modified Files: NT/rules.msc common/utils/Makefile.ag gdk/gdk_analytic_bounds.c gdk/gdk_heap.c monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err monetdb5/modules/atoms/Makefile.ag monetdb5/modules/mal/Makefile.ag monetdb5/tools/Makefile.ag sql/ChangeLog sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_rank.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_user.c sql/common/sql_backend.c sql/common/sql_backend.h sql/include/sql_catalog.h sql/scripts/75_storagemodel.sql sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_sequence.c sql/server/sql_mvc.c sql/server/sql_mvc.h sql/server/sql_privileges.c sql/server/sql_privileges.h sql/storage/bat/bat_table.c sql/storage/sql_catalog.c sql/storage/sql_storage.h sql/storage/store.c sql/storage/store_dependency.c sql/test/BugTracker-2009/Tests/copy_multiple_files.SF-2902320.stable.err sql/test/Dependencies/Tests/Dependencies.stable.out sql/test/Dependencies/Tests/Dependencies.stable.out.int128 sql/test/Dependencies/Tests/dependency_loop.stable.out sql/test/Dependencies/Tests/dependency_loop.stable.out.int128 sql/test/Tests/systemfunctions.stable.out sql/test/Tests/systemfunctions.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128 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/miscellaneous/Tests/All sql/test/testdb-reload/Tests/reload.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out.powerpc64.int128 sql/test/testdb/Tests/dump.stable.out sql/test/testdb/Tests/load.sql Branch: merge-statements Log Message:
Merge with default diffs (truncated from 63887 to 300 lines): diff --git a/NT/rules.msc b/NT/rules.msc --- a/NT/rules.msc +++ b/NT/rules.msc @@ -138,7 +138,13 @@ zlib_CFLAGS = -DHAVE_LIBZ "-I$(LIBZLIB)\ !IFNDEF LIBBZIP2 LIBBZIP2 = C:\bzip2-1.0.5.win$(bits) !ENDIF -bzip2_LIBS = "$(LIBBZIP2)\lib\libbz2.lib" +!IFDEF DEBUG +# in a debug build of MonetDB, we need to use a debug build of libbz2 +# since it seems that the FILE pointer cannot be carried over from a +# debug build to a non-debug build. +BZIPDEBUGEXT = d +!endif +bzip2_LIBS = "$(LIBBZIP2)\lib\libbz2$(BZIPDEBUGEXT).lib" bzip2_CFLAGS = -DHAVE_LIBBZ2 "-I$(LIBBZIP2)\include" !ENDIF diff --git a/common/utils/Makefile.ag b/common/utils/Makefile.ag --- a/common/utils/Makefile.ag +++ b/common/utils/Makefile.ag @@ -29,9 +29,3 @@ lib_msabaoth = { NOINST SOURCES = msabaoth.h msabaoth.c } - -lib_strptime = { - NOINST - SOURCES = strptime.cpp - COND = NATIVE_WIN32 -} diff --git a/gdk/gdk_analytic_bounds.c b/gdk/gdk_analytic_bounds.c --- a/gdk/gdk_analytic_bounds.c +++ b/gdk/gdk_analytic_bounds.c @@ -434,38 +434,38 @@ GDKanalyticalallbounds(BAT *r, BAT *b, B if (*np) { i += (np - pnp); j = k; - for (; k<i; k++, rb++) - *rb = j; + for (; k<i; k++) + rb[k] = j; pnp = np; } } i += (np - pnp); j = k; - for(; k<i; k++, rb++) - *rb = j; + for(; k<i; k++) + rb[k] = j; } else { i += (lng) cnt; j = k; - for(; k<i; k++, rb++) - *rb = j; + for(; k<i; k++) + rb[k] = j; } } else if(np) { /* following */ nend += cnt; for(; np<nend; np++) { if (*np) { i += (np - pnp); - for(; k<i; k++, rb++) - *rb = i; + for(; k<i; k++) + rb[k] = i; pnp = np; } } i += (np - pnp); - for(; k<i; k++, rb++) - *rb = i; + for(; k<i; k++) + rb[k] = i; } else { i += (lng) cnt; - for(; k<i; k++, rb++) - *rb = i; + for(; k<i; k++) + rb[k] = i; } BATsetcount(r, cnt); diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -1057,7 +1057,6 @@ HEAP_malloc(Heap *heap, size_t nbytes) /* Now we have found a block which is big enough in block. * The predecessor of this block is in trail. */ - trailp = HEAP_index(heap, trail, CHUNK); blockp = HEAP_index(heap, block, CHUNK); /* If selected block is bigger than block needed split block diff --git a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err --- a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err +++ b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.err @@ -30,17 +30,17 @@ stderr of test 'opt_sql_append` in direc # 22:58:57 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=rome" "--port=36275" # 22:58:57 > -MAPI = (monetdb) /var/tmp/mtest-5498/.s.monetdb.31321 -QUERY = explain copy into ttt from '\tmp/xyz'; -ERROR = !COPY INTO: filename must have absolute path: "\tmp/xyz" +MAPI = (monetdb) /var/tmp/mtest-20069/.s.monetdb.34504 +QUERY = explain copy into ttt from E'\\tmp/xyz'; +ERROR = !COPY INTO: filename must have absolute path: "\\tmp/xyz" CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 -QUERY = explain copy into ttt from 'a:\tmp/xyz'; -ERROR = !COPY INTO: filename must have absolute path: "a:\tmp/xyz" +MAPI = (monetdb) /var/tmp/mtest-20069/.s.monetdb.34504 +QUERY = explain copy into ttt from E'a:\\tmp/xyz'; +ERROR = !COPY INTO: filename must have absolute path: "a:\\tmp/xyz" CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 -QUERY = explain copy into ttt from '\tmp/xyz'; -ERROR = !COPY INTO: filename must have absolute path: "\tmp/xyz" +MAPI = (monetdb) /var/tmp/mtest-20069/.s.monetdb.34504 +QUERY = explain copy into ttt from E'\\tmp/xyz'; +ERROR = !COPY INTO: filename must have absolute path: "\\tmp/xyz" CODE = 42000 MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 QUERY = explain copy into ttt from 'Z:/tmp/xyz'; diff --git a/monetdb5/modules/atoms/Makefile.ag b/monetdb5/modules/atoms/Makefile.ag --- a/monetdb5/modules/atoms/Makefile.ag +++ b/monetdb5/modules/atoms/Makefile.ag @@ -9,7 +9,7 @@ INCLUDES = ../../mal \ ../../../common/stream \ ../../../common/utils \ ../../../gdk \ - $(libxml2_CFLAGS) $(curl_CFLAGS) $(openssl_CFLAGS) + $(libxml2_CFLAGS) $(openssl_CFLAGS) MTSAFE lib_atoms = { @@ -29,6 +29,12 @@ lib_atoms = { xml.c xml.h } +lib_strptime = { + NOINST + SOURCES = strptime.c + COND = NATIVE_WIN32 +} + headers_mal = { HEADERS = mal DIR = libdir/monetdb5 diff --git a/common/utils/strptime.cpp b/monetdb5/modules/atoms/strptime.c rename from common/utils/strptime.cpp rename to monetdb5/modules/atoms/strptime.c --- a/common/utils/strptime.cpp +++ b/monetdb5/modules/atoms/strptime.c @@ -1,17 +1,355 @@ -/* https://stackoverflow.com/questions/321849/strptime-equivalent-on-windows */ +/* Adapted from https://opensource.apple.com/source/lukemftp/lukemftp-3/lukemftp/libukem/strptime.c */ +/* $Id$ */ +/* $NetBSD: strptime.c,v 1.18 1999/04/29 02:58:30 tv Exp $ */ + +/*- + * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code was contributed to The NetBSD Foundation by Klaus Klein. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "monetdb_config.h" +#include "gdk.h" #include <time.h> -#include <iomanip> -#include <sstream> +#include <ctype.h> +#include <string.h> + +#ifdef WIN32 + +/* + * We do not implement alternate representations. However, we always + * check whether a given modifier is allowed for a certain conversion. + */ +#define ALT_E 0x01 +#define ALT_O 0x02 +#define LEGAL_ALT(x) { if (alt_format & ~(x)) return NULL; } + +#ifndef TM_YEAR_BASE +#define TM_YEAR_BASE 1900 +#endif + +static const char *day[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; + +static const char *abday[7] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + +static const char *mon[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", + "October", "November", "December"}; + +static const char *abmon[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; -extern "C" char * -strptime(const char *s, const char *f, struct tm *tm) +static const char *am_pm[2] = {"am", "pm"}; + +static int +strptime_conv_num(const char **buf, int *dest, int llim, int ulim) +{ + int result = 0; + + /* The limit also determines the number of valid digits. */ + int rulim = ulim; + + if (**buf < '0' || **buf > '9') + return 0; + + do { + result *= 10; + result += *(*buf)++ - '0'; + rulim /= 10; + } while ((result * 10 <= ulim) && rulim && **buf >= '0' && **buf <= '9'); + + if (result < llim || result > ulim) + return 0; + + *dest = result; + return 1; +} + +char * +strptime(const char *buf, const char *fmt, struct tm *tm) { - std::istringstream input(s); - input.imbue(std::locale(setlocale(LC_ALL, nullptr))); - input >> std::get_time(tm, f); - if (input.fail()) { - return nullptr; + char c; + const char *bp = buf; + size_t len = 0; + int alt_format, i, split_year = 0; + + if (THRhighwater()) /* defensive line for recursive strptime calls */ + return NULL; + + while ((c = *fmt) != '\0') { + /* Clear `alternate' modifier prior to new conversion. */ + alt_format = 0; + + /* Eat up white-space. */ + if (isspace(c)) { + while (isspace(*bp)) + bp++; + + fmt++; + continue; + } + + if ((c = *fmt++) != '%') + goto literal; + +again: + switch (c = *fmt++) { + case '%': /* "%%" is converted to "%". */ +literal: + if (c != *bp++) + return NULL; + break; + /* + * "Alternative" modifiers. Just set the appropriate flag + * and start over again. + */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list