Commit 6f0d04f0 by Orlando Vazquez

Don't free bind_req->pair values if there are none.

parent 9fae3abd
......@@ -89,16 +89,14 @@ function _doStep(db, statement, rowCallback) {
}
function _onPrepare(db, statement, bindings, rowCallback) {
if (Array.isArray(bindings)) {
if (bindings.length) {
_setBindingsByIndex(db, statement, bindings, _doStep, rowCallback);
}
else {
function next() {
_doStep(db, statement, rowCallback);
}
if (Array.isArray(bindings)) {
statement.bindArray(bindings, next);
}
else if (typeof(bindings) !== 'undefined') {
// TODO index by keys
else if (typeof(bindings) === 'object') {
statement.bindObject(bindings, next);
}
}
......
......@@ -79,8 +79,11 @@ int Statement::EIO_AfterBindArray(eio_req *req) {
bind_req->cb.Dispose();
free(bind_req->pairs->key);;
if (bind_req->len) {
free(bind_req->pairs->key);
free(bind_req->pairs->value);
}
free(bind_req->pairs);
free(bind_req);
......@@ -259,6 +262,7 @@ Handle<Value> Statement::BindArray(const Arguments& args) {
// setup value
if (val->IsInt32()) {
printf("Binding int\n");
pairs->value_type = VALUE_INT;
int *value = (int *) malloc(sizeof(int));
*value = val->Int32Value();
......
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