Changeset: 9424092b1874 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9424092b1874 Added Files: monetdb5/modules/mal/Tests/pqueue.mal monetdb5/modules/mal/Tests/pqueue.stable.err monetdb5/modules/mal/Tests/pqueue.stable.out sql/test/BugTracker-2013/Tests/aggregates-typing-issues.Bug-3277.sql sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.sql sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.stable.err sql/test/BugTracker-2013/Tests/copy-into-decimal.Bug-3265.stable.out sql/test/BugTracker-2013/Tests/empty-strings.Bug-3261.SQL.py sql/test/BugTracker-2013/Tests/empty-strings.Bug-3261.stable.err sql/test/BugTracker-2013/Tests/empty-strings.Bug-3261.stable.out sql/test/BugTracker-2013/Tests/median-null.Bug-3280.sql sql/test/BugTracker-2013/Tests/median-null.Bug-3280.stable.err sql/test/BugTracker-2013/Tests/median-null.Bug-3280.stable.out sql/test/BugTracker-2013/Tests/numeric-column-alias.Bug-3279.sql sql/test/BugTracker-2013/Tests/numeric-column-alias.Bug-3279.stable.err sql/test/BugTracker-2013/Tests/numeric-column-alias.Bug-3279.stable.out sql/test/BugTracker-2013/Tests/numeric-column-orderby.Bug-3278.sql sql/test/BugTracker-2013/Tests/numeric-column-orderby.Bug-3278.stable.err sql/test/BugTracker-2013/Tests/numeric-column-orderby.Bug-3278.stable.out sql/test/centipede/Tests/All sql/test/centipede/Tests/olap.sql Removed Files: sql/test/BugTracker-2013/Tests/aggregates-typing-issues.Bug-3277.csv sql/test/BugTracker-2013/Tests/aggregates-typing-issues.Bug-3277.sql.in Modified Files: clients/Tests/exports.stable.out clients/mapilib/mapi.c clients/python2/monetdb/sql/pythonize.py clients/python2/monetdb/sql/types.py clients/python2/test/capabilities.py clients/python3/monetdb/sql/pythonize.py clients/python3/monetdb/sql/types.py clients/python3/test/capabilities.py clients/python3/test/run.sh common/stream/stream.c common/stream/stream.h gdk/ChangeLog.Feb2013 gdk/gdk.h gdk/gdk_atoms.c gdk/gdk_bat.c gdk/gdk_bbp.c gdk/gdk_join.c gdk/gdk_logger.c gdk/gdk_posix.c gdk/gdk_storage.c gdk/gdk_utils.c geom/monetdb5/geom.c monetdb5/mal/mal_authorize.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_instruction.h monetdb5/mal/mal_interpreter.c monetdb5/modules/atoms/blob.c monetdb5/modules/atoms/url.c monetdb5/modules/kernel/aggr.c monetdb5/modules/mal/Tests/All monetdb5/modules/mal/pqueue.c monetdb5/modules/mal/remote.c monetdb5/optimizer/opt_centipede.c sql/backends/monet5/datacell/actuator.c sql/backends/monet5/datacell/receptor.c sql/backends/monet5/sql.mx sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_result.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/vaults/mseed.c sql/common/sql_types.c sql/scripts/39_analytics.sql sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090_nogeom.stable.out sql/test/BugTracker-2013/Tests/All sql/test/BugTracker-2013/Tests/aggregates-typing-issues.Bug-3277.stable.err sql/test/BugTracker-2013/Tests/aggregates-typing-issues.Bug-3277.stable.out sql/test/Tests/systemfunctions.stable.out sql/test/Tests/systemfunctions_nogeom.stable.out sql/test/leaks/Tests/check0.stable.out sql/test/leaks/Tests/check0_nogeom.stable.out sql/test/leaks/Tests/check1.stable.out sql/test/leaks/Tests/check1_nogeom.stable.out sql/test/leaks/Tests/check2.stable.out sql/test/leaks/Tests/check2_nogeom.stable.out sql/test/leaks/Tests/check3.stable.out sql/test/leaks/Tests/check3_nogeom.stable.out sql/test/leaks/Tests/check4.stable.out sql/test/leaks/Tests/check4_nogeom.stable.out sql/test/leaks/Tests/check5.stable.out sql/test/leaks/Tests/check5_nogeom.stable.out sql/test/mapi/Tests/php_monetdb.stable.out sql/test/mapi/Tests/php_monetdb_nogeom.stable.out sql/test/mapi/Tests/python2_test_monetdb_sql.stable.err sql/test/mapi/Tests/python3_test_monetdb_sql.stable.err sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out Branch: rdf Log Message:
Merge with default branch diffs (truncated from 6499 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 @@ -2988,7 +2988,7 @@ void removeInstruction(MalBlkPtr mb, Ins void removeInstructionBlock(MalBlkPtr mb, int pc, int cnt); int removeProp; void removeVariable(MalBlkPtr mb, int varid); -void renameVariable(MalBlkPtr mb, int i, str name); +void renameVariable(MalBlkPtr mb, int i, str pattern, int newid); str replaceRef; str replicatorRef; void resetMalBlk(MalBlkPtr mb, int stop); diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1036,8 +1036,8 @@ static int mapi_initialized = 0; do { \ if ((s) == NULL || mnstr_errnr(s)) { \ mapi_log_record(mid,msg); \ - mapi_log_record(mid,f); \ - close_connection(mid); \ + mapi_log_record(mid,f); \ + close_connection(mid); \ mapi_setError((mid), (msg), (f), MTIMEOUT); \ return (e); \ } \ @@ -3290,12 +3290,12 @@ read_line(Mapi mid) if (mid->trace == MAPI_TRACE) printf("fetch next block: start at:%d\n", mid->blk.end); len = mnstr_read(mid->from, mid->blk.buf + mid->blk.end, 1, BLOCK); + check_stream(mid, mid->from, "Connection terminated", "read_line", (mid->blk.eos = 1, (char *) 0)); if (mid->tracelog) { mapi_log_header(mid, "R"); mnstr_write(mid->tracelog, mid->blk.buf + mid->blk.end, 1, len); mnstr_flush(mid->tracelog); } - check_stream(mid, mid->from, "Connection terminated", "read_line", (mid->blk.eos = 1, (char *) 0)); mid->blk.buf[mid->blk.end + len] = 0; if (mid->trace == MAPI_TRACE) { printf("got next block: length:" SSZFMT "\n", len); 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 @@ -26,41 +26,7 @@ from monetdb.sql import types from monetdb.exceptions import ProgrammingError -def strip(data): - """ returns a python string, with chopped off quotes, - and replaced escape characters""" - return data[1:-1].decode('string_escape').decode('utf-8') - - -def py_bool(data): - """ return python boolean """ - return data == "true" - - -def py_time(data): - """ returns a python Time - """ - return Time(*[int(float(x)) for x in data.split(':')]) - - -def py_date(data): - """ Returns a python Date - """ - return Date(*[int(float(x)) for x in data.split('-')]) - - -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)) - - -def py_timestamptz(data): - """ Returns a python Timestamp where data contains a tz code - """ +def _extract_timezone(data): if data.find('+') != -1: (dt, tz) = data.split("+") (tzhour, tzmin) = [int(x) for x in tz.split(':')] @@ -72,6 +38,53 @@ def py_timestamptz(data): else: raise ProgrammingError("no + or - in %s" % data) + return dt, tzhour, tzmin + + +def strip(data): + """ returns a python string, with chopped off quotes, + and replaced escape characters""" + return data[1:-1].decode('string_escape').decode('utf-8') + + +def py_bool(data): + """ return python boolean """ + return data == "true" + + +def py_time(data): + """ returns a python Time + """ + return Time(*[int(float(x)) for x in data.split(':')]) + + +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) + + +def py_date(data): + """ Returns a python Date + """ + return Date(*[int(float(x)) for x in data.split('-')]) + + +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)) + + +def py_timestamptz(data): + """ Returns a python Timestamp where data contains a tz code + """ + dt, tzhour, tzmin = _extract_timezone(data) (datestr, timestr) = dt.split(" ") date = [int(float(x)) for x in datestr.split('-')] time = [int(float(x)) for x in timestr.split(':')] @@ -79,6 +92,7 @@ def py_timestamptz(data): hour, minute, second = time return Timestamp(year, month, day, hour + tzhour, minute + tzmin, second) + mapping = { types.CHAR: strip, types.VARCHAR: strip, @@ -97,6 +111,7 @@ mapping = { types.TIME: py_time, types.TIMESTAMP: py_timestamp, types.TIMESTAMPTZ: py_timestamptz, + types.TIMETZ: py_timetz, types.INTERVAL: strip, types.MONTH_INTERVAL: strip, types.SEC_INTERVAL: strip, @@ -105,6 +120,8 @@ mapping = { types.MEDIUMINT: int, types.LONGINT: int, types.FLOAT: float, + types.URL: strip, + types.INET: str, } diff --git a/clients/python2/monetdb/sql/types.py b/clients/python2/monetdb/sql/types.py --- a/clients/python2/monetdb/sql/types.py +++ b/clients/python2/monetdb/sql/types.py @@ -42,12 +42,16 @@ SEC_INTERVAL = 'sec_interval' WRD = 'wrd' TINYINT = 'tinyint' +URL = 'url' +INET = 'inet' + # Not on the website: SHORTINT = 'shortint' MEDIUMINT = 'mediumint' LONGINT = 'longint' FLOAT = 'float' TIMESTAMPTZ = 'timestamptz' +TIMETZ = 'timetz' # full names and aliases, spaces are replaced with underscores diff --git a/clients/python2/test/capabilities.py b/clients/python2/test/capabilities.py --- a/clients/python2/test/capabilities.py +++ b/clients/python2/test/capabilities.py @@ -241,6 +241,14 @@ class DatabaseTest(unittest.TestCase): ('col1 TIME',), generator) + def test_TIME(self): + ticks = time() + def generator(row,col): + return self.db_module.TimeFromTicks(ticks+row*86400-col*1313) + self.check_data_integrity( + ('col1 TIMETZ',), + generator) + def test_DATETIME(self): ticks = time() def generator(row,col): @@ -319,6 +327,20 @@ class DatabaseTest(unittest.TestCase): ('col1 BOOL',), generator) + def test_URL(self): + def generator(row,col): + return "http://example.org/something" + self.check_data_integrity( + ('col1 URL',), + generator) + + def test_INET(self): + def generator(row,col): + return "192.168.254.101" + self.check_data_integrity( + ('col1 INET',), + generator) + def test_description(self): self.table = self.new_table_name() shouldbe = [ diff --git a/clients/python3/monetdb/sql/pythonize.py b/clients/python3/monetdb/sql/pythonize.py --- a/clients/python3/monetdb/sql/pythonize.py +++ b/clients/python3/monetdb/sql/pythonize.py @@ -27,44 +27,7 @@ from monetdb.sql import types from monetdb.exceptions import ProgrammingError -def strip(data): - """ returns a python string, with chopped off quotes, - and replaced escape characters""" - return ''.join([w.encode('utf-8').decode('unicode_escape') - if '\\' in w - else w - for w in re.split('([\000-\200]+)', data[1:-1])]) - - -def py_bool(data): - """ return python boolean """ - return data == "true" - - -def py_time(data): - """ returns a python Time - """ - return Time(*[int(float(x)) for x in data.split(':')]) - - -def py_date(data): - """ Returns a python Date - """ - return Date(*[int(float(x)) for x in data.split('-')]) - - -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)) - - -def py_timestamptz(data): - """ Returns a python Timestamp where data contains a tz code - """ +def _extract_timezone(data): if data.find('+') != -1: (dt, tz) = data.split("+") (tzhour, tzmin) = [int(x) for x in tz.split(':')] @@ -76,6 +39,56 @@ def py_timestamptz(data): else: raise ProgrammingError("no + or - in %s" % data) + return dt, tzhour, tzmin + + +def strip(data): + """ returns a python string, with chopped off quotes, + and replaced escape characters""" + return ''.join([w.encode('utf-8').decode('unicode_escape') + if '\\' in w + else w + for w in re.split('([\000-\200]+)', data[1:-1])]) + + +def py_bool(data): + """ return python boolean """ + return data == "true" + + +def py_time(data): + """ returns a python Time + """ + return Time(*[int(float(x)) for x in data.split(':')]) + + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list