Mercurial > hg > orthanc
comparison Core/SQLite/Statement.cpp @ 137:0e97abc7b950
fix of a bug in older versions of sqlite
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Oct 2012 13:13:14 +0200 |
parents | 6212bf978584 |
children | bdd72233b105 |
comparison
equal
deleted
inserted
replaced
136:fe180eae201d | 137:0e97abc7b950 |
---|---|
40 #include "../Toolbox.h" | 40 #include "../Toolbox.h" |
41 | 41 |
42 #include <boost/lexical_cast.hpp> | 42 #include <boost/lexical_cast.hpp> |
43 #include <sqlite3.h> | 43 #include <sqlite3.h> |
44 #include <string.h> | 44 #include <string.h> |
45 #include <glog/logging.h> | |
45 | 46 |
46 namespace Orthanc | 47 namespace Orthanc |
47 { | 48 { |
48 namespace SQLite | 49 namespace SQLite |
49 { | 50 { |
104 } | 105 } |
105 | 106 |
106 | 107 |
107 bool Statement::Run() | 108 bool Statement::Run() |
108 { | 109 { |
110 VLOG(1) << "SQLite::Statement::Run " << sqlite3_sql(GetStatement()); | |
109 return CheckError(sqlite3_step(GetStatement())) == SQLITE_DONE; | 111 return CheckError(sqlite3_step(GetStatement())) == SQLITE_DONE; |
110 } | 112 } |
111 | 113 |
112 bool Statement::Step() | 114 bool Statement::Step() |
113 { | 115 { |
116 VLOG(1) << "SQLite::Statement::Step " << sqlite3_sql(GetStatement()); | |
114 return CheckError(sqlite3_step(GetStatement())) == SQLITE_ROW; | 117 return CheckError(sqlite3_step(GetStatement())) == SQLITE_ROW; |
115 } | 118 } |
116 | 119 |
117 void Statement::Reset(bool clear_bound_vars) | 120 void Statement::Reset(bool clear_bound_vars) |
118 { | 121 { |
119 // We don't call CheckError() here because sqlite3_reset() returns | 122 // We don't call CheckError() here because sqlite3_reset() returns |
120 // the last error that Step() caused thereby generating a second | 123 // the last error that Step() caused thereby generating a second |
121 // spurious error callback. | 124 // spurious error callback. |
122 if (clear_bound_vars) | 125 if (clear_bound_vars) |
123 sqlite3_clear_bindings(GetStatement()); | 126 sqlite3_clear_bindings(GetStatement()); |
127 //VLOG(1) << "SQLite::Statement::Reset"; | |
124 sqlite3_reset(GetStatement()); | 128 sqlite3_reset(GetStatement()); |
125 } | 129 } |
126 | 130 |
127 std::string Statement::GetOriginalSQLStatement() | 131 std::string Statement::GetOriginalSQLStatement() |
128 { | 132 { |