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 #ifndef OHOS_CLOUD_SYNC_SERVICE_FILE_DATA_CONVERTOR_H
17 #define OHOS_CLOUD_SYNC_SERVICE_FILE_DATA_CONVERTOR_H
18
19 #include <ctime>
20 #include <iostream>
21 #include <sstream>
22 #include <unordered_map>
23
24 #include "data_convertor.h"
25 #include "dfs_error.h"
26 #include "utils_log.h"
27 #include "gallery_file_const.h"
28
29 namespace OHOS {
30 namespace FileManagement {
31 namespace CloudSync {
32
33 class FileDataConvertor : public DataConvertor {
34 public:
35
36 enum PhotoSubType {
37 DEFAULT,
38 SCREENSHOT,
39 CAMERA
40 };
41
42 FileDataConvertor(int32_t userId, std::string &bundleName, OperationType type, const std::function<void(
43 int32_t err, NativeRdb::ResultSet &resultSet)> &func = nullptr);
44 ~FileDataConvertor() = default;
45
46 /* resultSet -> record */
47 int32_t Convert(DriveKit::DKRecord &record, NativeRdb::ResultSet &resultSet);
48 void HandleErr(int32_t err, NativeRdb::ResultSet &resultSet);
49 /* record -> resultSet */
50 int32_t Convert(DriveKit::DKRecord &record, NativeRdb::ValuesBucket &valuesBucket);
51 int32_t ConvertAsset(DriveKit::DKRecord &record, NativeRdb::ResultSet &resultSet);
52
53 std::string GetThumbPath(const std::string &path, const std::string &key);
54 std::string GetHmdfsLocalPath(const std::string &path);
55 std::string GetThumbParentPath(const std::string &path);
56 std::string GetThumbPathInCloud(const std::string &path, const std::string &key);
57 std::string GetLocalPathToCloud(const std::string &path);
58 /* path conversion */
59 std::string GetLowerPath(const std::string &path);
60 std::string GetLowerTmpPath(const std::string &path);
61 std::string GetSandboxPath(const std::string &path);
62 std::string GetPathWithoutTmp(const std::string &path);
63
64 private:
65 /* record id */
66 int32_t FillRecordId(DriveKit::DKRecord &record, NativeRdb::ResultSet &resultSet);
67
68 /* basic */
69 int32_t HandleAlbumId(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
70 int32_t HandleFileName(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
71 int32_t HandleHash(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
72 int32_t HandleSource(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
73 int32_t HandleFileType(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
74 int32_t HandleCreatedTime(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
75 int32_t HandleFavorite(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
76 int32_t HandleDescription(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
77 int32_t HandleRecycleTime(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
78 int32_t HandleRecycled(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
79 int32_t HandleSize(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
80 int32_t HandleMimeType(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
81 int32_t HandleEditedTime(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
82
83 int32_t HandleUniqueFileds(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
84 int32_t HandleCompatibleFileds(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
85
86 /* properties */
87 int32_t HandleProperties(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
88
89 int32_t HandleDuration(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
90 int32_t HandleHeight(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
91 int32_t HandleRotate(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
92 int32_t HandleWidth(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
93 int32_t HandlePosition(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
94 int32_t HandleDataAdded(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
95 int32_t HandleDataModified(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
96 int32_t HandleDetailTime(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
97 int32_t HandleFileCreateTime(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
98 int32_t HandleFirstUpdateTime(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
99 int32_t HandleRelativeBucketId(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
100 int32_t HandleSourceFileName(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
101 int32_t HandleSourcePath(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
102 int32_t HandleTimeZone(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
103 int32_t HandleThumbSize(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
104 int32_t HandleLcdSize(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
105 int32_t HandleFormattedDate(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
106 std::string StrCreateTime(const std::string &format, int64_t time);
107 /* properties - general */
108 int32_t HandleGeneral(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
109
110 int32_t HandleAttributes(DriveKit::DKRecordFieldMap &map, NativeRdb::ResultSet &resultSet);
111 /* attachments */
112 int32_t HandleAttachments(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
113
114 /* local info */
115 int32_t HandleLocalInfo(DriveKit::DKRecordData &data, NativeRdb::ResultSet &resultSet);
116
117 int32_t HandleContent(DriveKit::DKRecordData &data, std::string &path);
118 int32_t HandleThumbnail(DriveKit::DKRecordData &data, std::string &path);
119 int32_t HandleLcd(DriveKit::DKRecordData &data, std::string &path);
120
121 int32_t TryCompensateValue(const DriveKit::DKRecord &record, DriveKit::DKRecordData &data,
122 NativeRdb::ValuesBucket &valueBucket);
123 int32_t ExtractAttributeValue(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
124
125 /* compensate missing filed according gallery value*/
126 int32_t CompensateData(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
127 int32_t CompensateTitle(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
128 int32_t CompensateMediaType(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
129 int32_t CompensateDataAdded(const DriveKit::DKRecord &record, NativeRdb::ValuesBucket &valueBucket);
130 int32_t CompensateMetaDateModified(const DriveKit::DKRecord &record, NativeRdb::ValuesBucket &valueBucket);
131 int32_t CompensateSubtype(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
132 int32_t CompensateDuration(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
133 int32_t CompensateFormattedDate(const DriveKit::DKRecord &record, NativeRdb::ValuesBucket &valueBucket);
134 int32_t CompensateFormattedDate(uint64_t dateAdded, NativeRdb::ValuesBucket &valueBucket);
135 /* extract compatible value stored in properties */
136 int32_t ExtractCompatibleValue(const DriveKit::DKRecord &record,
137 DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
138 int32_t ExtractOrientation(DriveKit::DKRecordFieldMap &map, NativeRdb::ValuesBucket &valueBucket);
139 int32_t ExtractPosition(DriveKit::DKRecordFieldMap &map, NativeRdb::ValuesBucket &valueBucket);
140 int32_t ExtractHeight(DriveKit::DKRecordFieldMap &map, NativeRdb::ValuesBucket &valueBucket);
141 int32_t ExtractWidth(DriveKit::DKRecordFieldMap &map, NativeRdb::ValuesBucket &valueBucket);
142
143 int32_t ExtractSize(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
144 int32_t ExtractDisplayName(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
145 int32_t ExtractMimeType(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
146 int32_t ExtractDeviceName(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
147 int32_t ExtractDateModified(const DriveKit::DKRecord &record, NativeRdb::ValuesBucket &valueBucket);
148 int32_t ExtractDateTaken(const DriveKit::DKRecord &record, NativeRdb::ValuesBucket &valueBucket);
149 int32_t ExtractFavorite(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
150 int32_t ExtractDateTrashed(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
151 int32_t ExtractCloudId(const DriveKit::DKRecord &record, NativeRdb::ValuesBucket &valueBucket);
152 int32_t ExtractDescription(DriveKit::DKRecordData &data, NativeRdb::ValuesBucket &valueBucket);
153
154 bool IfContainsAttributes(const DriveKit::DKRecord &record);
155
156 /* identifier */
157 int32_t userId_;
158 std::string bundleName_;
159 static std::string recordType_;
160 OperationType type_;
161
162 /* path */
163 static std::string prefix_;
164 static std::string suffix_;
165 static std::string sandboxPrefix_;
166 static std::string prefixLCD_;
167 static std::string suffixLCD_;
168 static std::string prefixCloud_;
169 static std::string suffixCloud_;
170 static std::string tmpSuffix_;
171
172 /* err */
173 std::function<void(int32_t, NativeRdb::ResultSet &resultSet)> errHandler_;
174 };
175
HandleFileName(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)176 inline int32_t FileDataConvertor::HandleFileName(DriveKit::DKRecordData &data,
177 NativeRdb::ResultSet &resultSet)
178 {
179 std::string displayName;
180 int32_t ret = GetString(Media::PhotoColumn::MEDIA_NAME, displayName, resultSet);
181 if (ret != E_OK) {
182 return ret;
183 }
184 data[FILE_FILE_NAME] = DriveKit::DKRecordField(displayName);
185 return E_OK;
186 }
187
HandleCreatedTime(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)188 inline int32_t FileDataConvertor::HandleCreatedTime(DriveKit::DKRecordData &data,
189 NativeRdb::ResultSet &resultSet)
190 {
191 int64_t val;
192 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_ADDED, val, resultSet);
193 if (ret != E_OK) {
194 return ret;
195 }
196 /* local ms to cloud ms */
197 data[FILE_CREATED_TIME] = DriveKit::DKRecordField(std::to_string(val));
198 return E_OK;
199 }
200
HandleHash(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)201 inline int32_t FileDataConvertor::HandleHash(DriveKit::DKRecordData &data,
202 NativeRdb::ResultSet &resultSet)
203 {
204 data[FILE_HASH_ID] = DriveKit::DKRecordField("Md5_default_hash");
205 return E_OK;
206 }
207
HandleSize(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)208 inline int32_t FileDataConvertor::HandleSize(DriveKit::DKRecordData &data,
209 NativeRdb::ResultSet &resultSet)
210 {
211 int32_t val;
212 int32_t ret = GetInt(Media::PhotoColumn::MEDIA_SIZE, val, resultSet);
213 if (ret != E_OK) {
214 return ret;
215 }
216 data[FILE_SIZE] = DriveKit::DKRecordField(val);
217 return E_OK;
218 }
219
HandleSource(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)220 inline int32_t FileDataConvertor::HandleSource(DriveKit::DKRecordData &data,
221 NativeRdb::ResultSet &resultSet)
222 {
223 std::string val;
224 int32_t ret = GetString(Media::PhotoColumn::MEDIA_DEVICE_NAME, val, resultSet);
225 if (ret != E_OK) {
226 return ret;
227 }
228 data[FILE_SOURCE] = DriveKit::DKRecordField(val);
229 return E_OK;
230 }
231
HandleFileType(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)232 inline int32_t FileDataConvertor::HandleFileType(DriveKit::DKRecordData &data,
233 NativeRdb::ResultSet &resultSet)
234 {
235 int32_t val;
236 int32_t ret = GetInt(Media::PhotoColumn::MEDIA_TYPE, val, resultSet);
237 if (ret != E_OK) {
238 return ret;
239 }
240 data[FILE_FILETYPE] = DriveKit::DKRecordField(val ==
241 Media::MEDIA_TYPE_VIDEO ? FILE_TYPE_VIDEO : FILE_TYPE_IMAGE);
242 return E_OK;
243 }
244
HandleRecycled(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)245 inline int32_t FileDataConvertor::HandleRecycled(DriveKit::DKRecordData &data,
246 NativeRdb::ResultSet &resultSet)
247 {
248 int64_t val;
249 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_TRASHED, val, resultSet);
250 if (ret != E_OK) {
251 return ret;
252 }
253 data[FILE_RECYCLED] = DriveKit::DKRecordField(!!val);
254 return E_OK;
255 }
256
HandleRecycleTime(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)257 inline int32_t FileDataConvertor::HandleRecycleTime(DriveKit::DKRecordData &data,
258 NativeRdb::ResultSet &resultSet)
259 {
260 int64_t val;
261 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_TRASHED, val, resultSet);
262 if (ret != E_OK) {
263 return ret;
264 }
265 data[FILE_RECYCLE_TIME] = DriveKit::DKRecordField(std::to_string(val));
266 return E_OK;
267 }
268
HandleMimeType(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)269 inline int32_t FileDataConvertor::HandleMimeType(DriveKit::DKRecordData &data,
270 NativeRdb::ResultSet &resultSet)
271 {
272 std::string mimeType;
273 int32_t ret = GetString(Media::PhotoColumn::MEDIA_MIME_TYPE, mimeType, resultSet);
274 if (ret != E_OK) {
275 return ret;
276 }
277 data[FILE_MIME_TYPE] = DriveKit::DKRecordField(mimeType);
278 return E_OK;
279 }
280
HandleEditedTime(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)281 inline int32_t FileDataConvertor::HandleEditedTime(DriveKit::DKRecordData &data,
282 NativeRdb::ResultSet &resultSet)
283 {
284 int64_t val;
285 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_MODIFIED, val, resultSet);
286 if (ret != E_OK) {
287 return ret;
288 }
289 data[FILE_EDITED_TIME] = DriveKit::DKRecordField(std::to_string(val));
290 return E_OK;
291 }
292
HandleFavorite(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)293 inline int32_t FileDataConvertor::HandleFavorite(DriveKit::DKRecordData &data,
294 NativeRdb::ResultSet &resultSet)
295 {
296 int32_t val;
297 int32_t ret = GetInt(Media::PhotoColumn::MEDIA_IS_FAV, val, resultSet);
298 if (ret != E_OK) {
299 return ret;
300 }
301 data[FILE_FAVORITE] = DriveKit::DKRecordField(!!val);
302 return E_OK;
303 }
304
305 /* properties */
HandleSourceFileName(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)306 inline int32_t FileDataConvertor::HandleSourceFileName(DriveKit::DKRecordFieldMap &map,
307 NativeRdb::ResultSet &resultSet)
308 {
309 std::string val;
310 int32_t ret = GetString(Media::PhotoColumn::MEDIA_NAME, val, resultSet);
311 if (ret != E_OK) {
312 return ret;
313 }
314 map[FILE_SOURCE_FILE_NAME] = DriveKit::DKRecordField(val);
315 return E_OK;
316 }
317
HandleFirstUpdateTime(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)318 inline int32_t FileDataConvertor::HandleFirstUpdateTime(DriveKit::DKRecordFieldMap &map,
319 NativeRdb::ResultSet &resultSet)
320 {
321 int64_t val;
322 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_ADDED, val, resultSet);
323 if (ret != E_OK) {
324 return ret;
325 }
326 /* local ms to cloud ms */
327 map[FILE_FIRST_UPDATE_TIME] = DriveKit::DKRecordField(std::to_string(val));
328 return E_OK;
329 }
330
HandleFileCreateTime(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)331 inline int32_t FileDataConvertor::HandleFileCreateTime(DriveKit::DKRecordFieldMap &map,
332 NativeRdb::ResultSet &resultSet)
333 {
334 int64_t val;
335 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_ADDED, val, resultSet);
336 if (ret != E_OK) {
337 return ret;
338 }
339 /* local ms to cloud ms */
340 map[FILE_FILE_CREATE_TIME] = DriveKit::DKRecordField(std::to_string(val));
341 return E_OK;
342 }
343
HandleSourcePath(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)344 inline int32_t FileDataConvertor::HandleSourcePath(DriveKit::DKRecordFieldMap &map,
345 NativeRdb::ResultSet &resultSet)
346 {
347 std::string displayName;
348 int32_t ret = GetString(Media::PhotoColumn::MEDIA_NAME, displayName, resultSet);
349 if (ret != E_OK) {
350 return ret;
351 }
352 map[FILE_SOURCE_PATH] = DriveKit::DKRecordField("/storage/emulated/0/Pictures/cloud/Imports/" + displayName);
353 return E_OK;
354 }
355
HandleRelativeBucketId(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)356 inline int32_t FileDataConvertor::HandleRelativeBucketId(DriveKit::DKRecordFieldMap &map,
357 NativeRdb::ResultSet &resultSet)
358 {
359 return E_OK;
360 }
361
HandleDuration(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)362 inline int32_t FileDataConvertor::HandleDuration(DriveKit::DKRecordFieldMap &map,
363 NativeRdb::ResultSet &resultSet)
364 {
365 int32_t duration;
366 int32_t ret = GetInt(Media::PhotoColumn::MEDIA_DURATION, duration, resultSet);
367 if (ret != E_OK) {
368 return ret;
369 }
370 map[FILE_DURATION] = DriveKit::DKRecordField(duration);
371 return E_OK;
372 }
373
HandleDataAdded(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)374 inline int32_t FileDataConvertor::HandleDataAdded(DriveKit::DKRecordFieldMap &map,
375 NativeRdb::ResultSet &resultSet)
376 {
377 int64_t val;
378 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_ADDED, val, resultSet);
379 if (ret != E_OK) {
380 return ret;
381 }
382 map[Media::PhotoColumn::MEDIA_DATE_ADDED] = DriveKit::DKRecordField(val / MILLISECOND_TO_SECOND);
383 return E_OK;
384 }
385
HandleDataModified(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)386 inline int32_t FileDataConvertor::HandleDataModified(DriveKit::DKRecordFieldMap &map,
387 NativeRdb::ResultSet &resultSet)
388 {
389 int64_t val;
390 int32_t ret = GetLong(Media::PhotoColumn::MEDIA_DATE_MODIFIED, val, resultSet);
391 if (ret != E_OK) {
392 return ret;
393 }
394 map[FILE_EDITED_TIME_MS] = DriveKit::DKRecordField(val);
395 map[Media::PhotoColumn::MEDIA_DATE_MODIFIED] = DriveKit::DKRecordField(val / MILLISECOND_TO_SECOND);
396 return E_OK;
397 }
398
HandleTimeZone(DriveKit::DKRecordFieldMap & map,NativeRdb::ResultSet & resultSet)399 inline int32_t FileDataConvertor::HandleTimeZone(DriveKit::DKRecordFieldMap &map,
400 NativeRdb::ResultSet &resultSet)
401 {
402 map[FILE_TIME_ZONE] = DriveKit::DKRecordField("");
403 return E_OK;
404 }
405
HandleDescription(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)406 inline int32_t FileDataConvertor::HandleDescription(DriveKit::DKRecordData &data,
407 NativeRdb::ResultSet &resultSet)
408 {
409 std::string val;
410 int32_t ret = GetString(Media::PhotoColumn::PHOTO_USER_COMMENT, val, resultSet);
411 if (ret != E_OK) {
412 LOGE("Get user comment err %{public}d", ret);
413 return E_RDB;
414 }
415 data[FILE_DESCRIPTION] = DriveKit::DKRecordField(val);
416 return E_OK;
417 }
HandleAlbumId(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)418 inline int32_t FileDataConvertor::HandleAlbumId(DriveKit::DKRecordData &data,
419 NativeRdb::ResultSet &resultSet)
420 {
421 return E_OK;
422 }
423
HandleLocalInfo(DriveKit::DKRecordData & data,NativeRdb::ResultSet & resultSet)424 inline int32_t FileDataConvertor::HandleLocalInfo(DriveKit::DKRecordData &data,
425 NativeRdb::ResultSet &resultSet)
426 {
427 int32_t val;
428 int32_t ret = GetInt(Media::PhotoColumn::MEDIA_ID, val, resultSet);
429 if (ret != E_OK) {
430 return ret;
431 }
432 data[FILE_LOCAL_ID] = DriveKit::DKRecordField(val);
433 return E_OK;
434 }
435 } // namespace CloudSync
436 } // namespace FileManagement
437 } // namespace OHOS
438 #endif // OHOS_CLOUD_SYNC_SERVICE_FILE_DATA_CONVERTOR_H
439