RSqlColumnReadStream Class Reference

class RSqlColumnReadStream : public RReadStream

The read stream interface.

The class is used for reading the content of a column containing either binary data or text data.

The class derives from RReadStream, which means that all RReadStream public member functions and predefined stream operators >> can be used to deal with column data.

If the blob or text data is over 2Mb in size then it is recommended that the RSqlBlobReadStream or TSqlBlob class is used instead. These classes provide a more RAM-efficient way of reading large amounts of blob or text data from a database.

The following two cases are typical:

CASE 1 - processing large binary column data.

RSqlDatabase db;
<open/create "db" object>;
RSqlStatement stmt;
<prepare "stmt" object>;
TInt rc = stmt.Next();
if(rc == KSqlAtRow)
	{
	RSqlColumnReadStream colStream;
	CleanupClosePushL(colStream);
	User::LeaveIfError(colStream.ColumnBinary(stmt, <column_number>));
	TInt size = stmt.ColumnSize(<column_number>);
	//read the column data in a buffer ("buf" variable).
	//(or the column data can be retrieved in a smaller portions)
	colStream.ReadL(buf, size);
	//Close the stream
	CleanupStack::PopAndDestroy(&colStream);
	}
else
	{
	...
	}

CASE 2 - processing large text column data.

RSqlDatabase db;
<open/create "db" object>;
RSqlStatement stmt;
<prepare "stmt" object>;
TInt rc = stmt.Next();
if(rc == KSqlAtRow)
	{
	RSqlColumnReadStream colStream;
	CleanupClosePushL(colStream);
	User::LeaveIfError(colStream.ColumnText(stmt, <column_number>));
	TInt size = stmt.ColumnSize(<column_number>);
	//read the column data in a buffer ("buf" variable).
	//(or the column data can be retrieved in a smaller portions)
	colStream.ReadL(buf, size);
	//Close the stream
	CleanupStack::PopAndDestroy(&colStream);
	}
else
	{
	...
	}

RSqlBlobReadStream

TSqlBlob

Inherits from

Member Functions Documentation

ColumnBinary(RSqlStatement &, TInt)

IMPORT_C TIntColumnBinary(RSqlStatement &aStmt,
TIntaColumnIndex
)

Parameters

RSqlStatement & aStmt
TInt aColumnIndex

ColumnBinaryL(RSqlStatement &, TInt)

IMPORT_C voidColumnBinaryL(RSqlStatement &aStmt,
TIntaColumnIndex
)

Parameters

RSqlStatement & aStmt
TInt aColumnIndex

ColumnText(RSqlStatement &, TInt)

IMPORT_C TIntColumnText(RSqlStatement &aStmt,
TIntaColumnIndex
)

Parameters

RSqlStatement & aStmt
TInt aColumnIndex

ColumnTextL(RSqlStatement &, TInt)

IMPORT_C voidColumnTextL(RSqlStatement &aStmt,
TIntaColumnIndex
)

Parameters

RSqlStatement & aStmt
TInt aColumnIndex