Pass a NULL connection (Server)

Many functions in the smart-large-object interface take a connection descriptor as a parameter. However, many of the functions also accept a NULL-valued pointer as a connection descriptor.

Use of a NULL-valued connection descriptor has the following performance impact:
  • The smart-large-object functions do not need to check the validity of a connection descriptor.
  • The calling code is not required to open and close a connection.
To improve performance, you can pass a NULL-valued pointer as a connection descriptor to any of the following functions of the smart-large-object interface:
  • mi_lo_alter()
  • mi_lo_close()
  • mi_lo_colinfo_by_ids()
  • mi_lo_colinfo_by_name()
  • mi_lo_copy()
  • mi_lo_create()
  • mi_lo_decrefcount()
  • mi_lo_delete_immediate()
  • mi_lo_expand()
  • mi_lo_filename()
  • mi_lo_from_buffer()
  • mi_lo_from_file()
  • mi_lo_from_file_by_lofd()
  • mi_lo_increfcount()
  • mi_lo_invalidate()
  • mi_lo_lock()
  • mi_lo_lolist_create()
  • mi_lo_open()
  • mi_lo_spec_init()
  • mi_lo_stat()
  • mi_lo_stat_free()
  • mi_lo_tell()
  • mi_lo_to_buffer()
  • mi_lo_to_file()
  • mi_lo_truncate()
  • mi_lo_unlock()
  • mi_lo_utimes()
  • mi_lo_validate()
  • mi_lo_write()
  • mi_lo_writewithseek()
  • mi_lo_ptr_cmp()
  • mi_lo_read()
  • mi_lo_readwithseek()
  • mi_lo_release()
  • mi_lo_seek()
  • mi_lo_spec_free()
The following code fragment passes a valid connection descriptor to the mi_lo_alter() function:
conn = mi_open(NULL, NULL, NULL);
if ( mi_lo_alter(conn, LO_ptr, LO_spec) == MI_ERROR )

/* Code execution does not reach here when a database server
 * exception occurs.
 */
   return MI_ERROR;
mi_close(conn);
When you specify a NULL-valued pointer as a connection descriptor, you can omit the calls to mi_open() and mi_close(), as the following code fragment shows:
if ( mi_lo_alter(NULL, LO_ptr, LO_spec) == MI_ERROR )

/* Code execution does not reach here when a database server
 * exception occurs.
 */
   return MI_ERROR;