internal void SetUseprocedurebodies(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { sender.ValidateValue(ref value); MySqlTrace.LogWarning(-1, "Use Procedure Bodies is now obsolete. Use Check Parameters instead"); msb.SetValue("checkparameters", value); msb.SetValue("useprocedurebodies", value); }
internal void HandleTimeoutOrThreadAbort(Exception ex) { bool isFatal = false; if (this.isKillQueryConnection) { this.Abort(); if (!(ex is TimeoutException)) { return; } this.Throw(new MySqlException(Resources.Timeout, true, ex)); } try { this.CancelQuery(5); this.driver.ResetTimeout(5000); if (this.Reader != null) { this.Reader.Close(); this.Reader = null; } } catch (Exception ex2) { MySqlTrace.LogWarning(this.ServerThread, "Could not kill query, aborting connection. Exception was " + ex2.Message); this.Abort(); isFatal = true; } if (ex is TimeoutException) { this.Throw(new MySqlException(Resources.Timeout, isFatal, ex)); } }
internal void Abort() { try { driver.Close(); } catch (Exception ex) { MySqlTrace.LogWarning(ServerThread, String.Concat("Error occurred aborting the connection. Exception was: ", ex.Message)); } SetState(ConnectionState.Closed, true); }
internal void Abort() { try { this.driver.Close(); } catch (Exception ex) { MySqlTrace.LogWarning(this.ServerThread, "Error occurred aborting the connection. Exception was: " + ex.Message); } finally { this.isInUse = false; } this.SetState(ConnectionState.Closed, true); }
internal void HandleTimeoutOrThreadAbort(Exception ex) { bool isFatal = false; if (_isKillQueryConnection) { // Special connection started to cancel a query. // Abort will prevent recursive connection spawning Abort(); if (ex is TimeoutException) { Throw(new MySqlException(Resources.Timeout, true, ex)); } else { return; } } try { // Do a fast cancel.The reason behind small values for connection // and command timeout is that we do not want user to wait longer // after command has already expired. // Microsoft's SqlClient seems to be using 5 seconds timeouts // here as well. // Read the error packet with "interrupted" message. CancelQuery(5); driver.ResetTimeout(5000); if (Reader != null) { Reader.Close(); Reader = null; } } catch (Exception ex2) { MySqlTrace.LogWarning(ServerThread, "Could not kill query, " + " aborting connection. Exception was " + ex2.Message); Abort(); isFatal = true; } if (ex is TimeoutException) { Throw(new MySqlException(Resources.Timeout, isFatal, ex)); } }
private void ValidateKeyword(string keyword) { string key = keyword.ToLower(CultureInfo.InvariantCulture); if (!validKeywords.ContainsKey(key)) { throw new ArgumentException(Resources.KeywordNotSupported, keyword); } if (validKeywords[key] == "Use Old Syntax") { MySqlTrace.LogWarning(-1, "Use Old Syntax is now obsolete. Please see documentation"); } if (validKeywords[key] == "Encrypt") { MySqlTrace.LogWarning(-1, "Encrypt is now obsolete. Use Ssl Mode instead"); } }
internal void SetConnectionTimeOut(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object Value) { uint num = (uint)Convert.ChangeType(Value, sender.BaseType); uint num2 = Math.Min(num, 2147483u); if (num2 != num) { MySqlTrace.LogWarning(-1, string.Concat(new object[] { "Connection timeout value too large (", num, " seconds). Changed to max. possible value", num2, " seconds)" })); } msb.SetValue("connectiontimeout", num2); }
private void HandleObsolete(string keyword, object value) { if (String.Compare(keyword, "Use Old Syntax", true) == 0) { MySqlTrace.LogWarning(-1, "Use Old Syntax is now obsolete. Please see documentation"); } #if !CF else if (String.Compare(keyword, "Encrypt", true) == 0) { MySqlTrace.LogWarning(-1, "Encrypt is now obsolete. Use Ssl Mode instead"); Encrypt = (bool)value; } #endif else if (String.Compare(keyword, "Use Procedure Bodies", true) == 0) { MySqlTrace.LogWarning(-1, "Use Procedure Bodies is now obsolete. Use Check Parameters instead"); CheckParameters = (bool)value; } }
static MySqlConnectionStringBuilder() { // Server options Options.Add(new MySqlConnectionStringOption("pipe", "pipe name,pipename", typeof(string), "MYSQL", false, (msb, sender, value) => { #if NETSTANDARD1_6 || NETSTANDARD2_0 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(PipeName))); #else msb.SetValue("pipe", value); #endif }, (msb, sender) => msb.PipeName)); Options.Add(new MySqlConnectionStringOption("compress", "use compression,usecompression", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("compress", value); }, (msb, sender) => msb.UseCompression)); Options.Add(new MySqlConnectionStringOption("allowbatch", "allow batch", typeof(bool), true, false, (msb, sender, value) => { msb.SetValue("allowbatch", value); }, (msb, sender) => msb.AllowBatch)); Options.Add(new MySqlConnectionStringOption("logging", null, typeof(bool), false, false, (msb, sender, value) => { #if NETSTANDARD1_6 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(Logging))); #else msb.SetValue("logging", value); #endif }, (msb, sender) => msb.Logging)); Options.Add(new MySqlConnectionStringOption("sharedmemoryname", "shared memory name", typeof(string), "MYSQL", false, (msb, sender, value) => { #if NETSTANDARD1_6 || NETSTANDARD2_0 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(SharedMemoryName))); #else msb.SetValue("sharedmemoryname", value); #endif }, (msb, sender) => msb.SharedMemoryName)); Options.Add(new MySqlConnectionStringOption("defaultcommandtimeout", "command timeout,default command timeout", typeof(uint), (uint)30, false, (msb, sender, value) => { msb.SetValue("defaultcommandtimeout", value); }, (msb, sender) => msb.DefaultCommandTimeout)); Options.Add(new MySqlConnectionStringOption("usedefaultcommandtimeoutforef", "use default command timeout for ef", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("usedefaultcommandtimeoutforef", value); }, (msb, sender) => msb.UseDefaultCommandTimeoutForEF)); Options.Add(new MySqlConnectionStringOption("connectiontimeout", "connection timeout,connect timeout", typeof(uint), (uint)15, false, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object Value) { uint value = (uint)Convert.ChangeType(Value, sender.BaseType); // Timeout in milliseconds should not exceed maximum for 32 bit // signed integer (~24 days). We truncate the value if it exceeds // maximum (MySqlCommand.CommandTimeout uses the same technique uint timeout = Math.Min(value, Int32.MaxValue / 1000); if (timeout != value) { MySqlTrace.LogWarning(-1, "Connection timeout value too large (" + value + " seconds). Changed to max. possible value" + +timeout + " seconds)"); } msb.SetValue("connectiontimeout", timeout); }, (msb, sender) => (uint)msb.values["connectiontimeout"] )); Options.Add(new MySqlConnectionStringOption("allowloadlocalinfile", "allow load local infile", typeof(bool), false, false)); // Authentication options. Options.Add(new MySqlConnectionStringOption("persistsecurityinfo", "persist security info", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("persistsecurityinfo", value); }, (msb, sender) => msb.PersistSecurityInfo)); Options.Add(new MySqlConnectionStringOption("integratedsecurity", "integrated security", typeof(bool), false, false, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { if (!Platform.IsWindows()) { throw new MySqlException("IntegratedSecurity is supported on Windows only"); } #if NETSTANDARD1_6 || NETSTANDARD2_0 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(IntegratedSecurity))); #else msb.SetValue("Integrated Security", value.ToString().Equals("SSPI", StringComparison.OrdinalIgnoreCase) ? true : value); #endif }, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender) { object val = msb.values["integratedsecurity"]; return((bool)val); } )); Options.Add(new MySqlConnectionStringOption("allowpublickeyretrieval", null, typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("allowpublickeyretrieval", value); }, (msb, sender) => msb.AllowPublicKeyRetrieval)); // Other properties. #if !NETSTANDARD1_6 Options.Add(new MySqlConnectionStringOption("autoenlist", "auto enlist", typeof(bool), true, false, (msb, sender, value) => { msb.SetValue("autoenlist", value); }, (msb, sender) => msb.AutoEnlist)); Options.Add(new MySqlConnectionStringOption("includesecurityasserts", "include security asserts", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("includesecurityasserts", value); }, (msb, sender) => msb.IncludeSecurityAsserts)); #endif Options.Add(new MySqlConnectionStringOption("allowzerodatetime", "allow zero datetime", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("allowzerodatetime", value); }, (msb, sender) => msb.AllowZeroDateTime)); Options.Add(new MySqlConnectionStringOption("convertzerodatetime", "convert zero datetime", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("convertzerodatetime", value); }, (msb, sender) => msb.ConvertZeroDateTime)); Options.Add(new MySqlConnectionStringOption("useusageadvisor", "use usage advisor,usage advisor", typeof(bool), false, false, (msb, sender, value) => { #if NETSTANDARD1_6 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(UseUsageAdvisor))); #else msb.SetValue("useusageadvisor", value); #endif }, (msb, sender) => msb.UseUsageAdvisor)); Options.Add(new MySqlConnectionStringOption("procedurecachesize", "procedure cache size,procedure cache,procedurecache", typeof(uint), (uint)25, false, (msb, sender, value) => { msb.SetValue("procedurecachesize", value); }, (msb, sender) => msb.ProcedureCacheSize)); Options.Add(new MySqlConnectionStringOption("useperformancemonitor", "use performance monitor,useperfmon,perfmon", typeof(bool), false, false, (msb, sender, value) => { #if NETSTANDARD1_6 || NETSTANDARD2_0 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(UsePerformanceMonitor))); #else msb.SetValue("useperformancemonitor", value); #endif }, (msb, sender) => msb.UsePerformanceMonitor)); Options.Add(new MySqlConnectionStringOption("ignoreprepare", "ignore prepare", typeof(bool), true, false, (msb, sender, value) => { msb.SetValue("ignoreprepare", value); }, (msb, sender) => msb.IgnorePrepare)); Options.Add(new MySqlConnectionStringOption("respectbinaryflags", "respect binary flags", typeof(bool), true, false, (msb, sender, value) => { msb.SetValue("respectbinaryflags", value); }, (msb, sender) => msb.RespectBinaryFlags)); Options.Add(new MySqlConnectionStringOption("treattinyasboolean", "treat tiny as boolean", typeof(bool), true, false, (msb, sender, value) => { msb.SetValue("treattinyasboolean", value); }, (msb, sender) => msb.TreatTinyAsBoolean)); Options.Add(new MySqlConnectionStringOption("allowuservariables", "allow user variables", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("allowuservariables", value); }, (msb, sender) => msb.AllowUserVariables)); Options.Add(new MySqlConnectionStringOption("interactivesession", "interactive session,interactive", typeof(bool), false, false, (msb, sender, value) => { #if NETSTANDARD1_6 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(InteractiveSession))); #else msb.SetValue("interactivesession", value); #endif }, (msb, sender) => msb.InteractiveSession)); Options.Add(new MySqlConnectionStringOption("functionsreturnstring", "functions return string", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("functionsreturnstring", value); }, (msb, sender) => msb.FunctionsReturnString)); Options.Add(new MySqlConnectionStringOption("useaffectedrows", "use affected rows", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("useaffectedrows", value); }, (msb, sender) => msb.UseAffectedRows)); Options.Add(new MySqlConnectionStringOption("oldguids", "old guids", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("oldguids", value); }, (msb, sender) => msb.OldGuids)); Options.Add(new MySqlConnectionStringOption("sqlservermode", "sql server mode", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("sqlservermode", value); }, (msb, sender) => msb.SqlServerMode)); Options.Add(new MySqlConnectionStringOption("tablecaching", "table cache,tablecache", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("tablecaching", value); }, (msb, sender) => msb.TableCaching)); Options.Add(new MySqlConnectionStringOption("defaulttablecacheage", "default table cache age", typeof(int), (int)60, false, (msb, sender, value) => { msb.SetValue("defaulttablecacheage", value); }, (msb, sender) => msb.DefaultTableCacheAge)); Options.Add(new MySqlConnectionStringOption("checkparameters", "check parameters", typeof(bool), true, false, (msb, sender, value) => { msb.SetValue("checkparameters", value); }, (msb, sender) => msb.CheckParameters)); Options.Add(new MySqlConnectionStringOption("replication", null, typeof(bool), false, false, (msb, sender, value) => { #if NETSTANDARD1_6 throw new PlatformNotSupportedException(string.Format(Resources.OptionNotCurrentlySupported, nameof(Replication))); #else msb.SetValue("replication", value); #endif }, (msb, sender) => msb.Replication)); Options.Add(new MySqlConnectionStringOption("exceptioninterceptors", "exception interceptors", typeof(string), null, false, (msb, sender, value) => { msb.SetValue("exceptioninterceptors", value); }, (msb, sender) => msb.ExceptionInterceptors)); Options.Add(new MySqlConnectionStringOption("commandinterceptors", "command interceptors", typeof(string), null, false, (msb, sender, value) => { msb.SetValue("commandinterceptors", value); }, (msb, sender) => msb.CommandInterceptors)); // Pooling options. Options.Add(new MySqlConnectionStringOption("connectionlifetime", "connection lifetime", typeof(uint), (uint)0, false, (msb, sender, value) => { msb.SetValue("connectionlifetime", value); }, (msb, sender) => msb.ConnectionLifeTime)); Options.Add(new MySqlConnectionStringOption("pooling", null, typeof(bool), true, false, (msb, sender, value) => { msb.SetValue("pooling", value); }, (msb, sender) => msb.Pooling)); Options.Add(new MySqlConnectionStringOption("minpoolsize", "minimumpoolsize,min pool size,minimum pool size", typeof(uint), (uint)0, false, (msb, sender, value) => { msb.SetValue("minpoolsize", value); }, (msb, sender) => msb.MinimumPoolSize)); Options.Add(new MySqlConnectionStringOption("maxpoolsize", "maximumpoolsize,max pool size,maximum pool size", typeof(uint), (uint)100, false, (msb, sender, value) => { msb.SetValue("maxpoolsize", value); }, (msb, sender) => msb.MaximumPoolSize)); Options.Add(new MySqlConnectionStringOption("connectionreset", "connection reset", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("connectionreset", value); }, (msb, sender) => msb.ConnectionReset)); Options.Add(new MySqlConnectionStringOption("cacheserverproperties", "cache server properties", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("cacheserverproperties", value); }, (msb, sender) => msb.CacheServerProperties)); // Language and charset options. Options.Add(new MySqlConnectionStringOption("treatblobsasutf8", "treat blobs as utf8", typeof(bool), false, false, (msb, sender, value) => { msb.SetValue("treatblobsasutf8", value); }, (msb, sender) => msb.TreatBlobsAsUTF8)); Options.Add(new MySqlConnectionStringOption("blobasutf8includepattern", null, typeof(string), "", false, (msb, sender, value) => { msb.SetValue("blobasutf8includepattern", value); }, (msb, sender) => msb.BlobAsUTF8IncludePattern)); Options.Add(new MySqlConnectionStringOption("blobasutf8excludepattern", null, typeof(string), "", false, (msb, sender, value) => { msb.SetValue("blobasutf8excludepattern", value); }, (msb, sender) => msb.BlobAsUTF8ExcludePattern)); }
public override void Open() { if (this.State == ConnectionState.Open) { this.Throw(new InvalidOperationException(Resources.ConnectionAlreadyOpen)); } this.exceptionInterceptor = new ExceptionInterceptor(this); this.commandInterceptor = new CommandInterceptor(this); this.SetState(ConnectionState.Connecting, true); this.AssertPermissions(); if (this.Settings.AutoEnlist && Transaction.Current != null) { this.driver = DriverTransactionManager.GetDriverInTransaction(Transaction.Current); if (this.driver != null && (this.driver.IsInActiveUse || !this.driver.Settings.EquivalentTo(this.Settings))) { this.Throw(new NotSupportedException(Resources.MultipleConnectionsInTransactionNotSupported)); } } try { MySqlConnectionStringBuilder settings = this.Settings; if (ReplicationManager.IsReplicationGroup(this.Settings.Server)) { if (this.driver == null) { ReplicationManager.GetNewConnection(this.Settings.Server, false, this); return; } settings = this.driver.Settings; } if (this.Settings.Pooling) { MySqlPool pool = MySqlPoolManager.GetPool(settings); if (this.driver == null || !this.driver.IsOpen) { this.driver = pool.GetConnection(); } this.procedureCache = pool.ProcedureCache; } else { if (this.driver == null || !this.driver.IsOpen) { this.driver = Driver.Create(settings); } this.procedureCache = new ProcedureCache((int)this.Settings.ProcedureCacheSize); } } catch (Exception) { this.SetState(ConnectionState.Closed, true); throw; } if (this.driver.Settings.UseOldSyntax) { MySqlTrace.LogWarning(this.ServerThread, "You are using old syntax that will be removed in future versions"); } this.SetState(ConnectionState.Open, false); this.driver.Configure(this); if ((!this.driver.SupportsPasswordExpiration || !this.driver.IsPasswordExpired) && this.Settings.Database != null && this.Settings.Database != string.Empty) { this.ChangeDatabase(this.Settings.Database); } this.schemaProvider = new ISSchemaProvider(this); this.perfMonitor = new PerformanceMonitor(this); if (Transaction.Current != null && this.Settings.AutoEnlist) { this.EnlistTransaction(Transaction.Current); } this.hasBeenOpen = true; this.SetState(ConnectionState.Open, true); }
/// <include file='docs/MySqlConnection.xml' path='docs/Open/*'/> public override void Open() { if (State == ConnectionState.Open) { Throw(new InvalidOperationException(Resources.ConnectionAlreadyOpen)); } #if !RT // start up our interceptors exceptionInterceptor = new ExceptionInterceptor(this); commandInterceptor = new CommandInterceptor(this); #endif SetState(ConnectionState.Connecting, true); AssertPermissions(); #if !RT // if we are auto enlisting in a current transaction, then we will be // treating the connection as pooled if (Settings.AutoEnlist && Transaction.Current != null) { driver = DriverTransactionManager.GetDriverInTransaction(Transaction.Current); if (driver != null && (driver.IsInActiveUse || !driver.Settings.EquivalentTo(this.Settings))) { Throw(new NotSupportedException(Resources.MultipleConnectionsInTransactionNotSupported)); } } #endif try { MySqlConnectionStringBuilder currentSettings = Settings; // Load balancing if (ReplicationManager.IsReplicationGroup(Settings.Server)) { if (driver == null) { ReplicationManager.GetNewConnection(Settings.Server, false, this); } else { currentSettings = driver.Settings; } } if (Settings.Pooling) { MySqlPool pool = MySqlPoolManager.GetPool(currentSettings); if (driver == null || !driver.IsOpen) { driver = pool.GetConnection(); } procedureCache = pool.ProcedureCache; } else { if (driver == null || !driver.IsOpen) { driver = Driver.Create(currentSettings); } procedureCache = new ProcedureCache((int)Settings.ProcedureCacheSize); } } catch (Exception ex) { SetState(ConnectionState.Closed, true); throw; } // if the user is using old syntax, let them know if (driver.Settings.UseOldSyntax) { MySqlTrace.LogWarning(ServerThread, "You are using old syntax that will be removed in future versions"); } SetState(ConnectionState.Open, false); driver.Configure(this); if (!(driver.SupportsPasswordExpiration && driver.IsPasswordExpired)) { if (Settings.Database != null && Settings.Database != String.Empty) { ChangeDatabase(Settings.Database); } } // setup our schema provider schemaProvider = new ISSchemaProvider(this); perfMonitor = new PerformanceMonitor(this); // if we are opening up inside a current transaction, then autoenlist // TODO: control this with a connection string option #if !MONO && !RT if (Transaction.Current != null && Settings.AutoEnlist) { EnlistTransaction(Transaction.Current); } #endif hasBeenOpen = true; SetState(ConnectionState.Open, true); }
/// <include file='docs/MySqlConnection.xml' path='docs/Open/*'/> public override void Open() { if (State == ConnectionState.Open) { throw new InvalidOperationException(Resources.ConnectionAlreadyOpen); } SetState(ConnectionState.Connecting, true); #if !CF // if we are auto enlisting in a current transaction, then we will be // treating the connection as pooled if (settings.AutoEnlist && Transaction.Current != null) { driver = DriverTransactionManager.GetDriverInTransaction(Transaction.Current); if (driver != null && (driver.IsInActiveUse || !driver.Settings.EquivalentTo(this.Settings))) { throw new NotSupportedException(Resources.MultipleConnectionsInTransactionNotSupported); } } #endif try { if (settings.Pooling) { MySqlPool pool = MySqlPoolManager.GetPool(settings); if (driver == null || !driver.IsOpen) { driver = pool.GetConnection(); } procedureCache = pool.ProcedureCache; } else { if (driver == null || !driver.IsOpen) { driver = Driver.Create(settings); } procedureCache = new ProcedureCache((int)settings.ProcedureCacheSize); } } catch (Exception) { SetState(ConnectionState.Closed, true); throw; } // if the user is using old syntax, let them know if (driver.Settings.UseOldSyntax) { MySqlTrace.LogWarning(ServerThread, "You are using old syntax that will be removed in future versions"); } SetState(ConnectionState.Open, false); driver.Configure(this); if (settings.Database != null && settings.Database != String.Empty) { ChangeDatabase(settings.Database); } // setup our schema provider schemaProvider = new ISSchemaProvider(this); #if !CF perfMonitor = new PerformanceMonitor(this); #endif // if we are opening up inside a current transaction, then autoenlist // TODO: control this with a connection string option #if !MONO && !CF if (Transaction.Current != null && settings.AutoEnlist) { EnlistTransaction(Transaction.Current); } #endif hasBeenOpen = true; SetState(ConnectionState.Open, true); }
static MySqlConnectionStringBuilder() { MySqlConnectionStringBuilder.options = new MySqlConnectionStringOptionCollection(); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("server", "host,data source,datasource,address,addr,network address", typeof(string), "", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("database", "initial catalog", typeof(string), string.Empty, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("protocol", "connection protocol, connectionprotocol", typeof(MySqlConnectionProtocol), MySqlConnectionProtocol.Sockets, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("port", null, typeof(uint), 3306u, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("pipe", "pipe name,pipename", typeof(string), "MYSQL", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("compress", "use compression,usecompression", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("allowbatch", "allow batch", typeof(bool), true, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("logging", null, typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("sharedmemoryname", "shared memory name", typeof(string), "MYSQL", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("useoldsyntax", "old syntax,oldsyntax,use old syntax", typeof(bool), false, true, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { MySqlTrace.LogWarning(-1, "Use Old Syntax is now obsolete. Please see documentation"); msb.SetValue("useoldsyntax", value); }, (MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender) => (bool)msb.values["useoldsyntax"])); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("connectiontimeout", "connection timeout,connect timeout", typeof(uint), 15u, false, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object Value) { uint num = (uint)Convert.ChangeType(Value, sender.BaseType); uint num2 = Math.Min(num, 2147483u); if (num2 != num) { MySqlTrace.LogWarning(-1, string.Concat(new object[] { "Connection timeout value too large (", num, " seconds). Changed to max. possible value", num2, " seconds)" })); } msb.SetValue("connectiontimeout", num2); }, (MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender) => (uint)msb.values["connectiontimeout"])); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("defaultcommandtimeout", "command timeout,default command timeout", typeof(uint), 30u, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("usedefaultcommandtimeoutforef", "use default command timeout for ef", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("user id", "uid,username,user name,user,userid", typeof(string), "", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("password", "pwd", typeof(string), "", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("persistsecurityinfo", "persist security info", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("encrypt", null, typeof(bool), false, true, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { sender.ValidateValue(ref value); MySqlTrace.LogWarning(-1, "Encrypt is now obsolete. Use Ssl Mode instead"); msb.SetValue("Ssl Mode", ((bool)value) ? MySqlSslMode.Preferred : MySqlSslMode.None); }, (MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender) => msb.SslMode != MySqlSslMode.None)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("certificatefile", "certificate file", typeof(string), null, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("certificatepassword", "certificate password", typeof(string), null, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("certificatestorelocation", "certificate store location", typeof(MySqlCertificateStoreLocation), MySqlCertificateStoreLocation.None, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("certificatethumbprint", "certificate thumb print", typeof(string), null, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("integratedsecurity", "integrated security", typeof(bool), false, false, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { if (!Platform.IsWindows()) { throw new MySqlException("IntegratedSecurity is supported on Windows only"); } msb.SetValue("Integrated Security", value); }, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender) { object obj = msb.values["Integrated Security"]; return((bool)obj); })); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("allowzerodatetime", "allow zero datetime", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("convertzerodatetime", "convert zero datetime", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("useusageadvisor", "use usage advisor,usage advisor", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("procedurecachesize", "procedure cache size,procedure cache,procedurecache", typeof(uint), 25u, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("useperformancemonitor", "use performance monitor,useperfmon,perfmon", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("ignoreprepare", "ignore prepare", typeof(bool), true, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("useprocedurebodies", "use procedure bodies,procedure bodies", typeof(bool), true, true, delegate(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { sender.ValidateValue(ref value); MySqlTrace.LogWarning(-1, "Use Procedure Bodies is now obsolete. Use Check Parameters instead"); msb.SetValue("checkparameters", value); msb.SetValue("useprocedurebodies", value); }, (MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender) => (bool)msb.values["useprocedurebodies"])); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("autoenlist", "auto enlist", typeof(bool), true, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("respectbinaryflags", "respect binary flags", typeof(bool), true, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("treattinyasboolean", "treat tiny as boolean", typeof(bool), true, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("allowuservariables", "allow user variables", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("interactivesession", "interactive session,interactive", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("functionsreturnstring", "functions return string", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("useaffectedrows", "use affected rows", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("oldguids", "old guids", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("keepalive", "keep alive", typeof(uint), 0u, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("sqlservermode", "sql server mode", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("tablecaching", "table cache,tablecache", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("defaulttablecacheage", "default table cache age", typeof(int), 0, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("checkparameters", "check parameters", typeof(bool), true, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("replication", null, typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("exceptioninterceptors", "exception interceptors", typeof(string), null, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("commandinterceptors", "command interceptors", typeof(string), null, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("includesecurityasserts", "include security asserts", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("connectionlifetime", "connection lifetime", typeof(uint), 0u, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("pooling", null, typeof(bool), true, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("minpoolsize", "min pool size,minimum pool size", typeof(uint), 0u, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("maxpoolsize", "max pool size,maximum pool size", typeof(uint), 1000u, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("connectionreset", "connection reset", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("cacheserverproperties", "cache server properties", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("characterset", "character set,charset", typeof(string), "", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("treatblobsasutf8", "treat blobs as utf8", typeof(bool), false, false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("blobasutf8includepattern", null, typeof(string), "", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("blobasutf8excludepattern", null, typeof(string), "", false)); MySqlConnectionStringBuilder.options.Add(new MySqlConnectionStringOption("sslmode", "ssl mode", typeof(MySqlSslMode), MySqlSslMode.None, false)); }
internal void SetSslMode(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { sender.ValidateValue(ref value); MySqlTrace.LogWarning(-1, "Encrypt is now obsolete. Use Ssl Mode instead"); msb.SetValue("Ssl Mode", ((bool)value) ? MySqlSslMode.Preferred : MySqlSslMode.None); }
internal void SetValue(MySqlConnectionStringBuilder msb, MySqlConnectionStringOption sender, object value) { MySqlTrace.LogWarning(-1, "Use Old Syntax is now obsolete. Please see documentation"); msb.SetValue("useoldsyntax", value); }