Permalink
Browse files

Fixing issue when using the three-argument call on Query::execute()

  • Loading branch information...
mariano committed Nov 8, 2011
1 parent 5820c6f commit cda0172951789b2c1c61cec97dd7b55948cbfbff
Showing with 9 additions and 2 deletions.
  1. +1 −1 query.cc
  2. +8 −1 tests.js
View
@@ -974,6 +974,7 @@ v8::Handle<v8::Value> node_db::Query::set(const v8::Arguments& args) {
optionsIndex = 3;
} else if (args.Length() == 3) {
ARG_CHECK_STRING(0, query);
+ queryIndex = 0;
if (args[2]->IsFunction()) {
ARG_CHECK_FUNCTION(2, callback);
if (args[1]->IsArray()) {
@@ -988,7 +989,6 @@ v8::Handle<v8::Value> node_db::Query::set(const v8::Arguments& args) {
ARG_CHECK_STRING(0, query);
ARG_CHECK_ARRAY(1, values);
ARG_CHECK_OBJECT(2, options);
- queryIndex = 0;
valuesIndex = 1;
optionsIndex = 2;
}
View
@@ -200,7 +200,7 @@ exports.get = function(createDbClient, quoteName) {
},
"insert markers": function(test) {
var client = this.client;
- test.expect(5);
+ test.expect(6);
var created = new Date();
client.query(
@@ -269,6 +269,13 @@ exports.get = function(createDbClient, quoteName) {
}}
).execute();
+ client.query({
+ start: function(query) {
+ test.equal("INSERT INTO test (`test`) VALUES ('test value');", query);
+ return false;
+ }
+ }).execute("INSERT INTO test (`test`) VALUES (?);", ['test value'], function() {});
+
test.done();
},
"select()": function(test) {

0 comments on commit cda0172

Please sign in to comment.