Determine whether a specific datatype conversion is available within DB-Library.
DBBOOL dbwillconvert(srctype, desttype) int srctype; int desttype;
The datatype of the data that is to be converted. This parameter can be any of the server datatypes, as listed in Table 2-30.
The datatype that the source data is to be converted into. This parameter can be any of the server datatypes, as listed in Table 2-30.
“TRUE” if the datatype conversion is supported, “FALSE” if the conversion is not supported.
This routine allows the program to determine whether dbconvert is capable of performing a specific datatype conversion. When dbconvert is asked to perform a conversion that it does not support, it calls a user-supplied error handler (if any), sets a global error number, and returns FAIL.
dbconvert can convert data stored in any of the server datatypes (although, of course, not all conversions are legal). Table 2-30 lists the Server and DB-Library datatypes.
Server type |
Program variable type |
---|---|
SYBCHAR |
DBCHAR |
SYBTEXT |
DBCHAR |
SYBBINARY |
DBBINARY |
SYBIMAGE |
DBBINARY |
SYBINT1 |
DBTINYINT |
SYBINT2 |
DBSMALLINT |
SYBINT4 |
DBINT |
SYBFLT8 |
DBFLT8 |
SYBREAL |
DBREAL |
SYBNUMERIC |
DBNUMERIC |
SYBDECIMAL |
DBDECIMAL |
SYBBIT |
DBBIT |
SYBMONEY |
DBMONEY |
SYBMONEY4 |
DBMONEY4 |
SYBDATETIME |
DBDATETIME |
SYBDATETIME4 |
DBDATETIME4 |
SYBBOUNDARY |
DBCHAR |
SYBSENSITIVITY |
DBCHAR |
Table 2-8 lists the datatype conversions that dbconvert and dbconvert_ps support. The source datatypes are listed down the leftmost column and the destination datatypes are listed along the top row of the table. (For brevity, the prefix “SYB” has been eliminated from each datatype.) If dbwillconvert returns “TRUE” (T), the conversion is supported; if it returns “FALSE” (F), the conversion is not supported.
See the reference pages for dbconvert or dbconvert_ps.