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

GetSchema("Columns") fails for LONGTEXT column #802

Closed
Rtaglia opened this issue Apr 18, 2020 · 3 comments
Closed

GetSchema("Columns") fails for LONGTEXT column #802

Rtaglia opened this issue Apr 18, 2020 · 3 comments
Labels

Comments

@Rtaglia
Copy link

Rtaglia commented Apr 18, 2020

Hi,

Trying to read the metadata of mysql, the function GetSchema() failed because of CHARACTER_MAXIMUM_LENGTH.

DataTable columnsTable = connection.GetSchema("Columns", tableRestrictions);

I replace it by

public DataTable getMySqlColumns(string schemaName, string tableName)
        {
            DataTable columnTable = new DataTable();
            MySqlDataAdapter adapter = new MySqlDataAdapter();
            adapter.SelectCommand = (MySqlCommand)connection.CreateCommand();
            adapter.SelectCommand.CommandText = $@"
SELECT 
	COLUMN_NAME, DATA_TYPE, IS_NULLABLE, CHARACTER_MAXIMUM_LENGTH 
FROM 
	information_schema.columns
WHERE
	TABLE_SCHEMA='{schemaName}' AND TABLE_NAME='{tableName}'
ORDER BY
    ORDINAL_POSITION ASC;
";
            adapter.Fill(columnTable);
            return columnTable;
        }
@bgrainger
Copy link
Member

Trying to read the metadata of mysql, the function GetSchema() failed because of CHARACTER_MAXIMUM_LENGTH.

Can you provide more details on what specifically failed? Was there an exception message and call stack?

What MySQL Server software and version are you using?

@Rtaglia
Copy link
Author

Rtaglia commented Apr 21, 2020 via email

@bgrainger bgrainger changed the title GetSchema() failed GetSchema("Columns") fails for LONGTEXT column Apr 22, 2020
@bgrainger bgrainger added the bug label Apr 22, 2020
bgrainger added a commit that referenced this issue Apr 25, 2020
This brings MySqlConnector in line with Connector/NET's schema for this DataTable.
@bgrainger
Copy link
Member

Fixed in 0.64.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants