Home | Previous Page | Next Page   Working with Smart Large Objects >

Working with Data Structures for Smart Large Objects

A smart large object can be huge. Therefore, instead of storing the content of a smart large object in a database table, Dynamic Server does the following:

Because a smart large object can be huge, an IBM Informix ODBC Driver application cannot receive a smart large object in a variable. Instead, the application sends or receives information about the smart large object in a data structure. The following table describes the data structures that IBM Informix ODBC Driver uses for smart large objects.

Data Structure Name Description
lofd Smart-large-object file descriptor Provides access to a smart large object. Uses a file descriptor to access smart-large-object data as if it were in an operating-system file.
loptr Smart-large-object pointer structure Provides security information and a pointer to a smart large object. This structure is the data that the database server stores in a database table for a smart large object. Therefore, SQL statements such as INSERT and SELECT accept a smart-large-object pointer structure as a value for a column or a parameter that has a data type of smart large object.
lospec Smart-large-object specification structure Specifies the storage characteristics for a smart large object.
lostat Smart-large-object status structure Stores status information for a smart large object. Normally you can fetch a user-defined data type (UDT) in either binary or character representation. However, it is not possible to convert a smart-large-object status structure to character representation. Therefore, you need to use SQL_C_BINARY as the Informix ODBC Driver C data type for lostat.

Important:
These data structures are opaque to IBM Informix ODBC Driver applications and their internal structures might change. Therefore, do not access the internal structures directly. Use the smart-large-object client functions to manipulate the data structures.

The application is responsible for allocating space for these smart-large-object data structures.

To work with a smart-large-object data structure
  1. Determine the size of the smart-large-object structure.
  2. Use either a fixed size array or a dynamically allocated buffer that is at least the size of the data structure.
  3. Free the array or buffer space when you are done using it.

The following code example illustrates these steps:

rc = SQLGetInfo(hdbc, SQL_INFX_LO_SPEC_LENGTH, &lospec_size, 
   sizeof(lospec_size), NULL); 
lospec_buffer = malloc(lospec_size); 

·
·
·
free(lospec_buffer);
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]