The option parameter in the ct_cursor syntax has been extended to include CS_CUR_RELLOCKS_ONCLOSE. Use this option to direct Adaptive Server to release shared locks after a cursor closes. To use with read-only cursors or scrollable cursors, use the bitwise OR operator, “|” (pipe):
CS_CUR_RELLOCKS_ONCLOSE
CS_CUR_RELLOCKS_ONCLOSE | CS_READ_ONLY
CS_CUR_RELLOCKS_ONCLOSE | CS_FOR_UPDATE
CS_CUR_RELLOCKS_ONCLOSE | CS_SCROLL_CURSOR
CS_CUR_RELLOCKS_ONCLOSE | CS_SCROLL_INSENSITIVE
CS_CUR_RELLOCKS_ONCLOSE | CS_SCROLL_SEMISENSITIVE
CS_CUR_RELLOCKS_ONCLOSE | CS_NOSCROLL_INSENSITIVE
Example 1 Declares a cursor that releases its shared locks when it closes:
ct_cursor(cmd, CS_CURSOR_DECLARE, cursor_name, CS_NULLTERM, select_statement, CS_NULLTERM, CS_CUR_RELOCKS_ONCLOSE);
Example 2 Declares an insensitive, scrollable cursor that releases its shared locks when it closes:
ct_cursor(cmd, CS_CURSOR_DECLARE, cursor_name, CS_NULLTERM, select_statement, CS_NULLTERM, CS_CUR_RELOCKS_ONCLOSE | CS_SCROLL_INSENSITIVE);
For a sample Open Client program that illustrates this feature, see csr_disp_scrollcurs3.c.