| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/sync/syncable/directory_backing_store.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 10 #include <CoreFoundation/CoreFoundation.h> | 10 #include <CoreFoundation/CoreFoundation.h> |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 } | 274 } |
| 275 | 275 |
| 276 if (save_info) { | 276 if (save_info) { |
| 277 const Directory::PersistedKernelInfo& info = snapshot.kernel_info; | 277 const Directory::PersistedKernelInfo& info = snapshot.kernel_info; |
| 278 SQLStatement update; | 278 SQLStatement update; |
| 279 update.prepare(dbhandle, "UPDATE share_info " | 279 update.prepare(dbhandle, "UPDATE share_info " |
| 280 "SET last_sync_timestamp = ?, initial_sync_ended = ?, " | 280 "SET last_sync_timestamp = ?, initial_sync_ended = ?, " |
| 281 "store_birthday = ?, " | 281 "store_birthday = ?, " |
| 282 "next_id = ?"); | 282 "next_id = ?"); |
| 283 update.bind_int64(0, info.last_sync_timestamp); | 283 update.bind_int64(0, info.last_download_timestamp); |
| 284 update.bind_bool(1, info.initial_sync_ended); | 284 update.bind_bool(1, info.initial_sync_ended); |
| 285 update.bind_string(2, info.store_birthday); | 285 update.bind_string(2, info.store_birthday); |
| 286 update.bind_int64(3, info.next_id); | 286 update.bind_int64(3, info.next_id); |
| 287 | 287 |
| 288 if (!(SQLITE_DONE == update.step() && | 288 if (!(SQLITE_DONE == update.step() && |
| 289 SQLITE_OK == update.reset() && | 289 SQLITE_OK == update.reset() && |
| 290 1 == update.changes())) { | 290 1 == update.changes())) { |
| 291 return false; | 291 return false; |
| 292 } | 292 } |
| 293 } | 293 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 437 } |
| 438 | 438 |
| 439 void DirectoryBackingStore::LoadInfo(Directory::KernelLoadInfo* info) { | 439 void DirectoryBackingStore::LoadInfo(Directory::KernelLoadInfo* info) { |
| 440 { | 440 { |
| 441 SQLStatement query; | 441 SQLStatement query; |
| 442 query.prepare(load_dbhandle_, | 442 query.prepare(load_dbhandle_, |
| 443 "SELECT last_sync_timestamp, initial_sync_ended, " | 443 "SELECT last_sync_timestamp, initial_sync_ended, " |
| 444 "store_birthday, next_id, cache_guid " | 444 "store_birthday, next_id, cache_guid " |
| 445 "FROM share_info"); | 445 "FROM share_info"); |
| 446 CHECK(SQLITE_ROW == query.step()); | 446 CHECK(SQLITE_ROW == query.step()); |
| 447 info->kernel_info.last_sync_timestamp = query.column_int64(0); | 447 info->kernel_info.last_download_timestamp = query.column_int64(0); |
| 448 info->kernel_info.initial_sync_ended = query.column_bool(1); | 448 info->kernel_info.initial_sync_ended = query.column_bool(1); |
| 449 info->kernel_info.store_birthday = query.column_string(2); | 449 info->kernel_info.store_birthday = query.column_string(2); |
| 450 info->kernel_info.next_id = query.column_int64(3); | 450 info->kernel_info.next_id = query.column_int64(3); |
| 451 info->cache_guid = query.column_string(4); | 451 info->cache_guid = query.column_string(4); |
| 452 } | 452 } |
| 453 | 453 |
| 454 { | 454 { |
| 455 SQLStatement query; | 455 SQLStatement query; |
| 456 query.prepare(load_dbhandle_, | 456 query.prepare(load_dbhandle_, |
| 457 "SELECT MAX(metahandle) FROM metas"); | 457 "SELECT MAX(metahandle) FROM metas"); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 | 849 |
| 850 int DirectoryBackingStore::CreateMetasTable(bool is_temporary) { | 850 int DirectoryBackingStore::CreateMetasTable(bool is_temporary) { |
| 851 const char* name = is_temporary ? "temp_metas" : "metas"; | 851 const char* name = is_temporary ? "temp_metas" : "metas"; |
| 852 string query = "CREATE TABLE "; | 852 string query = "CREATE TABLE "; |
| 853 query.append(name); | 853 query.append(name); |
| 854 query.append(ComposeCreateTableColumnSpecs()); | 854 query.append(ComposeCreateTableColumnSpecs()); |
| 855 return ExecQuery(load_dbhandle_, query.c_str()); | 855 return ExecQuery(load_dbhandle_, query.c_str()); |
| 856 } | 856 } |
| 857 | 857 |
| 858 } // namespace syncable | 858 } // namespace syncable |
| OLD | NEW |