summaryrefslogtreecommitdiffstats
path: root/chrome/common/sqlite_compiled_statement.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/sqlite_compiled_statement.cc')
-rw-r--r--chrome/common/sqlite_compiled_statement.cc22
1 files changed, 21 insertions, 1 deletions
diff --git a/chrome/common/sqlite_compiled_statement.cc b/chrome/common/sqlite_compiled_statement.cc
index 3916d14..a580a29 100644
--- a/chrome/common/sqlite_compiled_statement.cc
+++ b/chrome/common/sqlite_compiled_statement.cc
@@ -27,9 +27,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "chrome/common/stl_util-inl.h"
#include "chrome/common/sqlite_compiled_statement.h"
+#include "base/logging.h"
+#include "chrome/common/stl_util-inl.h"
+
// SqliteStatementCache -------------------------------------------------------
SqliteStatementCache::~SqliteStatementCache() {
@@ -38,6 +40,11 @@ SqliteStatementCache::~SqliteStatementCache() {
db_ = NULL;
}
+void SqliteStatementCache::set_db(sqlite3* db) {
+ DCHECK(!db_) << "Setting the database twice";
+ db_ = db;
+}
+
SQLStatement* SqliteStatementCache::InternalGetStatement(const char* func_name,
int func_number,
const char* sql) {
@@ -86,3 +93,16 @@ SqliteCompiledStatement::~SqliteCompiledStatement() {
if (statement_)
statement_->reset();
}
+
+SQLStatement& SqliteCompiledStatement::operator*() {
+ DCHECK(statement_) << "Should check is_valid() before using the statement.";
+ return *statement_;
+}
+SQLStatement* SqliteCompiledStatement::operator->() {
+ DCHECK(statement_) << "Should check is_valid() before using the statement.";
+ return statement_;
+}
+SQLStatement* SqliteCompiledStatement::statement() {
+ DCHECK(statement_) << "Should check is_valid() before using the statement.";
+ return statement_;
+}