Bug #51887 Dont´t create dynamic fileld on query (char)
Submitted: 9 Mar 2010 19:51 Modified: 10 Mar 2010 7:26
Reporter: Roberto Valente Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.1 OS:Windows
Assigned to: CPU Architecture:Any
Tags: dynamic field query char

[9 Mar 2010 19:51] Roberto Valente
Description:
On MySQL ODBC 5.1.6 if a query is executed as above:

Select Column1, Column2, 'test field' as Column3
from mytesttable

the Column3 field is not created

If the query contais numeric fields the column is created
Select Column1, Column2, 1234 as Column3
from mytesttable

How to repeat:
Using Delphi with BDE + MySQL ODBC 5.1.6

Use a tQuery pointing to a MySQL Database
Use a TDataGrid 

Write some query like above:
Select Column1, Column2, 'test field' as Column3
from mytesttable
[10 Mar 2010 7:26] Tonci Grgin
Hi Roberto and thanks for your report.

Don't get me wrong, I just *love* Delphi and still use it but BDE is long EOL-ed piece of SW that has never functioned properly in my 20 years using it. Further more, BDE is closed source and all of the companies owning Delphi are not developing it since 90's.

So, please try using new stuff Delphi offers, like dbExpress (you can even create OODBC (open ODBC) bridge to make it work better), TADO ...

The problem is *not* repeatable using any other 3rd party ODBC client:
	Full Connect(Default)

	Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3

	Successfully connected to DSN '5-1-6-on-opensol'.

select testfwins.*, "test fld" AS DynFld from testfwins

SQLExecDirect:
	In:	hstmt = 0x001B6068, szSqlStr = "", cbSqlStr = -3
	Return:	SQL_SUCCESS=0

Get Data All:
"numVal", "DynFld"
0, "test fld"
1, "test fld"
2, "test fld"
...
95, "test fld"
96, "test fld"
97, "test fld"
98, "test fld"
99, "test fld"
10200 rows fetched from 2 columns.