OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 // A statement must be open for the preload command to work. If the meta | 124 // A statement must be open for the preload command to work. If the meta |
125 // table doesn't exist, it probably means this is a new database and there | 125 // table doesn't exist, it probably means this is a new database and there |
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) |
| 134 // This function is only defined in Chromium's version of sqlite. |
| 135 // Do not call it when using system sqlite. |
133 sqlite3Preload(db_); | 136 sqlite3Preload(db_); |
| 137 #endif |
134 } | 138 } |
135 | 139 |
136 bool Connection::BeginTransaction() { | 140 bool Connection::BeginTransaction() { |
137 if (needs_rollback_) { | 141 if (needs_rollback_) { |
138 DCHECK(transaction_nesting_ > 0); | 142 DCHECK(transaction_nesting_ > 0); |
139 | 143 |
140 // 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 |
141 // mark us as entering the nested transaction. | 145 // mark us as entering the nested transaction. |
142 return false; | 146 return false; |
143 } | 147 } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 410 |
407 int Connection::OnSqliteError(int err, sql::Statement *stmt) { | 411 int Connection::OnSqliteError(int err, sql::Statement *stmt) { |
408 if (error_delegate_.get()) | 412 if (error_delegate_.get()) |
409 return error_delegate_->OnError(err, this, stmt); | 413 return error_delegate_->OnError(err, this, stmt); |
410 // 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. |
411 NOTREACHED() << GetErrorMessage(); | 415 NOTREACHED() << GetErrorMessage(); |
412 return err; | 416 return err; |
413 } | 417 } |
414 | 418 |
415 } // namespace sql | 419 } // namespace sql |
OLD | NEW |