Exemplo n.º 1
0
        public int CreateCollation(IDbHandle db, ICollation collation)
        {
            var internalDbHandle = (DbHandle)db;

            var compareCallbackExecutor = new CompareCallbackExecutor(
                collation,
                SQLiteApiWin32Internal.GetCompareCallbackStringBytes);

            var func = new SQLiteApiWin32Internal.CompareCallback(compareCallbackExecutor.Execute);

            _allocatedGCHandles.Add(GCHandle.Alloc(func));

            return(SQLiteApiWin32Internal.sqlite3_create_collation(
                       internalDbHandle.DbPtr,
                       Encoding.UTF8.GetBytes(collation.Name),
                       SQLiteEncodings.SQLITE_UTF8,
                       IntPtr.Zero,
                       func));
        }