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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // The caller owns the returned EntryKernel*. | 93 // The caller owns the returned EntryKernel*. |
94 EntryKernel* UnpackEntry(SQLStatement* statement) { | 94 EntryKernel* UnpackEntry(SQLStatement* statement) { |
95 EntryKernel* result = NULL; | 95 EntryKernel* result = NULL; |
96 int query_result = statement->step(); | 96 int query_result = statement->step(); |
97 if (SQLITE_ROW == query_result) { | 97 if (SQLITE_ROW == query_result) { |
98 result = new EntryKernel; | 98 result = new EntryKernel; |
99 result->clear_dirty(); | 99 result->clear_dirty(); |
100 CHECK(statement->column_count() == static_cast<int>(FIELD_COUNT)); | 100 CHECK(statement->column_count() == static_cast<int>(FIELD_COUNT)); |
101 int i = 0; | 101 int i = 0; |
102 for (i = BEGIN_FIELDS; i < INT64_FIELDS_END; ++i) { | 102 for (i = BEGIN_FIELDS; i < INT64_FIELDS_END; ++i) { |
103 result->ref(static_cast<Int64Field>(i)) = | 103 result->put(static_cast<Int64Field>(i), statement->column_int64(i)); |
104 statement->column_int64(i); | |
105 } | 104 } |
106 for ( ; i < ID_FIELDS_END; ++i) { | 105 for ( ; i < ID_FIELDS_END; ++i) { |
107 result->ref(static_cast<IdField>(i)).s_ = statement->column_string(i); | 106 result->mutable_ref(static_cast<IdField>(i)).s_ = |
| 107 statement->column_string(i); |
108 } | 108 } |
109 for ( ; i < BIT_FIELDS_END; ++i) { | 109 for ( ; i < BIT_FIELDS_END; ++i) { |
110 result->ref(static_cast<BitField>(i)) = | 110 result->put(static_cast<BitField>(i), (0 != statement->column_int(i))); |
111 (0 != statement->column_int(i)); | |
112 } | 111 } |
113 for ( ; i < STRING_FIELDS_END; ++i) { | 112 for ( ; i < STRING_FIELDS_END; ++i) { |
114 result->ref(static_cast<StringField>(i)) = statement->column_string(i); | 113 result->put(static_cast<StringField>(i), |
| 114 statement->column_string(i)); |
115 } | 115 } |
116 for ( ; i < BLOB_FIELDS_END; ++i) { | 116 for ( ; i < BLOB_FIELDS_END; ++i) { |
117 statement->column_blob_as_vector( | 117 statement->column_blob_as_vector( |
118 i, &result->ref(static_cast<BlobField>(i))); | 118 i, &result->mutable_ref(static_cast<BlobField>(i))); |
119 } | 119 } |
120 ZeroFields(result, i); | 120 ZeroFields(result, i); |
121 } else { | 121 } else { |
122 CHECK(SQLITE_DONE == query_result); | 122 CHECK(SQLITE_DONE == query_result); |
123 result = NULL; | 123 result = NULL; |
124 } | 124 } |
125 return result; | 125 return result; |
126 } | 126 } |
127 | 127 |
128 static string ComposeCreateTableColumnSpecs(const ColumnSpec* begin, | 128 static string ComposeCreateTableColumnSpecs(const ColumnSpec* begin, |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 604 |
605 sqlite3* DirectoryBackingStore::LazyGetSaveHandle() { | 605 sqlite3* DirectoryBackingStore::LazyGetSaveHandle() { |
606 if (!save_dbhandle_ && !OpenAndConfigureHandleHelper(&save_dbhandle_)) { | 606 if (!save_dbhandle_ && !OpenAndConfigureHandleHelper(&save_dbhandle_)) { |
607 DCHECK(FALSE) << "Unable to open handle for saving"; | 607 DCHECK(FALSE) << "Unable to open handle for saving"; |
608 return NULL; | 608 return NULL; |
609 } | 609 } |
610 return save_dbhandle_; | 610 return save_dbhandle_; |
611 } | 611 } |
612 | 612 |
613 } // namespace syncable | 613 } // namespace syncable |
OLD | NEW |