Apointer to the DBPROCESS structure that providesthe connection for a particular front-end/server process.It contains all the information that DB-Library uses to manage communicationsand data between the front end and server. In dbconvert,the DBPROCESS is used only to supply any custom null values thatthe program may have specified using dbsetnull.If dbproc is NULL, dbconvert usesthe default values for null value data conversions.
A pointer to the data which is to be converted.If this pointer is NULL, dbconvert will placean appropriate null value in the destination variable. You can use dbdata toget the server data.
The length, in bytes, of the destination variable. destlen isignored for fixed-length datatypes. For a SYBCHAR, SYBBOUNDARY or SYBSENSITIVITYdestination, the value of destlen must be thetotal length of the destination buffer space.
If the conversion fails, dbconvert returnseither -1 or FAIL, depending on the cause of the failure. dbconvert returns-1 to indicate a NULL destination pointer or an illegal datatype. dbconvert returnsFAIL to indicate other types of failures.
This routine may fail for several reasons: the requested conversionwas not available; the conversion resulted in truncation, overflow,or loss of precision in the destination variable; or a syntax erroroccurred in converting a character string to some numeric type.
This routine allowsthe program to convert data from one representation to another.To determine whether a particular conversion is permitted, the programcan call dbwillconvert before attempting a conversion.
dbconvert can convert data storedin any of the server datatypes (although, of course, not all conversionsare legal). See Table 2-7 for a list of type constantsand corresponding program variable types.
In certain cases, it can be useful to convert adatatype to itself. For instance, a conversion of SYBCHAR to SYBCHARwith a destlen of -1 serves as a useful wayto append a null terminator to a string, as the example below illustrates.
OS/2 and NetWare programmers: When dbconvert isused to convert a money value to a character type, the resultingstring only contains two decimal places. On other platforms, money-to-characterconversions result in a string containing four decimal places.
See Types for a list of DB-Librarydatatypes and the corresponding Adaptive Server datatypes. For moreinformation on Adaptive Server datatypes, see the AdaptiveServer Enterprise Reference Manual.
3a8082e126