Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(937)

Side by Side Diff: sql/statement.h

Issue 8506027: build sql as a component - this will help ensure there is only one copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't export DiagnosticErrorDelegate Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sql/sql_export.h ('k') | sql/transaction.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SQL_STATEMENT_H_ 5 #ifndef SQL_STATEMENT_H_
6 #define SQL_STATEMENT_H_ 6 #define SQL_STATEMENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/string16.h" 14 #include "base/string16.h"
15 #include "sql/connection.h" 15 #include "sql/connection.h"
16 #include "sql/sql_export.h"
16 17
17 namespace sql { 18 namespace sql {
18 19
19 // Possible return values from ColumnType in a statement. These should match 20 // Possible return values from ColumnType in a statement. These should match
20 // the values in sqlite3.h. 21 // the values in sqlite3.h.
21 enum ColType { 22 enum ColType {
22 COLUMN_TYPE_INTEGER = 1, 23 COLUMN_TYPE_INTEGER = 1,
23 COLUMN_TYPE_FLOAT = 2, 24 COLUMN_TYPE_FLOAT = 2,
24 COLUMN_TYPE_TEXT = 3, 25 COLUMN_TYPE_TEXT = 3,
25 COLUMN_TYPE_BLOB = 4, 26 COLUMN_TYPE_BLOB = 4,
26 COLUMN_TYPE_NULL = 5, 27 COLUMN_TYPE_NULL = 5,
27 }; 28 };
28 29
29 // Normal usage: 30 // Normal usage:
30 // sql::Statement s(connection_.GetUniqueStatement(...)); 31 // sql::Statement s(connection_.GetUniqueStatement(...));
31 // if (!s) // You should check for errors before using the statement. 32 // if (!s) // You should check for errors before using the statement.
32 // return false; 33 // return false;
33 // 34 //
34 // s.BindInt(0, a); 35 // s.BindInt(0, a);
35 // if (s.Step()) 36 // if (s.Step())
36 // return s.ColumnString(0); 37 // return s.ColumnString(0);
37 // 38 //
38 // Step() and Run() just return true to signal success. If you want to handle 39 // Step() and Run() just return true to signal success. If you want to handle
39 // specific errors such as database corruption, install an error handler in 40 // specific errors such as database corruption, install an error handler in
40 // in the connection object using set_error_delegate(). 41 // in the connection object using set_error_delegate().
41 class Statement { 42 class SQL_EXPORT Statement {
42 public: 43 public:
43 // Creates an uninitialized statement. The statement will be invalid until 44 // Creates an uninitialized statement. The statement will be invalid until
44 // you initialize it via Assign. 45 // you initialize it via Assign.
45 Statement(); 46 Statement();
46 47
47 explicit Statement(scoped_refptr<Connection::StatementRef> ref); 48 explicit Statement(scoped_refptr<Connection::StatementRef> ref);
48 ~Statement(); 49 ~Statement();
49 50
50 // Initializes this object with the given statement, which may or may not 51 // Initializes this object with the given statement, which may or may not
51 // be valid. Use is_valid() to check if it's OK. 52 // be valid. Use is_valid() to check if it's OK.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 // See Succeeded() for what this holds. 160 // See Succeeded() for what this holds.
160 bool succeeded_; 161 bool succeeded_;
161 162
162 DISALLOW_COPY_AND_ASSIGN(Statement); 163 DISALLOW_COPY_AND_ASSIGN(Statement);
163 }; 164 };
164 165
165 } // namespace sql 166 } // namespace sql
166 167
167 #endif // SQL_STATEMENT_H_ 168 #endif // SQL_STATEMENT_H_
OLDNEW
« no previous file with comments | « sql/sql_export.h ('k') | sql/transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698