Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use select ... AS ... to make result column name predictable #70

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions MySQL.Data/src/Driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,13 @@ private async Task<Dictionary<string, string>> LoadServerPropertiesAsync(MySqlCo
{
// load server properties
Dictionary<string, string> hash = new Dictionary<string, string>();
MySqlCommand cmd = new MySqlCommand(@"SELECT @@max_allowed_packet, @@character_set_client,
@@character_set_connection, @@license, @@sql_mode, @@lower_case_table_names, @@autocommit;", connection);
MySqlCommand cmd = new MySqlCommand(@"SELECT @@max_allowed_packet AS max_allowed_packet,
@@character_set_client AS character_set_client,
@@character_set_connection AS character_set_connection,
@@license AS license,
@@sql_mode AS sql_mode,
@@lower_case_table_names AS lower_case_table_names,
@@autocommit AS autocommit;", connection);
try
{
using (MySqlDataReader reader = await cmd.ExecuteReaderAsync(default, execAsync, cancellationToken).ConfigureAwait(false))
Expand All @@ -309,7 +314,7 @@ private async Task<Dictionary<string, string>> LoadServerPropertiesAsync(MySqlCo
{
for (int i = 0; i <= reader.FieldCount - 1; i++)
{
string key = reader.GetName(i).Remove(0, 2);
string key = reader.GetName(i);
string value = reader[i].ToString();
hash[key] = value;
}
Expand Down