SQLAllocConnect Full Description |
|
Syntaxdefine external counter function SQLAllocConnect ( read-only SQL_handle_type EnvironmentHandle, read-only SQL_handle_type ConnectionHandle ) Purpose Allocates an SQL connection handle within the environment identified by EnvironmentHandle. This function has been superseded by Input arguments:
The following code demonstrates how to use local SQL_Handle_type EnvironmentHandle local SQL_Handle_type ConnectionHandle local SQL_Vector_type Vector local counter CounterSizeInBytes initial {4} local counter RetCode set RetCode to SQLAllocHandle ( SQL_HANDLE_ENV, SQL_NULL_HANDLE, EnvironmentHandle ) output "Allocating environment handle - " do when RetCode != SQL_SUCCESS output "failed%n" halt with 1 else output "passed%n" done SQLSetVectorSize( Vector, CounterSizeInBytes ) SQLSetVectorAsCounter( Vector, SQL_OV_ODBC2 ) set RetCode to SQLSetEnvAttr ( EnvironmentHandle, SQL_ATTR_ODBC_VERSION, Vector, CounterSizeInBytes, SQL_INTEGER ) output "Setting environment attribute - " do when RetCode != SQL_SUCCESS output "failed%n" halt with 1 else output "passed%n" done set RetCode to SQLAllocConnect(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 SQLFreeConnect(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 SQLFreeEnv(EnvironmentHandle) output "Freeing environment handle resources - " do when RetCode != SQL_SUCCESS output "failed%n" halt with 1 else output "passed%n" done |