Changeset: d8947cc746e0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d8947cc746e0
Removed Files:
        
sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.err.Windows
        
sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.out.Windows
Modified Files:
        clients/mapiclient/Makefile.ag
        clients/mapiclient/eventparser.c
        common/utils/strptime.c
        monetdb5/modules/atoms/mtime.c
Branch: Jul2015
Log Message:

We now have an implementation of strptime for Windows.
Two minor changes to the original strptime code so that it compiles
for us.


diffs (230 lines):

diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag
--- a/clients/mapiclient/Makefile.ag
+++ b/clients/mapiclient/Makefile.ag
@@ -5,7 +5,7 @@
 # Copyright 2008-2015 MonetDB B.V.
 
 MTSAFE
-INCLUDES = ../mapilib ../../common/options ../../common/stream 
../R/MonetDB.R/src $(READLINE_INCS)
+INCLUDES = ../mapilib ../../common/options ../../common/stream 
../../common/utils ../R/MonetDB.R/src $(READLINE_INCS)
 
 lib_mcutil = {
        NOINST
diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c
--- a/clients/mapiclient/eventparser.c
+++ b/clients/mapiclient/eventparser.c
@@ -23,6 +23,11 @@ int malvartop;
 int debug=0;
 char *monetdb_characteristics;
 
+#ifndef HAVE_STRPTIME
+extern char *strptime(const char *, const char *, struct tm *);
+#include "strptime.c"
+#endif
+
 void
 clearArguments(void)
 {
@@ -205,7 +210,6 @@ parseArguments(char *call, int m)
 int
 eventparser(char *row, EventRecord *ev)
 {
-#ifdef HAVE_STRPTIME
        char *c, *cc, *v =0;
        struct tm stm;
 
@@ -427,8 +431,5 @@ eventparser(char *row, EventRecord *ev)
        }
        if (ev->stmt && (v=strstr(ev->stmt, ";\",\t")))
                *v = 0;
-#else
-       (void) row;
-#endif
        return 0;
 }
diff --git a/common/utils/strptime.c b/common/utils/strptime.c
--- a/common/utils/strptime.c
+++ b/common/utils/strptime.c
@@ -32,7 +32,7 @@
 
 #ifdef WIN32
 
-#include "platform/platform.h"
+/* #include "platform/platform.h" */
 
 
 static const char *abb_weekdays[] = {
@@ -106,7 +106,7 @@ match_string (const char **buf, const ch
     int i = 0;
 
     for (i = 0; strs[i] != NULL; ++i) {
-       int len = strlen (strs[i]);
+       size_t len = strlen (strs[i]);
 
        if (strncasecmp (*buf, strs[i], len) == 0) {
            *buf += len;
diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c
--- a/monetdb5/modules/atoms/mtime.c
+++ b/monetdb5/modules/atoms/mtime.c
@@ -191,6 +191,12 @@
 #include "monetdb_config.h"
 #include "mtime.h"
 
+#ifndef HAVE_STRPTIME
+extern char *strptime(const char *, const char *, struct tm *);
+#include "strptime.c"
+#endif
+
+
 #define get_rule(r)    ((r).s.weekday | ((r).s.day<<6) | ((r).s.minutes<<10) | 
((r).s.month<<21))
 #define set_rule(r,i)                                                  \
        do {                                                                    
        \
@@ -3479,7 +3485,6 @@ MTIMEdaytime_extract_milliseconds_bulk(b
 str
 MTIMEstr_to_date(date *d, const char * const *s, const char * const *format)
 {
-#ifdef HAVE_STRPTIME
        struct tm t;
 
        if (strcmp(*s, str_nil) == 0 || strcmp(*format, str_nil) == 0) {
@@ -3491,9 +3496,6 @@ MTIMEstr_to_date(date *d, const char * c
                throw(MAL, "mtime.str_to_date", "format '%s', doesn't match 
date '%s'\n", *format, *s);
        *d = todate(t.tm_mday, t.tm_mon + 1, t.tm_year + 1900);
        return MAL_SUCCEED;
-#else
-       throw(MAL, "mtime.str_to_date", "strptime support missing");
-#endif
 }
 
 str
@@ -3528,7 +3530,6 @@ MTIMEdate_to_str(str *s, const date *d, 
 str
 MTIMEstr_to_time(daytime *d, const char * const *s, const char * const *format)
 {
-#ifdef HAVE_STRPTIME
        struct tm t;
 
        if (strcmp(*s, str_nil) == 0 || strcmp(*format, str_nil) == 0) {
@@ -3540,9 +3541,6 @@ MTIMEstr_to_time(daytime *d, const char 
                throw(MAL, "mtime.str_to_time", "format '%s', doesn't match 
time '%s'\n", *format, *s);
        *d = totime(t.tm_hour, t.tm_min, t.tm_sec, 0);
        return MAL_SUCCEED;
-#else
-       throw(MAL, "mtime.str_to_time", "strptime support missing");
-#endif
 }
 
 str
@@ -3576,7 +3574,6 @@ MTIMEtime_to_str(str *s, const daytime *
 str
 MTIMEstr_to_timestamp(timestamp *ts, const char * const *s, const char * const 
*format)
 {
-#ifdef HAVE_STRPTIME
        struct tm t;
 
        if (strcmp(*s, str_nil) == 0 || strcmp(*format, str_nil) == 0) {
@@ -3589,9 +3586,6 @@ MTIMEstr_to_timestamp(timestamp *ts, con
        ts->days = todate(t.tm_mday, t.tm_mon + 1, t.tm_year + 1900);
        ts->msecs = totime(t.tm_hour, t.tm_min, t.tm_sec, 0);
        return MAL_SUCCEED;
-#else
-       throw(MAL, "mtime.str_to_timestamp", "strptime support missing");
-#endif
 }
 
 str
diff --git 
a/sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.err.Windows 
b/sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.err.Windows
deleted file mode 100644
--- 
a/sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.err.Windows
+++ /dev/null
@@ -1,43 +0,0 @@
-stderr of test 'date_script_test.Bug-2973` in directory 
'sql/test/BugTracker-2012` itself:
-
-
-# 14:12:34 >  
-# 14:12:34 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/ufs/manegold/_/Monet/HG/Dec2011/prefix/--disable-debug_--enable-optimize_--disable-assert/var/MonetDB"
 "--set" "mapi_open=true" "--set" "mapi_port=36122" "--set" "monet_prompt=" 
"--trace" "--forcemito" "--set" "mal_listing=2" 
"--dbname=mTests_test_BugTracker-2012" "--set" "mal_listing=0"
-# 14:12:34 >  
-
-# builtin opt  gdk_dbname = demo
-# builtin opt  gdk_dbfarm = 
/ufs/manegold/_/Monet/HG/Dec2011/prefix/--disable-debug_--enable-optimize_--disable-assert/var/monetdb5/dbfarm
-# builtin opt  gdk_debug = 0
-# builtin opt  gdk_alloc_map = no
-# builtin opt  gdk_vmtrim = yes
-# builtin opt  monet_prompt = >
-# builtin opt  monet_daemon = no
-# builtin opt  mapi_port = 50000
-# builtin opt  mapi_open = false
-# builtin opt  mapi_autosense = false
-# builtin opt  sql_optimizer = default_pipe
-# builtin opt  sql_debug = 0
-# cmdline opt  gdk_nr_threads = 0
-# cmdline opt  gdk_dbfarm = 
/ufs/manegold/_/Monet/HG/Dec2011/prefix/--disable-debug_--enable-optimize_--disable-assert/var/MonetDB
-# cmdline opt  mapi_open = true
-# cmdline opt  mapi_port = 36122
-# cmdline opt  monet_prompt = 
-# cmdline opt  mal_listing = 2
-# cmdline opt  gdk_dbname = mTests_test_BugTracker-2012
-# cmdline opt  mal_listing = 0
-
-# 14:12:34 >  
-# 14:12:34 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=rome" 
"--port=36122"
-# 14:12:34 >  
-
-MAPI  = monetdb@LAB03:34616
-QUERY = select str_to_date('12-01-01','%y-%m-%d');
-ERROR = !strptime support missing
-MAPI  = monetdb@LAB03:34616
-QUERY = select str_to_date('2012-01-01','%Y-%m-%d');
-ERROR = !strptime support missing
-
-# 14:12:34 >  
-# 14:12:34 >  "Done."
-# 14:12:34 >  
-
diff --git 
a/sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.out.Windows 
b/sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.out.Windows
deleted file mode 100644
--- 
a/sql/test/BugTracker-2012/Tests/date_script_test.Bug-2973.stable.out.Windows
+++ /dev/null
@@ -1,42 +0,0 @@
-stdout of test 'date_script_test.Bug-2973` in directory 
'sql/test/BugTracker-2012` itself:
-
-
-# 14:12:34 >  
-# 14:12:34 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/ufs/manegold/_/Monet/HG/Dec2011/prefix/--disable-debug_--enable-optimize_--disable-assert/var/MonetDB"
 "--set" "mapi_open=true" "--set" "mapi_port=36122" "--set" "monet_prompt=" 
"--trace" "--forcemito" "--set" "mal_listing=2" 
"--dbname=mTests_test_BugTracker-2012" "--set" "mal_listing=0"
-# 14:12:34 >  
-
-# MonetDB 5 server v11.7.2
-# This is an unreleased version
-# Serving database 'mTests_test_BugTracker-2012', using 8 threads
-# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
-# Found 15.662 GiB available main-memory.
-# Copyright (c) 1993-July 2008 CWI.
-# Copyright (c) August 2008-2015 MonetDB B.V., all rights reserved
-# Visit http://www.monetdb.org/ for further information
-# Listening for connection requests on mapi:monetdb://rome.ins.cwi.nl:36122/
-# MonetDB/GIS module loaded
-# MonetDB/SQL module loaded
-
-Ready.
-
-# 14:25:48 >  
-# 14:25:48 >  "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=LAB03" 
"--port=34616"
-# 14:25:48 >  
-
-#select date_to_str('2012-02-11','%y/%m/%d');
-% .L # table_name
-% date_to_str_single_value # name
-% clob # type
-% 8 # length
-[ "12/02/11"   ]
-#select date_to_str('2012-02-11','%Y/%m/%d');
-% .L # table_name
-% date_to_str_single_value # name
-% clob # type
-% 10 # length
-[ "2012/02/11" ]
-
-# 14:25:49 >  
-# 14:25:49 >  "Done."
-# 14:25:49 >  
-
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to