Changeset: 52675ee7ab2d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=52675ee7ab2d Added Files: sql/test/BugTracker-2015/Tests/long_insert.Bug-3845.sql Removed Files: clients/nodejs/Tests/nodetest.js clients/nodejs/monetdb/README.md clients/nodejs/monetdb/mapiclient.js clients/nodejs/monetdb/package.json Modified Files: .hgtags MonetDB.spec NT/installer32/MonetDB-ODBC-Installer.vdproj NT/installer32/MonetDB5-Geom-Module.vdproj NT/installer32/MonetDB5-SQL-Installer.vdproj NT/installer64/MonetDB-ODBC-Installer.vdproj NT/installer64/MonetDB5-Geom-Module.vdproj NT/installer64/MonetDB5-SQL-Installer.vdproj NT/monetdb_config.h.in NT/rules.msc clients/Makefile.ag clients/mapiclient/mclient.c clients/mapilib/mapi.rc clients/odbc/driver/driver.rc clients/odbc/winsetup/setup.rc clients/python2/setup.py clients/python3/setup.py clients/ruby/Makefile.ag clients/ruby/Tests/All clients/ruby/Tests/rubytest.rb configure.ag debian/changelog gdk/gdk_atoms.c gdk/libbat.rc libversions monetdb5/modules/mal/manifold.c monetdb5/optimizer/opt_costModel.c monetdb5/tools/libmonetdb5.rc sql/test/BugTracker-2015/Tests/All vertoo.data Branch: embedded Log Message:
merge with default diffs (truncated from 1051 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -610,3 +610,6 @@ d1bce2fabbc36a3a3b996b09e55e764a626026a8 d1dd6e5b7a5acfe14a33070e08c776341996deb2 Jul2015_9 d1bce2fabbc36a3a3b996b09e55e764a626026a8 Jul2015_SP1_release d1dd6e5b7a5acfe14a33070e08c776341996deb2 Jul2015_SP1_release +2ca94cddcdf52121541eff4bf706b1b7c451f511 Jul2015_11 +d1dd6e5b7a5acfe14a33070e08c776341996deb2 Jul2015_SP1_release +2ca94cddcdf52121541eff4bf706b1b7c451f511 Jul2015_SP1_release diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -995,6 +995,12 @@ rm -f %{buildroot}%{_bindir}/Maddlog %postun -p /sbin/ldconfig %changelog +* Fri Oct 30 2015 Sjoerd Mullender <sjo...@acm.org> - 11.21.11-20151030 +- Rebuilt. +- BZ#3828: Schema corruption after several ALTER TABLE statements and + server restart +- BZ#3839: msqldump generates incorrect syntax ON UPDATE (null) + * Mon Oct 26 2015 Sjoerd Mullender <sjo...@acm.org> - 11.21.9-20151026 - Rebuilt. - BZ#3816: Server crashes when trying to convert timestamp to str with diff --git a/clients/Makefile.ag b/clients/Makefile.ag --- a/clients/Makefile.ag +++ b/clients/Makefile.ag @@ -6,4 +6,4 @@ SUBDIRS = mapilib mapiclient HAVE_ODBC?odbc HAVE_PERL?perl php HAVE_RUBYGEM?ruby examples HAVE_PYTHON2?python2 HAVE_PYTHON3?python3 NATIVE_WIN32?NT -EXTRA_DIST_DIR = Tests R nodejs +EXTRA_DIST_DIR = Tests R diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -2154,7 +2154,6 @@ myread(void *private, void *buf, size_t free(p->buf); p->buf = NULL; } - ((char *) buf)[cpsize] = '\0'; return cpsize / elmsize; } @@ -2195,6 +2194,7 @@ doFile(Mapi mid, stream *fp, int useinse #ifdef HAVE_LIBREADLINE init_readline(mid, language, save_history); rl.s = fp; + rl.buf = NULL; fp = callback_stream(&rl, myread, NULL, mydestroy, mnstr_name(fp)); #endif } diff --git a/clients/nodejs/Tests/nodetest.js b/clients/nodejs/Tests/nodetest.js deleted file mode 100644 --- a/clients/nodejs/Tests/nodetest.js +++ /dev/null @@ -1,147 +0,0 @@ -var monetdb = require('../monetdb'); -var assert = require('assert'); - -var dbport = parseInt(process.argv[2]); -var dbname = process.argv[3]; - -/* lets first check some failing connection attempts */ -monetdb.connect({host:'veryinvalidhostnamethathopefullyresolvesnowhere'}, function(err) { - assert(err); -}); - -monetdb.connect({dbname:'nonexist', port:dbport}, function(err) { - assert(err); -}); - -var failedconn = monetdb.connect({dbname:dbname, user:'nonexist', port:dbport}, function(err) { - assert(err); -}); -/* try to query on a failed connection, we need this callback */ -failedconn.query('SELECT 1',function(err,res) { - assert(err); -}); - -/* now actually connect */ -var conn = monetdb.connect({dbname:dbname, port:dbport, debug: false}, function(err) { - assert.equal(null, err); - assert.equal(conn.env.gdk_dbname, dbname); -}); - - -/* some querying, call chaining */ -conn.query('start transaction'). - query('create table foo(a int, b float, c clob)'). - query("insert into foo values (42,4.2,'42'),(43,4.3,'43'),(44,4.4,'44'),(45,4.5,'45')"); - -conn.query('select * from foo', function(err, res) { - assert.equal(null, err); - - assert.equal('table', res.type); - assert.equal(4, res.rows); - assert.equal(3, res.cols); - - assert.equal(3, res.structure.length); - - assert.equal('a', res.structure[0].column); - assert.equal('int', res.structure[0].type); - - assert.equal(4, res.data.length); - - assert.equal(42, res.data[0][res.structure[0].index]); - assert.equal(4.3, res.data[1][res.col['b']]); - assert.equal('44', res.data[2][2]); -}); - -/* we can also just put the queries in one .query call */ -conn.query('delete from foo; drop table foo; rollback'); - -/* query that will stress multi-block operations */ -function rep(str,n) { - ret = ''; - for (var i = 0; i< n; i++) { - ret += str; - } - return ret; -} - -var longstr = rep('ABCDEFGHIJKLMNOP', 100000); -conn.query("SELECT '" + longstr + "'", function(err, res) { - assert.equal(null, err); - assert.equal(longstr,res.data[0][0]); -}); - -/* failing query */ -conn.query('MEHR BIER', function(err, res) { - assert(err); -}); - -/* prepared statements */ -conn.query('MEHR BIER', - ['connections', 0, false], function(err, res) { - assert(err); -}); - - -/* fire-and-forget query with parameters */ -conn.query('SELECT id from tables where name=? and type=? and temporary=?', - ['connections', 0, 0], function(err, res) { - assert.equal(null, err); - assert(res.rows > 0); -}); - -/* Try the log callback functionality */ -var nr_log_callbacks = 0; -conn.log_callback = function(message, error, result) { - assert(message); // message must contain something - ++nr_log_callbacks; -} -conn.query('SELECT id FROM tables WHERE name=? AND type=? AND temporary=?', - ['connections', 0, 0], function(err, res) { - assert.equal(null, err); - assert(nr_log_callbacks > 0); - conn.log_callback = null; -}); - -/* some quoting fun, jesus */ -conn.query("SELECT '\\\\asdf','\"', '\\\"', '\\\\\"', '\\''", function(err, res) { - assert.equal(null, err); - assert.equal('\\asdf', res.data[0][0]); - assert.equal('"', res.data[0][1]); - assert.equal('\"', res.data[0][2]); - assert.equal('\\"', res.data[0][3]); - assert.equal("'", res.data[0][4]); -}); - -/* Retrieving escaped characters from the database */ -conn.query('start transaction'). - query('create table foo(a string)'). - query("insert into foo values ('\t\n\r\n\tlalala\t\n\r')"); - -conn.query("select * from foo", function(err, res) { - assert.equal(null, err); - assert.equal(1, res.rows); - assert.equal('\t\n\r\n\tlalala\t\n\r', res.data[0][0]); -}); - -conn.query('delete from foo; drop table foo; rollback'); - - -/* prepared statements can also be re-used */ -conn.prepare('SELECT id from tables where name=? and type=? and temporary=?', function(err, res){ - assert.equal(null, err); - - /* parameters can also be given as array */ - res.exec(['connections', 0, 0], function(err, res) { - assert.equal(null, err); - assert(res.rows > 0); - }); - - /* this fails due to missing param */ - res.exec([0, false], function(err, res) { - assert(err); - }); - - res.release(); -}); - -conn.close(); diff --git a/clients/nodejs/monetdb/README.md b/clients/nodejs/monetdb/README.md deleted file mode 100644 --- a/clients/nodejs/monetdb/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# monetdb -This package defines a mapiclient that allows easy communication between a NodeJS application and a running MonetDB server process. - -# Installation -npm install [-g] monetdb - -# Example usage: - -``` -var options = { - host : 'localhost', - port : 50000, - dbname : 'mydb', - user : 'monetdb', - password : 'monetdb' -}; - -var conn = require('monetdb').connect(options , function(err) { - if (!err) console.log('connected'); -}); - -conn.query('SELECT 1', function(err, res) { - if (!err) console.log(res); -}); - -conn.query('SELECT id FROM tables WHERE name=? and readonly=?', - ['connections', false], function(err, res) { - if (!err) console.log(res); -}); - -conn.close(); -``` - -# API - -#### <a name="connect"></a>connect(options, fn) -Obtain a MonetDBConnection object that tries to connect to a MonetDB server process using the provided options. - -- options [object]: Options to use for this connection. Possible options are: - - host [string]: hostname to connect to (default: localhost) - - port [integer]: port on which the MonetDB server process is listening (default: 50000) - - dbname [string]: name of the database to use (default: demo) - - user [string]: username to use for logging in (default: monetdb) - - password [string]: password to use for logging in (default: monetdb) - - language [string]: query language to use (default: sql) - - debug [boolean]: whether or not to initialize the connection in debug node (default: false) - - q [function]: in case you want to use promises, you should pass in the result of require('q') in here. See [Q Integration](#q) for more information on our Q integration. -- fn [function]: Callback function to call whenever the connection succeeds or fails. This function receives one argument, which contains an error string on failure or null on success. Note: this function might be called multiple times when the MonetDB connection fails after it first succeeded. In that case, the callback will first be called indicating success, and later again with an error message. - -Returns an instance of a MonetDBConnection object. Note that thanks to a queueing system, this object can immediately receive queries when it is returned, even if the connection is not established yet. - ---- - -#### <a name="query"></a>MonetDBConnection.query(query, [params], [raw], fn) -Run a query against this MonetDBConnection - -- query [string]: A query string in the chosen language, where values may be replaced by question marks, in which case the params array must be set (note: when the params array is given, the MonetDBConnection.prepare will be used under the hood). -- params [array]: In case question marks are given for some values in the query, this array supplies the query method with the values to fill in. (default: null) -- raw [boolean]: If set to true, a raw query is expected, including an initial 's' and a trailing ';'. (default: false) -- fn [function]: Callback function that will be called when the query completes. It then receives two arguments: - - err: Error string if an error occurred, null if the query succeeded - - result: The [query result](#result) - ---- - -#### <a name="result"></a>Query result -A query returns a query result object. This object has the following properties: - -- data [array]: When a SELECT query was done, this array contains the resulting data from the database. It is passed as an array of arrays, where every inner array represents one data tuple. -- col [object]: Object that maps column names to query result indices. So if you for example did SELECT a, b FROM ... you can access b in a tuple array by issuing tuple[result.col.b], which in this case would resolve to tuple[1]. -- rows [integer]: The number of rows in the result set -- cols [integer]: The number of columns in the result set -- structure [array]: An array containing an object for every column, with information about the column (like from which table it came, what its name is etc.) -- queryid [integer]: A unique identifier for this query -- type: The type of the result (currently only 'table' is supported) - ---- - -#### MonetDBConnection.prepare(query, fn) -Prepares a query for repeated execution. - -- query [string]: The query that has to be prepared. In this query, actual values can be replaced by question marks. -- fn [function]: Callback function that will be called when the preparation finished. It gets passed two arguments. The first argument is an error string or null on success, the second argument is an object with the following properties: - - prepare: The [query result](#result) of the prepare statement - - exec: A function that you can call if you want to execute your prepared statement. It takes two parameters, the first one is an array with the query parameters and the second is a callback that gets executed when the execution of the prepared statement finishes (same as callback to [MonetDBConnection.query](#query)). - - release: A function that you can call when you want to free the resources used by your prepared statement. After calling this function, calls to the exec function will fail. - ---- - _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list