in MySQL.Data/src/NativeDriver.cs [336:412]
private void SetConnectionFlags(ClientFlags serverCaps)
{
// We always allow multiple result sets
ClientFlags flags = ClientFlags.MULTI_RESULTS;
// allow load data local infile
if (Settings.AllowLoadLocalInfile || !String.IsNullOrWhiteSpace(Settings.AllowLoadLocalInfileInPath))
flags |= ClientFlags.LOCAL_FILES;
if (!Settings.UseAffectedRows)
flags |= ClientFlags.FOUND_ROWS;
flags |= ClientFlags.PROTOCOL_41;
// Need this to get server status values
flags |= ClientFlags.TRANSACTIONS;
// user allows/disallows batch statements
if (Settings.AllowBatch)
flags |= ClientFlags.MULTI_STATEMENTS;
// if the server allows it, tell it that we want long column info
if ((serverCaps & ClientFlags.LONG_FLAG) != 0)
flags |= ClientFlags.LONG_FLAG;
// if the server supports it and it was requested, then turn on compression
if ((serverCaps & ClientFlags.COMPRESS) != 0 && Settings.UseCompression)
flags |= ClientFlags.COMPRESS;
flags |= ClientFlags.LONG_PASSWORD; // for long passwords
// did the user request an interactive session?
if (Settings.InteractiveSession)
flags |= ClientFlags.INTERACTIVE;
// if the server allows it and a database was specified, then indicate
// that we will connect with a database name
if ((serverCaps & ClientFlags.CONNECT_WITH_DB) != 0 &&
Settings.Database != null && Settings.Database.Length > 0)
flags |= ClientFlags.CONNECT_WITH_DB;
// if the server is requesting a secure connection, then we oblige
if ((serverCaps & ClientFlags.SECURE_CONNECTION) != 0)
flags |= ClientFlags.SECURE_CONNECTION;
// if the server is capable of SSL and the user is requesting SSL
if ((serverCaps & ClientFlags.SSL) != 0 && Settings.SslMode != MySqlSslMode.Disabled
&& Settings.ConnectionProtocol != MySqlConnectionProtocol.NamedPipe
&& Settings.ConnectionProtocol != MySqlConnectionProtocol.SharedMemory)
flags |= ClientFlags.SSL;
// if the server supports output parameters, then we do too
if ((serverCaps & ClientFlags.PS_MULTI_RESULTS) != 0)
flags |= ClientFlags.PS_MULTI_RESULTS;
if ((serverCaps & ClientFlags.PLUGIN_AUTH) != 0)
flags |= ClientFlags.PLUGIN_AUTH;
// if the server supports connection attributes
if ((serverCaps & ClientFlags.CONNECT_ATTRS) != 0)
flags |= ClientFlags.CONNECT_ATTRS;
if ((serverCaps & ClientFlags.CAN_HANDLE_EXPIRED_PASSWORD) != 0)
flags |= ClientFlags.CAN_HANDLE_EXPIRED_PASSWORD;
// if the server supports query attributes
if ((serverCaps & ClientFlags.CLIENT_QUERY_ATTRIBUTES) != 0)
flags |= ClientFlags.CLIENT_QUERY_ATTRIBUTES;
// if the server supports MFA
if ((serverCaps & ClientFlags.MULTI_FACTOR_AUTHENTICATION) != 0)
flags |= ClientFlags.MULTI_FACTOR_AUTHENTICATION;
// need this to get server session trackers
flags |= ClientFlags.CLIENT_SESSION_TRACK;
connectionFlags = flags;
}