Example #1
0
        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates a copy of the specified
        /// <see cref="UnsafeNativeMethods.sqlite3_module" /> object instance,
        /// using default implementations for the contained delegates when
        /// necessary.
        /// </summary>
        /// <param name="module">
        /// The <see cref="UnsafeNativeMethods.sqlite3_module" /> object
        /// instance to copy.
        /// </param>
        /// <returns>
        /// The new <see cref="UnsafeNativeMethods.sqlite3_module" /> object
        /// instance.
        /// </returns>
        private UnsafeNativeMethods.sqlite3_module CopyNativeModule(
            UnsafeNativeMethods.sqlite3_module module
            )
        {
            UnsafeNativeMethods.sqlite3_module newModule =
                new UnsafeNativeMethods.sqlite3_module();

            newModule.iVersion = module.iVersion;

            newModule.xCreate = new UnsafeNativeMethods.xCreate(
                (module.xCreate != null) ? module.xCreate : xCreate);

            newModule.xConnect = new UnsafeNativeMethods.xConnect(
                (module.xConnect != null) ? module.xConnect : xConnect);

            newModule.xBestIndex = new UnsafeNativeMethods.xBestIndex(
                (module.xBestIndex != null) ? module.xBestIndex : xBestIndex);

            newModule.xDisconnect = new UnsafeNativeMethods.xDisconnect(
                (module.xDisconnect != null) ? module.xDisconnect :
                xDisconnect);

            newModule.xDestroy = new UnsafeNativeMethods.xDestroy(
                (module.xDestroy != null) ? module.xDestroy : xDestroy);

            newModule.xOpen = new UnsafeNativeMethods.xOpen(
                (module.xOpen != null) ? module.xOpen : xOpen);

            newModule.xClose = new UnsafeNativeMethods.xClose(
                (module.xClose != null) ? module.xClose : xClose);

            newModule.xFilter = new UnsafeNativeMethods.xFilter(
                (module.xFilter != null) ? module.xFilter : xFilter);

            newModule.xNext = new UnsafeNativeMethods.xNext(
                (module.xNext != null) ? module.xNext : xNext);

            newModule.xEof = new UnsafeNativeMethods.xEof(
                (module.xEof != null) ? module.xEof : xEof);

            newModule.xColumn = new UnsafeNativeMethods.xColumn(
                (module.xColumn != null) ? module.xColumn : xColumn);

            newModule.xRowId = new UnsafeNativeMethods.xRowId(
                (module.xRowId != null) ? module.xRowId : xRowId);

            newModule.xUpdate = new UnsafeNativeMethods.xUpdate(
                (module.xUpdate != null) ? module.xUpdate : xUpdate);

            newModule.xBegin = new UnsafeNativeMethods.xBegin(
                (module.xBegin != null) ? module.xBegin : xBegin);

            newModule.xSync = new UnsafeNativeMethods.xSync(
                (module.xSync != null) ? module.xSync : xSync);

            newModule.xCommit = new UnsafeNativeMethods.xCommit(
                (module.xCommit != null) ? module.xCommit : xCommit);

            newModule.xRollback = new UnsafeNativeMethods.xRollback(
                (module.xRollback != null) ? module.xRollback : xRollback);

            newModule.xFindFunction = new UnsafeNativeMethods.xFindFunction(
                (module.xFindFunction != null) ? module.xFindFunction :
                xFindFunction);

            newModule.xRename = new UnsafeNativeMethods.xRename(
                (module.xRename != null) ? module.xRename : xRename);

            newModule.xSavepoint = new UnsafeNativeMethods.xSavepoint(
                (module.xSavepoint != null) ? module.xSavepoint : xSavepoint);

            newModule.xRelease = new UnsafeNativeMethods.xRelease(
                (module.xRelease != null) ? module.xRelease : xRelease);

            newModule.xRollbackTo = new UnsafeNativeMethods.xRollbackTo(
                (module.xRollbackTo != null) ? module.xRollbackTo :
                xRollbackTo);

            return newModule;
        }
Example #2
0
        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns the native sqlite_module structure using the
        /// specified <see cref="ISQLiteNativeModule" /> interface
        /// implementation.
        /// </summary>
        /// <param name="module">
        /// The <see cref="ISQLiteNativeModule" /> interface implementation to
        /// use.
        /// </param>
        /// <returns>
        /// The native sqlite_module structure using the specified
        /// <see cref="ISQLiteNativeModule" /> interface implementation.
        /// </returns>
        private UnsafeNativeMethods.sqlite3_module AllocateNativeModule(
            ISQLiteNativeModule module
            )
        {
            nativeModule = new UnsafeNativeMethods.sqlite3_module();
            nativeModule.iVersion = DefaultModuleVersion;

            if (module != null)
            {
                nativeModule.xCreate = new UnsafeNativeMethods.xCreate(
                   module.xCreate);

                nativeModule.xConnect = new UnsafeNativeMethods.xConnect(
                    module.xConnect);

                nativeModule.xBestIndex = new UnsafeNativeMethods.xBestIndex(
                    module.xBestIndex);

                nativeModule.xDisconnect = new UnsafeNativeMethods.xDisconnect(
                    module.xDisconnect);

                nativeModule.xDestroy = new UnsafeNativeMethods.xDestroy(
                    module.xDestroy);

                nativeModule.xOpen = new UnsafeNativeMethods.xOpen(
                    module.xOpen);

                nativeModule.xClose = new UnsafeNativeMethods.xClose(
                    module.xClose);

                nativeModule.xFilter = new UnsafeNativeMethods.xFilter(
                    module.xFilter);

                nativeModule.xNext = new UnsafeNativeMethods.xNext(
                    module.xNext);

                nativeModule.xEof = new UnsafeNativeMethods.xEof(module.xEof);

                nativeModule.xColumn = new UnsafeNativeMethods.xColumn(
                    module.xColumn);

                nativeModule.xRowId = new UnsafeNativeMethods.xRowId(
                    module.xRowId);

                nativeModule.xUpdate = new UnsafeNativeMethods.xUpdate(
                    module.xUpdate);

                nativeModule.xBegin = new UnsafeNativeMethods.xBegin(
                    module.xBegin);

                nativeModule.xSync = new UnsafeNativeMethods.xSync(
                    module.xSync);

                nativeModule.xCommit = new UnsafeNativeMethods.xCommit(
                    module.xCommit);

                nativeModule.xRollback = new UnsafeNativeMethods.xRollback(
                    module.xRollback);

                nativeModule.xFindFunction = new UnsafeNativeMethods.xFindFunction(
                    module.xFindFunction);

                nativeModule.xRename = new UnsafeNativeMethods.xRename(
                    module.xRename);

                nativeModule.xSavepoint = new UnsafeNativeMethods.xSavepoint(
                    module.xSavepoint);

                nativeModule.xRelease = new UnsafeNativeMethods.xRelease(
                    module.xRelease);

                nativeModule.xRollbackTo = new UnsafeNativeMethods.xRollbackTo(
                    module.xRollbackTo);
            }
            else
            {
                nativeModule.xCreate = new UnsafeNativeMethods.xCreate(
                    xCreate);

                nativeModule.xConnect = new UnsafeNativeMethods.xConnect(
                    xConnect);

                nativeModule.xBestIndex = new UnsafeNativeMethods.xBestIndex(
                    xBestIndex);

                nativeModule.xDisconnect = new UnsafeNativeMethods.xDisconnect(
                    xDisconnect);

                nativeModule.xDestroy = new UnsafeNativeMethods.xDestroy(
                    xDestroy);

                nativeModule.xOpen = new UnsafeNativeMethods.xOpen(xOpen);
                nativeModule.xClose = new UnsafeNativeMethods.xClose(xClose);

                nativeModule.xFilter = new UnsafeNativeMethods.xFilter(
                    xFilter);

                nativeModule.xNext = new UnsafeNativeMethods.xNext(xNext);
                nativeModule.xEof = new UnsafeNativeMethods.xEof(xEof);

                nativeModule.xColumn = new UnsafeNativeMethods.xColumn(
                    xColumn);

                nativeModule.xRowId = new UnsafeNativeMethods.xRowId(xRowId);

                nativeModule.xUpdate = new UnsafeNativeMethods.xUpdate(
                    xUpdate);

                nativeModule.xBegin = new UnsafeNativeMethods.xBegin(xBegin);
                nativeModule.xSync = new UnsafeNativeMethods.xSync(xSync);

                nativeModule.xCommit = new UnsafeNativeMethods.xCommit(
                    xCommit);

                nativeModule.xRollback = new UnsafeNativeMethods.xRollback(
                    xRollback);

                nativeModule.xFindFunction = new UnsafeNativeMethods.xFindFunction(
                    xFindFunction);

                nativeModule.xRename = new UnsafeNativeMethods.xRename(
                    xRename);

                nativeModule.xSavepoint = new UnsafeNativeMethods.xSavepoint(
                    xSavepoint);

                nativeModule.xRelease = new UnsafeNativeMethods.xRelease(
                    xRelease);

                nativeModule.xRollbackTo = new UnsafeNativeMethods.xRollbackTo(
                    xRollbackTo);
            }

            return nativeModule;
        }