Some improvements to the prepared statement code.

This commit is contained in:
JoelKatz
2013-02-07 17:06:34 -08:00
parent e07fffc834
commit 0136779b11
2 changed files with 24 additions and 0 deletions

View File

@@ -376,4 +376,23 @@ bool SqliteStatement::isRow(int j)
return j == SQLITE_ROW;
}
bool SqliteStatement::isError(int j)
{
switch (j)
{
case SQLITE_OK:
case SQLITE_ROW:
case SQLITE_DONE:
return true;
default:
return false;
}
}
std::string SqliteStatement::getError(int j)
{
return sqlite3_errstr(j);
}
// vim:ts=4

View File

@@ -76,6 +76,7 @@ public:
sqlite3_stmt* peekStatement();
// positions start at 1
int bind(int position, const void *data, int length);
int bindStatic(int position, const void *data, int length);
int bindStatic(int position, const std::vector<unsigned char>& value);
@@ -86,6 +87,7 @@ public:
int bind(int position, uint32 value);
int bind(int position);
// columns start at 0
int size(int column);
const void* peekBlob(int column);
@@ -99,9 +101,12 @@ public:
int step();
int reset();
// translate return values of step and reset
bool isOk(int);
bool isDone(int);
bool isRow(int);
bool isError(int);
std::string getError(int);
};
// vim:ts=4