JetSetSystemParameter() public static method

Sets database configuration options.
public static JetSetSystemParameter ( JET_INSTANCE instance, JET_SESID sesid, JET_param paramid, JET_CALLBACK paramValue, string paramString ) : JET_wrn
instance JET_INSTANCE /// The instance to set the option on or /// to set the option on all instances. ///
sesid JET_SESID The session to use.
paramid JET_param The parameter to set.
paramValue JET_CALLBACK The value of the parameter to set, if the parameter is an integer type.
paramString string The value of the parameter to set, if the parameter is a string type.
return JET_wrn
Example #1
0
        public void Init(bool recoveryEnabled)
        {
            int pageSize;

            Esent.JetGetDatabaseFileInfo(m_filename, out pageSize, JET_DbInfo.PageSize);

            string dir = Path.GetDirectoryName(m_filename) + Path.DirectorySeparatorChar;

            Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.DatabasePageSize, pageSize, null);
            Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.LogFilePath, 0, dir);
            Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.SystemPath, 0, dir);

            // Put the temp DB in our working directory.
            Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.TempPath, 0, Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar);

            // Set recovery option.
            Esent.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, JET_param.Recovery, 0, recoveryEnabled ? "On" : "Off");

            m_jetInstance = new Instance("ESEVIEW");
            m_jetInstance.Init();

            m_sesid = new Session(m_jetInstance);

            Esent.JetAttachDatabase(m_sesid, m_filename, recoveryEnabled ? AttachDatabaseGrbit.None : AttachDatabaseGrbit.ReadOnly);
            Esent.JetOpenDatabase(m_sesid, m_filename, null, out m_dbid, OpenDatabaseGrbit.ReadOnly);
        }
 /// <summary>
 /// Set a system parameter which is a boolean.
 /// </summary>
 /// <param name="param">The parameter to set.</param>
 /// <param name="value">The value to set.</param>
 private void SetBoolParameter(JET_param param, bool value)
 {
     if (value)
     {
         Api.JetSetSystemParameter(this.instance, this.sesid, param, 1, null);
     }
     else
     {
         Api.JetSetSystemParameter(this.instance, this.sesid, param, 0, null);
     }
 }
Example #3
0
        /// <summary>
        /// Set a system parameter which is a boolean.
        /// </summary>
        /// <param name="param">The parameter to set.</param>
        /// <param name="value">The value to set.</param>
        private static void SetBoolParameter(JET_param param, bool value)
        {
            int setting = value ? 1 : 0;

            Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, param, setting, null);
        }
Example #4
0
 /// <summary>
 /// Set a system parameter which is an integer.
 /// </summary>
 /// <param name="param">The parameter to set.</param>
 /// <param name="value">The value to set.</param>
 private static void SetIntegerParameter(JET_param param, int value)
 {
     Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, param, value, null);
 }
 /// <summary>
 /// Set a system parameter which is a string.
 /// </summary>
 /// <param name="param">The parameter to set.</param>
 /// <param name="value">The value to set.</param>
 private static void SetStringParameter(JET_param param, string value)
 {
     Api.JetSetSystemParameter(JET_INSTANCE.Nil, JET_SESID.Nil, param, 0, value);
 }
 /// <summary>
 /// Set a system parameter which is an integer.
 /// </summary>
 /// <param name="param">The parameter to set.</param>
 /// <param name="value">The value to set.</param>
 private void SetIntegerParameter(JET_param param, int value)
 {
     Api.JetSetSystemParameter(this.instance, this.sesid, param, value, null);
 }
 /// <summary>
 /// Set a system parameter which is a string.
 /// </summary>
 /// <param name="param">The parameter to set.</param>
 /// <param name="value">The value to set.</param>
 private void SetStringParameter(JET_param param, string value)
 {
     Api.JetSetSystemParameter(this.instance, this.sesid, param, 0, value);
 }