diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 05:01:42 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 05:01:42 +0000 |
commit | 765b445022c7f2a24bc862b45d48ece4ca9a77e1 (patch) | |
tree | 9f351b1203bbfd02fae7018a1f11e2f15b6eeacb /app/sql/statement.h | |
parent | eb6f2c542d7405788d668a762282b66655836e1d (diff) | |
download | chromium_src-765b445022c7f2a24bc862b45d48ece4ca9a77e1.zip chromium_src-765b445022c7f2a24bc862b45d48ece4ca9a77e1.tar.gz chromium_src-765b445022c7f2a24bc862b45d48ece4ca9a77e1.tar.bz2 |
Convert history to use new sql wrappers. Enhance wrappers in several ways to
support the needs of history.
BUG=none
TEST=covered by unit tests
Review URL: http://codereview.chromium.org/246053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27832 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/sql/statement.h')
-rw-r--r-- | app/sql/statement.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/sql/statement.h b/app/sql/statement.h index 6211d34..8ee6ef5 100644 --- a/app/sql/statement.h +++ b/app/sql/statement.h @@ -14,6 +14,16 @@ namespace sql { +// Possible return values from ColumnType in a statement. These should match +// the values in sqlite3.h. +enum ColType { + COLUMN_TYPE_INTEGER = 1, + COLUMN_TYPE_FLOAT = 2, + COLUMN_TYPE_TEXT = 3, + COLUMN_TYPE_BLOB = 4, + COLUMN_TYPE_NULL = 5, +}; + // Normal usage: // sql::Statement s = connection_.GetUniqueStatement(...); // if (!s) // You should check for errors before using the statement. @@ -88,6 +98,7 @@ class Statement { // The main thing you may want to check is when binding large blobs or // strings there may be out of memory. bool BindNull(int col); + bool BindBool(int col, bool val); bool BindInt(int col, int val); bool BindInt64(int col, int64 val); bool BindDouble(int col, double val); @@ -100,7 +111,16 @@ class Statement { // Returns the number of output columns in the result. int ColumnCount() const; + // Returns the type associated with the given column. + // + // Watch out: the type may be undefined if you've done something to cause a + // "type conversion." This means requesting the value of a column of a type + // where that type is not the native type. For safety, call ColumnType only + // on a column before getting the value out in any way. + ColType ColumnType(int col) const; + // These all take a 0-based argument index. + bool ColumnBool(int col) const; int ColumnInt(int col) const; int64 ColumnInt64(int col) const; double ColumnDouble(int col) const; |