Click or drag to resize

DbServer.BLOBGet Method (Typed)

X#
Get the contents of a BLOB, identified by its memo field number.

Namespace:  XSharp.VO.SDK
Assembly:  XSharp.VORDDClasses (in XSharp.VORDDClasses.dll) Version: 2.21
Syntax
 VIRTUAL METHOD BLOBGet(
	uField AS USUAL,
	nStart AS LONG,
	nCount AS LONG
) AS USUAL
Request Example View Source

Parameters

uField
Type: Usual
The name, number, or symbol representing the position of the field in the database file structure.
nStart
Type: Long
The starting position in the memo field of the BLOB data. If nStart is positive, the starting position is relative to the leftmost character in uFieldPos. If nStart is negative, it is relative to the rightmost character in uFieldPos. If nStart is omitted, it is assumed to be 1.
nCount
Type: Long
The number of bytes of data to retrieve, beginning at nStart. If nCount is larger than the amount of data stored, excess data is ignored. If omitted, DBServer:BLOBGet() retrieves to the end of the data.

Return Value

Type: Usual
The BLOB data retrieved from the memo field. The data type of the return value depends on the actual data stored. Use ValType() or UsualType() to determine the data type. If the indicated field is not a memo field, DBServer:BLOBGet() returns NIL.
Remarks
Tip Tip
nStart and nCount apply to string data only. They are ignored for any other data types.
DBServer:BLOBGet() is very similar to DBServer:FieldGet(). However, because string type variables cannot be larger than 64KB, DBServer:FieldGet() will raise a runtime error when attempting to retrieve memo fields of this magnitude or greater. DBServer:BLOBGet() will also raise an error if you attempt to retrieve a field greater than this magnitude; however, you can retrieve any subset of the BLOB data by using an nCount less than 64KB.
Tip Tip
BLOB data less than 64KB can be retrieved from a memo field using standard means (for example, referring to the field by name in an expression or using the DBServer:FieldGet() method).
Examples
This example imports information from a word processing document into a field, then uses DBServer:BLOBGet() to extract the first 25 characters of the field:
X#
 1FUNCTION GetFirst25()
 2LOCAL nPos
 3LOCAL cStr AS STRING
 4LOCAL oDBCust := Customer{}
 5oDBCust := Customer{}
 6// Field that contains word processor documentation
 7nPos := oDBCust:FieldPos("WP_DOC")
 8// Import a file (can be larger than 64 KB), then obtain the
 9// first 25 characters to show to the user
10IF oDBCust:BLOBImport(nPos, "c:\app\temp.doc")
11cStr := oDBCust:BLOBGet(nPos, 1, 25)
12ELSE
13cStr := "Error: could not import file!"
14ENDIF
15oDBCust:Close()
16RETURN cStr
See Also