Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter EightData Functions (continued)

ODBCFetchBinary Function

Overview

The ODBCFetchBinary function returns the content of the specified column for the current row within an ODBC Results Object.

Syntax/Parameters

Syntax

handle = ODBCFetchBinary ( handle hResult, int index, [string descriptor] );

Parameters

hResult

A handle for an ODBC Results Object.

index

A zero-based int specifying the column index.

descriptor

An optional string specifying a Data Object descriptor. See Section 5.10 Data Object Functions for more information.

Return Value

Returns a handle to a Data Object or a NULL_HANDLE if the column contains no data or on failure. Use the GetLastError function to retrieve error information. The GetLastErrorMessage function may supply additional information.

On success, the last error will contain the total bytes added to the Data Object.

Remarks

While the ODBCFetchData function is designed to retrieve textual data from a database, this function is meant to capture binary ‘blob’ data. The SQL data type for the field must be BINARY, VARBINARY or LONGVARBINARY or an ERROR_PARAMETER will be returned. ODBCFetchBinary can retrieve data larger than 2MB and the data can also be binary, meaning it can be anything from an image to compressed text.

Once data has been retrieved and a Data Object created, the data can be saved as a file, inspected or edited as required using other API functions.

Unlike the ODBCFetchArray function, the ODBCFetchBinary function does not adjust the internal position of the ODBC Results Object. This function is meant to be used with the ODBCNextRow function.

Because an empty result can indicate an error or that the corresponding column position within the current row contained no data, use the GetLastError function to determine if an error occurred.

The descriptor is used by some API functions. If known, can be set as part of the fetch. It can also be set later using the DataObjectSetDescriptor function. For example, a descriptor from a GIF image retrieved from a database is “GIFDataObject”.

Use the CloseHandle function to destroy the resulting Data Object when processing is complete. If the function is used on an iterative basis (such as a loop), failure to close the handle may result in significant memory leakage. If the handle is defined locally, on return the orphan handles will automatically be closed (like any other handle).

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE