|        | |||||
|  | |||||
| function | SQLSetArrayAsCounterShelf | ||||
| Related Syntax | Other Library Functions | 
| Library: ODBC Include: omodbc.xin | 
  define external function SQLSetArrayAsCounterShelf
     (  read-only SQL_array_type Array,
        read-only counter InputShelf,
        value counter ItemCount )
Sets elements in the SQL_array_type variable's data contents to the specified counter shelf items.
Input arguments:
The following code demonstrates how to use SQLSetArrayAsCounterShelf to set the value of the SQL array counter:
  local SQL_Array_type Array
  local counter ArrayCounterShelf variable
  local counter i
  SQLSetArraySize( Array, 20, 5 )
  ;
  ; Check initial values.
  ;
  SQLGetArrayAsCounterShelf( Array, ArrayCounterShelf, 5 )
  repeat over ArrayCounterShelf
          output "Initial counter shelf value[%d(#ITEM)] = %d(ArrayCounterShelf)%n"
  again
  ;
  ; Set counter values.
  ;
  set i to 0
  repeat
          set ArrayCounterShelf@(i+1) to (2*(i+1))
          increment i
          exit when i=5
  again
  SQLSetArrayAsCounterShelf( Array, ArrayCounterShelf, 5 )
  ;
  ; Check current values.
  ;
  SQLGetArrayAsCounterShelf( Array, ArrayCounterShelf, 5 )
  repeat over ArrayCounterShelf
          output "Current counter shelf value[%d(#ITEM)] = %d(ArrayCounterShelf)%n"
  again
The following code demonstrates how to sett the counter values of multiple elements in an SQL array type:
  local SQL_Array_type Array
  local counter ArrayCounterShelf variable
  local counter i
  SQLSetArraySize( Array, 20, 5 )
  ;
  ; Check initial values.
  ;
  SQLGetArrayAsCounterShelf( Array, ArrayCounterShelf, 5 )
  repeat over ArrayCounterShelf
          output "Initial counter shelf value[%d(#ITEM)] = %d(ArrayCounterShelf)%n"
  again
  ;
  ; Set counter values.
  ;
  set i to 0
  repeat
          set ArrayCounterShelf@(i+1) to (2*(i+1))
          increment i
          exit when i=5
  again
  SQLSetArrayAsCounterShelf( Array, ArrayCounterShelf, 5 )
  ;
  ; Check current values.
  ;
  SQLGetArrayAsCounterShelf( Array, ArrayCounterShelf, 5 )
  repeat over ArrayCounterShelf
          output "Current counter shelf value[%d(#ITEM)] = %d(ArrayCounterShelf)%n"
  again
| ---- |