When I want to known the table structure I use information_schema.COLUMNS and
information_schema.TABLES in order to get the right and original datatypes.
This, of course, involves 2 steps:
1) query for fieldnames+fieldtypes
2) my actual query
Retrieving fieldsnames is OK but fieldtypes will always return types C, L, D, M, N and U.
I need to known which datatype in MySQL is used. In MYSQL.CH I see:
Code: Select all
#define MYSQL_TYPE_DECIMAL 0
#define MYSQL_TYPE_TIMESTAMP 7
...
#define MYSQL_TYPE_VAR_STRING 253
Code: Select all
cQ := "SELECT FIELD1 AS 'F1', "
cQ += "FIELD2 AS 'F2', "
cQ += "FIELD3 AS 'F3', "
cQ += "CONCAT( ROUND(SUM(LENGTH(FIELD1) + LENGTH(FIELD2) + LENGTH(FIELD3) / 1024 )), 'kB') AS 'SIZE' "
cQ += "FROM SOME_TABLE "
cQ += "WHERE 1 "
cQ := dbo:Query( cQ )
FOR j = 1 TO cQ:FCOUNT()
? J, cQ:FieldName(J), cQ:FieldTYPE(J) // DBF FIELDTYPE BLOB-->M TIMESTAMP-->U
// # ok DBF-FIELDTYPE
NEXT
Code: Select all
METHOD FieldType( nNum ) CLASS TMySQLRow
Rathi or Dragan or someone else does knwon how to get it?
Thanks, Serge