Skip to content

Commit

Permalink
Merge pull request wankdanker#71 from ugate/feature-stmt-bind-param-c…
Browse files Browse the repository at this point in the history
…ount-errors

Show the statement bind parameter counts in errors
  • Loading branch information
markdirish authored Mar 31, 2020
2 parents fb01964 + fba0fe6 commit 94d0f6c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/odbc_statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <napi.h>
#include <time.h>
#include <string>

#include "odbc.h"
#include "odbc_connection.h"
Expand Down Expand Up @@ -303,7 +304,7 @@ Napi::Value ODBCStatement::Bind(const Napi::CallbackInfo& info) {
if (data->parameterCount != (SQLSMALLINT)this->napiParameters.Value().Length() || data->parameters == NULL) {
std::vector<napi_value> callbackArguments;

Napi::Error error = Napi::Error::New(env, Napi::String::New(env, "[node-odbc] Error in Statement::BindAsyncWorker::Bind: The number of parameters in the prepared statement doesn't match the number of parameters passed to bind."));
Napi::Error error = Napi::Error::New(env, Napi::String::New(env, "[node-odbc] Error in Statement::BindAsyncWorker::Bind: The number of parameters in the prepared statement (" + std::to_string(data->parameterCount) + ") doesn't match the number of parameters passed to bind (" + std::to_string((SQLSMALLINT)this->napiParameters.Value().Length()) + "}."));
callbackArguments.push_back(error.Value());

callback.Call(callbackArguments);
Expand Down

0 comments on commit 94d0f6c

Please sign in to comment.