Esempio n. 1
0
        private static void BulkInsertRequest(int requestId, IntPtr handlePtr, IntPtr bulk_data, IntPtr userData)
        {
            Provider         provider;
            BulkInsertResult result;
            BulkData         bulkData = new BulkData(new Interop.DataControl.SafeBulkDataHandle(bulk_data, false));

            Interop.DataControl.SafeBulkDataHandle sbdh = bulkData.SafeBulkDataHandle;
            IntPtr     bundleHandel;
            ResultType ret;

            int           count     = bulkData.GetCount();
            List <string> queryList = new List <string>();

            for (int i = 0; i < count; i++)
            {
                Interop.DataControl.BulkGetData(sbdh, i, out bundleHandel);
                queryList.Add(GetQuery(handlePtr, new SafeBundleHandle(bundleHandel, false), null, OperationType.Insert));
            }

            provider = GetProvider(handlePtr);
            if (provider == null)
            {
                Log.Error(LogTag, "Provider not exist ");
                return;
            }

            result = provider.OnBulkInsert(queryList, bulkData);
            if (result != null)
            {
                if (result.Result)
                {
                    ret = Interop.DataControl.SendBulkInsertResult(requestId, result.BulkResultData.SafeBulkDataHandle);
                    if (ret != ResultType.Success)
                    {
                        Log.Error(LogTag, "SendBulkInsertResult fail " + ret.ToString());
                    }
                }
                else
                {
                    ret = Interop.DataControl.SendError(requestId, result.Result.ToString());
                    if (ret != ResultType.Success)
                    {
                        Log.Error(LogTag, "SendError fail " + ret.ToString());
                    }
                }

                if (result.BulkResultData != null)
                {
                    result.BulkResultData.Dispose();
                }
            }
            else
            {
                Log.Info(LogTag, $"BulkInsertResult is null : {requestId.ToString()}");
            }
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
 /// <summary>
 /// Overrides this method if you want to handle the behavior when the bulk add request is received.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 protected virtual MapBulkAddResult OnMapBulkAdd(BulkData bulkAddData)
 {
     Log.Info(LogTag, "The OnMapBulkAdd is not implemented.");
     return(null);
 }
Esempio n. 4
0
 /// <summary>
 /// Overrides this method if you want to handle the behavior when the bulk insert request is received.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 protected virtual BulkInsertResult OnBulkInsert(IEnumerable <string> query, BulkData bulkInsertData)
 {
     Log.Info(LogTag, "The OnBulkInsert is not implemented.");
     return(null);
 }