OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_ |
| 6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_ |
| 7 |
| 8 #include "chrome/browser/sync/syncable/syncable.h" |
| 9 #include "chrome/browser/sync/syncable/syncable_changes_version.h" |
| 10 |
| 11 namespace syncable { |
| 12 |
| 13 struct ColumnSpec { |
| 14 const char* name; |
| 15 const char* spec; |
| 16 }; |
| 17 |
| 18 // Must be in exact same order as fields in syncable. |
| 19 static const ColumnSpec g_metas_columns[] = { |
| 20 ////////////////////////////////////// |
| 21 // int64s |
| 22 {"metahandle", "bigint primary key ON CONFLICT FAIL"}, |
| 23 {"base_version", "bigint default " CHANGES_VERSION_STRING}, |
| 24 {"server_version", "bigint default 0"}, |
| 25 // These timestamps are kept in native file timestamp format. It is |
| 26 // up to the syncer to translate to Java time when syncing. |
| 27 {"mtime", "bigint default 0"}, |
| 28 {"server_mtime", "bigint default 0"}, |
| 29 {"ctime", "bigint default 0"}, |
| 30 {"server_ctime", "bigint default 0"}, |
| 31 {"server_position_in_parent", "bigint default 0"}, |
| 32 // This is the item ID that we store for the embedding application. |
| 33 {"local_external_id", "bigint default 0"}, |
| 34 ////////////////////////////////////// |
| 35 // Ids |
| 36 {"id", "varchar(255) default \"r\""}, |
| 37 {"parent_id", "varchar(255) default \"r\""}, |
| 38 {"server_parent_id", "varchar(255) default \"r\""}, |
| 39 {"prev_id", "varchar(255) default \"r\""}, |
| 40 {"next_id", "varchar(255) default \"r\""}, |
| 41 ////////////////////////////////////// |
| 42 // bits |
| 43 {"is_unsynced", "bit default 0"}, |
| 44 {"is_unapplied_update", "bit default 0"}, |
| 45 {"is_del", "bit default 0"}, |
| 46 {"is_dir", "bit default 0"}, |
| 47 {"is_bookmark_object", "bit default 0"}, |
| 48 {"server_is_dir", "bit default 0"}, |
| 49 {"server_is_del", "bit default 0"}, |
| 50 {"server_is_bookmark_object", "bit default 0"}, |
| 51 ////////////////////////////////////// |
| 52 // Strings |
| 53 {"name", "varchar(255) COLLATE PATHNAME"}, |
| 54 {"unsanitized_name", "varchar(255) COLLATE PATHNAME"}, |
| 55 {"non_unique_name", "varchar"}, |
| 56 {"server_name", "varchar(255) COLLATE PATHNAME"}, |
| 57 {"server_non_unique_name", "varchar"}, |
| 58 {"bookmark_url", "varchar"}, |
| 59 {"server_bookmark_url", "varchar"}, |
| 60 {"singleton_tag", "varchar"}, |
| 61 ////////////////////////////////////// |
| 62 // Blobs. |
| 63 {"bookmark_favicon", "blob"}, |
| 64 {"server_bookmark_favicon", "blob"}, |
| 65 }; |
| 66 |
| 67 // At least enforce that there are equal number of column names and fields. |
| 68 COMPILE_ASSERT(ARRAYSIZE(g_metas_columns) >= FIELD_COUNT, missing_column_name); |
| 69 COMPILE_ASSERT(ARRAYSIZE(g_metas_columns) <= FIELD_COUNT, extra_column_names); |
| 70 |
| 71 static inline const char* ColumnName(int field) { |
| 72 DCHECK(field < BEGIN_TEMPS); |
| 73 return g_metas_columns[field].name; |
| 74 } |
| 75 |
| 76 } // namespace syncable |
| 77 |
| 78 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_COLUMNS_H_ |
OLD | NEW |