dbsafestr

Description

Double the quotes in a character string.

Syntax

RETCODE dbsafestr(dbproc, src, srclen, dest, destlen, 
                quotetype)
 
DBPROCESS     *dbproc;
char                    *src;
DBINT                 srclen;
char                    *dest;
DBINT           destlen;
int                  quotetype;

Parameters

dbproc

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.

src

A pointer to the original string.

srclen

The length of src, in bytes. If srclen is -1, src is assumed to be null-terminated.

dest

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.

destlen

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.

quotetype

The type of quotes to double. Table 2-24 lists the possible values for quotetype.

Table 2-24: 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

Returns

SUCCEED or FAIL.

dbsafestr fails if the resulting string is too large for dest, or if an invalid quotetype is specified.

Usage

See also

dbcmd, dbfcmd