OLD | NEW |
1 // Copyright (c) 2010 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 #include "app/sql/connection.h" | 5 #include "app/sql/connection.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "app/sql/statement.h" | 9 #include "app/sql/statement.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // is nothing to preload (so it's OK we do nothing). | 126 // is nothing to preload (so it's OK we do nothing). |
127 if (!DoesTableExist("meta")) | 127 if (!DoesTableExist("meta")) |
128 return; | 128 return; |
129 Statement dummy(GetUniqueStatement("SELECT * FROM meta")); | 129 Statement dummy(GetUniqueStatement("SELECT * FROM meta")); |
130 if (!dummy || !dummy.Step()) | 130 if (!dummy || !dummy.Step()) |
131 return; | 131 return; |
132 | 132 |
133 #if !defined(USE_SYSTEM_SQLITE) | 133 #if !defined(USE_SYSTEM_SQLITE) |
134 // This function is only defined in Chromium's version of sqlite. | 134 // This function is only defined in Chromium's version of sqlite. |
135 // Do not call it when using system sqlite. | 135 // Do not call it when using system sqlite. |
136 sqlite3Preload(db_); | 136 sqlite3_preload(db_); |
137 #endif | 137 #endif |
138 } | 138 } |
139 | 139 |
140 bool Connection::BeginTransaction() { | 140 bool Connection::BeginTransaction() { |
141 if (needs_rollback_) { | 141 if (needs_rollback_) { |
142 DCHECK_GT(transaction_nesting_, 0); | 142 DCHECK_GT(transaction_nesting_, 0); |
143 | 143 |
144 // When we're going to rollback, fail on this begin and don't actually | 144 // When we're going to rollback, fail on this begin and don't actually |
145 // mark us as entering the nested transaction. | 145 // mark us as entering the nested transaction. |
146 return false; | 146 return false; |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 410 |
411 int Connection::OnSqliteError(int err, sql::Statement *stmt) { | 411 int Connection::OnSqliteError(int err, sql::Statement *stmt) { |
412 if (error_delegate_.get()) | 412 if (error_delegate_.get()) |
413 return error_delegate_->OnError(err, this, stmt); | 413 return error_delegate_->OnError(err, this, stmt); |
414 // The default handling is to assert on debug and to ignore on release. | 414 // The default handling is to assert on debug and to ignore on release. |
415 NOTREACHED() << GetErrorMessage(); | 415 NOTREACHED() << GetErrorMessage(); |
416 return err; | 416 return err; |
417 } | 417 } |
418 | 418 |
419 } // namespace sql | 419 } // namespace sql |
OLD | NEW |