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

Fix | Support Georgian collation #2194

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -4435,6 +4435,9 @@ internal int GetCodePage(SqlCollation collation, TdsParserStateObject stateObj)
case 0x43f:
codePage = 1251; // Kazakh code page based on SQL Server
break;
case 0x10437:
codePage = 1252; // Georgian code page based on SQL Server
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5006,6 +5006,9 @@ internal int GetCodePage(SqlCollation collation, TdsParserStateObject stateObj)
case 0x43f:
codePage = 1251; // Kazakh code page based on SQL Server
break;
case 0x10437:
codePage = 1252; // Georgian code page based on SQL Server
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ public static void CheckSparseColumnBit()
}

// Synapse: Statement 'Drop Database' is not supported in this version of SQL Server.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void CollatedDataReaderTest()
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse))]
[InlineData("KAZAKH_90_CI_AI")]
[InlineData("Georgian_Modern_Sort_CI_AS")]
public static void CollatedDataReaderTest(string collation)
{
var databaseName = DataTestUtility.GetUniqueName("DB");
// Remove square brackets
var dbName = databaseName.Substring(1, databaseName.Length - 2);
string dbName = DataTestUtility.GetUniqueName("CollationTest", false);

SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString)
{
Expand All @@ -140,33 +140,27 @@ public static void CollatedDataReaderTest()
con.Open();

// Create collated database
cmd.CommandText = $"CREATE DATABASE {databaseName} COLLATE KAZAKH_90_CI_AI";
cmd.CommandText = $"CREATE DATABASE [{dbName}] COLLATE {collation}";
cmd.ExecuteNonQuery();

//Create connection without pooling in order to delete database later.
using (SqlConnection dbCon = new(builder.ConnectionString))
using (SqlCommand dbCmd = dbCon.CreateCommand())
{
var data = "TestData";
string data = Guid.NewGuid().ToString();

dbCon.Open();
dbCmd.CommandText = $"SELECT '{data}'";
using SqlDataReader reader = dbCmd.ExecuteReader();
reader.Read();
Assert.Equal(data, reader.GetString(0));
}

// Let connection close safely before dropping database for slow servers.
Thread.Sleep(500);
}
catch (SqlException e)
{
Assert.Fail($"Unexpected Exception occurred: {e.Message}");
}
finally
{
cmd.CommandText = $"DROP DATABASE {databaseName}";
cmd.ExecuteNonQuery();
// Let connection close safely before dropping database for slow servers.
Thread.Sleep(500);
DataTestUtility.DropDatabase(con, dbName);
}
}

Expand Down
Loading