Working with large objects

This section describes functions that allow you to:
  • create large objects.
  • open, close, and delete large objects.
  • return and change the current position within a large object.
  • read from and write to large objects.
  • copy a large object.
Generally, you use the functions described in this section in the following order.
  1. You use lld_create() to create a large object. It returns a pointer to an lld_locator row that points to the large object.

    If the large object already exists, you can insert an lld_locator row into a table in the database to point to the object without calling lld_create().

  2. You can pass the lld_locator type to the lld_open() function to open the large object you created. This function returns an LLD_IO structure that you can pass to various Large Object Locator functions to manipulate data in the open object (see Step 3).

    You can also pass the lld_locator type to the lld_copy(), lld_from_client(), or lld_to_client() functions to copy the large object.

  3. After you open a large object, you can pass the LLD_IO structure to:
    lld_tell()
    Returns the current position within the large object.
    lld_seek()
    Changes the current position within the object.
    lld_read()
    Reads from large object.
    lld_write()
    Writes to the large object.
    lld_close()
    Closes an object. You should close a large object if the transaction in which you open it is aborted or committed.
Tip: To delete a large object, you can pass the lld_locator row to lld_delete() any time after you create it. For example, if the transaction in which you created the object is aborted and the object is not a smart large object, you should delete the object because the server's rollback on the transaction cannot delete an object outside the database.

The functions within this section are presented in alphabetical order, not in the order in which you might use them.