Open Client supports the partial update of text and image columns. A partial update allows you to specify the part of the text or image field that you want to replace, delete, or insert, and to update that part only instead of modifying the entire field.
Currently, ASE does not support partial updates of text or image data. However, Open Server does support partial updates of text or image data. For more information, see Chapter 2, “Topics“ in the Open Server Server-Library/C Reference Manual.
To perform a partial update, use ct_data_info to set iotype, delete_length, and offset. The values of delete_length and of the data passed to the server through ct_send_data determine the behavior of the partial update:
delete_length |
Text data |
Server action |
---|---|---|
0 |
Provided |
Insert the text data at offset. |
!= 0 |
Provided |
Starting from offset, overwrite delete_length bytes of data with text data. |
!= 0 |
Not provided |
Starting at offset, delete delete_length bytes of data. |
NULL |
Provided / Not provided |
Delete data starting from offset to the end of the text or image column. |
The ct_send_data routine can be used to send partially updated data. For partially updated data, the ct_send_data constructs a Transact-SQL updatetext statement, and the data is sent in chunks using multiple ct_send_data calls. The updatetext syntax is:
updatetext table_name.column_name text_pointer {NULL | offset} {NULL | delete_length} [with_log]
The updatetext statement is created only if the iotype value of the CS_IODESC structure is set to is set to CS_IOPARTIAL.
If your client application performs partial updates on 2-byte Unicode datatypes, the application must make sure that it sends an even number of bytes to avoid a character split. You can use the buflen parameter of ct_send_data and the total_txtlen field of CS_IODESC to specify the length, in bytes, of the Unicode data. For Unitext, the offset and delete_length values must be specified as a character count while total_txtlen must be specified in bytes. For other datatypes, the offset, delete_length, and total_txtlen must be in bytes.