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 "chrome/browser/sync/syncable/directory_backing_store.h" | 5 #include "sync/syncable/directory_backing_store.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
11 #include "base/base64.h" | 11 #include "base/base64.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
19 #include "base/stringprintf.h" | 19 #include "base/stringprintf.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "chrome/browser/sync/protocol/service_constants.h" | |
22 #include "chrome/browser/sync/syncable/syncable-inl.h" | |
23 #include "chrome/browser/sync/syncable/syncable_columns.h" | |
24 #include "chrome/browser/sync/util/time.h" | |
25 #include "sql/connection.h" | 21 #include "sql/connection.h" |
26 #include "sql/statement.h" | 22 #include "sql/statement.h" |
27 #include "sql/transaction.h" | 23 #include "sql/transaction.h" |
28 #include "sync/protocol/bookmark_specifics.pb.h" | 24 #include "sync/protocol/bookmark_specifics.pb.h" |
| 25 #include "sync/protocol/service_constants.h" |
29 #include "sync/protocol/sync.pb.h" | 26 #include "sync/protocol/sync.pb.h" |
| 27 #include "sync/syncable/syncable-inl.h" |
| 28 #include "sync/syncable/syncable_columns.h" |
| 29 #include "sync/util/time.h" |
30 | 30 |
31 using std::string; | 31 using std::string; |
32 | 32 |
33 namespace syncable { | 33 namespace syncable { |
34 | 34 |
35 // This just has to be big enough to hold an UPDATE or INSERT statement that | 35 // This just has to be big enough to hold an UPDATE or INSERT statement that |
36 // modifies all the columns in the entry table. | 36 // modifies all the columns in the entry table. |
37 static const string::size_type kUpdateStatementBufferSize = 2048; | 37 static const string::size_type kUpdateStatementBufferSize = 2048; |
38 | 38 |
39 // Increment this version whenever updating DB tables. | 39 // Increment this version whenever updating DB tables. |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 "?, " // name | 962 "?, " // name |
963 "?, " // store_birthday | 963 "?, " // store_birthday |
964 "?, " // db_create_version | 964 "?, " // db_create_version |
965 "?, " // db_create_time | 965 "?, " // db_create_time |
966 "-2, " // next_id | 966 "-2, " // next_id |
967 "?, " // cache_guid | 967 "?, " // cache_guid |
968 "?);")); // notification_state | 968 "?);")); // notification_state |
969 s.BindString(0, dir_name_); // id | 969 s.BindString(0, dir_name_); // id |
970 s.BindString(1, dir_name_); // name | 970 s.BindString(1, dir_name_); // name |
971 s.BindString(2, ""); // store_birthday | 971 s.BindString(2, ""); // store_birthday |
972 s.BindString(3, SYNC_ENGINE_VERSION_STRING); // db_create_version | 972 // TODO(akalin): Remove this unused db_create_version field. (Or |
| 973 // actually use it for something.) http://crbug.com/118356 |
| 974 s.BindString(3, "Unknown"); // db_create_version |
973 s.BindInt(4, static_cast<int32>(time(0))); // db_create_time | 975 s.BindInt(4, static_cast<int32>(time(0))); // db_create_time |
974 s.BindString(5, GenerateCacheGUID()); // cache_guid | 976 s.BindString(5, GenerateCacheGUID()); // cache_guid |
975 s.BindBlob(6, NULL, 0); // notification_state | 977 s.BindBlob(6, NULL, 0); // notification_state |
976 | 978 |
977 if (!s.Run()) | 979 if (!s.Run()) |
978 return false; | 980 return false; |
979 } | 981 } |
980 | 982 |
981 if (!CreateModelsTable()) | 983 if (!CreateModelsTable()) |
982 return false; | 984 return false; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 "name TEXT, " | 1069 "name TEXT, " |
1068 "store_birthday TEXT, " | 1070 "store_birthday TEXT, " |
1069 "db_create_version TEXT, " | 1071 "db_create_version TEXT, " |
1070 "db_create_time INT, " | 1072 "db_create_time INT, " |
1071 "next_id INT default -2, " | 1073 "next_id INT default -2, " |
1072 "cache_guid TEXT )"); | 1074 "cache_guid TEXT )"); |
1073 return db_->Execute(query.c_str()); | 1075 return db_->Execute(query.c_str()); |
1074 } | 1076 } |
1075 | 1077 |
1076 } // namespace syncable | 1078 } // namespace syncable |
OLD | NEW |