[fpc-devel] MySQL components in SQLDB

Michael Van Canneyt michael at freepascal.org
Sat Apr 8 14:52:55 CEST 2006



On Fri, 7 Apr 2006, Doug Nettleton wrote:

> Hi All,
> 
> I'm new here - variously playing with Lazarus and mseide&msegui.  I posted the
> following at public.mseide-msegui.talk:
> 
> > bug in tmsesqlquery, certain field types don't appear in the FieldDefs
> > list.
> > Initailly, I had a file with four character fields and four decimal(7,3)
> > fields.  "select * from mytable" as the SQL and setting active to True.
> > FieldDefs property only contains the 4 character (TString) fields.
> > Adding a
> > date field to the table and setting active flag to false then back to
> > true,
> > FieldDefs property contains 5 fields - the 4 character fields and the
> > date field.
> 
> and got the following from Martin...
> 
> This problem lies probably in the underlying TSQLQuery. Could you discuss it
> with Jost van der Sluis at FPC-Devel mailing list?
> 
> I've looked in the 2.0.2 source, 2.0.3 snapshot source, 2.1.x snapshot source
> and don't see an obvious reason why character and date fields would work
> differently from decimal although I noticed comments somewhere last week about
> the "new" decimal field in MySQL version 5.0.

Probably that is used.

> 
> The function MySQLDataType, in fcl/db/sqldb/mysql/mysqlconn.inc refers to
> FIELD_TYPE_DECIMAL in one of the case clauses.  Perhaps version 5.0 changed
> this value?

No. It did introduce a new type "MYSQL_TYPE_NEWDECIMAL"

I added support for this new fieldtype.

> On another matter, are there any plans to implement a datasource property on
> TMySQLQuery for resolving parameters?  This is a very powerful facility.  I
> think I know a workaround, but I'd prefer not to use it.

It is implemented for SQLDB since last week, but for MySQL it doesn't work yet:
the parameters are ignored. (because MySQL has no native parameter support) 
It does work for firebird and  postgres. It should be easy to add, however, 
to mysql. All that needs to be done is to replace the parameter names with the 
actual current values.

Michael.



More information about the fpc-devel mailing list