Пример #1
0
 internal abstract CollationSequence GetCollationSequence(SqliteFunction func, SqliteContextHandle context);
 internal override CollationSequence GetCollationSequence(SqliteFunction func, Wrapper.SqliteContextHandle context) {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Called by SQLiteBase derived classes, this function binds all user-defined functions to a connection.
        /// It is done this way so that all user-defined functions will access the database using the same encoding scheme
        /// as the connection (UTF-8 or UTF-16).
        /// </summary>
        /// <remarks>
        /// The wrapper functions that interop with SQLite will create a unique cookie value, which internally is a pointer to
        /// all the wrapped callback functions.  The interop function uses it to map CDecl callbacks to StdCall callbacks.
        /// </remarks>
        /// <param name="sqlbase">The base object on which the functions are to bind</param>
        /// <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>
        internal static SqliteFunction[] BindFunctions(SqliteBase sqlbase) {
            SqliteFunction f;
            List<SqliteFunction> lFunctions = new List<SqliteFunction>();

            foreach (SqliteFunctionAttribute pr in _registeredFunctions) {
                f = (SqliteFunction)Activator.CreateInstance(pr._instanceType);
                f._base = sqlbase;
                f._InvokeFunc = (pr.FuncType == FunctionType.Scalar) ? new SqliteCallback(f.ScalarCallback) : null;
                f._StepFunc = (pr.FuncType == FunctionType.Aggregate) ? new SqliteCallback(f.StepCallback) : null;
                f._FinalFunc = (pr.FuncType == FunctionType.Aggregate) ? new SqliteFinalCallback(f.FinalCallback) : null;
                f._CompareFunc = (pr.FuncType == FunctionType.Collation) ? new SqliteCollation(f.CompareCallback) : null;
                f._CompareFunc16 = (pr.FuncType == FunctionType.Collation) ? new SqliteCollation(f.CompareCallback16) : null;

                if (pr.FuncType != FunctionType.Collation)
                    sqlbase.CreateFunction(pr.Name, pr.Arguments, (f is SqliteFunctionEx), f._InvokeFunc, f._StepFunc, f._FinalFunc);
                else
                    sqlbase.CreateCollation(pr.Name, f._CompareFunc, f._CompareFunc16);


                lFunctions.Add(f);
            }

            SqliteFunction[] arFunctions = new SqliteFunction[lFunctions.Count];
            lFunctions.CopyTo(arFunctions, 0);

            return arFunctions;
        }
Пример #4
0
 internal abstract CollationSequence GetCollationSequence(SqliteFunction func, SqliteContextHandle context);