Skip to content

Commit 27e7767

Browse files
committed
Merge branch '6.9' of D:\Repos\ConnectorNET\connector-net into 6.9
2 parents 67d6897 + b376581 commit 27e7767

File tree

4 files changed

+38
-159
lines changed

4 files changed

+38
-159
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- Fix for sockets stay in CLOSE_WAIT when using SSL (MySQL Bug #75022, Oracle Bug #20393654).
33
- Fix for unexpected ColumnSize for CHAR(63) and BLOB columns in GetSchemaTable (MySQL Bug #87868, Oracle Bug #26876582)
44
- Fix to correct unexpected ColummSize and IsLong values returned by MySqlDataReader.GetSchemaTable when using LongText and LongBlob data types. (MySQL Bug #87876, Oracle Bug #26876592)
5+
- Fix to correct the wrong NumericPrecision value returned by MySqlDataReader.GetSchemaTable when NumericScale is 0 for Decimal data types. (MySQL Bug #88058, Oracle Bug #26954812)
56

67

78
6.9.10

Source/MySql.Data/NativeDriver.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ public void Open()
197197
{
198198
baseStream = StreamCreator.GetStream(Settings);
199199
#if !RT
200-
if (Settings.IncludeSecurityAsserts)
201-
MySqlSecurityPermission.CreatePermissionSet(false).Assert();
200+
if (Settings.IncludeSecurityAsserts)
201+
MySqlSecurityPermission.CreatePermissionSet(false).Assert();
202202
#endif
203203
}
204204
catch (System.Security.SecurityException)
@@ -418,16 +418,16 @@ private bool ServerCheckValidation(object sender, X509Certificate certificate,
418418
}
419419

420420

421-
#endregion
421+
#endregion
422422

423423
#endif
424424

425-
#region Authentication
425+
#region Authentication
426426

427-
/// <summary>
428-
/// Return the appropriate set of connection flags for our
429-
/// server capabilities and our user requested options.
430-
/// </summary>
427+
/// <summary>
428+
/// Return the appropriate set of connection flags for our
429+
/// server capabilities and our user requested options.
430+
/// </summary>
431431
private void SetConnectionFlags(ClientFlags serverCaps)
432432
{
433433
// allow load data local infile
@@ -739,9 +739,9 @@ private void GetColumnData(MySqlField field)
739739

740740
if (type == MySqlDbType.Decimal || type == MySqlDbType.NewDecimal)
741741
{
742-
field.Precision = (byte)(field.ColumnLength - 2);
743-
if ((colFlags & ColumnFlags.UNSIGNED) != 0)
744-
field.Precision++;
742+
field.Precision = ((colFlags & ColumnFlags.UNSIGNED) != 0) ? (byte)(field.ColumnLength) : (byte)(--field.ColumnLength);
743+
if (field.Scale != 0)
744+
field.Precision--;
745745
}
746746

747747
field.SetTypeAndFlags(type, colFlags);

Tests/MySql.Data.Tests/GetSchemaTests.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,8 +690,8 @@ public void ColumnSize()
690690
[Fact]
691691
public void IsLongProperty()
692692
{
693-
st.execSQL("DROP TABLE IF EXISTS test");
694-
st.execSQL("CREATE TABLE test(`longtext` longtext, `longblob` longblob, `tinytext` tinytext, `tinyblob` tinyblob, `text` text, `blob` blob");
693+
st.execSQL("DROP TABLE IF EXISTS test;");
694+
st.execSQL("CREATE TABLE test(`longtext` longtext, `longblob` longblob, `tinytext` tinytext, `tinyblob` tinyblob, `text` text, `blob` blob);");
695695

696696
using (MySqlDataReader reader = st.execReader("SELECT * FROM test;"))
697697
{
@@ -711,5 +711,29 @@ public void IsLongProperty()
711711
Assert.True((bool)schemaTable.Rows[5]["IsLong"]);
712712
}
713713
}
714+
715+
/// <summary>
716+
/// Bug #26954812 Decimal with numericScale of 0 has wrong numericPrecision in GetSchemaTable.
717+
/// </summary>
718+
[Fact]
719+
public void NumericPrecisionProperty()
720+
{
721+
st.execSQL("DROP TABLE IF EXISTS test;");
722+
st.execSQL("CREATE TABLE test(decimal0 decimal(8,0), decimal1 decimal(8), decimal2 decimal(8,2), decimal3 decimal(8,1) UNSIGNED);");
723+
724+
using (MySqlDataReader reader = st.execReader("SELECT * FROM test;"))
725+
{
726+
DataTable schemaTable = reader.GetSchemaTable();
727+
728+
Assert.Equal(8, schemaTable.Rows[0]["NumericPrecision"]);
729+
Assert.Equal(0, schemaTable.Rows[0]["NumericScale"]);
730+
Assert.Equal(8, schemaTable.Rows[1]["NumericPrecision"]);
731+
Assert.Equal(0, schemaTable.Rows[1]["NumericScale"]);
732+
Assert.Equal(8, schemaTable.Rows[2]["NumericPrecision"]);
733+
Assert.Equal(2, schemaTable.Rows[2]["NumericScale"]);
734+
Assert.Equal(8, schemaTable.Rows[3]["NumericPrecision"]);
735+
Assert.Equal(1, schemaTable.Rows[3]["NumericScale"]);
736+
}
737+
}
714738
}
715739
}

Tests/MySql.Data.Tests/MySql.Data.RT.Tests.csproj

Lines changed: 0 additions & 146 deletions
This file was deleted.

0 commit comments

Comments
 (0)