Page 1 of 1

Type mismatch for databasetype Real

Posted: Wed 14 Dec 2016 09:07
by rlssv
Monday I downloaded dbExpress Driver for SQL Server (trial) and installed it into DelphiXE7.
We are in the process of upgrading some projects from Delphi2010 to XE7.
It seems that dbexpress was the last missing piece - and the projects now does compile.

However I am getting type mismatch for databasefields of type "real" when running the project.
The persistent fields in the projects are TFloatFields, but it seems that the current driver wants the fields to be TSingleFields)

(cldsHuse: Type mismatch for field 'H_HUHPRIS', expecting: Float actual: Single )

I don' quite understand this, because readme.html states:

real ftFloat TFloatField

Is this an error in trial-version ? Will it be the same when buying the product. ?
Can I do something to fix it. On your website you're saying:

dbExpress drivers have additional options to control data type mapping, which allow to customize correspondence between database and Delphi data types.

But how do I do that ?
René / SSV

Re: Type mismatch for databasetype Real

Posted: Thu 15 Dec 2016 09:36
by azyk
Thank you for the comment about Readme.html. Our dbExpress SQL Server driver maps real->ftFloat for the version before RAD Studio 2007, for RAD Studio 2007 and higher real->ftSingle - this behavior is correct. We will fix the description in Readme.html soon.

To avoid the specified error, change the TFloatField type into TSingleField for persistent fields with the SQL Server real type.

Re: Type mismatch for databasetype Real

Posted: Thu 15 Dec 2016 10:38
by rlssv
Thank you for your answer. It was not quite what I hoped, but no problem. I will change my persistent fields.
I just would not do that at first when documentation contradicted.
When you update the documentation, be sure to correct for database type float too, it should be ftFMTBcd and not ftFloat (as stated) according to my test. (I tried to change the fields in my database to float in order to hit the type of my persistent fields).
René/SSV

Re: Type mismatch for databasetype Real

Posted: Mon 19 Dec 2016 08:55
by azyk
According to dbExpress specification the SQL Server float type should be mapped to TDBXDataTypes.DoubleType, i.e. to ftFloat, but not to ftFMTBcd. More details about this in Embarcadero documentation:
http://docwiki.embarcadero.com/RADStudi ... _Databases