configurable internal storage

This commit is contained in:
Aleksandar Fabijanic
2007-05-30 23:20:47 +00:00
parent 911d0c5b82
commit c1ecb3ee05
30 changed files with 1137 additions and 199 deletions

View File

@@ -106,6 +106,14 @@ bool Statement::done()
}
bool Statement::canModifyStorage()
{
return 0 == extractionCount() &&
(_ptr->getState() == StatementImpl::ST_INITIALIZED ||
_ptr->getState() == StatementImpl::ST_RESET);
}
Statement& Statement::reset(Session& session)
{
Statement stmt(session.createStatementImpl());
@@ -114,10 +122,55 @@ Statement& Statement::reset(Session& session)
}
const std::string& Statement::getStorage() const
{
switch (storage())
{
case STORAGE_VECTOR:
return StatementImpl::VECTOR;
case STORAGE_LIST:
return StatementImpl::LIST;
case STORAGE_DEQUE:
return StatementImpl::DEQUE;
case STORAGE_UNKNOWN:
return StatementImpl::UNKNOWN;
}
throw IllegalStateException("Invalid storage setting.");
}
void now(Statement& statement)
{
statement.execute();
}
void vector(Statement& statement)
{
if (!statement.canModifyStorage())
throw InvalidAccessException("Storage not modifiable.");
statement.setStorage("vector");
}
void list(Statement& statement)
{
if (!statement.canModifyStorage())
throw InvalidAccessException("Storage not modifiable.");
statement.setStorage("list");
}
void deque(Statement& statement)
{
if (!statement.canModifyStorage())
throw InvalidAccessException("Storage not modifiable.");
statement.setStorage("deque");
}
} } // namespace Poco::Data