- SQL logging channel and archiving strategy

- row formatting refactored
- affected row count for insert, delete and update returned from Statement::execute()
- internal SQL string formatting capability using Poco::format()
This commit is contained in:
Aleksandar Fabijanic
2008-01-12 18:25:27 +00:00
parent b57f579d16
commit 9e8e627347
63 changed files with 2556 additions and 337 deletions

View File

@@ -80,6 +80,16 @@ void Binder::bind(std::size_t pos, const Poco::Int64 &val, Direction dir)
}
#ifndef POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const long &val, Direction dir)
{
long tmp = static_cast<long>(val);
int rc = sqlite3_bind_int(_pStmt, (int) pos, val);
checkReturn(rc);
}
#endif
void Binder::bind(std::size_t pos, const double &val, Direction dir)
{
int rc = sqlite3_bind_double(_pStmt, (int) pos, val);

View File

@@ -65,7 +65,7 @@ Poco::AutoPtr<Poco::Data::SessionImpl> Connector::createSession(const std::strin
void Connector::registerConnector()
{
Poco::Data::SessionFactory::instance().add(KEY, new Connector());
Poco::Data::SessionFactory::instance().add(new Connector());
}

View File

@@ -53,7 +53,8 @@ SQLiteStatementImpl::SQLiteStatementImpl(Poco::Data::SessionImpl& rSession, sqli
_pDB(pDB),
_pStmt(0),
_stepCalled(false),
_nextResponse(0)
_nextResponse(0),
_affectedRowCount(0)
{
}
@@ -136,7 +137,7 @@ bool SQLiteStatementImpl::canBind() const
void SQLiteStatementImpl::bindImpl()
{
_stepCalled = false;
_stepCalled = false;
_nextResponse = 0;
if (_pStmt == 0) return;
@@ -150,6 +151,8 @@ void SQLiteStatementImpl::bindImpl()
Bindings::iterator it = binds.begin();
Bindings::iterator itEnd = binds.end();
if (it != itEnd)
_affectedRowCount = (*it)->numOfRowsHandled();
for (; it != itEnd && (*it)->canBind(); ++it)
{
(*it)->bind(pos);
@@ -161,6 +164,7 @@ void SQLiteStatementImpl::bindImpl()
void SQLiteStatementImpl::clear()
{
_columns.clear();
_affectedRowCount = 0;
if (_pStmt)
{
@@ -222,7 +226,7 @@ Poco::UInt32 SQLiteStatementImpl::next()
int rc = _nextResponse;
Utility::throwException(rc, std::string("Iterator Error: trying to access the next value"));
}
return 1u;
}
@@ -240,4 +244,10 @@ const MetaColumn& SQLiteStatementImpl::metaColumn(Poco::UInt32 pos) const
}
Poco::UInt32 SQLiteStatementImpl::affectedRowCount() const
{
return _affectedRowCount ? _affectedRowCount : sqlite3_changes(_pDB);
}
} } } // namespace Poco::Data::SQLite