Comparing call sequences

Table 5-2 compares DB-Library routines used for opening a connection with their Client-Library equivalents:

Table 5-2: DB-Library vs. Client-Library—opening a connection

DB-Library routines

DB-Library functionality

Client-Library routines

Client-Library functionality

dblogin()

Allocate a LOGINREC for use in dbopen.

ct_con_alloc(context, connection)

Allocate a CS_CONNECTION structure.

DBSETLUSER(
loginrec, username)

Set the username in the LOGINREC structure.

ct_con_props(
connection, CS_SET, CS_USERNAME, username, buflen, NULL)

Set the user name property in the connection structure.

DBSETLPWD(
loginrec, password)

Set the user server password in the LOGINREC structure.

ct_con_props(
connection, CS_SET, CS_PASSWORD, password, buflen, NULL)

Set the user server password property in the connection structure.

DBSETLAPP(
loginrec, application)

Set the application name in the LOGINREC structure.

ct_con_props(
connection, CS_SET, CS_APPNAME, appname, buflen, NULL)

Set the application name property in the connection structure.

dbopen(loginrec, server)

Connect to a server (and allocate the DBPROCESS).

ct_connect(connection, server_name, snamelen)

Connect to a server (with the pre-allocated connection structure).

dbloginfree(
loginrec)

Free the LOGINREC structure.

None

language commands, RPC commands, and TDS passthrough calls

Send requests and process results using a DBPROCESS structure.

CS_COMMAND

(See “Code that sends commands”)

Send requests and process results using a command structure.

dbclose(dbproc)

Close and deallocate a DBPROCESS structure.

ct_close( connection, option)

Close a server connection.

option is normally CS_UNUSED. CS_FORCE_CLOSE is useful when closing the connection because of an error.

(none)

ct_con_drop(connection)

Deallocate a connection structure.