예제 #1
0
        /// <summary>
        /// Sends the update request to the provider application.
        /// </summary>
        /// <remarks>The OnUpdateResult will recieve result of this API.</remarks>
        /// <param name="updateData">The update data.</param>
        /// <param name="where">The Where statement for the query.</param>
        /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
        /// <privilege>http://tizen.org/privilege/datasharing</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <since_tizen> 3 </since_tizen>
        public void Update(Bundle updateData, string where)
        {
            int        reqId;
            ResultType ret;

            if (updateData == null || updateData.SafeBundleHandle.IsInvalid)
            {
                ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "insertData");
            }

            if (string.IsNullOrEmpty(where))
            {
                ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "where");
            }

            _lock.WaitOne();
            ret = Interop.DataControl.Update(_handle, updateData.SafeBundleHandle, where, out reqId);
            _lock.ReleaseMutex();
            if (ret != ResultType.Success)
            {
                ErrorFactory.ThrowException(ret, false, "Update");
            }

            CallbackManager.RegisterReqId(reqId, this);
        }
예제 #2
0
        /// <summary>
        /// Sends the select request to the provider application.
        /// </summary>
        /// <remarks>The OnSelectResult will recieve the result of this API.</remarks>
        /// <param name="columnList">Select the target column list.</param>
        /// <param name="where">The Where statement for the select query.</param>
        /// <param name="order">The Order statement for the select query.</param>
        /// <param name="pageNumber">Select the target page number.</param>
        /// <param name="countPerPage">Select the row count per page.</param>
        /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied..</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
        /// <privilege>http://tizen.org/privilege/datasharing</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <since_tizen> 3 </since_tizen>
        public void Select(string[] columnList, string where, string order, int pageNumber = 1, int countPerPage = 20)
        {
            int        reqId, i;
            ResultType ret;

            if (columnList == null || columnList.Length == 0)
            {
                ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column_list");
            }

            for (i = 0; i < columnList.Length; i++)
            {
                if (string.IsNullOrEmpty(columnList[i]))
                {
                    ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column_list index " + i.ToString());
                }
            }

            _lock.WaitOne();
            ret = Interop.DataControl.Select(_handle, columnList, columnList.Length, where, order, pageNumber, countPerPage, out reqId);
            _lock.ReleaseMutex();
            if (ret != ResultType.Success)
            {
                ErrorFactory.ThrowException(ret, false, "Select");
            }
            Log.Info(LogTag, "select end. " + reqId.ToString());

            CallbackManager.RegisterReqId(reqId, this);
        }
예제 #3
0
        /// <summary>
        /// Sends the delete request to the provider application.
        /// </summary>
        /// <remarks>The OnDeleteResult will recieve the result of this API</remarks>
        /// <param name="where">The Where statement for the delete query.</param>
        /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
        /// <privilege>http://tizen.org/privilege/datasharing</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <since_tizen> 3 </since_tizen>
        public void Delete(string where)
        {
            int        reqId;
            ResultType ret;

            _lock.WaitOne();
            ret = Interop.DataControl.Delete(_handle, where, out reqId);
            _lock.ReleaseMutex();
            if (ret != ResultType.Success)
            {
                ErrorFactory.ThrowException(ret, false, "Delete");
            }

            CallbackManager.RegisterReqId(reqId, this);
        }
예제 #4
0
        /// <summary>
        /// Sends the map bulk add request to the provider application.
        /// </summary>
        /// <remarks>The OnMapBulkAddResult will recieve the result of this API.</remarks>
        /// <param name="addData">The map bulk add data.</param>
        /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
        /// <privilege>http://tizen.org/privilege/datasharing</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <since_tizen> 3 </since_tizen>
        public void MapBulkAdd(BulkData addData)
        {
            int        reqId;
            ResultType ret;

            if (addData == null || addData.SafeBulkDataHandle.IsInvalid)
            {
                ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "addData");
            }

            _lock.WaitOne();
            ret = Interop.DataControl.BulkAdd(_handle, addData.SafeBulkDataHandle, out reqId);
            _lock.ReleaseMutex();
            if (ret != ResultType.Success)
            {
                ErrorFactory.ThrowException(ret, false, "BulkAdd");
            }

            CallbackManager.RegisterReqId(reqId, this);
        }
예제 #5
0
        /// <summary>
        /// Sends the map set request to the provider application.
        /// </summary>
        /// <remarks>The OnMapSetResult will recieve the result of this API.</remarks>
        /// <param name="key">The key of the value to replace.</param>
        /// <param name="oldValue">The value to be replaced.</param>
        /// <param name="newValue"> The new value that replaces the existing value.</param>
        /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit (1MB).</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
        /// <privilege>http://tizen.org/privilege/datasharing</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <since_tizen> 3 </since_tizen>
        public void MapSet(string key, string oldValue, string newValue)
        {
            int        reqId;
            ResultType ret;

            if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(oldValue) || string.IsNullOrEmpty(newValue))
            {
                ErrorFactory.ThrowException(ResultType.InvalidParameter, false);
            }

            _lock.WaitOne();
            ret = Interop.DataControl.MapSet(_handle, key, oldValue, newValue, out reqId);
            _lock.ReleaseMutex();
            if (ret != ResultType.Success)
            {
                ErrorFactory.ThrowException(ret, false, "MapSet");
            }

            CallbackManager.RegisterReqId(reqId, this);
        }
예제 #6
0
        /// <summary>
        /// Sends the map get request to the provider application.
        /// </summary>
        /// <remarks>The OnMapGetResult will recieve the result of this API.</remarks>
        /// <param name="key">The key of the value list to obtain.</param>
        /// <param name="pageNumber">The page number of the value set.</param>
        /// <param name="countPerPage">The desired maximum count of the data items per page.</param>
        /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
        /// <privilege>http://tizen.org/privilege/datasharing</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <since_tizen> 3 </since_tizen>
        public void MapGet(string key, int pageNumber = 1, int countPerPage = 20)
        {
            int        reqId;
            ResultType ret;

            if (string.IsNullOrEmpty(key) || pageNumber <= 0 || countPerPage <= 0)
            {
                ErrorFactory.ThrowException(ResultType.InvalidParameter, false);
            }

            _lock.WaitOne();
            ret = Interop.DataControl.MapGet(_handle, key, out reqId, pageNumber, countPerPage);
            _lock.ReleaseMutex();
            if (ret != ResultType.Success)
            {
                ErrorFactory.ThrowException(ret, false, "MapGet");
            }

            CallbackManager.RegisterReqId(reqId, this);
        }
예제 #7
0
        /// <summary>
        /// Sends the insert request to the provider application.
        /// </summary>
        /// <remarks>The OnInsertResult will recieve the result of this API.</remarks>
        /// <param name="insertData">The insert data.</param>
        /// <exception cref="ArgumentException">Thrown in case of an invalid parmaeter.</exception>
        /// <exception cref="UnauthorizedAccessException">Thrown in case if a permission is denied.</exception>
        /// <exception cref="ArgumentOutOfRangeException">Thrown when the message has exceeded the maximum limit (1MB).</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception>
        /// <privilege>http://tizen.org/privilege/datasharing</privilege>
        /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
        /// <since_tizen> 3 </since_tizen>
        public void Insert(Bundle insertData)
        {
            int        reqId;
            ResultType ret;

            if (insertData == null || insertData.SafeBundleHandle.IsInvalid)
            {
                ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "insertData");
            }

            _lock.WaitOne();
            ret = Interop.DataControl.Insert(_handle, insertData.SafeBundleHandle, out reqId);
            _lock.ReleaseMutex();
            if (ret != ResultType.Success)
            {
                ErrorFactory.ThrowException(ret, false, "Insert");
            }

            CallbackManager.RegisterReqId(reqId, this);
        }