3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 #include "data-adapter/common.h"
22 #include "data-adapter/common_internal.h"
24 #include "account/manager.h"
28 * @brief Internal API to manage sync-agent-framework database
31 /** @addtogroup data_adapter
36 * =============================================================================================================================
37 * Database Open & Close & Delete Account Data
38 * =============================================================================================================================
42 * @brief Start Agent database transaction
43 * @param[in] daci_handler sqlite3 handler pointer about thread
44 * @return Operation result
45 * @retval SYNC_AGENT_DA_SUCCESS success
46 * @retval SYNC_AGENT_DA_ERR_TRANSACTION_FAILED error
48 sync_agent_da_return_e da_begin_transaction(SYNC_AGENT_DA_HANDLER * daci_handler);
51 * @brief Finish Agent database transaction
52 * @param[in] daci_handler sqlite3 handler pointer about thread
53 * @param[in] transaction commit or rollback transaction
54 * @return Operation result
55 * @retval SYNC_AGENT_DA_SUCCESS success
56 * @retval SYNC_AGENT_DA_ERR_TRANSACTION_FAILED error
58 sync_agent_da_return_e da_end_transaction(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_transaction_e transaction);
61 * @brief Set agent db file path
62 * @param[in] file_path agent db file path
64 void da_set_agent_db_file_path(char *file_path);
67 * @brief Open Agent database
68 * @param[in] daci_handler sqlite3 handler pointer about thread
69 * @return Operation result
70 * @retval SYNC_AGENT_DA_SUCCESS success
71 * @retval SYNC_AGENT_DA_ERR_OPEN_FAILED error
73 sync_agent_da_return_e da_open_agent(SYNC_AGENT_DA_HANDLER ** daci_handler);
76 * @brief Close Agent database
77 * @param[in] daci_handler sqlite3 handler pointer about thread
78 * @return Operation result
79 * @retval SYNC_AGENT_DA_SUCCESS success
80 * @retval SYNC_AGENT_DA_ERR_CLOSE_FAILED error
82 sync_agent_da_return_e da_close_Agent(SYNC_AGENT_DA_HANDLER * daci_handler);
85 * @brief Create Agent database
86 * @param[in] daci_handler sqlite3 handler pointer about thread
87 * @return Operation result
88 * @retval SYNC_AGENT_DA_SUCCESS success
89 * @retval SYNC_AGENT_DA_ERR_CLOSE_FAILED error
91 sync_agent_da_return_e da_create_agent_default_table(SYNC_AGENT_DA_HANDLER * daci_handler);
94 * @brief Empty Agent database table
95 * @param[in] daci_handler sqlite3 handler pointer about thread
96 * @return Operation result
97 * @retval SYNC_AGENT_DA_SUCCESS success
98 * @retval SYNC_AGENT_DA_ERR_CLOSE_FAILED error
100 sync_agent_da_return_e da_empty_agent_default_table(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_table_name_e table_name);
103 * @brief Empty all Agent database tables
104 * @param[in] daci_handler sqlite3 handler pointer about thread
105 * @return Operation result
106 * @retval SYNC_AGENT_DA_SUCCESS success
107 * @retval SYNC_AGENT_DA_ERR_CLOSE_FAILED error
109 sync_agent_da_return_e da_empty_all_agent_table(SYNC_AGENT_DA_HANDLER * daci_handler);
112 * =============================================================================================================================
114 * =============================================================================================================================
118 * @brief Insert account into account_tbl
119 * @param[in] daci_handler sqlite3 handler pointer about thread
120 * @param[in] sync_agent_fw_account_s account info
121 * @return Operation result
122 * @retval account id (positive number) success
125 int da_add_fw_account(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_fw_account_s * account);
128 * @brief Update account into account_tbl
129 * @param[in] daci_handler sqlite3 handler pointer about thread
130 * @param[in] sync_agent_fw_account_s account info
131 * @return Operation result
132 * @retval SYNC_AGENT_DA_SUCCESS success
133 * @retval negative value error
135 sync_agent_da_return_e da_update_fw_account(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_fw_account_s * account);
138 * @brief Delete account data from Agent database
139 * @param[in] daci_handler sqlite3 handler pointer about thread
140 * @param[in] account_id account id
141 * @return Operation result
142 * @retval SYNC_AGENT_DA_SUCCESS success
143 * @retval negative value error
145 sync_agent_da_return_e da_delete_fw_account(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id);
148 * @brief Get account data from Agent database
149 * @param[in] daci_handler sqlite3 handler pointer about thread
150 * @param[in] account_id account id
151 * @param[in] account as returned by da_get_fw_account() - account info
152 * @return Operation result
153 * @retval SYNC_AGENT_DA_SUCCESS success
154 * @retval negative value error
156 sync_agent_da_return_e da_get_fw_account(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, sync_agent_fw_account_s ** account);
159 * @brief Get all account data from Agent database
160 * @param[in] daci_handler sqlite3 handler pointer about thread
161 * @param[in] list list of sync_agent_fw_account_s
162 * @return Operation result
163 * @retval SYNC_AGENT_DA_SUCCESS success
164 * @retval negative value error
166 sync_agent_da_return_e da_get_all_fw_account(SYNC_AGENT_DA_HANDLER * daci_handler, GList ** list);
169 * @brief Get account data by access name from Agent database
170 * @param[in] daci_handler sqlite3 handler pointer about thread
171 * @param[in] access_name db access name
172 * @param[in] list as returned by da_get_fw_account_by_access_name() - list of sync_agent_fw_account_s
173 * @return Operation result
174 * @retval SYNC_AGENT_DA_SUCCESS success
175 * @retval negative value error
177 sync_agent_da_return_e da_get_fw_account_by_access_name(SYNC_AGENT_DA_HANDLER * daci_handler, char *access_name, GList ** list);
180 * @brief Get all account id from account_tbl
181 * @param[in] daci_handler sqlite3 handler pointer about thread
182 * @param[in] count as returned by da_get_account_account_id_list() - count of account id
183 * @return Operation result
184 * @retval array of account id success
187 int *da_get_account_account_id_list(SYNC_AGENT_DA_HANDLER * daci_handler, int *count);
190 * @brief Checking whether the account id exist in account_tbl
191 * @param[in] daci_handler sqlite3 handler pointer about thread
192 * @param[in] account_id account id
193 * @return Checking result
195 * @retval 0 error or not exist
197 int da_is_exist_account(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id);
200 * @brief Get account id list from account_tbl by access name
201 * @remarks Caller should free return value
202 * @param[in] daci_handler sqlite3 handler pointer about thread
203 * @param[in] access_name db access name
204 * @param[in] accountId_count as returned by da_get_account_id_list_by_access_name() - count of account id
205 * @return Operation result
206 * @retval account id list success
209 int *da_get_account_id_list_by_access_name(SYNC_AGENT_DA_HANDLER * daci_handler, char *access_name, int *accountId_count);
212 * @brief Get account count
213 * @param[in] daci_handler sqlite3 handler pointer about thread
214 * @return Checking result
216 * @retval 0 error or not exist
218 int da_get_account_count(SYNC_AGENT_DA_HANDLER * daci_handler);
221 * =============================================================================================================================
223 * =============================================================================================================================
227 * @brief Insert folder into folder_tbl - currently unused function
228 * @param[in] daci_handler sqlite3 handler pointer about thread
229 * @param[in] folder array of folder info
230 * @param[in] count count of folder info
231 * @return Operation result
232 * @retval SYNC_AGENT_DA_SUCCESS success
233 * @retval negative value error
235 sync_agent_da_return_e da_add_folder(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_folder_s * folder, int count);
238 * @brief Insert folder into folder_tbl
239 * @param[in] daci_handler sqlite3 handler pointer about thread
240 * @param[in] folder array of folder info
241 * @param[in] count count of folder info
242 * @param[in] folder_id as returned by da_add_folder_new() - id of newly added folder
243 * @return Operation result
244 * @retval SYNC_AGENT_DA_SUCCESS success
245 * @retval negative value error
247 sync_agent_da_return_e da_add_folder_new(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_folder_s * folder, int count, char **folder_id);
250 * @brief Delete folder from folder_tbl by folderId
251 * @param[in] daci_handler sqlite3 handler pointer about thread
252 * @param[in] folder_id folder id
253 * @return Operation result
254 * @retval SYNC_AGENT_DA_SUCCESS success
255 * @retval negative value error
257 sync_agent_da_return_e da_delete_folder_by_folder_id(SYNC_AGENT_DA_HANDLER * daci_handler, char *folder_id);
260 * @brief Get folderId from folder_tbl
261 * @param[in] daci_handler sqlite3 handler pointer about thread
262 * @param[in] account_id account id
263 * @param[in] item_type_id item type id
264 * @param[in] service_id service id
265 * @param[in] folder_type_id folder type id
266 * @return Operation result
267 * @retval folder id success
270 char *da_get_folder_folder_id_by_service_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, char *service_id, int folder_type_id);
273 * @brief Get folderId from folder_tbl by folder type id - currently unused function
274 * @param[in] daci_handler sqlite3 handler pointer about thread
275 * @param[in] account_id account id
276 * @param[in] item_type_id item type id
277 * @param[in] folder_type_id folder type id
278 * @return Operation result
279 * @retval folder id success
282 sync_agent_da_id_list_s *da_get_folder_folder_id_by_folder_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, int folder_type_id);
285 * @brief Get folderId from folder_tbl by folder type id
286 * @param[in] daci_handler sqlite3 handler pointer about thread
287 * @param[in] account_id account id
288 * @param[in] item_type_id item type id
289 * @param[in] folder_type_id folder type id
290 * @param[in] list as returned by da_get_folder_folder_id_by_folder_type_id_new() - list of folder id
291 * @return Operation result
292 * @retval SYNC_AGENT_DA_SUCCESS success
293 * @retval negative value error
295 sync_agent_da_return_e da_get_folder_folder_id_by_folder_type_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, int folder_type_id, GList ** list);
298 * @brief Get serviceId from folder_tbl
299 * @param[in] daci_handler sqlite3 handler pointer about thread
300 * @param[in] folder_id folder id
301 * @return Operation result
302 * @retval service id success
305 char *da_get_folder_service_id(SYNC_AGENT_DA_HANDLER * daci_handler, char *folder_id);
308 * @brief Get all folder_id_list from folder_tbl by data_store_id - currently unused function
309 * Get all the folders in account and data store
310 * @param[in] daci_handler sqlite3 handler pointer about thread
311 * @param[in] account_id account id
312 * @param[in] item_type_id item type id
313 * @return Operation result
314 * @retval array of folder id success
317 sync_agent_da_id_list_s *da_get_folder_folder_id_list_by_item_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id);
320 * @brief Get all folder_id_list from folder_tbl by data_store_id
321 * Get all the folders in account and data store
322 * @param[in] daci_handler sqlite3 handler pointer about thread
323 * @param[in] account_id account id
324 * @param[in] item_type_id item type id
325 * @param[in] list as returned by da_get_folder_folder_id_list_by_item_type_id_new() - list of folder id
326 * @return Operation result
327 * @retval SYNC_AGENT_DA_SUCCESS success
328 * @retval negative value error
330 sync_agent_da_return_e da_get_folder_folder_id_list_by_item_type_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, GList ** list);
333 * @brief Get item from folder_tbl - currently unused function
334 * Belonging to different account of folder get folder with the same service_id
335 * @param[in] daci_handler sqlite3 handler pointer about thread
336 * @param[in] account_id account id
337 * @param[in] folder_id folder id
338 * @param[in] count as returned by da_get_folder_mapping_service_id() - count of item info
339 * @return Operation result
340 * @retval array of folder info success
343 sync_agent_da_folder_s *da_get_folder_mapping_service_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *folder_id, int *count);
346 * @brief Get item from folder_tbl
347 * Belonging to different account of folder get folder with the same service_id
348 * @param[in] daci_handler sqlite3 handler pointer about thread
349 * @param[in] account_id account id
350 * @param[in] folder_id folder id
351 * @param[in] list as returned by da_get_folder_mapping_service_id() - list of item info
352 * @return Operation result
353 * @retval SYNC_AGENT_DA_SUCCESS success
354 * @retval negative value error
356 sync_agent_da_return_e da_get_folder_mapping_service_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *folder_id, GList ** list);
359 * @brief Get folder info from folder_tbl by folder id
360 * @param[in] daci_handler sqlite3 handler pointer about thread
361 * @param[in] folder_id folder id
362 * @param[in] sync_agent_folder as returned by da_get_folder_by_folder_id() - folder info
363 * @return Operation result
364 * @retval SYNC_AGENT_DA_SUCCESS success
365 * @retval negative value error
367 sync_agent_da_return_e da_get_folder_by_folder_id(SYNC_AGENT_DA_HANDLER * daci_handler, char *folder_id, sync_agent_da_folder_s ** sync_agent_folder);
370 * @brief Checking whether the folderId exist in folder_tbl
371 * @param[in] daci_handler sqlite3 handler pointer about thread
372 * @param[in] account_id account id
373 * @param[in] folder_id folder id
374 * @return Checking result
376 * @retval 0 error or not exist
378 int da_is_exist_folder(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *folder_id);
381 * =============================================================================================================================
383 * =============================================================================================================================
387 * @brief Insert item into item_tbl
388 * @param[in] daci_handler sqlite3 handler pointer about thread
389 * @param[in] item array of item info
390 * @param[in] count count of item info
391 * @return Operation result
392 * @retval SYNC_AGENT_DA_SUCCESS success
393 * @retval negative value error
395 sync_agent_da_return_e da_add_item(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_item_s * item, int count);
398 * @brief Insert item into item_tbl
399 * @param[in] daci_handler sqlite3 handler pointer about thread
400 * @param[in] fw_id framework id
401 * @param[in] parent_id parent service id of fw_id item
402 * @return Operation result
403 * @retval SYNC_AGENT_DA_SUCCESS success
404 * @retval negative value error
406 sync_agent_da_return_e da_update_item(SYNC_AGENT_DA_HANDLER * daci_handler, char *fw_id, char *parent_id);
409 * @brief Insert item into item_tbl
410 * @param[in] daci_handler sqlite3 handler pointer about thread
411 * @param[in] item array of item info
412 * @param[in] count count of item info
413 * @param[in] item_id - id of newly added item
414 * @return Operation result
415 * @retval SYNC_AGENT_DA_SUCCESS success
416 * @retval negative value error
418 sync_agent_da_return_e da_add_item_new(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_item_s * item, int count, char **item_id);
421 * @brief Delete item from item_tbl by item id
422 * @param[in] daci_handler sqlite3 handler pointer about thread
423 * @param[in] item_id item id
424 * @return Operation result
425 * @retval SYNC_AGENT_DA_SUCCESS success
426 * @retval negative value error
428 sync_agent_da_return_e da_delete_item_by_Item_id(SYNC_AGENT_DA_HANDLER * daci_handler, char *item_id);
431 * @brief Delete item from item_tbl by account id and item type id - currently unused function
432 * @param[in] daci_handler sqlite3 handler pointer about thread
433 * @param[in] account_id account id
434 * @param[in] item_type_id item type id
435 * @return Operation result
436 * @retval SYNC_AGENT_DA_SUCCESS success
437 * @retval negative value error
439 sync_agent_da_return_e da_delete_item_by_item_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id);
442 * @brief Delete child item from item_tbl by parent service id
443 * @param[in] daci_handler sqlite3 handler pointer about thread
444 * @param[in] parent_service_id parent service id
445 * @return Operation result
446 * @retval SYNC_AGENT_DA_SUCCESS success
447 * @retval negative value error
449 sync_agent_da_return_e da_delete_all_child_item(SYNC_AGENT_DA_HANDLER * daci_handler, char *parent_service_id);
452 * @brief Delete child item from item_tbl by parent service id
453 * @param[in] daci_handler sqlite3 handler pointer about thread
454 * @param[in] parent_service_id parent service id
455 * @return Operation result
456 * @retval SYNC_AGENT_DA_SUCCESS success
457 * @retval negative value error
459 sync_agent_da_return_e da_delete_child_item(SYNC_AGENT_DA_HANDLER * daci_handler, char *parent_service_id, char *child_service_id);
463 * @brief Delete item from item_tbl by account id and item type id
464 * @param[in] daci_handler sqlite3 handler pointer about thread
465 * @param[in] account_id account id
466 * @param[in] item_type_id item type id
467 * @return Operation result
468 * @retval SYNC_AGENT_DA_SUCCESS success
469 * @retval negative value error
471 sync_agent_da_return_e da_delete_item_by_item_type_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id);
474 * @brief Delete item from item_tbl by account id and item type id and row that checked delete from changelog tbl
475 * @param[in] daci_handler sqlite3 handler pointer about thread
476 * @param[in] account_id account id
477 * @param[in] item_type_id item type id
478 * @return Operation result
479 * @retval SYNC_AGENT_DA_SUCCESS success
480 * @retval negative value error
482 sync_agent_da_return_e da_delete_item_by_item_type_id_and_delete_changelog(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id);
485 * @brief Get item id from item_tbl - currently unused function
486 * @param[in] daci_handler sqlite3 handler pointer about thread
487 * @param[in] account_id account id
488 * @param[in] service_id service id
489 * @param[in] item_type_id item type id
490 * @return Operation result
491 * @retval item id success
494 char *da_get_item_item_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *service_id, int item_type_id);
497 * @brief Get item id from item_tbl
498 * @param[in] daci_handler sqlite3 handler pointer about thread
499 * @param[in] account_id account id
500 * @param[in] service_id service id
501 * @param[in] item_type_id item type id
502 * @param[in] item_id as returned by da_get_item_item_id_new() - id of newly added item
503 * @return Operation result
504 * @retval SYNC_AGENT_DA_SUCCESS success
505 * @retval negative value error
507 sync_agent_da_return_e da_get_item_item_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *service_id, int item_type_id, char **item_id);
510 * @brief Get service id from item_tbl
511 * @param[in] daci_handler sqlite3 handler pointer about thread
512 * @param[in] item_id item id
513 * @return Operation result
514 * @retval service id success
517 char *da_get_item_service_id(SYNC_AGENT_DA_HANDLER * daci_handler, char *item_id);
520 * @brief Get item from item_tbl - currently unused function
521 * @param[in] daci_handler sqlite3 handler pointer about thread
522 * @param[in] item_id item id
523 * @return Operation result
524 * @retval item info success
527 sync_agent_da_item_s *da_get_item(SYNC_AGENT_DA_HANDLER * daci_handler, char *item_id);
530 * @brief Get item from item_tbl
531 * @param[in] daci_handler sqlite3 handler pointer about thread
532 * @param[in] item_id item id
533 * @param[in] sync_agent_item as returned by da_get_item_new() - item info
534 * @return Operation result
535 * @retval SYNC_AGENT_DA_SUCCESS success
536 * @retval negative value error
538 sync_agent_da_return_e da_get_item_new(SYNC_AGENT_DA_HANDLER * daci_handler, char *item_id, sync_agent_da_item_s ** sync_agent_item);
541 * @brief Get data_store item id from item_tbl
542 * @param[in] daci_handler sqlite3 handler pointer about thread
543 * @param[in] item_id item id
544 * @param[in] sync_agent_item as returned by da_get_item_new() - item info
545 * @return Operation result
546 * @retval SYNC_AGENT_DA_SUCCESS success
547 * @retval negative value error
549 sync_agent_da_return_e da_get_item_data_store_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, char *item_id, sync_agent_da_item_s ** sync_agent_item);
552 * @brief Get account item id from item_tbl
553 * @param[in] daci_handler sqlite3 handler pointer about thread
554 * @param[in] item_id item id
555 * @param[in] sync_agent_item as returned by da_get_item_new() - item info
556 * @return Operation result
557 * @retval SYNC_AGENT_DA_SUCCESS success
558 * @retval negative value error
560 sync_agent_da_return_e da_get_item_account_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, char *item_id, sync_agent_da_item_s ** sync_agent_item);
563 * @brief Get all item id from item_tbl
564 * @param[in] daci_handler sqlite3 handler pointer about thread
565 * @return Operation result
566 * @retval array of item id success
569 sync_agent_da_id_list_s *da_get_all_item_id(SYNC_AGENT_DA_HANDLER * daci_handler);
572 * @brief Get all id in folder from item_tbl - currently unused function
573 * @param[in] daci_handler sqlite3 handler pointer about thread
574 * @param[in] folder_id folder id
575 * @param[in] column_name column name (SYNC_AGENT_DA_COLUMN_NAME_ITEM_ID or SYNC_AGENT_DA_COLUMN_NAME_SERVICE_ID)
576 * @return Operation result
577 * @retval array of item id success
580 sync_agent_da_id_list_s *da_get_item_id_list(SYNC_AGENT_DA_HANDLER * daci_handler, char *folder_id, sync_agent_da_column_name_e column_name);
583 * @brief Get all id in folder from item_tbl
584 * @param[in] daci_handler sqlite3 handler pointer about thread
585 * @param[in] folder_id folder id
586 * @param[in] column_name column name (SYNC_AGENT_DA_COLUMN_NAME_ITEM_ID or SYNC_AGENT_DA_COLUMN_NAME_SERVICE_ID)
587 * @param[in] list as returned by da_get_item_id_list_new() - list of item id
588 * @return Operation result
589 * @retval SYNC_AGENT_DA_SUCCESS success
590 * @retval negative value error
592 sync_agent_da_return_e da_get_item_id_list_new(SYNC_AGENT_DA_HANDLER * daci_handler, char *folder_id, sync_agent_da_column_name_e column_name, GList ** list);
595 * @brief Get item from item_tbl by accountId - currently unused function
596 * Get all the items in account
597 * @param[in] daci_handler sqlite3 handler pointer about thread
598 * @param[in] account_id account id
599 * @param[in] item_type_id item type id
600 * @param[in] count as returned by da_get_item_by_account_id() - count of item info
601 * @return Operation result
602 * @retval array of item info success
605 sync_agent_da_item_s *da_get_item_by_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, int *count);
608 * @brief Get item from item_tbl by accountId
609 * Get all the items in account
610 * @param[in] daci_handler sqlite3 handler pointer about thread
611 * @param[in] account_id account id
612 * @param[in] item_type_id item type id
613 * @param[in] list as returned by da_get_item_by_account_id() - list of item info
614 * @return Operation result
615 * @retval SYNC_AGENT_DA_SUCCESS success
616 * @retval negative value error
618 sync_agent_da_return_e da_get_item_by_account_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, GList ** list);
621 * @brief Get item data from item_tbl and account_item_changelog_tbl
622 * Among the items that belong to the item type id, Search for item info belong to the changelog
623 * @param[in] daci_handler sqlite3 handler pointer about thread
624 * @param[in] account_id account id
625 * @param[in] item_type_id item type id
626 * @param[in] count as returned by da_get_item_info_by_item_type_id() - count of item data
627 * @return Operation result
628 * @retval array of item data success
631 sync_agent_da_item_info_s *da_get_item_info_by_item_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, int *count);
634 * @brief Get item data from item_tbl and account_item_changelog_tbl - currently unused function
635 * Among the items that belong to the item type id, Search for item info belong to the changelog
636 * @param[in] daci_handler sqlite3 handler pointer about thread
637 * @param[in] account_id account id
638 * @param[in] item_type_id item type id
639 * @param[in] operation_id operation id
640 * @param[in] count as returned by da_get_item_info_by_item_type_id_and_operation_id() - count of item data
641 * @return Operation result
642 * @retval array of item data success
645 sync_agent_da_item_info_s *da_get_item_info_by_item_type_id_and_operation_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, int operation_id, int *count);
648 * @brief Get item data from item_tbl and account_item_changelog_tbl
649 * Among the items that belong to the item type id, Search for item info belong to the changelog
650 * @param[in] daci_handler sqlite3 handler pointer about thread
651 * @param[in] account_id account id
652 * @param[in] item_type_id item type id
653 * @param[in] operation_id operation id
654 * @param[in] list as returned by da_get_item_info_by_item_type_id_and_operation_id() - list of item data
655 * @return Operation result
656 * @retval SYNC_AGENT_DA_SUCCESS success
657 * @retval negative value error
659 sync_agent_da_return_e da_get_item_info_by_item_type_id_and_operation_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, int operation_id, GList ** list);
662 * @brief Get item from item_tbl - currently unused function
663 * Belonging to different account of item get item with the same service id
664 * @param[in] daci_handler sqlite3 handler pointer about thread
665 * @param[in] account_id account id
666 * @param[in] item_id item id
667 * @param[in] count as returned by da_get_item_mapping_service_id() - count of item info
668 * @return Operation result
669 * @retval array of item info success
672 sync_agent_da_item_s *da_get_item_mapping_service_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *item_id, int *count);
675 * @brief Get item from item_tbl
676 * Belonging to different account of item get item with the same service id
677 * @param[in] daci_handler sqlite3 handler pointer about thread
678 * @param[in] account_id account id
679 * @param[in] item_id item id
680 * @param[in] list as returned by da_get_item_mapping_service_id() - list of item info
681 * @return Operation result
682 * @retval SYNC_AGENT_DA_SUCCESS success
683 * @retval negative value error
685 sync_agent_da_return_e da_get_item_mapping_service_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *item_id, GList ** list);
688 * @brief Get all item id from item_tbl by data store id - currently unused function
689 * @param[in] daci_handler sqlite3 handler pointer about thread
690 * @param[in] data_store_id data store id
691 * @return Operation result
692 * @retval array of item id success
695 sync_agent_da_id_list_s *da_get_item_id_list_by_datastore_id(SYNC_AGENT_DA_HANDLER * daci_handler, int data_store_id);
698 * @brief Get all item id from item_tbl by data store id
699 * @param[in] daci_handler sqlite3 handler pointer about thread
700 * @param[in] data_store_id data store id
701 * @param[in] list as returned by da_get_item_id_list_by_datastore_id_new() - list of item id
702 * @return Operation result
703 * @retval SYNC_AGENT_DA_SUCCESS success
704 * @retval negative value error
706 sync_agent_da_return_e da_get_item_id_list_by_datastore_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int data_store_id, GList ** list);
709 * @brief Get item id list from item_tbl by data store id and account id - currently unused function
710 * @param[in] daci_handler sqlite3 handler pointer about thread
711 * @param[in] account_id sync-agent-framework account id
712 * @param[in] data_store_id data store id
713 * @return Operation result
714 * @retval array of item id success
715 * @retval NULL error or not exist
717 sync_agent_da_id_list_s *da_get_item_id_list_by_datastore_id_with_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int data_store_id);
720 * @brief Get item id list from item_tbl by data store id and account id
721 * @param[in] daci_handler sqlite3 handler pointer about thread
722 * @param[in] account_id sync-agent-framework account id
723 * @param[in] data_store_id data store id
724 * @param[in] list as returned by da_get_item_id_list_by_datastore_id_with_account_id_new() - list of item id
725 * @return Operation result
726 * @retval SYNC_AGENT_DA_SUCCESS success
727 * @retval negative value error
729 sync_agent_da_return_e da_get_item_id_list_by_datastore_id_with_account_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int data_store_id, GList ** list);
732 * @brief Get item id list from item_tbl and account_item_changelog_tbl by operation id - currently unused function
733 * Among the items that belong to the data_store_id, Search for item info belong to the changelog by operation_id
734 * @param[in] daci_handler sqlite3 handler pointer about thread
735 * @param[in] account_id account id
736 * @param[in] data_store_id data store id
737 * @param[in] operation_id operation id
738 * @return Operation result
739 * @retval array of item id success
742 sync_agent_da_id_list_s *da_get_item_id_list_by_operation_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int data_store_id, int operation_id);
745 * @brief Get item id list from item_tbl and account_item_changelog_tbl by operation id
746 * Among the items that belong to the data_store_id, Search for item info belong to the changelog by operation_id
747 * @param[in] daci_handler sqlite3 handler pointer about thread
748 * @param[in] account_id account id
749 * @param[in] data_store_id data store id
750 * @param[in] operation_id operation id
751 * @param[in] list as returned by da_get_item_id_list_by_operation_id_new() - list of item id
752 * @return Operation result
753 * @retval SYNC_AGENT_DA_SUCCESS success
754 * @retval negative value error
756 sync_agent_da_return_e da_get_item_id_list_by_operation_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int data_store_id, int operation_id, GList ** list);
759 * @brief Get item id list from item_tbl and account_item_changelog_tbl by operation id and folder id - currently unused function
760 * Among the items that belong to the data_store_id, Search for item info belong to the changelog by operation_id and folder_id
761 * @param[in] daci_handler sqlite3 handler pointer about thread
762 * @param[in] account_id account id
763 * @param[in] folder_id folder id
764 * @param[in] data_store_id data store id
765 * @param[in] operation_id operation id
766 * @return Operation result
767 * @retval array of item id success
770 sync_agent_da_id_list_s *da_get_item_id_list_by_operation_id_and_folder_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *folder_id, int data_store_id, int operation_id);
773 * @brief Get item id list from item_tbl and account_item_changelog_tbl by operation id and folder id
774 * Among the items that belong to the data_store_id, Search for item info belong to the changelog by operation_id and folder_id
775 * @param[in] daci_handler sqlite3 handler pointer about thread
776 * @param[in] account_id account id
777 * @param[in] folder_id folder id
778 * @param[in] data_store_id data store id
779 * @param[in] operation_id operation id
780 * @param[in] list as returned by da_get_item_id_list_by_operation_id_and_folder_id_new() - list of item id
781 * @return Operation result
782 * @retval SYNC_AGENT_DA_SUCCESS success
783 * @retval negative value error
785 sync_agent_da_return_e da_get_item_id_list_by_operation_id_and_folder_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *folder_id, int data_store_id, int operation_id, GList ** list);
788 * @brief Get item id list from item_tbl and account_item_changelog_tbl by account id and folder id
789 * Among the items that belong to the data_store_id, Search for item info belong to the changelog by operation_id and folder_id
790 * @param[in] daci_handler sqlite3 handler pointer about thread
791 * @param[in] account_id account id
792 * @param[in] folder_id folder id
793 * @param[out] list as returned by da_get_item_id_list_by_operation_id_and_folder_id_new() - list of item id
794 * @return Operation result
795 * @retval SYNC_AGENT_DA_SUCCESS success
796 * @retval negative value error
798 sync_agent_da_return_e da_get_item_id_list_by_folder_id_and_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *folder_id, GList ** list);
801 * @brief Checking whether the itemId exist in item_tbl
802 * @param[in] daci_handler sqlite3 handler pointer about thread
803 * @param[in] item_id item id
804 * @return Checking result
806 * @retval 0 error or not exist
808 int da_is_exist_item(SYNC_AGENT_DA_HANDLER * daci_handler, char *item_id);
811 * =============================================================================================================================
813 * =============================================================================================================================
817 * @brief Insert config into config_tbl
818 * @param[in] daci_handler sqlite3 handler pointer about thread
819 * @param[in] config config info
820 * @return Operation result
821 * @retval SYNC_AGENT_DA_SUCCESS success
822 * @retval negative value error
824 sync_agent_da_return_e da_add_config(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_config_s * config);
827 * @brief Insert config list into config_tbl
828 * @param[in] daci_handler sqlite3 handler pointer about thread
829 * @param[in] config_list list list of config info
830 * @return Operation result
831 * @retval SYNC_AGENT_DA_SUCCESS success
832 * @retval negative value error
834 sync_agent_da_return_e da_add_config_list(SYNC_AGENT_DA_HANDLER * daci_handler, GList * config_list);
837 * @brief Delete config from config_tbl by key
838 * @param[in] daci_handler sqlite3 handler pointer about thread
839 * @param[in] config_id config id
840 * @param[in] key key value
841 * @return Operation result
842 * @retval SYNC_AGENT_DA_SUCCESS success
843 * @retval negative value error
845 sync_agent_da_return_e da_delete_config_by_key(SYNC_AGENT_DA_HANDLER * daci_handler, int config_id, char *key);
848 * @brief Get list of config info from config_tbl by account id
849 * Get all the config in account
850 * @param[in] daci_handler sqlite3 handler pointer about thread
851 * @param[in] account_id account id
852 * @param[in] list as returned by da_get_config_by_account_id() - list of config info
853 * @return Operation result
854 * @retval SYNC_AGENT_DA_SUCCESS success
855 * @retval negative value error
857 sync_agent_da_return_e da_get_config_by_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, GList ** list);
860 * @brief Get config info from config_tbl by key
861 * @param[in] daci_handler sqlite3 handler pointer about thread
862 * @param[in] config_id config id
863 * @param[in] key key value
864 * @param[in] config as returned by da_get_config_by_key() - config info (account id, key, value, type)
865 * @return Operation result
866 * @retval SYNC_AGENT_DA_SUCCESS success
867 * @retval negative value error
869 sync_agent_da_return_e da_get_config_by_key(SYNC_AGENT_DA_HANDLER * daci_handler, int config_id, char *key, sync_agent_da_config_s ** config);
872 * @brief Checking whether account of the config exist in config_tbl
873 * @param[in] daci_handler sqlite3 handler pointer about thread
874 * @param[in] config_id config id
875 * @param[in] key key value
876 * @param[in] exist as returned by da_is_exist_config() - whether exist or not
877 * @return Operation result
878 * @retval SYNC_AGENT_DA_SUCCESS success
879 * @retval negative value error
881 sync_agent_da_return_e da_is_exist_config(SYNC_AGENT_DA_HANDLER * daci_handler, int config_id, char *key, int *exist);
884 * @brief Insert or update config into config_tbl
885 * checking whether the config exist in config_tbl
886 * If it does not exist, insert config into config_tbl
887 * If it existed, update config into config_tbl
888 * @param[in] daci_handler sqlite3 handler pointer about thread
889 * @param[in] config config info
890 * @return Operation result
891 * @retval SYNC_AGENT_DA_SUCCESS success
892 * @retval negative value error
894 sync_agent_da_return_e da_update_config(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_config_s * config);
897 * @brief Update config into config_tbl
898 * @param[in] daci_handler sqlite3 handler pointer about thread
899 * @param[in] config config info
900 * @return Operation result
901 * @retval SYNC_AGENT_DA_SUCCESS success
902 * @retval negative value error
904 sync_agent_da_return_e da_set_config_value(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_config_s * config);
907 * =============================================================================================================================
908 * account_item_changelog_tbl
909 * =============================================================================================================================
913 * @brief Insert itemChangelog into account_item_changelog_tbl
914 * @param[in] daci_handler sqlite3 handler pointer about thread
915 * @param[in] account_id account id
916 * @param[in] itemChangelog array of itemChangelog info
917 * @param[in] count count of itemChangelog info
918 * @return Operation result
919 * @retval SYNC_AGENT_DA_SUCCESS success
920 * @retval negative value error
922 sync_agent_da_return_e da_add_item_changelog(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, sync_agent_da_item_changelog_s * item_changelog, int count);
925 * @brief Delete itemChangelog from account_item_changelog_tbl by item id
926 * @param[in] daci_handler sqlite3 handler pointer about thread
927 * @param[in] account_id account id
928 * @param[in] item_id item id
929 * @return Operation result
930 * @retval SYNC_AGENT_DA_SUCCESS success
931 * @retval negative value error
933 sync_agent_da_return_e da_delete_item_changelog_by_item_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *item_id);
936 * @brief Delete itemChangelog from account_item_changelog_tbl by item id list
937 * @param[in] daci_handler sqlite3 handler pointer about thread
938 * @param[in] account_id account id
939 * @param[in] item_id_list array of item id
940 * @param[in] count count of item id
941 * @return Operation result
942 * @retval SYNC_AGENT_DA_SUCCESS success
943 * @retval negative value error
945 sync_agent_da_return_e da_delete_item_changelog_by_item_id_list(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char **item_id_list, int count);
948 * @brief Delete itemChangelog from account_item_changelog_tbl by item type id
949 * @param[in] daci_handler sqlite3 handler pointer about thread
950 * @param[in] account_id account id
951 * @param[in] item_type_id item type id
952 * @return Operation result
953 * @retval SYNC_AGENT_DA_SUCCESS success
954 * @retval negative value error
956 sync_agent_da_return_e da_delete_item_changelog_by_item_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id);
959 * @brief Set operation id and sync status to account_item_changelog_tbl
960 * @param[in] daci_handler sqlite3 handler pointer about thread
961 * @param[in] account_id account id
962 * @param[in] item_changelog itemChangelog info (operationId, syncStatus, accessName, itemId)
963 * @return Operation result
964 * @retval SYNC_AGENT_DA_SUCCESS success
965 * @retval negative value error
967 sync_agent_da_return_e da_set_item_changelog_operation_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, sync_agent_da_item_changelog_s * item_changelog);
970 * @brief Set sync status to account_item_changelog_tbl
971 * @param[in] daci_handler sqlite3 handler pointer about thread
972 * @param[in] account_id account id
973 * @param[in] item_changelog itemChangelog info (syncStatus, accessName, itemId)
974 * @return Operation result
975 * @retval SYNC_AGENT_DA_SUCCESS success
976 * @retval negative value error
978 sync_agent_da_return_e da_set_item_changelog_sync_status(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, sync_agent_da_item_changelog_s * item_changelog);
981 * @brief Set SYNC_WAIT to account_item_changelog_tbl
982 * Among the items that match to the itemTypeId and belong to the folder
983 * If it existed in account_item_changelog_tbl, set SYNC_WAIT to account_item_changelog_tbl
984 * @param[in] daci_handler sqlite3 handler pointer about thread
985 * @param[in] account_id account id
986 * @param[in] folder_id_list list of folder id
987 * @param[in] folder_id_count count of folder id
988 * @param[in] item_type_id_list list of item type id
989 * @param[in] item_type_id_count count of item type id
990 * @return Operation result
991 * @retval SYNC_AGENT_DA_SUCCESS success
992 * @retval negative value error
994 sync_agent_da_return_e da_set_item_changelog_wait_status(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char **folder_id_list, int folder_id_count, int *item_type_id_list, int item_type_id_count);
997 * @brief Get itemChangelog info from account_item_changelog_tbl by item id - currently unused function
998 * @remarks Item id that is included in sync_agent_da_item_changelog_s must be set by user when call this function
999 * @param[in] daci_handler sqlite3 handler pointer about thread
1000 * @param[in] account_id account id
1001 * @param[in] item_changelog as returned by da_get_item_changelog_by_item_id() - itemChangelog info (itemId, operationId, syncStatus, accessName)
1002 * @return Operation result
1003 * @retval SYNC_AGENT_DA_SUCCESS success
1004 * @retval negative value error
1006 sync_agent_da_return_e da_get_item_changelog_by_item_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, sync_agent_da_item_changelog_s * item_changelog);
1009 * @brief Get itemChangelog info from account_item_changelog_tbl by item id
1010 * @param[in] daci_handler sqlite3 handler pointer about thread
1011 * @param[in] account_id account id
1012 * @param[in] item_id item id
1013 * @param[in] sync_agent_item as returned by da_get_item_changelog_by_item_id() - itemChangelog info (itemId, operationId, syncStatus, accessName)
1014 * @return Operation result
1015 * @retval SYNC_AGENT_DA_SUCCESS success
1016 * @retval negative value error
1018 sync_agent_da_return_e da_get_item_changelog_by_item_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *item_id, sync_agent_da_item_changelog_s ** sync_agent_item);
1021 * @brief Get itemChangelog info from account_item_changelog_tbl by item type id
1022 * @param[in] daci_handler sqlite3 handler pointer about thread
1023 * @param[in] account_id account id
1024 * @param[in] item_type_id item type id
1025 * @param[in] list as returned by da_get_item_changelog_by_item_type_id() - list of itemChangelog info
1026 * @return Operation result
1027 * @retval SYNC_AGENT_DA_SUCCESS success
1028 * @retval negative value error
1030 sync_agent_da_return_e da_get_item_changelog_by_item_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, GList ** list);
1033 * @brief Checking whether the item id exist in account_item_changelog_tbl
1034 * @param[in] daci_handler sqlite3 handler pointer about thread
1035 * @param[in] account_id account id
1036 * @param[in] item_id item id
1037 * @return Checking result
1039 * @retval 0 error or not exist
1041 int da_is_exist_item_changelog(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *item_id);
1044 * =============================================================================================================================
1046 * =============================================================================================================================
1050 * @brief Insert anchor into last_anchor_tbl
1051 * @param[in] daci_handler sqlite3 handler pointer about thread
1052 * @param[in] last_anchor last anchor info
1053 * @return Operation result
1054 * @retval SYNC_AGENT_DA_SUCCESS success
1055 * @retval negative value error
1057 sync_agent_da_return_e da_add_last_anchor(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_last_anchor_s * last_anchor);
1060 * @brief Delete anchor from last_anchor_tbl by account id
1061 * Delete all the anchor in account
1062 * @param[in] daci_handler sqlite3 handler pointer about thread
1063 * @param[in] account_id account id
1064 * @return Operation result
1065 * @retval SYNC_AGENT_DA_SUCCESS success
1066 * @retval negative value error
1068 sync_agent_da_return_e da_delete_last_anchor_by_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id);
1071 * @brief Delete anchor from last_anchor_tbl by item type id
1072 * Delete all the anchor in account and item type id
1073 * @param[in] daci_handler sqlite3 handler pointer about thread
1074 * @param[in] account_id account id
1075 * @param[in] item_type_id item type id
1076 * @return Operation result
1077 * @retval SYNC_AGENT_DA_SUCCESS success
1078 * @retval negative value error
1080 sync_agent_da_return_e da_delete_last_anchor_by_item_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id);
1083 * @brief Set last_anchor_server and last_anchor_client to last_anchor_tbl
1084 * @param[in] daci_handler sqlite3 handler pointer about thread
1085 * @param[in] last_anchor last anchor info
1086 * @return Operation result
1087 * @retval SYNC_AGENT_DA_SUCCESS success
1088 * @retval negative value error
1090 sync_agent_da_return_e da_set_last_anchor(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_last_anchor_s * last_anchor);
1093 * @brief Get all last anchor in account from last_anchor_tbl
1094 * @param[in] daci_handler sqlite3 handler pointer about thread
1095 * @param[in] account_id account id
1096 * @param[in] count as returned by da_get_last_anchor_by_account_id() - count of last anchor info
1097 * @return Operation result
1098 * @retval array of last anchor info success
1099 * @retval NULL error
1101 sync_agent_da_last_anchor_s *da_get_last_anchor_by_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int *count);
1104 * @brief Get last_anchor_server and last_anchor_client from last_anchor_tbl by item type id - currently unused function
1105 * @param[in] daci_handler sqlite3 handler pointer about thread
1106 * @param[in] account_id accountId
1107 * @param[in] item_type_id itemTypeId
1108 * @param[in] count as returned by da_get_last_anchor_by_item_type_id() - count of last anchor info
1109 * @return Operation result
1110 * @retval last anchor info success
1111 * @retval NULL error
1113 sync_agent_da_last_anchor_s *da_get_last_anchor_by_item_type_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, int *count);
1116 * @brief Get last_anchor_server and last_anchor_client from last_anchor_tbl by item type id
1117 * @param[in] daci_handler sqlite3 handler pointer about thread
1118 * @param[in] account_id accountId
1119 * @param[in] item_type_id itemTypeId
1120 * @param[in] list as returned by da_get_last_anchor_by_item_type_id() - list of last anchor info
1121 * @return Operation result
1122 * @retval SYNC_AGENT_DA_SUCCESS success
1123 * @retval negative value error
1125 sync_agent_da_return_e da_get_last_anchor_by_item_type_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id, GList ** list);
1128 * @brief Checking whether item type id of the anchor exist in last_anchor_tbl
1129 * @param[in] daci_handler sqlite3 handler pointer about thread
1130 * @param[in] account_id account id
1131 * @param[in] item_type_id item type id
1132 * @return Checking result
1134 * @retval 0 error or not exist
1136 int da_is_exist_last_anchor(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int item_type_id);
1139 * =============================================================================================================================
1141 * =============================================================================================================================
1145 * @brief Insert mapping into mapping_tbl
1146 * @param[in] daci_handler sqlite3 handler pointer about thread
1147 * @param[in] mapping mapping info
1148 * @return Operation result
1149 * @retval SYNC_AGENT_DA_SUCCESS success
1150 * @retval negative value error
1152 sync_agent_da_return_e da_add_mapping(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_mapping_s * mapping);
1155 * @brief Delete mapping from mapping_tbl by account id
1156 * Delete all the mapping in account
1157 * @param[in] daci_handler sqlite3 handler pointer about thread
1158 * @param[in] account_id account id
1159 * @return Operation result
1160 * @retval SYNC_AGENT_DA_SUCCESS success
1161 * @retval negative value error
1163 sync_agent_da_return_e da_delete_mapping_by_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id);
1166 * @brief Delete mapping from mapping_tbl by luid
1167 * @param[in] daci_handler sqlite3 handler pointer about thread
1168 * @param[in] account_id account id
1169 * @param[in] luid luid
1170 * @return Operation result
1171 * @retval SYNC_AGENT_DA_SUCCESS success
1172 * @retval negative value error
1174 sync_agent_da_return_e da_delete_mapping_by_luid(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *luid);
1177 * @brief Get all mapping info from mapping_tbl by account id - currently unused function
1178 * Get all the mapping info in account
1179 * @param[in] daci_handler sqlite3 handler pointer about thread
1180 * @param[in] account_id account id
1181 * @param[in] count as returned by da_get_mapping_by_account_id() - count of mapping info
1182 * @return Operation result
1183 * @retval array of mapping info success
1184 * @retval NULL error
1186 sync_agent_da_mapping_s *da_get_mapping_by_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, int *count);
1189 * @brief Get all mapping info from mapping_tbl by account id
1190 * Get all the mapping info in account
1191 * @param[in] daci_handler sqlite3 handler pointer about thread
1192 * @param[in] account_id account id
1193 * @param[in] list as returned by da_get_mapping_by_account_id() - list of mapping info
1194 * @return Operation result
1195 * @retval SYNC_AGENT_DA_SUCCESS success
1196 * @retval negative value error
1198 sync_agent_da_return_e da_get_mapping_by_account_id_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, GList ** list);
1201 * @brief Get luid from mapping_tbl by guid - currently unused function
1202 * @param[in] daci_handler sqlite3 handler pointer about thread
1203 * @param[in] account_id account id
1204 * @param[in] luid luid
1205 * @return Operation result
1206 * @retval guid success
1207 * @retval NULL error
1209 char *da_get_mapping_guid(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *luid);
1212 * @brief Get luid from mapping_tbl by guid
1213 * @param[in] daci_handler sqlite3 handler pointer about thread
1214 * @param[in] account_id account id
1215 * @param[in] luid luid
1216 * @param[in] sync_agent_mapping as returned by da_get_mapping_guid_new() - mapping info
1217 * @return Operation result
1218 * @retval SYNC_AGENT_DA_SUCCESS success
1219 * @retval negative value error
1221 sync_agent_da_return_e da_get_mapping_guid_new(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *luid, sync_agent_da_mapping_s ** sync_agent_mapping);
1224 * @brief Checking whether account exist in mapping_tbl
1225 * @param[in] daci_handler sqlite3 handler pointer about thread
1226 * @param[in] account_id account id
1227 * @return Checking result
1229 * @retval 0 error or not exist
1231 int da_is_exist_mapping_by_account_id(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id);
1234 * @brief Checking whether the account and item tpe id of the item type id exist in mapping_tbl
1235 * @param[in] daci_handler sqlite3 handler pointer about thread
1236 * @param[in] account_id account id
1237 * @param[in] luid luid
1238 * @return Checking result
1240 * @retval 0 error or not exist
1242 int da_is_exist_mapping_by_luid(SYNC_AGENT_DA_HANDLER * daci_handler, int account_id, char *luid);
1245 * =============================================================================================================================
1246 * id_provider_tbl, id_page_tbl
1247 * =============================================================================================================================
1251 * @brief Insert id_provider into id_provider_tbl
1252 * @param[in] daci_handler sqlite3 handler pointer about thread
1253 * @param[in] id_provider id provider info
1254 * @return Operation result
1255 * @retval SYNC_AGENT_DA_SUCCESS success
1256 * @retval negative value error
1258 sync_agent_da_return_e da_add_id_provider(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_id_provider_s * id_provider);
1261 * @brief Get id_provider from id_provider_tbl
1262 * @param[in] daci_handler sqlite3 handler pointer about thread
1263 * @param[in] id_provider_code id provider code
1264 * @param[in] id_provider as returned by da_get_id_provider() - id provider info
1265 * @return Operation result
1266 * @retval SYNC_AGENT_DA_SUCCESS success
1267 * @retval negative value error
1269 sync_agent_da_return_e da_get_id_provider(SYNC_AGENT_DA_HANDLER * daci_handler, unsigned int id_provider_code, sync_agent_da_id_provider_s ** id_provider);
1272 * @brief Update id provider in id_provider_tbl
1273 * @param[in] daci_handler sqlite3 handler pointer about thread
1274 * @param[in] id_provider id provider info
1275 * @return Operation result
1276 * @retval SYNC_AGENT_DA_SUCCESS success
1277 * @retval negative value error
1279 sync_agent_da_return_e da_update_id_provider(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_id_provider_s * id_provider);
1282 * @brief Insert id page into id_page_tbl
1283 * @param[in] daci_handler sqlite3 handler pointer about thread
1284 * @param[in] id_page id page info
1285 * @param[in] page_byte_size page byte size
1286 * @return Operation result
1287 * @retval SYNC_AGENT_DA_SUCCESS success
1288 * @retval negative value error
1290 sync_agent_da_return_e da_add_id_page(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_id_page_s * id_page, unsigned int page_byte_size);
1293 * @brief Delete id page from id_page_tbl by page index
1294 * @param[in] daci_handler sqlite3 handler pointer about thread
1295 * @param[in] id_provider_code id provider code
1296 * @param[in] page_index page index
1297 * @return Operation result
1298 * @retval SYNC_AGENT_DA_SUCCESS success
1299 * @retval negative value error
1301 sync_agent_da_return_e da_delete_id_page(SYNC_AGENT_DA_HANDLER * daci_handler, unsigned int id_provider_code, unsigned int page_index);
1304 * @brief Insert id page into id_page_tbl
1305 * @param[in] daci_handler sqlite3 handler pointer about thread
1306 * @param[in] id_provider_code id provider code
1307 * @param[in] page_index page index
1308 * @param[in] page_bit as returned by da_get_id_page() - page bit
1309 * @return Operation result
1310 * @retval SYNC_AGENT_DA_SUCCESS success
1311 * @retval negative value error
1313 sync_agent_da_return_e da_get_id_page(SYNC_AGENT_DA_HANDLER * daci_handler, unsigned int id_provider_code, unsigned int page_index, char **page_bit);
1316 * @brief Get id of page index
1317 * @param[in] daci_handler sqlite3 handler pointer about thread
1318 * @param[in] id_provider_code id provider code
1319 * @param[in] count as returned by da_get_id_page_index() - count of page index
1320 * @return Operation result
1321 * @retval SYNC_AGENT_DA_SUCCESS success
1322 * @retval negative value error
1324 sync_agent_da_return_e da_get_id_page_index(SYNC_AGENT_DA_HANDLER * daci_handler, unsigned int id_provider_code, int *count);
1327 * @brief Insert id page into id_page_tbl
1328 * @param[in] daci_handler sqlite3 handler pointer about thread
1329 * @param[in] id_page id page info
1330 * @param[in] page_byte_size page byte size
1331 * @return Operation result
1332 * @retval SYNC_AGENT_DA_SUCCESS success
1333 * @retval negative value error
1335 sync_agent_da_return_e da_update_id_page(SYNC_AGENT_DA_HANDLER * daci_handler, sync_agent_da_id_page_s * id_page, unsigned int page_byte_size);
1338 * @brief get item count with data store id
1339 * @param[in] daci_handler sqlite3 handler pointer about thread
1340 * @param[in] data_store_id data store id
1341 * @param[in] fw_account_id account id
1342 * @param[out] item_count item count
1343 * @return operation result
1344 * @retval SYNC_AGENT_DA_SUCCESS success
1345 * @retval error value fail
1347 sync_agent_da_return_e da_get_item_count_by_datastore_id(SYNC_AGENT_DA_HANDLER *daci_handler, int data_store_id, int fw_account_id, int *item_count);
1350 * @brief get updated_exdate_item count with parent item's framework id
1351 * @param[in] daci_handler sqlite3 handler pointer about thread
1352 * @param[in] fw_id framework id of the parent item
1353 * @param[in] list list as returned updated exdate item_id list
1354 * @return sync_agent_da_return_e
1355 * @retval SYNC_AGENT_DA_SUCCESS success
1356 * @retval error value fail
1358 sync_agent_da_return_e da_get_updated_exdate_item_id_list(SYNC_AGENT_DA_HANDLER *daci_handler, char *fw_id, GList ** list);
1361 * =============================================================================================================================
1363 * =============================================================================================================================
1367 * @brief Drop database table for list of account id
1368 * @param[in] daci_handler sqlite3 handler pointer about thread
1369 * @param[in] account_id_list list of account id
1370 * @param[in] account_count count of account id
1372 void da_drop_table(SYNC_AGENT_DA_HANDLER * daci_handler, int *account_id_list, int account_count);
1375 * For ID_Provider todo i should remove this rutine!!!!
1378 * @breif Get daci file path
1379 * @return Operation result
1380 * @retval daci file path success
1381 * @retval NULL error
1383 char *da_get_daci_file_path(void);
1385 #endif /* AGENT_H_ */