示例#1
0
        /// <summary>
        /// initializes the UnQLite library. It should be invoked before other methods called.
        /// </summary>
        /// <exception cref="System.ArgumentNullException">
        /// setting is null
        /// </exception>
        /// <exception cref="UnQLiteException">
        /// The UnQLiteException when initializes the library.
        /// </exception>
        public static void LibInit(UnQLiteLibConfigSetting setting)
        {
            if (setting == null)
            {
                throw new ArgumentNullException("setting");
            }

            UnQLiteLibConfigCode config = setting.IsThreadSafe ? UnQLiteLibConfigCode.ThreadLevelMulti : UnQLiteLibConfigCode.ThreadLevelSingle;
            UnQLiteResultCode    code   = UnsafeNativeMethods.unqlite_lib_config(config, __arglist());

            if (code != UnQLiteResultCode.Ok)
            {
                throw new UnQLiteException(code, null);
            }

            if (setting.PageSize > 0)
            {
                code = UnsafeNativeMethods.unqlite_lib_config(UnQLiteLibConfigCode.PageSize, __arglist(setting.PageSize));
                if (code != UnQLiteResultCode.Ok)
                {
                    throw new UnQLiteException(code, null);
                }
            }

            code = UnsafeNativeMethods.unqlite_lib_init();
            if (code != UnQLiteResultCode.Ok)
            {
                throw new UnQLiteException(code, null);
            }
        }
示例#2
0
 public static unsafe extern UnQLiteResultCode unqlite_lib_config(UnQLiteLibConfigCode nConfigOp, __arglist);