fix for SF 1871946 (no exception thrown on error)

This commit is contained in:
Aleksandar Fabijanic
2008-01-16 00:25:28 +00:00
parent 4d0817e8f9
commit 48d0d9fef9
5 changed files with 150 additions and 9 deletions

View File

@@ -81,7 +81,7 @@ void SQLiteStatementImpl::compileImpl()
while (rc == SQLITE_OK && !pStmt && !queryFound)
{
rc = sqlite3_prepare(_pDB, pSql, -1, &pStmt, &pLeftover);
rc = sqlite3_prepare_v2(_pDB, pSql, -1, &pStmt, &pLeftover);
if (rc != SQLITE_OK)
{
if (pStmt)
@@ -145,8 +145,13 @@ void SQLiteStatementImpl::bindImpl()
// bind
Bindings& binds = bindings();
if (binds.empty()) return;
int pc = sqlite3_bind_parameter_count(_pStmt);
if (binds.empty() && 0 == pc) return;
else if (binds.empty() && pc > 0)
throw ParameterCountMismatchException();
else if (!binds.empty() && binds.size() * (*binds.begin())->numOfColumnsHandled() != pc)
throw ParameterCountMismatchException();
std::size_t pos = 1; // sqlite starts with 1 not 0!
Bindings::iterator it = binds.begin();