Defines substitution values for use when binding null values.
RETCODE dbsetnull (
PDBPROCESS dbproc,
INT bindtype,
INT bindlen,
LPCBYTE bindval );
SUCCEED or FAIL. The dbsetnull function fails if you give it a null bindval or if the length is smaller than 1 when CHARBIND and BINARYBIND types are used.
The dbbind and dbaltbind functions are used to bind returned SQL Server column values to your program variables. Because a null value can be returned, there is a mechanism for defining what values should be substituted for the null value when doing automatic copying of column data to program variables. Associated with each DBPROCESS is a list of substitute values for each of the binding types. The default substitution values are as follows:
Binding type | Default substitution value |
---|---|
TINYBIND | 0 |
SMALLBIND | 0 |
INTBIND | 0 |
BITBIND | 0 |
CHARBIND | Empty string (padded with blanks) |
STRINGBIND | Empty string (padded with blanks, null-terminated) |
NTBSTRINGBIND | Empty string (null-terminated) |
VARYCHARBIND | Empty string |
BINARYBIND | Empty array (padded with zeros) |
VARYBINBIND | Empty array |
DATETIMEBIND | 8 bytes of zeros |
MONEYBIND | $0.00 |
FLT8BIND | 0.0 |
FLT4BIND | 0.0 |
SMALLMONEYBIND | $0.00 |
SMALLDATETIBIND | 4 bytes of zeros |
DECIMALBIND | 0.0 |
NUMERICBIND | 0.0 |
SRCDECIMALBIND | 0.0 |
SRCNUMERICBIND | 0.0 |
Call dbsetnull to supply your own null substitution values. Whenever you call dbsetnull to change a particular null substitution value, the new value remains in force for that DBPROCESS until you change it with another call to dbsetnull.
The dbconvert function also uses the current null substitution values when it needs to set a destination variable to null.
dbaltbind | dbconvert |
dbbind | DB-Library for C Data Types |