[fpc-devel] TMySQLConnection.LoadField field length
Bram Kuijvenhoven
kuifwaremailinglists at xs4all.nl
Fri May 13 15:38:16 CEST 2005
Hi,
The TMySQLConnection.LoadField method from sqldb/mysql does not fetch the field lengths properly. It uses mysql_fetch_field_direct, but this only returns data about an entire column in your result set. It does not give valid field lengths for fields of variable length. Is should use mysql_fetch_lengths I think (http://dev.mysql.com/doc/mysql/en/mysql-fetch-lengths.html).
Example query causing an access violation:
SELECT FORMAT(myDouble,2) FROM myTable
Actually, the field length reported by mysql_fetch_field_drect is 5592424 in my program.
The MySQLDataType method also uses length information from mysql_fetch_field_direct and pumps this into TFieldDef.Create.
I'm not sure about the meaning of the ASize parameter for TFieldDef.Create. What if a string can have arbitrary length?
I need answers to these questions if I want to make a (good) patch I think.
Greetings,
Bram
More information about the fpc-devel
mailing list