aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/statement.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/sqlite/statement.cxx')
-rw-r--r--odb/sqlite/statement.cxx34
1 files changed, 17 insertions, 17 deletions
diff --git a/odb/sqlite/statement.cxx b/odb/sqlite/statement.cxx
index 417a746..fc9e780 100644
--- a/odb/sqlite/statement.cxx
+++ b/odb/sqlite/statement.cxx
@@ -132,7 +132,7 @@ namespace odb
//
if (!truncated)
{
- *b.is_null = sqlite3_column_type (stmt_, j) != SQLITE_NULL;
+ *b.is_null = sqlite3_column_type (stmt_, j) == SQLITE_NULL;
if (*b.is_null)
continue;
@@ -200,15 +200,14 @@ namespace odb
if (stmt_ == 0) // Empty statement or comment.
return 0;
- if (int e = sqlite3_reset (stmt_))
- translate_error (e, conn_);
-
unsigned long long r (0);
int e;
for (e = sqlite3_step (stmt_); e == SQLITE_ROW; e = sqlite3_step (stmt_))
r++;
+ sqlite3_reset (stmt_);
+
if (e != SQLITE_DONE)
translate_error (e, conn_);
@@ -235,13 +234,15 @@ namespace odb
execute ()
{
done_ = false;
-
- if (int e = sqlite3_reset (stmt_))
- translate_error (e, conn_);
-
bind_param (cond_.bind, cond_.count);
}
+ void select_statement::
+ free_result ()
+ {
+ sqlite3_reset (stmt_);
+ }
+
bool select_statement::
next ()
{
@@ -254,6 +255,7 @@ namespace odb
case SQLITE_DONE:
{
done_ = true;
+ sqlite3_reset (stmt_);
break;
}
case SQLITE_ROW:
@@ -262,6 +264,7 @@ namespace odb
}
default:
{
+ sqlite3_reset (stmt_);
translate_error (e, conn_);
}
}
@@ -300,13 +303,12 @@ namespace odb
bool insert_statement::
execute ()
{
- if (int e = sqlite3_reset (stmt_))
- translate_error (e, conn_);
-
bind_param (data_.bind, data_.count);
int e (sqlite3_step (stmt_));
+ sqlite3_reset (stmt_);
+
if (e != SQLITE_DONE)
{
// SQLITE_CONSTRAINT error code covers more than just a duplicate
@@ -345,14 +347,13 @@ namespace odb
void update_statement::
execute ()
{
- if (int e = sqlite3_reset (stmt_))
- translate_error (e, conn_);
-
bind_param (data_.bind, data_.count);
bind_param (cond_.bind, cond_.count, data_.count);
int e (sqlite3_step (stmt_));
+ sqlite3_reset (stmt_);
+
if (e != SQLITE_DONE)
translate_error (e, conn_);
@@ -372,13 +373,12 @@ namespace odb
unsigned long long delete_statement::
execute ()
{
- if (int e = sqlite3_reset (stmt_))
- translate_error (e, conn_);
-
bind_param (cond_.bind, cond_.count);
int e (sqlite3_step (stmt_));
+ sqlite3_reset (stmt_);
+
if (e != SQLITE_DONE)
translate_error (e, conn_);