Database Engines:odbc

How to adapt the resulting Xbase++ data type to my needs? Professional

Some SQL data types do not match perfectly with Xbase++ data types. The data type mapping may even lead to loss of data. On the other hand, not all data stored in SQL tables may be relevant for Xbase++ applications. A good example for this is the data type TIMESTAMP which contains both, date and time information. By default, this data type is mapped to the DDL type "T" and to the DML type "C". However, if the time information stored in the SQL table column is not used in the Xbase++ application, it is more convenient to map TIMESTAMP to "D" (Date). The default data type mapping can be changed on a per column basis after the table is opened. For example:

#include "" 
#include "" 

USE Customer 

// assume column #3 is of type TIMESTAMP, mapped to "T", 
// In Xbase++ we want to use this column as a Date type 

The third column is now used as the Xbase++ data type "D" (date). Note, however, that not every type can be remapped to any other data type. If the remapping was not successful, the returning data type for this column will be undefined and its value NIL.

A general data type mapping problem occurs when using SQL types like DATETIME, TIMESTAMP etc. They are mapped to XPP_TIMESTAMP by default, but sometimes only the date-part is of interest. It is possible to map all fields of those types to the data type XPP_DATE by calling:

oSession:setProperty(ODBCSSN_TIMESTAMP_AS_DATE, .T.) 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.