Extra statement constructor.

This commit is contained in:
JoelKatz
2013-04-02 13:41:17 -07:00
parent 2e28179217
commit 335716c1c6
2 changed files with 9 additions and 0 deletions

View File

@@ -279,6 +279,14 @@ SqliteStatement::SqliteStatement(SqliteDatabase* db, const char *sql)
throw j;
}
SqliteStatement::SqliteStatement(SqliteDatabase* db, const std::string& sql)
{
assert(db);
int j = sqlite3_prepare_v2(db->peekConnection(), sql.c_str(), sql.size() + 1, &statement, NULL);
if (j != SQLITE_OK)
throw j;
}
SqliteStatement::~SqliteStatement()
{
sqlite3_finalize(statement);

View File

@@ -73,6 +73,7 @@ protected:
public:
SqliteStatement(SqliteDatabase* db, const char *statement);
SqliteStatement(SqliteDatabase* db, const std::string& statement);
~SqliteStatement();
sqlite3_stmt* peekStatement();