summaryrefslogtreecommitdiff
path: root/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc')
-rw-r--r--src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc b/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc
index 423d266b4..6a1d70f00 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc
+++ b/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -60,7 +60,16 @@ bool SQLDatabase::Open() {
return error_ == SQLITE_OK;
}
+bool SQLDatabase::IsReadWrite() {
+ const char* schema = "main";
+ return sqlite3_db_readonly(conn_, schema) == 0;
+}
+
void SQLDatabase::Close() {
+ if (!conn_) {
+ return;
+ }
+
sync_primitives::AutoLock auto_lock(conn_lock_);
error_ = sqlite3_close(conn_);
if (error_ == SQLITE_OK) {