|        | |||||
|  | |||||
| function | SQLSetArrayAsStream | ||||
| Related Syntax | Other Library Functions | 
| Library: ODBC Include: omodbc.xin | 
  define external function SQLSetArrayAsStream
     (  read-only SQL_array_type Array,
        value counter ElementPos,
        value stream StreamValue )
Sets the specified element in the data area of the SQL_array_type variable to the specified stream value. The contents of the stream may be any text or binary information.
Input arguments:
The following code demonstrates how to use SQLSetArrayAsStream to set the value of the SQL array type stream:
  local SQL_Array_type Array
  local SQL_Array_type ArrayCopy
  local stream ArrayStreamValue
  local counter ArrayStreamLen
  local counter i
  SQLSetArraySize( Array, 20, 5 )
  ;
  ; Check initial values.
  ;
  set i to 0
  repeat
          set ArrayStreamValue to SQLGetArrayAsStream( Array, i )
          set ArrayStreamLen to (length of ArrayStreamValue)
          output "Initial stream value[%d(i)] = %g(ArrayStreamValue) "
          output "(length = %d(ArrayStreamLen))%n"
          increment i
          exit when i=5
  again
  ;
  ; Set stream values.
  ;
  set i to 0
  repeat
          set ArrayStreamValue to "*" ||* (i+1) || "%0#- post null"
          SQLSetArrayAsStream( Array, i, ArrayStreamValue )
          increment i
          exit when i=5
  again
  ;
  ; Check current values.
  ;
  set i to 0
  repeat
          set ArrayStreamValue to SQLGetArrayAsStream( Array, i )
          set ArrayStreamLen to (length of ArrayStreamValue)
          output "Current stream value[%d(i)] = %g(ArrayStreamValue) "
          output "(length = %d(ArrayStreamLen))%n"
          increment i
          exit when i=5
  again
The following code demonstrates how to set the stream values of multiple elements in an SQL array type:
  local SQL_Array_type Array
  local stream ArrayStreamShelf variable
  local counter ArrayStreamLen
  local counter i
  SQLSetArraySize( Array, 20, 5 )
  ;
  ; Check initial values.
  ;
  SQLGetArrayAsStreamShelf( Array, ArrayStreamShelf, 5 )
  repeat over ArrayStreamShelf
          set ArrayStreamLen to (length of ArrayStreamShelf)
          output "Initial stream shelf value[%d(#ITEM)] = %g(ArrayStreamShelf) "
          output "(length = %d(ArrayStreamLen))%n"
  again
  ;
  ; Set stream values.
  ;
  set i to 0
  repeat
          set ArrayStreamShelf@(i+1) to "*" ||* (i+1) || "%0#- post null"
          increment i
          exit when i=5
  again
  SQLSetArrayAsStreamShelf( Array, ArrayStreamShelf, 5 )
  ;
  ; Check current values.
  ;
  SQLGetArrayAsStreamShelf( Array, ArrayStreamShelf, 5 )
  repeat over ArrayStreamShelf
          set ArrayStreamLen to (length of ArrayStreamShelf)
          output "Current stream shelf value[%d(#ITEM)] = %g(ArrayStreamShelf) "
          output "(length = %d(ArrayStreamLen))%n"
  again
| ---- |