add comments in mysql handle part to find mysql errors

This commit is contained in:
Dario 2020-07-15 13:53:11 +02:00
parent af340f95de
commit b40d674bbb
2 changed files with 9 additions and 1 deletions

View File

@ -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);

View File

@ -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;