Exemplo n.º 1
0
        /// <summary>
        /// The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method.
        /// WARNING: Must not throw exceptions.
        /// </summary>
        /// <remarks>
        /// This function takes care of doing the lookups and getting the important information put together to call the Step() function.
        /// That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
        /// binary searches can be done to find the data.
        /// </remarks>
        /// <param name="context">A raw context pointer</param>
        /// <param name="nArgs">Number of arguments passed in</param>
        /// <param name="argsptr">A pointer to the array of arguments</param>
        internal void StepCallback(IntPtr context, int nArgs, IntPtr argsptr)
        {
            try
            {
                AggregateData data = null;

                if (_base != null)
                {
                    IntPtr nAux = _base.AggregateContext(context);

                    if ((_contextDataList != null) &&
                        !_contextDataList.TryGetValue(nAux, out data))
                    {
                        data = new AggregateData();
                        _contextDataList[nAux] = data;
                    }
                }

                if (data == null)
                {
                    data = new AggregateData();
                }

                try
                {
                    _context = context;
                    Step(ConvertParams(nArgs, argsptr),
                         data._count, ref data._data); /* throw */
                }
                finally
                {
                    data._count++;
                }
            }
#if !PLATFORM_COMPACTFRAMEWORK
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                try
                {
                    if ((_flags & SQLiteConnectionFlags.LogCallbackException) ==
                        SQLiteConnectionFlags.LogCallbackException)
                    {
                        SQLiteLog.LogMessage(COR_E_EXCEPTION, String.Format(
                                                 CultureInfo.CurrentCulture,
                                                 "Caught exception in \"Step\" method: {1}",
                                                 e)); /* throw */
                    }
                }
                catch
                {
                    // do nothing.
                }
            }
#else
            catch /* NOTE: Must catch ALL. */
            {
                // do nothing (Windows CE).
            }
#endif
        }
Exemplo n.º 2
0
        /// <summary>
        /// The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method.
        /// </summary>
        /// <remarks>
        /// This function takes care of doing the lookups and getting the important information put together to call the Step() function.
        /// That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
        /// binary searches can be done to find the data.
        /// </remarks>
        /// <param name="context">A raw context pointer</param>
        /// <param name="nArgs">Number of arguments passed in</param>
        /// <param name="argsptr">A pointer to the array of arguments</param>
        internal void StepCallback(IntPtr context, int nArgs, IntPtr argsptr)
        {
            int    n = _base.AggregateCount(context);
            long   nAux;
            object obj = null;

            nAux = (long)_base.AggregateContext(context);
            if (n > 1)
            {
                obj = _contextDataList[nAux];
            }

            Step(ConvertParams(nArgs, argsptr), n, ref obj);
            _contextDataList[nAux] = obj;
        }
Exemplo n.º 3
0
        /// <summary>
        /// The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method.
        /// </summary>
        /// <remarks>
        /// This function takes care of doing the lookups and getting the important information put together to call the Step() function.
        /// That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
        /// binary searches can be done to find the data.
        /// </remarks>
        /// <param name="context">A raw context pointer</param>
        /// <param name="nArgs">Number of arguments passed in</param>
        /// <param name="argsptr">A pointer to the array of arguments</param>
        internal void StepCallback(IntPtr context, int nArgs, IntPtr argsptr)
        {
            long          nAux;
            AggregateData data;

            nAux = (long)_base.AggregateContext(context);
            if (_contextDataList.TryGetValue(nAux, out data) == false)
            {
                data = new AggregateData();
                _contextDataList[nAux] = data;
            }

            try
            {
                _context = context;
                Step(ConvertParams(nArgs, argsptr), data._count, ref data._data);
            }
            finally
            {
                data._count++;
            }
        }