MySQL Forums
Forum List  »  Connector/ODBC

Re: describe table from oracle to mysql shows wrong data type
Posted by: Bogdan Degtyariov
Date: February 08, 2023 01:38AM

This is looking more and more like a bug.
Indeed it is showing the octet length instead of the character length.
However, without the ODBC trace it is difficult to find which call exactly is failing.

I checked the SQLColumns() function and here is the output (sorry, it is a bit misaligned):

SQLColumns:
In: StatementHandle = 0x000000000472A340,
CatalogName = SQL_NULL_HANDLE, NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0,
TableName = "lecturas", NameLength3 = 8, ColumnName = SQL_NULL_HANDLE, NameLength4 = 0
Return: SQL_SUCCESS=0

Get Data All:
"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE", "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS", "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE", "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION", "IS_NULLABLE"
"", <Null>, "lecturas", "idSim", 4, "int", 10, 4, 0, 10, 1, "", "NULL", 4, 0, <Null>, 1, "YES"
"", <Null>, "lecturas", "idAlfresco", -9, "varchar", 65, 195, <Null>, <Null>, 1, "", "NULL", -9, 0, 195, 2, "YES"
"", <Null>, "lecturas", "nombre", -9, "varchar", 60, 180, <Null>, <Null>, 1, "", "NULL", -9, 0, 180, 3, "YES"
"", <Null>, "lecturas", "descripcion", -9, "varchar", 500, 1500, <Null>, <Null>, 1, "", "NULL", -9, 0, 1500, 4, "YES"
"", <Null>, "lecturas", "bloqueado", -8, "char", 1, 3, <Null>, <Null>, 1, "", "NULL", -8, 0, 3, 5, "YES"
5 rows fetched from 18 columns.


If you check the idAlfresco column you can see COLUMN_SIZE=64 (in characters), BUFFER_LENGTH=195 (in bytes), CHAR_OCTET_LENGHT=195 (in bytes) just as in the SQLColumns() specification by Microsoft:

https://learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlcolumns-function?view=sql-server-ver16

--
Best regards,
Bogdan Degtyariov

Options: ReplyQuote


Subject
Written By
Posted
Re: describe table from oracle to mysql shows wrong data type
February 08, 2023 01:38AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.