Developing Portable Applications : 3. Application Considerations : Data Type Limits : Portability with OpenSQL String Type Casts
 
Share this page                  
Portability with OpenSQL String Type Casts
OpenSQL supports several string type cast functions. These include CHAR and VARCHAR for non-Unicode string types, and NCHAR and NVARCHAR for gateways and DBMSs that support Unicode types. String type casts can be used to convert one string type into another, or non-string types such as numerics into strings.
OpenSQL string type casts accommodate the data to be cast and an optional result length specifier. For optimum application portability, you should always use an explicit length specifier in string type casts to avoid being locked into a particular database.
Length specifier behavior differs between DBMSs. In Oracle, type cast strings must contain a length specifier because no default length exists and an error is generated if the length is omitted. Other databases such as MS SQL Server use a default length if the length is omitted. However, Enterprise Access does not rely on the DBMS default and instead defaults the length automatically. EA uses a default of 30 (same as the MS SQL Server default). You can change this default using the typecast_strlen parameter. For more information on typecast_strlen, see the Administrator Guide. For information on changing the typecast_strlen default, see the Configuration-by-Forms (CBF) and Configuration Manager (VCBF) help.