MySQL Enterprise 5.1.30
MySQL ODBC Driver 5.1.5
All the String data are stored in UTF8.
We specify the charset=utf8 in the odbc configuration :
Code: Select all
remotedbname=my56088,Driver={MySQL ODBC 5.1 Driver};Server=localhost;Port=3306;Database=SAC56088;Charset=UTF8
When we try to read data stored in utf8 from a CHAR or VARCHAR column => no problem with SQLDescribeCol, SQLBindCol and SQLFetch in sqlodb32.dll => TD 5.1 convert the text to UTF16
But when we try to insert or update data or to bind a variable in the where clause, I think that TD5.1 sends data in LATIN1 to MySQL (LATIN1 is the default enconding on my computer)... And when we try to convert to UTF8 before sending the data, it replaces all the characters with '?'... So, For me, it's a bug in sqlodb32.dll when calling the functions SQLDescribeParam and SQLBindParameter
For example, when we put the string 'éè' in a variable called gsTest, the following query give us the following error message :
Query : "update errors_list set erl_val_d = :gsTest where erl_code = '00001'"
Error message : "MySQL:1366[MySQL][ODBC 5.1 Driver][mysqld-5.1.30-enterprise-gpl-pro-log]Incorrect string value: '\xE9\xE8' for column 'ERL_VAL_D' at row 1"
But when we execute the following query, there's no problem : "update errors_list set erl_val_d = '" || gsTest || "' where erl_code = '00001'"
So, please, when we specify the encoding in the ODBC configuration, use it to send the data in this encoding when there's binding to do.
TEXT :
With the data types TINYTEXT, TEXT and MEDIUMTEXT => no problem to read the data stored with charset utf8 => TD 5.1 convert the text to UTF16 with no problem in a SELECT
But we must convert UTF16 to UTF8 when we do an insert or an update (and so, we can't use SalTblDoInserts and SalTblDoUpdates !) :
Code: Select all
Call SalStrToMultiByte( gsTest, gsTest, ENC_UTF8)
Call SalSetBufferLength(gsTest, SalGetBufferLength( gsTest) + 1)
Or "the must" would be a property associated to a column component (in a table or in a grid) to indicate the charset used in the database and that property would be used by TD 5.1 to convert the encoding.
And the data type LONGTEXT can't be use because the data are truncated and can't be read properly.
This refers to my original post here :
https://support.guptatechnologies.com/s ... =18&t=2493
Olvin