Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TFDQuery field data types


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Jun 27, 2017 7:47 AM Last Post By: Trevor Cooper
Trevor Cooper

Posts: 45
Registered: 10/7/10
TFDQuery field data types  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 23, 2017 3:09 AM
Hi,

I'm using FireDAC with SQLite databases. I run an TFDQuery to perform a join on two tables. One of these tables containing an integer primary key field. The TFDQuery has some TField definitions attached, and this integer primary key field is mapped to a TLargeIntField.

Most of the time this all works fine. But on certain databases it does not. On these databases we see the error message 'type mismatch ... expecting: LargeInt, actual: WideString. The databases all have identical schema, having been created from the same script. This field contains only integers, and can contain only integers.

How does a TFDQuery assign data types to fields in a results set? Why is it not always the data type in the table being queried? How can this be controlled?

The same problem in fact occurs for all numeric fields in this join whether integer or float.

Thanks for any advice.

Trevor Cooper
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDQuery field data types
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 23, 2017 10:40 PM   in response to: Trevor Cooper in response to: Trevor Cooper
Read paragraph starting with "For an expression in a SELECT list" at:
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_SQLite_with_FireDAC#Adjusting_FireDAC_Mapping

--
With best regards,
Dmitry
Trevor Cooper

Posts: 45
Registered: 10/7/10
Re: TFDQuery field data types  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 27, 2017 7:47 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Thanks Dmitry. It all works perfectly now. Fantastic.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02