Re: Empty string returned when retrieving text field using ODBC (MFC)

Guillermo Miranda Álamo <[email protected]> Wed, 23 Jun 2010 17:44:24 +0200
Newsgroups gmane.comp.db.mysql.odbc
Message-ID <[email protected]>
On 23/06/2010 17:23, Lawrin Novitsky wrote:
> Hi,
>
> Did you try "handle binary as char" option?
>
> What's a charset of your field? do you set charset in connection
> string/dsn?
>
> And yes, odbc log would be useful. But the better place for it probably
> a bug report would be, not this maillist.
>
> Regards,
>
> Lawrin Novitsky

Hi Lawrin,

I just tried that but it didn't work. The field's charset is utf8_bin. I 
wasn't manually specifying the charset in the connection string because 
it did work with VARCHAR, I did so, but I keep getting that empty string.

This is the line where I connect to the DB:
db.OpenEx("DSN=mysource;CHARSET=latin1");

Hope it's OK.

I've attached the last lines of the ODBC log. SQL_text_r.LOG is what I 
get when the field is a TEXT field, and SQL_varchar_r.LOG when it's a 
VARCHAR field. All lines of the log file before what's in the attached 
files have been removed as there was no difference between those file 
(besides memory addresses).

Thanks
Guillermo.


-- 
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe:    http://lists.mysql.com/[email protected]
SQL_text_r.LOG (text/plain, 1.1 KB)
dll_spell_Debug a74-a7c	ENTER SQLGetData 
		HSTMT               0x00805B68
		UWORD                        2 
		SWORD                        1 <SQL_C_CHAR>
		PTR                 0x023E0468 
		SQLLEN                     2
		SQLLEN *            0x0012E18C

dll_spell_Debug a74-a7c	EXIT  SQLGetData  with return code 0 (SQL_SUCCESS)
		HSTMT               0x00805B68
		UWORD                        2 
		SWORD                        1 <SQL_C_CHAR>
		PTR                 0x023E0468 [       2] "\ 0\ff"
		SQLLEN                     2
		SQLLEN *            0x0012E18C (20)

dll_spell_Debug a74-a7c	ENTER SQLGetData 
		HSTMT               0x00805B68
		UWORD                        2 
		SWORD                        1 <SQL_C_CHAR>
		PTR                 0x023E0469 
		SQLLEN                    20
		SQLLEN *            0x0012E17C

dll_spell_Debug a74-a7c	EXIT  SQLGetData  with return code 0 (SQL_SUCCESS)
		HSTMT               0x00805B68
		UWORD                        2 
		SWORD                        1 <SQL_C_CHAR>
		PTR                 0x023E0469 [      20] "436F6D6F2065737461\ 0\ff"
		SQLLEN                    20
		SQLLEN *            0x0012E17C (20)
SQL_varchar_r.LOG (text/plain, 569 B)
dll_spell_Debug a74-a7c	ENTER SQLGetData 
		HSTMT               0x00805600
		UWORD                        2 
		SWORD                        1 <SQL_C_CHAR>
		PTR                 0x0063BF98 
		SQLLEN                    65
		SQLLEN *            0x0012E18C

dll_spell_Debug a74-a7c	EXIT  SQLGetData  with return code 0 (SQL_SUCCESS)
		HSTMT               0x00805600
		UWORD                        2 
		SWORD                        1 <SQL_C_CHAR>
		PTR                 0x0063BF98 [      10] "Como estas"
		SQLLEN                    65
		SQLLEN *            0x0012E18C (10)