dbreadtext

Reads part of a text or image value from SQL Server.

Syntax

DBINT dbreadtext (
PDBPROCESS
dbproc,
LPVOID
buf,
DBINT
bufsize );

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.
buf
Is a pointer to a caller-allocated buffer that will contain the chunk of text or image data.
bufsize
Is the size, in bytes, of the caller's buffer. This value must be smaller than 64K.

Returns

Returns Description
>0 The number of bytes put into the caller's buffer.
0 The end of a row.
-1 An error.
NO_MORE_ROWS All rows read.

Remarks

Use dbreadtext instead of dbnextrow to read SQLTEXT and SQLIMAGE values.

This function takes a large SQLTEXT or SQLIMAGE value from SQL Server and breaks it into several smaller chunks. A buffer cannot be larger than 64K although the text or image value can be much larger.

To read successive chunks of the same SQLTEXT or SQLIMAGE value, call dbreadtext until it returns 0 (end of row).

The dbreadtext function processes the results of Transact-SQL queries if those queries return only one column containing either text or image data. The Transact-SQL READTEXT statement returns results of this type.

See Also

dbmoretext, dbnextrow, dbwritetext; Bulk-Copy Functions