contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
Setting ODBC environment attributes  
Introduction: ODBC connections  

Sample

  local SQL_Handle_type EnvironmentHandle
  local SQL_Vector_type EnvAttr
  local counter CounterSizeInBytes initial {4}
  local counter StringLen
  local counter EnvAttrVal
  local counter RetCode

  set RetCode to SQLAllocEnv(EnvironmentHandle)
  output "Allocating environment handle - "
  do when RetCode != SQL_SUCCESS
     output "failed%n"
     halt with 1
  else
     output "passed%n"
  done

  SQLSetVectorSize( EnvAttr, CounterSizeInBytes )
  output "Getting environment attribute - "
  set RetCode to SQLGetEnvAttr
          (       EnvironmentHandle,
                  SQL_ATTR_ODBC_VERSION,
                  EnvAttr,
                  CounterSizeInBytes,
                  StringLen
          )
  do when RetCode != SQL_SUCCESS
     output "failed%n"
     halt with 1
  else
     output "passed%n"
     set EnvAttrVal to SQLGetVectorAsCounter( EnvAttr )
     output "- %d(EnvAttrVal) (%d(StringLen))%n"
  done

  SQLSetVectorAsCounter( EnvAttr, SQL_OV_ODBC3 )
  output "Setting environment attribute - "
  set RetCode to SQLSetEnvAttr
          (       EnvironmentHandle,
                  SQL_ATTR_ODBC_VERSION,
                  EnvAttr,
                  4,
                  SQL_INTEGER
          )
  do when RetCode != SQL_SUCCESS
     output "failed%n"
     halt with 1
  else
     output "passed%n"
  done

  output "Getting environment attribute - "
  set RetCode to SQLGetEnvAttr
          (       EnvironmentHandle,
                  SQL_ATTR_ODBC_VERSION,
                  EnvAttr,
                  CounterSizeInBytes,
                  StringLen
          )
  do when RetCode != SQL_SUCCESS
     output "failed%n"
     halt with 1
  else
     output "passed%n"
     set EnvAttrVal to SQLGetVectorAsCounter( EnvAttr )
     output "- %d(EnvAttrVal) (%d(StringLen))%n"
  done

  set RetCode to SQLFreeHandle(SQL_HANDLE_ENV, EnvironmentHandle)
  output "Freeing environment handle resources - "
  do when RetCode != SQL_SUCCESS
     output "failed%n"
     halt with 1
  else
     output "passed%n"
  done

 
----  

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:01:43 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.