summaryrefslogtreecommitdiffstats
path: root/chrome/common/sqlite_utils.h
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 23:50:35 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-05 23:50:35 +0000
commit06a793f89522301fe42fbaaffba20a301f809d72 (patch)
treea82f89826a1e5baf4c456f0ba60c5d0b846e5df0 /chrome/common/sqlite_utils.h
parent6b1c25b4adfcd0ce330c10a65d3eed22182f59f8 (diff)
downloadchromium_src-06a793f89522301fe42fbaaffba20a301f809d72.zip
chromium_src-06a793f89522301fe42fbaaffba20a301f809d72.tar.gz
chromium_src-06a793f89522301fe42fbaaffba20a301f809d72.tar.bz2
Safari Bookmark/Favicon import.
Review URL: http://codereview.chromium.org/159750 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/sqlite_utils.h')
-rw-r--r--chrome/common/sqlite_utils.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/common/sqlite_utils.h b/chrome/common/sqlite_utils.h
index bacbef0..33915d1 100644
--- a/chrome/common/sqlite_utils.h
+++ b/chrome/common/sqlite_utils.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/string_util.h"
@@ -197,6 +198,25 @@ class scoped_sqlite3_stmt_ptr {
DISALLOW_COPY_AND_ASSIGN(scoped_sqlite3_stmt_ptr);
};
+//------------------------------------------------------------------------------
+// A scoped sqlite database that closes when it goes out of scope.
+//------------------------------------------------------------------------------
+
+// TODO: Use this namespace for the functions below (see TODO further down by
+// estade).
+namespace sqlite_utils {
+
+class DBClose {
+ public:
+ inline void operator()(sqlite3* x) const {
+ sqlite3_close(x);
+ }
+};
+
+typedef scoped_ptr_malloc<sqlite3, DBClose> scoped_sqlite_db_ptr;
+
+} // namespace sqlite_utils
+
//------------------------------------------------------------------------------
// A scoped sqlite statement with convenient C++ wrappers for sqlite3 APIs.