Double the quotes in a character string.
RETCODE dbsafestr(dbproc, src, srclen, dest, destlen, quotetype) DBPROCESS *dbproc; char *src; DBINT srclen; char *dest; DBINT destlen; int quotetype;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library uses to manage communications and data between the front end and server.
A pointer to the original string.
The length of src, in bytes. If srclen is -1, src is assumed to be null-terminated.
A pointer to a programmer-supplied buffer to contain the resulting string. dest must be large enough for the resulting string plus a null terminator.
The length of the programmer-supplied buffer to contain the resulting string. If destlen is -1, dest is assumed to be large enough to hold the resulting string.
The type of quotes to double. Table 2-24 lists the possible values for quotetype.
Value of quotetype |
dbsafestr |
---|---|
DBSINGLE |
Doubles all single quotes (’) in src |
DBDOUBLE |
Doubles all double quotes (") in src |
DBBOTH |
Doubles all single and double quotes in src |
SUCCEED or FAIL.
dbsafestr fails if the resulting string is too large for dest, or if an invalid quotetype is specified.
dbsafestr doubles the single and/or double quotes found in a character string. This is useful when specifying literal quotes within a character string.