comparison OrthancFramework/Sources/SQLite/Connection.cpp @ 4304:50b0c69b653a

continued abi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 06 Nov 2020 16:33:52 +0100
parents c7bd2f21ccc3
children c847b0dfd255
comparison
equal deleted inserted replaced
4303:44b53a2c0a13 4304:50b0c69b653a
173 { 173 {
174 return error == SQLITE_OK; 174 return error == SQLITE_OK;
175 } 175 }
176 } 176 }
177 177
178 int Connection::ExecuteAndReturnErrorCode(const char* sql) 178 bool Connection::Execute(const std::string &sql)
179 { 179 {
180 CheckIsOpen(); 180 return Execute(sql.c_str());
181 return sqlite3_exec(db_, sql, NULL, NULL, NULL);
182 } 181 }
183 182
184 // Info querying ------------------------------------------------------------- 183 // Info querying -------------------------------------------------------------
185 184
186 bool Connection::IsSQLValid(const char* sql) 185 bool Connection::IsSQLValid(const char* sql)
187 { 186 {
188 sqlite3_stmt* stmt = NULL; 187 sqlite3_stmt* stmt = NULL;
189 if (sqlite3_prepare_v2(db_, sql, -1, &stmt, NULL) != SQLITE_OK) 188 if (sqlite3_prepare_v2(db_, sql, -1, &stmt, NULL) != SQLITE_OK)
190 return false; 189 return false;
191 190
257 const char* Connection::GetErrorMessage() const 256 const char* Connection::GetErrorMessage() const
258 { 257 {
259 return sqlite3_errmsg(db_); 258 return sqlite3_errmsg(db_);
260 } 259 }
261 260
261
262 int Connection::ExecuteAndReturnErrorCode(const char* sql)
263 {
264 CheckIsOpen();
265 return sqlite3_exec(db_, sql, NULL, NULL, NULL);
266 }
267
268 bool Connection::HasCachedStatement(const StatementId &id) const
269 {
270 return cachedStatements_.find(id) != cachedStatements_.end();
271 }
272
273 int Connection::GetTransactionNesting() const
274 {
275 return transactionNesting_;
276 }
262 277
263 bool Connection::BeginTransaction() 278 bool Connection::BeginTransaction()
264 { 279 {
265 if (needsRollback_) 280 if (needsRollback_)
266 { 281 {