Commit 27106877 by Orlando Vazquez

Improve awkward binding behaviour with Statement#bindArray.

parent f89fa7e3
...@@ -29,13 +29,13 @@ additional steps. ...@@ -29,13 +29,13 @@ additional steps.
// bindings list is optional // bindings list is optional
var ponies = []; var ponies = [];
db.query(sql, [colour], function (pony) { db.query(sql, [colour], function (pony) {
if (!pony) { if (!pony) {
// no more ponies // no more ponies
if (!ponies.length) if (!ponies.length)
sys.puts('There are no ponies with ' + colour + ' tails. :('); sys.puts('There are no ponies with ' + colour + ' tails. :(');
else else
sys.puts('The following ponies have ' + colour + ' tails: ' + ponies.join(', ')); sys.puts('The following ponies have ' + colour + ' tails: ' + ponies.join(', '));
} }
sys.puts(sys.inspect(pony)); sys.puts(sys.inspect(pony));
...@@ -88,7 +88,7 @@ from the API have been made to improve performance. ...@@ -88,7 +88,7 @@ from the API have been made to improve performance.
}); });
}); });
}); });
DESCRIPTION DESCRIPTION
----------- -----------
......
...@@ -53,12 +53,17 @@ class Statement : public EventEmitter { ...@@ -53,12 +53,17 @@ class Statement : public EventEmitter {
static int EIO_AfterBind(eio_req *req); static int EIO_AfterBind(eio_req *req);
static int EIO_Bind(eio_req *req); static int EIO_Bind(eio_req *req);
static Handle<Value> Bind(const Arguments& args); static Handle<Value> Bind(const Arguments& args);
static int EIO_AfterBindArray(eio_req *req);
static int EIO_BindArray(eio_req *req);
static Handle<Value> BindArray(const Arguments& args);
static int EIO_AfterFinalize(eio_req *req); static int EIO_AfterFinalize(eio_req *req);
static int EIO_Finalize(eio_req *req); static int EIO_Finalize(eio_req *req);
static Handle<Value> Finalize(const Arguments& args); static Handle<Value> Finalize(const Arguments& args);
static Handle<Value> Reset(const Arguments& args); static Handle<Value> Reset(const Arguments& args);
static Handle<Value> ClearBindings(const Arguments& args);
static int EIO_AfterStep(eio_req *req); static int EIO_AfterStep(eio_req *req);
static int EIO_Step(eio_req *req); static int EIO_Step(eio_req *req);
...@@ -100,6 +105,11 @@ struct bind_request { ...@@ -100,6 +105,11 @@ struct bind_request {
Persistent<Function> cb; Persistent<Function> cb;
Statement *sto; Statement *sto;
struct bind_pair *pairs;
size_t len;
};
struct bind_pair {
enum BindKeyType key_type; enum BindKeyType key_type;
enum BindValueType value_type; enum BindValueType value_type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment