Other TEXT/IMAGE APIs

The syb_ct_data_info() API fetches or updates the CS_IODESC structure for the image/text data item you want to update.

For example:

$stat = syb_ct_data_info($action, $column, $attr)
  • $action – CS_SET or CS_GET.

  • $column – the column number of the active select statement (ignored for a CS_SET operation).

  • $attr – a hash reference that sets the values in the structure.

You must fist call syb_ct_data_info() with CS_GET to fetch the CS_IODESC structure for the image/text data item you want to update. Then update the value of the total_txtlen structure element to the length (in bytes) of the image/text data you are going to insert. Set the log_on_update to true to enable full logging of the operation.

Calling syb_ct_data_info() with a CS_GET fails if the image/text data for which the CS_IODESC is being fetched is NULL. Use standard SQL to update the NULL value to non-NULL value (for example, an empty string) before you retrieve the CS_IODESC entry.

In this example, consider updating the data in the image column where the id column is 1:

  1. Find the CS_IODESC data for the data:
    $sth = $dbh->prepare("select img from imgtable where id = 1"); 
    		$sth->execute; 
    	while($sth->fetch) {    # don't care about the data! 
    		$sth->syb_ct_data_info('CS_GET', 1); 
    	}
  2. Update with the CS_IODESC values:
    $sth->syb_ct_prepare_send();
  3. Set the size of the new data item to be inserted and make the operation unlogged:
    $sth->syb_ct_data_info('CS_SET', 1, {total_txtlen 
    => length($image), log_on_update => 0});
  4. To transfer the data in a single chunk:
    $sth->syb_ct_send_data($image, length($image));
  5. To commit the operation:
    $sth->syb_ct_finish_send();