Commit 5230e8e1 by Konstantin Käfer

add blob support to .bindObject and .bindArray functions

parent d1a750dc
...@@ -222,6 +222,12 @@ Handle<Value> Statement::BindObject(const Arguments& args) { ...@@ -222,6 +222,12 @@ Handle<Value> Statement::BindObject(const Arguments& args) {
pairs->value = value; pairs->value = value;
pairs->value_size = text.length(); pairs->value_size = text.length();
} }
else if (Buffer::HasInstance(val)) {
pairs->value_type = VALUE_BLOB;
Buffer* buffer = Buffer::Unwrap<Buffer>(val->ToObject());
pairs->value = buffer->data();
pairs->value_size = buffer->length();
}
else if (val->IsNull() || val->IsUndefined()) { else if (val->IsNull() || val->IsUndefined()) {
pairs->value_type = VALUE_NULL; pairs->value_type = VALUE_NULL;
pairs->value = NULL; pairs->value = NULL;
...@@ -296,6 +302,12 @@ Handle<Value> Statement::BindArray(const Arguments& args) { ...@@ -296,6 +302,12 @@ Handle<Value> Statement::BindArray(const Arguments& args) {
pairs->value = value; pairs->value = value;
pairs->value_size = text.length(); pairs->value_size = text.length();
} }
else if (Buffer::HasInstance(val)) {
pairs->value_type = VALUE_BLOB;
Buffer* buffer = Buffer::Unwrap<Buffer>(val->ToObject());
pairs->value = buffer->data();
pairs->value_size = buffer->length();
}
else if (val->IsNull() || val->IsUndefined()) { else if (val->IsNull() || val->IsUndefined()) {
pairs->value_type = VALUE_NULL; pairs->value_type = VALUE_NULL;
pairs->value = NULL; pairs->value = NULL;
......
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