Bug #87876 Unexpected ColumnSize, IsLong in GetSchemaTable for LONGTEXT and LONGBLOB column
Submitted: 26 Sep 2017 16:22 Modified: 8 Jan 2018 21:04
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / NET Severity:S3 (Non-critical)
Version:6.9.9 OS:Microsoft Windows (10.0.15063 x64)
Assigned to: CPU Architecture:Any

[26 Sep 2017 16:22] Bradley Grainger
Description:
The "ColumnSize" value returned by MySqlDataReader.GetSchemaTable is zero for LONGTEXT and LONGBLOB data types. Additionally, the "IsLong" value is false.

I would expect Int32.MaxValue for "ColumnSize" and True for "IsLong".

How to repeat:
Execute the following SQL:
	create schema schema_table collate utf8_bin;
	create table schema_table.datatypes(
		`longtext` longtext,
		`longblob` longblob
	);
	insert into schema_table.datatypes values('test', _binary'test');");

Then run this C# code:
	using (var connection = new MySqlConnection("... connection string ..."))
	{
		connection.Open();
		using (var cmd = connection.CreateCommand())
		{
			cmd.CommandText = "SELECT * FROM schema_table.datatypes;";
			using (var reader = cmd.ExecuteReader())
			{
				var schemaTable = reader.GetSchemaTable();
				Console.WriteLine(schemaTable.Rows[0]["ColumnSize"]); // prints 0, expected int.MaxValue (or uint.MaxValue-1)
				Console.WriteLine(schemaTable.Rows[0]["IsLong"]); // prints False, expected True
				Console.WriteLine(schemaTable.Rows[1]["ColumnSize"]); // prints 0, expected int.MaxValue (or uint.MaxValue-1)
				Console.WriteLine(schemaTable.Rows[1]["IsLong"]); // prints False, expected True
			}
		}
	}
[27 Sep 2017 5:31] Chiranjeevi Battula
Hello Bradley Grainger,

Thank you for the bug report and test case.
Verified this behavior on Visual Studio 2013 (C#.Net) and Connector/NET 6.9.9 version.

Thanks,
Chiranjeevi.
[27 Sep 2017 5:32] Chiranjeevi Battula
Screenshot

Attachment: Bug_87876.JPG (image/jpeg, text), 162.83 KiB.

[8 Jan 2018 21:04] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Connector/NET 6.9.11 release, and here's the changelog entry:

The data table returned by the MySqlDataReader.GetSchemaTable method had
an inaccurate value of zero assigned to the ColumnSize field for LONGTEXT
and LONGBLOB data types, and also indicated that the IsLong field value
was false when it should have returned true.

Thank you for the bug report.