Type mismatch for databasetype Real

Type mismatch for databasetype Real

Postby rlssv » Wed 14 Dec 2016 09:07

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
rlssv
 
Posts: 2
Joined: Tue 13 Dec 2016 10:17

Re: Type mismatch for databasetype Real

Postby azyk » Thu 15 Dec 2016 09:36

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.
azyk
Devart Team
 
Posts: 748
Joined: Fri 11 Apr 2014 11:47

Re: Type mismatch for databasetype Real

Postby rlssv » Thu 15 Dec 2016 10:38

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
rlssv
 
Posts: 2
Joined: Tue 13 Dec 2016 10:17

Re: Type mismatch for databasetype Real

Postby azyk » Mon 19 Dec 2016 08:55

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/RADStudio/Berlin//en/DbExpress_Data_Type_Mapping_for_Supported_Databases
azyk
Devart Team
 
Posts: 748
Joined: Fri 11 Apr 2014 11:47


Return to dbExpress driver for SQL Server