OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sql/connection.h" | 5 #include "sql/connection.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 // Histogram failures specific to initial open for debugging | 624 // Histogram failures specific to initial open for debugging |
625 // purposes. | 625 // purposes. |
626 UMA_HISTOGRAM_ENUMERATION("Sqlite.OpenFailure", err & 0xff, 50); | 626 UMA_HISTOGRAM_ENUMERATION("Sqlite.OpenFailure", err & 0xff, 50); |
627 | 627 |
628 OnSqliteError(err, NULL); | 628 OnSqliteError(err, NULL); |
629 Close(); | 629 Close(); |
630 db_ = NULL; | 630 db_ = NULL; |
631 return false; | 631 return false; |
632 } | 632 } |
633 | 633 |
634 if (!enable_lookaside_buffer_) { | |
635 // Disable lookaside buffer. Must be run immediatly after opening the | |
636 // database before any SQL statements are run. | |
637 sqlite3_db_config(db_, SQLITE_DBCONFIG_LOOKASIDE, NULL, 0, 0); | |
Scott Hess - ex-Googler
2013/06/05 17:58:49
And maybe buff up the first line of the comment to
rmcilroy
2013/06/05 22:24:47
Done.
| |
638 } | |
639 | |
634 // sqlite3_open() does not actually read the database file (unless a | 640 // sqlite3_open() does not actually read the database file (unless a |
635 // hot journal is found). Successfully executing this pragma on an | 641 // hot journal is found). Successfully executing this pragma on an |
636 // existing database requires a valid header on page 1. | 642 // existing database requires a valid header on page 1. |
637 // TODO(shess): For now, just probing to see what the lay of the | 643 // TODO(shess): For now, just probing to see what the lay of the |
638 // land is. If it's mostly SQLITE_NOTADB, then the database should | 644 // land is. If it's mostly SQLITE_NOTADB, then the database should |
639 // be razed. | 645 // be razed. |
640 err = ExecuteAndReturnErrorCode("PRAGMA auto_vacuum"); | 646 err = ExecuteAndReturnErrorCode("PRAGMA auto_vacuum"); |
641 if (err != SQLITE_OK) | 647 if (err != SQLITE_OK) |
642 UMA_HISTOGRAM_ENUMERATION("Sqlite.OpenProbeFailure", err & 0xff, 50); | 648 UMA_HISTOGRAM_ENUMERATION("Sqlite.OpenProbeFailure", err & 0xff, 50); |
643 | 649 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
779 // as a single string. This doesn't appear to be an API contract, | 785 // as a single string. This doesn't appear to be an API contract, |
780 // it could return separate lines, so loop _and_ split. | 786 // it could return separate lines, so loop _and_ split. |
781 while (stmt.Step()) { | 787 while (stmt.Step()) { |
782 std::string result(stmt.ColumnString(0)); | 788 std::string result(stmt.ColumnString(0)); |
783 base::SplitString(result, '\n', messages); | 789 base::SplitString(result, '\n', messages); |
784 } | 790 } |
785 return stmt.Succeeded(); | 791 return stmt.Succeeded(); |
786 } | 792 } |
787 | 793 |
788 } // namespace sql | 794 } // namespace sql |
OLD | NEW |