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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 bool Connection::Delete(const base::FilePath& path) { | 669 bool Connection::Delete(const base::FilePath& path) { |
670 base::ThreadRestrictions::AssertIOAllowed(); | 670 base::ThreadRestrictions::AssertIOAllowed(); |
671 | 671 |
672 base::FilePath journal_path(path.value() + FILE_PATH_LITERAL("-journal")); | 672 base::FilePath journal_path(path.value() + FILE_PATH_LITERAL("-journal")); |
673 base::FilePath wal_path(path.value() + FILE_PATH_LITERAL("-wal")); | 673 base::FilePath wal_path(path.value() + FILE_PATH_LITERAL("-wal")); |
674 | 674 |
675 std::string journal_str = AsUTF8ForSQL(journal_path); | 675 std::string journal_str = AsUTF8ForSQL(journal_path); |
676 std::string wal_str = AsUTF8ForSQL(wal_path); | 676 std::string wal_str = AsUTF8ForSQL(wal_path); |
677 std::string path_str = AsUTF8ForSQL(path); | 677 std::string path_str = AsUTF8ForSQL(path); |
678 | 678 |
| 679 // Make sure sqlite3_initialize() is called before anything else. |
| 680 InitializeSqlite(); |
| 681 |
679 sqlite3_vfs* vfs = sqlite3_vfs_find(NULL); | 682 sqlite3_vfs* vfs = sqlite3_vfs_find(NULL); |
680 CHECK(vfs); | 683 CHECK(vfs); |
681 CHECK(vfs->xDelete); | 684 CHECK(vfs->xDelete); |
682 CHECK(vfs->xAccess); | 685 CHECK(vfs->xAccess); |
683 | 686 |
684 // We only work with unix, win32 and mojo filesystems. If you're trying to | 687 // We only work with unix, win32 and mojo filesystems. If you're trying to |
685 // use this code with any other VFS, you're not in a good place. | 688 // use this code with any other VFS, you're not in a good place. |
686 CHECK(strncmp(vfs->zName, "unix", 4) == 0 || | 689 CHECK(strncmp(vfs->zName, "unix", 4) == 0 || |
687 strncmp(vfs->zName, "win32", 5) == 0 || | 690 strncmp(vfs->zName, "win32", 5) == 0 || |
688 strcmp(vfs->zName, "mojo") == 0); | 691 strcmp(vfs->zName, "mojo") == 0); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 ignore_result(Execute(kNoWritableSchema)); | 1385 ignore_result(Execute(kNoWritableSchema)); |
1383 | 1386 |
1384 return ret; | 1387 return ret; |
1385 } | 1388 } |
1386 | 1389 |
1387 base::TimeTicks TimeSource::Now() { | 1390 base::TimeTicks TimeSource::Now() { |
1388 return base::TimeTicks::Now(); | 1391 return base::TimeTicks::Now(); |
1389 } | 1392 } |
1390 | 1393 |
1391 } // namespace sql | 1394 } // namespace sql |
OLD | NEW |