diff --git a/src/cpp/MySQL/MySQLStatementImpl.cpp b/src/cpp/MySQL/MySQLStatementImpl.cpp index 210bce7e8..5661f7194 100644 --- a/src/cpp/MySQL/MySQLStatementImpl.cpp +++ b/src/cpp/MySQL/MySQLStatementImpl.cpp @@ -133,6 +133,12 @@ void MySQLStatementImpl::bindImpl() std::size_t pos = 0; Poco::Data::AbstractBindingVec::iterator it = binds.begin(); Poco::Data::AbstractBindingVec::iterator itEnd = binds.end(); + for (; it != itEnd; ++it) { + if (!(*it)->canBind()) { + printf("[MySQLStatementImpl::bindImpl] canBind return false, name: %s\n", (*it)->name().data()); + break; + } + } for (; it != itEnd && (*it)->canBind(); ++it) { (*it)->bind(pos); diff --git a/src/cpp/MySQL/StatementExecutor.cpp b/src/cpp/MySQL/StatementExecutor.cpp index 10fdeb4d0..db235c930 100644 --- a/src/cpp/MySQL/StatementExecutor.cpp +++ b/src/cpp/MySQL/StatementExecutor.cpp @@ -75,8 +75,10 @@ void StatementExecutor::bindParams(MYSQL_BIND* params, std::size_t count) if (_state < STMT_COMPILED) throw StatementException("Statement is not compiled yet"); - if (count != mysql_stmt_param_count(_pHandle)) + if (count != mysql_stmt_param_count(_pHandle)) { + printf("[StatementExecutor::bindParams] count: %d, count return from mysql: %d\n", count, mysql_stmt_param_count(_pHandle)); throw StatementException("wrong bind parameters count", 0, _query); + } if (count == 0) return;