Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: How to map TBooleanField to LOGICAL data type with dBASE ODBC driver?


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


Permlink Replies: 3 - Last Post: Jul 24, 2017 2:26 AM Last Post By: Dmitry Arefiev
Diego Rodrigues...

Posts: 11
Registered: 8/19/17
How to map TBooleanField to LOGICAL data type with dBASE ODBC driver?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 19, 2017 5:01 PM
When using dBASE ODBC driver, having a TBooleanField in TFDTable, FireDAC generates SQL command like this when calling CreateTable:
CREATE TABLE MyTable (
  MyLogicalField BOOLEAN
)

instead of:
CREATE TABLE MyTable (
  MyLogicalField LOGICAL
)

What can I do to get correct result? I cannot read FireDAC source, have only older version with source by hand. Could you point me how this command is generated and optionally how to map TBooleanField to LOGICAL data type?

dBASE data type LOGICAL is mapped to SQL_BIT, so the point is why that data type is not used when generating CREATE command.
[dBASE data types|https://docs.microsoft.com/en-us/sql/odbc/microsoft/dbase-data-types]

Is e.g. SQLGetTypeInfo ODBC function used, or the command is generated purely by FireDAC?
Diego Rodrigues...

Posts: 11
Registered: 8/19/17
Re: How to map TBooleanField to LOGICAL data type with dBASE ODBC driver?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 19, 2017 8:54 PM   in response to: Diego Rodrigues... in response to: Diego Rodrigues...
It's actually related to any "unsupported" ODBC driver, maybe to all DBMSs. Not only ancient dBASE. I believe that the CREATE command might be generated by the TFDPhysCommandGenerator class when CreateTable method is called. I'm just wondering how FireDAC gets data types for used fields. Is that from driver, or is that hardcoded (e.g. always to be BOOLEAN for TBooleanField) for "unsupported" ODBC drivers?
Diego Rodrigues...

Posts: 11
Registered: 8/19/17
Re: How to map TBooleanField to LOGICAL data type with dBASE ODBC driver?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 21, 2017 4:10 PM   in response to: Diego Rodrigues... in response to: Diego Rodrigues...
Guys, it will be something easy, I just don't have source code by hand. I believe there's a method like GenerateCreateTable (or similar) in TFDPhysCommandGenerator class that generates that script. I just need to find the way how it gets the column data types for ODBC drivers. If it's from driver or hardcoded by FireDAC.

Thank you :) !
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: How to map TBooleanField to LOGICAL data type with dBASE ODBC driver?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 24, 2017 2:26 AM   in response to: Diego Rodrigues... in response to: Diego Rodrigues...
FireDAC uses hard coded data type names according to SQL 2003 standard. This is done inside of TFDPhysCommandGenerator.GetColumnType.

--
With best regards,
Dmitry
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02