Sample
local SQL_Handle_type EnvironmentHandle
local SQL_Handle_type ConnectionHandle
local SQL_Array_type FuncArray
local stream OutConnection
local counter StringLen
local counter RetCode
local counter FuncExists
local counter FuncID initial {SQL_API_SQLBULKOPERATIONS}
SQLSetArraySize( FuncArray, 125, 1 )
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
set RetCode to SQLAllocHandle
( SQL_HANDLE_DBC, EnvironmentHandle, ConnectionHandle )
output "Allocating connection handle - "
do when RetCode != SQL_SUCCESS
output "failed%n"
halt with 1
else
output "passed%n"
done
set RetCode to SQLDriverConnect
( ConnectionHandle,
SQL_NULL_HANDLE,
"dsn=omodbc",
20,
OutConnection,
1024,
StringLen,
SQL_DRIVER_NOPROMPT
)
output "Connecting to database - "
do when RetCode != SQL_SUCCESS
output "failed%n"
halt with 1
else
output "passed%n"
done
set RetCode to SQLGetFunctions
( ConnectionHandle, SQL_API_ODBC3_ALL_FUNCTIONS, FuncArray )
output "Retrieving list of all functions - "
do when RetCode != SQL_SUCCESS
output "failed%n"
halt with 1
else
output "passed%n"
done
set FuncExists to SQL_FUNC_EXISTS( FuncArray, FuncID )
output "Function (%d(FuncID)) "
do when FuncExists != SQL_TRUE
output "is not supported%n"
else
output "is supported%n"
done
set RetCode to SQLDisconnect( ConnectionHandle )
output "Disconnecting from database - "
do when RetCode != SQL_SUCCESS
output "failed%n"
halt with 1
else
output "passed%n"
done
set RetCode to SQLFreeHandle(SQL_HANDLE_DBC, ConnectionHandle)
output "Freeing connection handle resources - "
do when RetCode != SQL_SUCCESS
output "failed%n"
halt with 1
else
output "passed%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
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.