Commit 481cfbbb by Konstantin Käfer

allow start binding parameters from another start index

parent dd0e118b
......@@ -172,17 +172,17 @@ int Statement::EIO_AfterPrepare(eio_req *req) {
return 0;
}
template <class T> T* Statement::Bind(const Arguments& args) {
template <class T> T* Statement::Bind(const Arguments& args, int start) {
int last = args.Length();
Local<Function> callback;
if (last > 0 && args[last - 1]->IsFunction()) {
if (last > start && args[last - 1]->IsFunction()) {
callback = Local<Function>::Cast(args[last - 1]);
last--;
}
T* baton = new T(this, callback);
for (int i = 0; i < last; i++) {
for (int i = start; i < last; i++) {
if (args[i]->IsString()) {
String::Utf8Value val(args[i]->ToString());
baton->parameters.push_back(new Result::Text(val.length(), *val));
......
......@@ -151,7 +151,7 @@ protected:
static void Finalize(Baton* baton);
void Finalize();
template <class T> T* Bind(const Arguments& args);
template <class T> T* Bind(const Arguments& args, int start = 0);
bool Bind(const Result::Row parameters);
static void GetRow(Result::Row* row, sqlite3_stmt* stmt);
......
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