Commit debc81b4 by Konstantin Käfer

correctly check bind arguments

parent 92d0e9c9
...@@ -136,6 +136,8 @@ const char* sqlite_code_string(int code); ...@@ -136,6 +136,8 @@ const char* sqlite_code_string(int code);
static int EIO_After##name(eio_req *req); static int EIO_After##name(eio_req *req);
#define STATEMENT_BEGIN(type) \ #define STATEMENT_BEGIN(type) \
assert(baton); \
assert(baton->stmt); \
assert(!baton->stmt->locked); \ assert(!baton->stmt->locked); \
assert(!baton->stmt->finalized); \ assert(!baton->stmt->finalized); \
assert(baton->stmt->prepared); \ assert(baton->stmt->prepared); \
......
...@@ -302,9 +302,13 @@ Handle<Value> Statement::Get(const Arguments& args) { ...@@ -302,9 +302,13 @@ Handle<Value> Statement::Get(const Arguments& args) {
Statement* stmt = ObjectWrap::Unwrap<Statement>(args.This()); Statement* stmt = ObjectWrap::Unwrap<Statement>(args.This());
Baton* baton = stmt->Bind<RowBaton>(args); Baton* baton = stmt->Bind<RowBaton>(args);
if (baton == NULL) {
return ThrowException(Exception::Error(String::New("Data type is not supported")));
}
else {
stmt->Schedule(EIO_BeginGet, baton); stmt->Schedule(EIO_BeginGet, baton);
return args.This(); return args.This();
}
} }
void Statement::EIO_BeginGet(Baton* baton) { void Statement::EIO_BeginGet(Baton* baton) {
...@@ -368,9 +372,13 @@ Handle<Value> Statement::Run(const Arguments& args) { ...@@ -368,9 +372,13 @@ Handle<Value> Statement::Run(const Arguments& args) {
Statement* stmt = ObjectWrap::Unwrap<Statement>(args.This()); Statement* stmt = ObjectWrap::Unwrap<Statement>(args.This());
Baton* baton = stmt->Bind<Baton>(args); Baton* baton = stmt->Bind<Baton>(args);
if (baton == NULL) {
return ThrowException(Exception::Error(String::New("Data type is not supported")));
}
else {
stmt->Schedule(EIO_BeginRun, baton); stmt->Schedule(EIO_BeginRun, baton);
return args.This(); return args.This();
}
} }
void Statement::EIO_BeginRun(Baton* baton) { void Statement::EIO_BeginRun(Baton* baton) {
...@@ -425,9 +433,13 @@ Handle<Value> Statement::All(const Arguments& args) { ...@@ -425,9 +433,13 @@ Handle<Value> Statement::All(const Arguments& args) {
Statement* stmt = ObjectWrap::Unwrap<Statement>(args.This()); Statement* stmt = ObjectWrap::Unwrap<Statement>(args.This());
Baton* baton = stmt->Bind<RowsBaton>(args); Baton* baton = stmt->Bind<RowsBaton>(args);
if (baton == NULL) {
return ThrowException(Exception::Error(String::New("Data type is not supported")));
}
else {
stmt->Schedule(EIO_BeginAll, baton); stmt->Schedule(EIO_BeginAll, baton);
return args.This(); return args.This();
}
} }
void Statement::EIO_BeginAll(Baton* baton) { void Statement::EIO_BeginAll(Baton* baton) {
......
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