Sync with original maps package
[platform/core/csapi/tizenfx.git] / src / Tizen.Pims.Calendar / Interop / Interop.Database.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19
20 internal static partial class Interop
21 {
22     internal static partial class Database
23     {
24         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
25             internal delegate void DBChangedCallback(string uri, IntPtr userData);
26
27         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_record")]
28             internal static extern int Insert(IntPtr recordHandle, out int recordId);
29         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_record")]
30             internal static extern int Get(string uri, int recordId, out IntPtr recordHandle);
31         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_update_record")]
32             internal static extern int Update(IntPtr recordHandle);
33         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_delete_record")]
34             internal static extern int Delete(string uri, int recordId);
35         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_all_records")]
36             internal static extern int GetAllRecords(string uri, int offset, int limit, out IntPtr recordListHandle);
37         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_records_with_query")]
38             internal static extern int GetRecords(IntPtr queryHandle, int offset, int limit, out IntPtr recordListHandle);
39         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_count")]
40             internal static extern int GetCount(string uri, out int count);
41         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_count_with_query")]
42             internal static extern int GetCountWithQuery(IntPtr queryHandle, out int count);
43         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_records")]
44             internal static extern int InsertRecords(IntPtr recordListHandle, out IntPtr recordIds, out int count);
45         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_update_records")]
46             internal static extern int UpdateRecords(IntPtr recordListHandle);
47         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_delete_records")]
48             internal static extern int DeleteRecords(string uri, int[] ids, int count);
49         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_current_version")]
50             internal static extern int GetCurrentVersion(out int version);
51         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_add_changed_cb")]
52             internal static extern int AddChangedCallback(string uri, DBChangedCallback callback, IntPtr userData);
53         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_remove_changed_cb")]
54             internal static extern int RemoveChangedCallback(string uri, DBChangedCallback callback, IntPtr userData);
55         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_changes_by_version")]
56             internal static extern int GetChangesByVersion(string uri, int bookId, int dbVersion, out IntPtr recordListHandle, out int currentDBVersion);
57         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_vcalendars")]
58             internal static extern int InsertVcalendars(string stream, out IntPtr recordIds, out int count);
59         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_vcalendars")]
60             internal static extern int ReplaceVcalendars(string stream, int[] ids, int count);
61         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_record")]
62             internal static extern int Replace(IntPtr recordHandle, int recordId);
63         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_records")]
64             internal static extern int ReplaceRecords(IntPtr recordListHandle, int[] ids, int count);
65         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_last_change_version")]
66             internal static extern int GetLastChangeVersion(out int lastChangeVersion);
67         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_changes_exception_by_version")]
68             internal static extern int GetChangesException(string uri, int eventId, int dbVersion, out IntPtr recordListHandle);
69         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_clean_after_sync")]
70             internal static extern int Clean(int bookId, int dbVersion);
71         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_link_record")]
72             internal static extern int LinkRecord(int baseId, int recordId);
73         [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_unlink_record")]
74             internal static extern int UnlinkRecord(int recordId);
75     }
76 }