• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "file_column.h"
17 
18 namespace OHOS {
19 namespace FileManagement {
20 namespace CloudDisk {
21 const std::string FileColumn::CLOUD_ID = "cloud_id";
22 const std::string FileColumn::IS_DIRECTORY = "isDirectory";
23 const std::string FileColumn::FILE_NAME = "file_name";
24 const std::string FileColumn::PARENT_CLOUD_ID = "parent_cloud_id";
25 const std::string FileColumn::FILE_SIZE = "file_size";
26 const std::string FileColumn::FILE_SHA256 = "sha256";
27 const std::string FileColumn::FILE_TIME_ADDED = "time_added";
28 const std::string FileColumn::FILE_TIME_EDITED = "time_edited";
29 const std::string FileColumn::FILE_TIME_RECYCLED = "time_recycled";
30 const std::string FileColumn::META_TIME_EDITED = "meta_time_edited";
31 const std::string FileColumn::FILE_TIME_VISIT = "time_visit";
32 const std::string FileColumn::DIRECTLY_RECYCLED = "directly_recycled";
33 const std::string FileColumn::VERSION = "version";
34 const std::string FileColumn::OPERATE_TYPE = "operateType";
35 const std::string FileColumn::SYNC_STATUS = "sync_status";
36 const std::string FileColumn::POSITION = "position";
37 const std::string FileColumn::DIRTY_TYPE = "dirty_type";
38 const std::string FileColumn::MIME_TYPE = "mimetype";
39 const std::string FileColumn::FILE_TYPE = "file_type";
40 const std::string FileColumn::FILE_CATEGORY = "file_category";
41 
42 const std::string FileColumn::FILES_TABLE = "CloudDisk";
43 const std::string FileColumn::PARENT_CLOUD_ID_INDEX = "parentCloudId_index";
44 
45 const std::string FileColumn::CREATE_FILE_TABLE = "CREATE TABLE IF NOT EXISTS " +
46     FILES_TABLE + " (" +
47     CLOUD_ID + " TEXT PRIMARY KEY NOT NULL, " +
48     IS_DIRECTORY + " INT, " +
49     FILE_NAME + " TEXT NOT NULL, " +
50     PARENT_CLOUD_ID + " TEXT NOT NULL, " +
51     FILE_SIZE + " BIGINT, " +
52     FILE_SHA256 + " TEXT, " +
53     FILE_TIME_ADDED + " BIGINT, " +
54     FILE_TIME_EDITED + " BIGINT, " +
55     FILE_TIME_RECYCLED + " BIGINT DEFAULT 0, " +
56     META_TIME_EDITED + " BIGINT, " +
57     FILE_TIME_VISIT + " BIGINT DEFAULT 0, " +
58     DIRECTLY_RECYCLED + " INT DEFAULT 0, " +
59     VERSION + " BIGINT DEFAULT 0, " +
60     OPERATE_TYPE + " BIGINT DEFAULT 0, " +
61     SYNC_STATUS + " INT DEFAULT 0, " +
62     POSITION + " INT DEFAULT 1, " +
63     DIRTY_TYPE + " INT DEFAULT 1, " +
64     MIME_TYPE + " TEXT, " +
65     FILE_TYPE + " INT, " +
66     FILE_CATEGORY + " TEXT)";
67 
68 const std::string FileColumn::CREATE_PARENT_CLOUD_ID_INDEX = "CREATE INDEX IF NOT EXISTS " +
69     PARENT_CLOUD_ID_INDEX + " ON " + FILES_TABLE +
70     " (" + PARENT_CLOUD_ID + ")";
71 
72 const std::vector<std::string> FileColumn::FILE_SYSTEM_QUERY_COLUMNS = {
73     FILE_NAME,
74     CLOUD_ID,
75     PARENT_CLOUD_ID,
76     POSITION,
77     FILE_SIZE,
78     META_TIME_EDITED,
79     FILE_TIME_ADDED,
80     FILE_TIME_EDITED,
81     IS_DIRECTORY
82 };
83 
84 const std::vector<std::string> FileColumn::DISK_CLOUD_SYNC_COLUMNS = {
85     CLOUD_ID,
86     IS_DIRECTORY,
87     FILE_NAME,
88     PARENT_CLOUD_ID,
89     FILE_SIZE,
90     FILE_SHA256,
91     FILE_TIME_ADDED,
92     FILE_TIME_EDITED,
93     FILE_TIME_RECYCLED,
94     META_TIME_EDITED,
95     DIRECTLY_RECYCLED,
96     VERSION,
97     OPERATE_TYPE
98 };
99 
100 const std::vector<std::string> FileColumn::LOCAL_COLUMNS = {
101     FILE_TIME_VISIT, SYNC_STATUS, POSITION, DIRTY_TYPE,
102     MIME_TYPE, IS_DIRECTORY, FILE_TYPE, FILE_CATEGORY,
103 };
104 
105 const std::vector<std::string> FileColumn::PULL_QUERY_COLUMNS = {
106     CLOUD_ID, FILE_TIME_RECYCLED, VERSION, DIRTY_TYPE, POSITION,
107     FILE_TIME_EDITED, FILE_SHA256, FILE_SIZE,
108 };
109 
110 const std::vector<std::string> FileColumn::DISK_ON_UPLOAD_COLUMNS = {
111     CLOUD_ID,
112     FILE_TIME_EDITED,
113     META_TIME_EDITED
114 };
115 } // namespace CloudDisk
116 } // namespace FileManagement
117 } // namespace OHOS