dbstrcpy

Copies a portion of the command buffer in the DBPROCESS structure to a specified memory location.

Syntax

RETCODE dbstrcpy (
PDBPROCESS
dbproc,
INT
start,
INT
numbytes,
LPSTR
dest );

where

dbproc
Is the DBPROCESS structure that is the handle for a particular workstation/ SQL Server process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.
start
Is the character position in the command buffer to start copying from. The first character position is 0. If start is greater than the length of the command buffer, a null terminator is inserted at dest[0].
numbytes
Is the number of characters to copy.
numbytes setting Result
< 0 dbstrcpy copies the entire command buffer. It is legal to copy 0 bytes.
= 0 A null terminator is inserted at dest[0].
> 0 dbstrcpy copies the number of bytes available and returns SUCCEED.

dest
Is a pointer to the memory location to copy the source string into.

Returns

SUCCEED or FAIL. FAIL is returned if start is a negative number.

Remarks

The copy is null-terminated. The dbstrcpy function assumes that the destination string is large enough to receive the source string. If not, unexpected errors may occur.

Internally, the command buffer is a linked list of non-terminated text strings. Parts of the command buffer can be located and copied using the dbgetchar, dbstrcpy, and dbstrlen functions.

See Also

dbcmd, dbfcmd, dbfreebuf, dbgetchar, dbstrlen