SQLSetArrayAsCounter
Full Description
swirl
Syntax
  define external function SQLSetArrayAsCounter
     (  read-only SQL_array_type Array,
        value counter ElementPos,
        value counter CounterValue )


Purpose

Sets an element in the SQL_array_type variable's data contents to the specified counter value.

Input arguments:

  • Array. The SQL_array_type variable to modify.
  • ElementPos. The position of the element, with zero (0) as the first element.
  • CounterValue. The specified counter value.

The following code demonstrates how to use SQLSetArrayAsCounter to set the counter value of an element in an SQL array type.

  local SQL_Array_type Array

  local SQL_Array_type ArrayCopy
  local counter ArrayCounterValue
  local counter i

  SQLSetArraySize( Array, 20, 5 )

The following code checks the counter's initial values.

  set i to 0
  repeat
          set ArrayCounterValue to SQLGetArrayAsCounter ( Array, i )
          output "Initial counter value[%d(i)] = %d(ArrayCounterValue)%n"
          increment i
          exit when i=5
  again

The following code sets the counter values.

  set i to 0
  repeat
          set ArrayCounterValue to (i+1)
          SQLSetArrayAsCounter ( Array, i, ArrayCounterValue )
          increment i
          exit when i=5
  again

The following code checks the counter's current values.

  set i to 0
  repeat
          set ArrayCounterValue to SQLGetArrayAsCounter ( Array, i )
          output "Current counter value[%d(i)] = %d(ArrayCounterValue)%n"
          increment i
          exit when i=5
  again

Copyright © OmniMark Technologies Corporation, 1988-1998.