mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-08 21:10:02 +02:00
null bindings and RecordSet::isNull (SQLite done and tested, ODBC todo)
This commit is contained in:
@@ -110,6 +110,12 @@ void Binder::bind(std::size_t pos, const DateTime& val, Direction dir)
|
||||
}
|
||||
|
||||
|
||||
void Binder::bind(std::size_t pos, const NullData&, Direction)
|
||||
{
|
||||
sqlite3_bind_null(_pStmt, pos);
|
||||
}
|
||||
|
||||
|
||||
void Binder::checkReturn(int rc)
|
||||
{
|
||||
if (rc != SQLITE_OK)
|
||||
|
@@ -313,7 +313,16 @@ bool Extractor::extract(std::size_t pos, Poco::Any& val)
|
||||
|
||||
bool Extractor::isNull(std::size_t pos)
|
||||
{
|
||||
return sqlite3_column_type(_pStmt, (int) pos) == SQLITE_NULL;
|
||||
if (pos >= _nulls.size())
|
||||
_nulls.resize(pos + 1);
|
||||
|
||||
if (!_nulls[pos].first)
|
||||
{
|
||||
_nulls[pos].first = true;
|
||||
_nulls[pos].second = (SQLITE_NULL == sqlite3_column_type(_pStmt, pos));
|
||||
}
|
||||
|
||||
return _nulls[pos].second;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -185,6 +185,8 @@ bool SQLiteStatementImpl::hasNext()
|
||||
|
||||
_stepCalled = true;
|
||||
_nextResponse = sqlite3_step(_pStmt);
|
||||
_pExtractor->reset();//to clear the cached null indicators
|
||||
|
||||
if (_nextResponse != SQLITE_ROW && _nextResponse != SQLITE_OK && _nextResponse != SQLITE_DONE)
|
||||
{
|
||||
Utility::throwException(_nextResponse);
|
||||
|
Reference in New Issue
Block a user