Changeset: 2de73dc7cea2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2de73dc7cea2
Added Files:
        clients/python/MANIFEST.in
        debian/monetdb5-sql.README.Debian
        debian/python3-monetdb.install
        debian/source/format
Removed Files:
        monetdb5/modules/mal/Tests/modulechk.mal
        monetdb5/modules/mal/Tests/modulechk.stable.err
        monetdb5/modules/mal/Tests/modulechk.stable.out
Modified Files:
        clients/Tests/exports.stable.out
        clients/python/monetdb/sql/cursors.py
        clients/python/monetdb/sql/monetize.py
        clients/python/test/capabilities.py
        clients/python3/monetdb/sql/cursors.py
        clients/python3/monetdb/sql/monetize.py
        clients/python3/test/capabilities.py
        common/stream/stream.c
        common/utils/msabaoth.c
        common/utils/msabaoth.h
        configure.ag
        debian/control
        debian/monetdb-testing-python.install
        debian/monetdb5-server.install
        debian/monetdb5-sql.default
        debian/monetdb5-sql.dirs
        debian/monetdb5-sql.init.d
        debian/python-monetdb.install
        debian/rules
        gdk/gdk.h
        gdk/gdk_batop.c
        gdk/gdk_logger.c
        gdk/gdk_select.c
        monetdb5/ChangeLog.Jul2012
        monetdb5/mal/mal.c
        monetdb5/mal/mal_runtime.c
        monetdb5/mal/mal_sabaoth.c
        monetdb5/mal/mal_sabaoth.h
        monetdb5/modules/kernel/algebra.mx
        monetdb5/modules/kernel/status.c
        monetdb5/modules/mal/Tests/All
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/sabaoth.c
        monetdb5/modules/mal/sabaoth.h
        monetdb5/modules/mal/sabaoth.mal
        monetdb5/tests/mapi/Tests/sample0.stable.out
        monetdb5/tests/suite_01/Tests/test_15.stable.out
        sql/server/sql_parser.y
        sql/test/mapi/Tests/python_test_monetdb_sql.stable.err
        testing/Mtest.py.in
        tools/merovingian/ChangeLog.Jul2012
        tools/merovingian/daemon/controlrunner.c
        tools/merovingian/daemon/discoveryrunner.c
        tools/merovingian/daemon/forkmserver.c
        tools/merovingian/daemon/handlers.c
        tools/merovingian/daemon/multiplex-funnel.c
        tools/mserver/mserver5.c
Branch: sciql
Log Message:

Merge with default branch.


diffs (truncated from 2461 to 300 lines):

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
@@ -173,6 +173,7 @@ BAT *BATsort_rev(BAT *b);
 BAT *BATssort(BAT *b);
 BAT *BATssort_rev(BAT *b);
 BAT *BATsubselect(BAT *b, BAT *s, const void *tl, const void *th, int li, int 
hi, int anti);
+gdk_return BATsubsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, 
BAT *g, int reverse, int stable);
 BAT *BATsunion(BAT *b, BAT *c);
 BAT *BATsunique(BAT *b);
 BAT *BATthetajoin(BAT *l, BAT *r, int mode, BUN estimate);
@@ -429,7 +430,8 @@ char *msab_getUplogInfo(sabuplog *ret, c
 void msab_init(char *dbfarm, char *dbname);
 char *msab_marchConnection(const char *host, const int port);
 char *msab_marchScenario(const char *lang);
-char *msab_registerStart(void);
+char *msab_registerStarted(void);
+char *msab_registerStarting(void);
 char *msab_registerStop(void);
 char *msab_retreatScenario(const char *lang);
 char *msab_serialise(char **ret, const sabdb *db);
@@ -718,6 +720,15 @@ str ALGstdev_sht(dbl *res, int *bid);
 str ALGstdev_wrd(dbl *res, int *bid);
 str ALGsubselect1(bat *result, bat *bid, const void *low, const void *high, 
const bit *li, const bit *hi, const bit *anti);
 str ALGsubselect2(bat *result, bat *bid, bat *sid, const void *low, const void 
*high, const bit *li, const bit *hi, const bit *anti);
+str ALGsubsort11(bat *result, bat *bid, bit *reverse, bit *stable);
+str ALGsubsort12(bat *result, bat *norder, bat *bid, bit *reverse, bit 
*stable);
+str ALGsubsort13(bat *result, bat *norder, bat *ngroup, bat *bid, bit 
*reverse, bit *stable);
+str ALGsubsort21(bat *result, bat *bid, bat *order, bit *reverse, bit *stable);
+str ALGsubsort22(bat *result, bat *norder, bat *bid, bat *order, bit *reverse, 
bit *stable);
+str ALGsubsort23(bat *result, bat *norder, bat *ngroup, bat *bid, bat *order, 
bit *reverse, bit *stable);
+str ALGsubsort31(bat *result, bat *bid, bat *order, bat *group, bit *reverse, 
bit *stable);
+str ALGsubsort32(bat *result, bat *norder, bat *bid, bat *order, bat *group, 
bit *reverse, bit *stable);
+str ALGsubsort33(bat *result, bat *norder, bat *ngroup, bat *bid, bat *order, 
bat *group, bit *reverse, bit *stable);
 str ALGsum_bte_bte(bte *res, int *bid, bit *empty_is_nil);
 str ALGsum_bte_dbl(dbl *res, int *bid, bit *empty_is_nil);
 str ALGsum_bte_int(int *res, int *bid, bit *empty_is_nil);
@@ -2288,11 +2299,8 @@ str SABAOTHgetUplogInfo(sabuplog *ret, s
 void SABAOTHinit(str dbfarm, str dbname);
 str SABAOTHmarchConnection(int *ret, str *host, int *port);
 str SABAOTHmarchScenario(int *ret, str *lang);
-str SABAOTHregisterStart(int *ret);
-str SABAOTHregisterStop(int *ret);
 str SABAOTHretreatScenario(int *ret, str *lang);
 str SABAOTHserialise(str *ret, sabdb *db);
-str SABAOTHwildRetreat(int *ret);
 str SABepilogue(int *ret);
 str SABgetLocalConnectionHost(str *ret);
 str SABgetLocalConnectionPort(int *ret);
@@ -2301,7 +2309,6 @@ str SABmarchConnection(int *ret, str *ho
 str SABmarchScenario(int *ret, str *lang);
 str SABprelude(int *ret);
 str SABretreatScenario(int *ret, str *lang);
-str SABwildRetreat(int *ret);
 str SAMPLEuniform(bat *r, bat *b, ptr s);
 str SAMPLEuniform(bat *r, bat *b, ptr s){ BAT *br, *bb;
 str SAMPLEuniform_dbl(bat *r, bat *b, ptr p);
diff --git a/clients/python/MANIFEST.in b/clients/python/MANIFEST.in
new file mode 100644
--- /dev/null
+++ b/clients/python/MANIFEST.in
@@ -0,0 +1,13 @@
+include monetdb/exceptions.py
+include monetdb/sql/pythonize.py
+include monetdb/sql/connections.py
+include monetdb/sql/converters.py
+include monetdb/sql/types.py
+include monetdb/sql/monetize.py
+include monetdb/sql/cursors.py
+include monetdb/sql/__init__.py
+include monetdb/mapi.py
+include monetdb/__init__.py
+include README.rst
+include setup.py
+
diff --git a/clients/python/monetdb/sql/cursors.py 
b/clients/python/monetdb/sql/cursors.py
--- a/clients/python/monetdb/sql/cursors.py
+++ b/clients/python/monetdb/sql/cursors.py
@@ -155,6 +155,9 @@ class Cursor(object):
         will be bound to variables in the operation.
         """
 
+        if not self.connection:
+            self.__exception_handler(ProgrammingError, "cursor is closed")
+
         # clear message history
         self.messages = []
 
diff --git a/clients/python/monetdb/sql/monetize.py 
b/clients/python/monetdb/sql/monetize.py
--- a/clients/python/monetdb/sql/monetize.py
+++ b/clients/python/monetdb/sql/monetize.py
@@ -16,7 +16,9 @@
 # All Rights Reserved.
 
 """
-functions for converting python objects to monetdb SQL format
+functions for converting python objects to monetdb SQL format. If you want
+to add support for a specific type you should add a function as a value to
+the mapping dict and the datatype as key.
 """
 
 import datetime
@@ -77,9 +79,4 @@ def convert(data):
     try:
         return mapping[type(data)](data)
     except KeyError:
-        if hasattr(data, '__unicode__'):
-            return unicode(data).encode('utf-8')
-        elif hasattr(data, '__str__'):
-            return str(data)
-        else:
-            raise ProgrammingError("type %s not supported as value" % 
type(data))
\ No newline at end of file
+        raise ProgrammingError("type %s not supported as value" % type(data))
\ No newline at end of file
diff --git a/clients/python/test/capabilities.py 
b/clients/python/test/capabilities.py
--- a/clients/python/test/capabilities.py
+++ b/clients/python/test/capabilities.py
@@ -25,7 +25,7 @@
 """
 from time import time
 import unittest
-
+from monetdb.exceptions import ProgrammingError
 
 class DatabaseTest(unittest.TestCase):
 
@@ -342,3 +342,14 @@ class DatabaseTest(unittest.TestCase):
         self.cursor.execute('select * from tables, tables')
         r = self.cursor.fetchall()
         self.assertEqual(len(r), n**2)
+
+    def test_closecur(self):
+        self.cursor.close()
+        self.assertRaises(ProgrammingError, self.cursor.execute, "select * 
from tables")
+        self.cursor = self.connection.cursor()
+
+    def test_customtype(self):
+        t = ["list", "test"]
+        self.assertRaises(ProgrammingError, self.db_module.monetize.convert, t)
+        self.db_module.monetize.mapping[list] = str
+        self.assertEqual(self.db_module.monetize.convert(t), "['list', 
'test']")
\ No newline at end of file
diff --git a/clients/python3/monetdb/sql/cursors.py 
b/clients/python3/monetdb/sql/cursors.py
--- a/clients/python3/monetdb/sql/cursors.py
+++ b/clients/python3/monetdb/sql/cursors.py
@@ -157,6 +157,9 @@ class Cursor:
         will be bound to variables in the operation.
         """
 
+        if not self.connection:
+            self.__exception_handler(ProgrammingError, "cursor is closed")
+
         # clear message history
         self.messages = []
 
diff --git a/clients/python3/monetdb/sql/monetize.py 
b/clients/python3/monetdb/sql/monetize.py
--- a/clients/python3/monetdb/sql/monetize.py
+++ b/clients/python3/monetdb/sql/monetize.py
@@ -16,12 +16,15 @@
 # All Rights Reserved.
 
 """
-functions for converting python objects to monetdb SQL format
+functions for converting python objects to monetdb SQL format. If you want
+to add support for a specific type you should add a function as a value to
+the mapping dict and the datatype as key.
 """
 
 import datetime
 import logging
 import decimal
+from monetdb.exceptions import ProgrammingError
 
 logger = logging.getLogger("monetdb")
 
diff --git a/clients/python3/test/capabilities.py 
b/clients/python3/test/capabilities.py
--- a/clients/python3/test/capabilities.py
+++ b/clients/python3/test/capabilities.py
@@ -24,10 +24,8 @@
 
 """
 from time import time
-import array
 import unittest
-import sys
-
+from monetdb.exceptions import ProgrammingError
 
 class DatabaseTest(unittest.TestCase):
 
@@ -325,7 +323,6 @@ class DatabaseTest(unittest.TestCase):
             ('col1 TINYINT',),
             generator)
 
-
     def test_small_CHAR(self):
         # Character data
         def generator(row,col):
@@ -337,7 +334,6 @@ class DatabaseTest(unittest.TestCase):
             ('col1 char(1)','col2 char(1)'),
             generator)
 
-
     def test_description(self):
         self.table = self.new_table_name()
         shouldbe = [
@@ -353,8 +349,6 @@ class DatabaseTest(unittest.TestCase):
         finally:
             self.cursor.execute('drop table %s' % (self.table))
 
-
-
     def test_bigresult(self):
         self.cursor.execute('select count(*) from tables')
         r = self.cursor.fetchone()
@@ -364,3 +358,13 @@ class DatabaseTest(unittest.TestCase):
         r = self.cursor.fetchall()
         self.assertEqual(len(r), n**2)
 
+    def test_closecur(self):
+        self.cursor.close()
+        self.assertRaises(ProgrammingError, self.cursor.execute, "select * 
from tables")
+        self.cursor = self.connection.cursor()
+
+    def test_customtype(self):
+        t = ["list", "test"]
+        self.assertRaises(ProgrammingError, self.db_module.monetize.convert, t)
+        self.db_module.monetize.mapping[list] = str
+        self.assertEqual(self.db_module.monetize.convert(t), "['list', 
'test']")
diff --git a/common/stream/stream.c b/common/stream/stream.c
--- a/common/stream/stream.c
+++ b/common/stream/stream.c
@@ -305,7 +305,6 @@ mnstr_fgetpos(stream *s, lng *p)
 #ifdef STREAM_DEBUG
        printf("fgetpos %s\n", s->name ? s->name : "<unnamed>");
 #endif
-       assert(s->access == ST_WRITE);
        if (s->errnr)
                return s->errnr;
        if (s->fgetpos)
diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -365,6 +365,7 @@ msab_wildRetreat(void)
 }
 
 #define UPLOGFILE ".uplog"
+#define STARTINGFILE ".starting"
 /**
  * Writes a start attempt to the sabaoth start/stop log.  Examination of
  * the log at a later stage reveals crashes of the server.  In addition
@@ -372,7 +373,7 @@ msab_wildRetreat(void)
  * the current process behind.
  */
 char *
-msab_registerStart(void)
+msab_registerStarting(void)
 {
        /* The sabaoth uplog is in fact a simple two column table that
         * contains a start time and a stop time.  Start times are followed
@@ -408,6 +409,31 @@ msab_registerStart(void)
                return(NULL);
        }
        fclose(fopen(path, "w"));
+       /* flag this database as starting up, with the same boundary
+        * conditions as above */
+       if ((tmp = getDBPath(&path, PATHLENGTH, STARTINGFILE)) != NULL)
+               return(tmp);
+       fclose(fopen(path, "w"));
+
+       return(NULL);
+}
+
+/**
+ * Removes the starting state, and turns this into a fully started
+ * engine.  The caller is responsible for calling registerStarting()
+ * first.
+ */
+char *
+msab_registerStarted(void)
+{
+       char pathbuf[PATHLENGTH];
+       char *path = pathbuf;
+       char *tmp;
+
+       /* remove starting flag */
+       if ((tmp = getDBPath(&path, PATHLENGTH, STARTINGFILE)) != NULL)
+               return(tmp);
+       unlink(path);
 
        return(NULL);
 }
@@ -597,7 +623,14 @@ msab_getStatus(sabdb** ret, char *dbname
                                        /* the log is empty, assume no crash */
                                        sdb->state = SABdbInactive;
                                } else if (data[0] == '\t') {
-                                       sdb->state = SABdbRunning;
+                                       /* see if the database has finished 
starting */
+                                       snprintf(buf, sizeof(buf), "%s/%s/%s",
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to