Changeset: 68963f7f9de7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=68963f7f9de7
Added Files:
        sql/test/BugTracker-2014/Tests/integer-cast.Bug-3424.sql
        sql/test/BugTracker-2014/Tests/integer-cast.Bug-3424.stable.err
        sql/test/BugTracker-2014/Tests/integer-cast.Bug-3424.stable.out
        sql/test/BugTracker-2014/Tests/python-microseconds.Bug-3439.SQL.py
        sql/test/BugTracker-2014/Tests/python-microseconds.Bug-3439.stable.err
        sql/test/BugTracker-2014/Tests/python-microseconds.Bug-3439.stable.out
        sql/test/Tests/alastair_udf_mergetable_bug.py
        sql/test/Tests/alastair_udf_mergetable_bug.stable.err
        sql/test/Tests/alastair_udf_mergetable_bug.stable.out
Modified Files:
        clients/mapiclient/dump.c
        clients/mapiclient/mclient.c
        clients/python2/monetdb/sql/pythonize.py
        clients/python3/monetdb/sql/pythonize.py
        common/stream/stream.c
        common/utils/msabaoth.c
        common/utils/mutils.c
        configure.ag
        gdk/gdk_atoms.c
        gdk/gdk_bbp.c
        gdk/gdk_calc.c
        gdk/gdk_heap.c
        gdk/gdk_posix.c
        gdk/gdk_storage.c
        gdk/gdk_utils.c
        java/src/nl/cwi/monetdb/jdbc/MonetPreparedStatement.java
        monetdb5/mal/Tests/tst013.stable.out
        monetdb5/mal/Tests/tst036.stable.out
        monetdb5/mal/Tests/tst050.stable.out
        monetdb5/mal/Tests/tst070.stable.out
        monetdb5/mal/Tests/tst105.stable.out
        monetdb5/mal/Tests/tst106.stable.out
        monetdb5/mal/Tests/tst150.stable.out
        monetdb5/mal/Tests/tst2504.mal
        monetdb5/mal/Tests/tst2504.stable.out
        monetdb5/mal/Tests/tst611.stable.out
        monetdb5/mal/mal_atom.c
        monetdb5/mal/mal_box.c
        monetdb5/mal/mal_factory.c
        monetdb5/mal/mal_import.c
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_linker.c
        monetdb5/mal/mal_module.c
        monetdb5/mal/mal_parser.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_readline.c
        monetdb5/mal/mal_resolve.c
        monetdb5/mal/mal_session.c
        monetdb5/modules/atoms/inet.c
        monetdb5/modules/atoms/str.c
        monetdb5/modules/mal/bbp.c
        monetdb5/optimizer/Tests/inline08.stable.out
        monetdb5/optimizer/opt_accumulators.c
        monetdb5/optimizer/opt_aliases.c
        monetdb5/optimizer/opt_centipede.c
        monetdb5/optimizer/opt_macro.c
        monetdb5/optimizer/opt_mapreduce.c
        monetdb5/optimizer/opt_octopus.c
        monetdb5/optimizer/opt_pushselect.c
        monetdb5/scheduler/run_octopus.c
        monetdb5/scheduler/srvpool.c
        
monetdb5/tests/BugDay_2005-10-06_4.9.3/Tests/ADT_not_available.SF-850137.stable.out
        monetdb5/tests/BugReports/Tests/lngssaretruncated.stable.out
        monetdb5/tests/BugTracker/Tests/parser.SF-2051309.stable.out
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_scenario.c
        sql/server/sql_mvc.c
        sql/test/ADT2006/bram.sql
        
sql/test/BugTracker-2012/Tests/table_function_with_column_subselects.Bug-3172.stable.err
        sql/test/BugTracker-2014/Tests/All
        testing/process.py
        tools/merovingian/daemon/argvcmds.c
        tools/merovingian/daemon/merovingian.c
        tools/mserver/mserver5.c
Branch: int128
Log Message:

Merge with Jan2014 branch.


diffs (truncated from 4792 to 300 lines):

diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -790,70 +790,69 @@ describe_table(Mapi mid, char *schema, c
        if (view) {
                /* the table is actually a view */
                mnstr_printf(toConsole, "%s\n", view);
-               goto doreturn;
+       } else {
+               /* the table is a real table */
+               mnstr_printf(toConsole, "CREATE TABLE \"%s\".\"%s\" ", schema, 
tname);
+
+               if (dump_column_definition(mid, toConsole, schema, tname, NULL, 
foreign))
+                       goto bailout;
+               mnstr_printf(toConsole, ";\n");
+
+               snprintf(query, maxquerylen,
+                        "SELECT \"i\".\"name\", "              /* 0 */
+                               "\"k\".\"name\", "              /* 1 */
+                               "\"kc\".\"nr\", "               /* 2 */
+                               "\"c\".\"name\" "               /* 3 */
+                        "FROM \"sys\".\"idxs\" AS \"i\" LEFT JOIN 
\"sys\".\"keys\" AS \"k\" "
+                                       "ON \"i\".\"name\" = \"k\".\"name\", "
+                             "\"sys\".\"objects\" AS \"kc\", "
+                             "\"sys\".\"_columns\" AS \"c\", "
+                             "\"sys\".\"schemas\" \"s\", "
+                             "\"sys\".\"_tables\" AS \"t\" "
+                        "WHERE \"i\".\"table_id\" = \"t\".\"id\" AND "
+                              "\"i\".\"id\" = \"kc\".\"id\" AND "
+                              "\"t\".\"id\" = \"c\".\"table_id\" AND "
+                              "\"kc\".\"name\" = \"c\".\"name\" AND "
+                              "(\"k\".\"type\" IS NULL OR \"k\".\"type\" = 1) 
AND "
+                              "\"t\".\"schema_id\" = \"s\".\"id\" AND "
+                              "\"s\".\"name\" = '%s' AND "
+                              "\"t\".\"name\" = '%s' "
+                        "ORDER BY \"i\".\"name\", \"kc\".\"nr\"", schema, 
tname);
+               if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid))
+                       goto bailout;
+               cnt = 0;
+               while (mapi_fetch_row(hdl) != 0) {
+                       char *i_name = mapi_fetch_field(hdl, 0);
+                       char *k_name = mapi_fetch_field(hdl, 1);
+                       char *kc_nr = mapi_fetch_field(hdl, 2);
+                       char *c_name = mapi_fetch_field(hdl, 3);
+
+                       if (mapi_error(mid))
+                               goto bailout;
+                       if (k_name != NULL) {
+                               /* unique key, already handled */
+                               continue;
+                       }
+
+                       if (strcmp(kc_nr, "0") == 0) {
+                               if (cnt)
+                                       mnstr_printf(toConsole, ");\n");
+                               mnstr_printf(toConsole,
+                                            "CREATE INDEX \"%s\" ON 
\"%s\".\"%s\" (",
+                                            i_name, schema, tname);
+                               cnt = 1;
+                       } else
+                               mnstr_printf(toConsole, ", ");
+                       mnstr_printf(toConsole, "\"%s\"", c_name);
+                       if (mnstr_errnr(toConsole))
+                               goto bailout;
+               }
+               if (cnt)
+                       mnstr_printf(toConsole, ");\n");
+               if (mapi_error(mid))
+                       goto bailout;
        }
 
-       mnstr_printf(toConsole, "CREATE TABLE \"%s\".\"%s\" ", schema, tname);
-
-       if (dump_column_definition(mid, toConsole, schema, tname, NULL, 
foreign))
-               goto bailout;
-       mnstr_printf(toConsole, ";\n");
-
-       snprintf(query, maxquerylen,
-                "SELECT \"i\".\"name\", "              /* 0 */
-                       "\"k\".\"name\", "              /* 1 */
-                       "\"kc\".\"nr\", "               /* 2 */
-                       "\"c\".\"name\" "               /* 3 */
-                "FROM \"sys\".\"idxs\" AS \"i\" LEFT JOIN \"sys\".\"keys\" AS 
\"k\" "
-                               "ON \"i\".\"name\" = \"k\".\"name\", "
-                     "\"sys\".\"objects\" AS \"kc\", "
-                     "\"sys\".\"_columns\" AS \"c\", "
-                     "\"sys\".\"schemas\" \"s\", "
-                     "\"sys\".\"_tables\" AS \"t\" "
-                "WHERE \"i\".\"table_id\" = \"t\".\"id\" AND "
-                      "\"i\".\"id\" = \"kc\".\"id\" AND "
-                      "\"t\".\"id\" = \"c\".\"table_id\" AND "
-                      "\"kc\".\"name\" = \"c\".\"name\" AND "
-                      "(\"k\".\"type\" IS NULL OR \"k\".\"type\" = 1) AND "
-                      "\"t\".\"schema_id\" = \"s\".\"id\" AND "
-                      "\"s\".\"name\" = '%s' AND "
-                      "\"t\".\"name\" = '%s' "
-                "ORDER BY \"i\".\"name\", \"kc\".\"nr\"", schema, tname);
-       if ((hdl = mapi_query(mid, query)) == NULL || mapi_error(mid))
-               goto bailout;
-       cnt = 0;
-       while (mapi_fetch_row(hdl) != 0) {
-               char *i_name = mapi_fetch_field(hdl, 0);
-               char *k_name = mapi_fetch_field(hdl, 1);
-               char *kc_nr = mapi_fetch_field(hdl, 2);
-               char *c_name = mapi_fetch_field(hdl, 3);
-
-               if (mapi_error(mid))
-                       goto bailout;
-               if (k_name != NULL) {
-                       /* unique key, already handled */
-                       continue;
-               }
-
-               if (strcmp(kc_nr, "0") == 0) {
-                       if (cnt)
-                               mnstr_printf(toConsole, ");\n");
-                       mnstr_printf(toConsole,
-                                    "CREATE INDEX \"%s\" ON \"%s\".\"%s\" (",
-                                    i_name, schema, tname);
-                       cnt = 1;
-               } else
-                       mnstr_printf(toConsole, ", ");
-               mnstr_printf(toConsole, "\"%s\"", c_name);
-               if (mnstr_errnr(toConsole))
-                       goto bailout;
-       }
-       if (cnt)
-               mnstr_printf(toConsole, ");\n");
-       if (mapi_error(mid))
-               goto bailout;
-
-  doreturn:
        if (hdl)
                mapi_close_handle(hdl);
        if (view)
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1639,7 +1639,7 @@ doRequest(Mapi mid, const char *buf)
        return 0;
 }
 
-#define CHECK_RESULT(mid, hdl, buf, break_or_continue)                 \
+#define CHECK_RESULT(mid, hdl, buf, break_or_continue,freebuf)                 
\
                switch (mapi_error(mid)) {                              \
                case MOK:                                               \
                        /* everything A OK */                           \
@@ -1674,7 +1674,7 @@ doRequest(Mapi mid, const char *buf)
                                mapi_explain(mid, stderr);              \
                        errseen = 1;                                    \
                        timerEnd();                                     \
-                       free(buf);                                      \
+                       if( freebuf) free(freebuf);                             
        \
                        return 1;                                       \
                }
 
@@ -1721,7 +1721,7 @@ doFileBulk(Mapi mid, FILE *fp)
 
                if (hdl == NULL) {
                        hdl = mapi_query_prep(mid);
-                       CHECK_RESULT(mid, hdl, buf, continue);
+                       CHECK_RESULT(mid, hdl, buf, continue, buf);
                }
 
                if (first &&
@@ -1735,7 +1735,7 @@ doFileBulk(Mapi mid, FILE *fp)
                        assert(hdl != NULL);
 
                        mapi_query_part(hdl, buf + skip, length - skip);
-                       CHECK_RESULT(mid, hdl, buf + skip, continue);
+                       CHECK_RESULT(mid, hdl, buf + skip, continue, buf);
 
                        /*  make sure there is a newline in the buffer */
                        if (strchr(buf + skip, '\n') == NULL)
@@ -1754,14 +1754,14 @@ doFileBulk(Mapi mid, FILE *fp)
                                (length > 0 || mapi_query_done(hdl) == MMORE))
                        continue;       /* get more data */
 
-               CHECK_RESULT(mid, hdl, buf + skip, continue);
+               CHECK_RESULT(mid, hdl, buf + skip, continue, buf);
 
                rc = format_result(mid, hdl, 0);
 
                if (rc == MMORE && (length > 0 || mapi_query_done(hdl) != MOK))
                        continue;       /* get more data */
 
-               CHECK_RESULT(mid, hdl, buf + skip, continue);
+               CHECK_RESULT(mid, hdl, buf + skip, continue, buf);
 
                mapi_close_handle(hdl);
                hdl = NULL;
@@ -2317,7 +2317,7 @@ doFile(Mapi mid, const char *file, int u
                                                                  "" :
                                                                  "AND 
\"system\" = false"));
                                                hdl = mapi_query(mid, q);
-                                               CHECK_RESULT(mid, hdl, buf, 
continue);
+                                               CHECK_RESULT(mid, hdl, buf, 
continue, buf);
                                                while (fetch_row(hdl) == 5) {
                                                        name = 
mapi_fetch_field(hdl, 0);
                                                        type = 
mapi_fetch_field(hdl, 1);
@@ -2505,7 +2505,7 @@ doFile(Mapi mid, const char *file, int u
                if (hdl == NULL) {
                        timerStart();
                        hdl = mapi_query_prep(mid);
-                       CHECK_RESULT(mid, hdl, buf, continue);
+                       CHECK_RESULT(mid, hdl, buf, continue, buf);
                } else
                        timerResume();
 
@@ -2514,7 +2514,7 @@ doFile(Mapi mid, const char *file, int u
                if (length > 0) {
                        SQLsetSpecial(line);
                        mapi_query_part(hdl, line, length);
-                       CHECK_RESULT(mid, hdl, buf, continue);
+                       CHECK_RESULT(mid, hdl, buf, continue, buf);
                }
 
                /* If the server wants more but we're at the
@@ -2532,7 +2532,7 @@ doFile(Mapi mid, const char *file, int u
                                continue;       /* done */
                        }
                }
-               CHECK_RESULT(mid, hdl, buf, continue);
+               CHECK_RESULT(mid, hdl, buf, continue, buf);
 
                if (mapi_get_querytype(hdl) == Q_PREPARE) {
                        prepno = mapi_get_tableid(hdl);
@@ -2544,7 +2544,7 @@ doFile(Mapi mid, const char *file, int u
                if (rc == MMORE && (line != NULL || mapi_query_done(hdl) != 
MOK))
                        continue;       /* get more data */
 
-               CHECK_RESULT(mid, hdl, buf, continue);
+               CHECK_RESULT(mid, hdl, buf, continue, buf);
 
                timerEnd();
                mapi_close_handle(hdl);
diff --git a/clients/python2/monetdb/sql/pythonize.py 
b/clients/python2/monetdb/sql/pythonize.py
--- a/clients/python2/monetdb/sql/pythonize.py
+++ b/clients/python2/monetdb/sql/pythonize.py
@@ -27,19 +27,16 @@ from monetdb.exceptions import Programmi
 
 
 def _extract_timezone(data):
-    if data.find('+') != -1:
-        (dt, tz) = data.split("+")
-        (tzhour, tzmin) = [int(x) for x in tz.split(':')]
-    elif data.find('-') != -1:
-        (dt, tz) = data.split("-")
-        (tzhour, tzmin) = [int(x) for x in tz.split(':')]
-        tzhour *= -1
-        tzmin *= -1
+    sign_symbol = data[-6]
+
+    if sign_symbol == '+':
+        sign = 1
+    elif sign_symbol == '-':
+        sign = -1
     else:
         raise ProgrammingError("no + or - in %s" % data)
 
-    return dt, tzhour, tzmin
-
+    return data[:-6], datetime.timedelta(hours=sign * int(data[-5:-3]), 
minutes=sign * int(data[-2:]))
 
 def strip(data):
     """ returns a python string, with chopped off quotes,
@@ -55,42 +52,33 @@ def py_bool(data):
 def py_time(data):
     """ returns a python Time
     """
-    return Time(*[int(float(x)) for x in data.split(':')])
+    return datetime.datetime.strptime(data, '%H:%M:%S').time()
 
 
 def py_timetz(data):
     """ returns a python Time where data contains a tz code
     """
-    dt, tzhour, tzmin = _extract_timezone(data)
-    hour, minute, second = [int(float(x)) for x in dt.split(':')]
-    return Time(hour + tzhour, minute + tzmin, second)
+    t, timezone_delta = _extract_timezone(data)
+    return (datetime.datetime.strptime(t, '%H:%M:%S') + timezone_delta).time()
 
 
 def py_date(data):
     """ Returns a python Date
     """
-    return Date(*[int(float(x)) for x in data.split('-')])
+    return datetime.datetime.strptime(data, '%Y-%m-%d').date()
 
 
 def py_timestamp(data):
     """ Returns a python Timestamp
     """
-    splitted = data.split(" ")
-    date = [int(float(x)) for x in splitted[0].split('-')]
-    time = [int(float(x)) for x in splitted[1].split(':')]
-    return Timestamp(*(date + time))
+    return datetime.datetime.strptime(data, '%Y-%m-%d %H:%M:%S.%f')
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to