OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 APP_SQL_CONNECTION_H_ | 5 #ifndef APP_SQL_CONNECTION_H_ |
6 #define APP_SQL_CONNECTION_H_ | 6 #define APP_SQL_CONNECTION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Returns a non-cached statement for the given SQL. Use this for SQL that | 190 // Returns a non-cached statement for the given SQL. Use this for SQL that |
191 // is only executed once or only rarely (there is overhead associated with | 191 // is only executed once or only rarely (there is overhead associated with |
192 // keeping a statement cached). | 192 // keeping a statement cached). |
193 // | 193 // |
194 // See GetCachedStatement above for examples and error information. | 194 // See GetCachedStatement above for examples and error information. |
195 scoped_refptr<StatementRef> GetUniqueStatement(const char* sql); | 195 scoped_refptr<StatementRef> GetUniqueStatement(const char* sql); |
196 | 196 |
197 // Info querying ------------------------------------------------------------- | 197 // Info querying ------------------------------------------------------------- |
198 | 198 |
199 // Returns true if the given table exists. | 199 // Returns true if the given table exists. |
200 bool DoesTableExist( const char* table_name); | 200 bool DoesTableExist( const char* table_name) const; |
201 | 201 |
202 // Returns true if a column with the given name exists in the given table. | 202 // Returns true if a column with the given name exists in the given table. |
203 bool DoesColumnExist(const char* table_name, const char* column_name); | 203 bool DoesColumnExist(const char* table_name, const char* column_name) const; |
204 | 204 |
205 // Returns sqlite's internal ID for the last inserted row. Valid only | 205 // Returns sqlite's internal ID for the last inserted row. Valid only |
206 // immediately after an insert. | 206 // immediately after an insert. |
207 int64 GetLastInsertRowId() const; | 207 int64 GetLastInsertRowId() const; |
208 | 208 |
| 209 // Returns sqlite's count of the number of rows modified by the last |
| 210 // statement executed. Will be 0 if no statement has executed or the database |
| 211 // is closed. |
| 212 int GetLastChangeCount() const; |
| 213 |
209 // Errors -------------------------------------------------------------------- | 214 // Errors -------------------------------------------------------------------- |
210 | 215 |
211 // Returns the error code associated with the last sqlite operation. | 216 // Returns the error code associated with the last sqlite operation. |
212 int GetErrorCode() const; | 217 int GetErrorCode() const; |
213 | 218 |
214 // Returns a pointer to a statically allocated string associated with the | 219 // Returns a pointer to a statically allocated string associated with the |
215 // last sqlite operation. | 220 // last sqlite operation. |
216 const char* GetErrorMessage() const; | 221 const char* GetErrorMessage() const; |
217 | 222 |
218 private: | 223 private: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // When we get to the outermost transaction, this will determine if we do | 307 // When we get to the outermost transaction, this will determine if we do |
303 // a rollback instead of a commit. | 308 // a rollback instead of a commit. |
304 bool needs_rollback_; | 309 bool needs_rollback_; |
305 | 310 |
306 DISALLOW_COPY_AND_ASSIGN(Connection); | 311 DISALLOW_COPY_AND_ASSIGN(Connection); |
307 }; | 312 }; |
308 | 313 |
309 } // namespace sql | 314 } // namespace sql |
310 | 315 |
311 #endif // APP_SQL_CONNECTION_H_ | 316 #endif // APP_SQL_CONNECTION_H_ |
OLD | NEW |