Table A-1 lists DB-Library routines and their corresponding Client-Library and CS-Library equivalents:
DB-Library routine |
DB-Library functionality |
Client-Library or CS-Library equivalent |
---|---|---|
db12hour |
Determines whether the specified language uses 12-hour or 24-hour time. |
cs_dt_info(CS_12HOUR) |
dbadata |
Returns a pointer to the data for a compute column. |
No direct equivalent. Applications must retrieve data values by binding or with ct_get_data. See “Retrieving data values”. |
dbadlen |
Returns the actual length of the data for a compute column. |
No direct equivalent:
|
dbaltbind |
Binds a compute column to a program variable. |
ct_bind |
dbaltbind_ps |
Binds a compute column to a program variable, with precision and scale support for numeric and decimal data. |
ct_bind |
dbaltcolid |
Returns the column ID for a compute column. |
ct_compute_info(CS_COMP_COLID) |
dbaltlen |
Returns the maximum length of the data for a particular compute column. |
ct_describe (The maxlength field of the CS_DATAFMT) |
dbaltop |
Returns the type of aggregate operator for a particular compute column. |
ct_compute_info(CS_COMP_OP) |
dbalttype |
Returns the datatype for a compute column. |
ct_describe (The datatype field of the CS_DATAFMT) |
dbaltutype |
Returns the user-defined datatype for a compute column. |
ct_describe (The usertype field of the CS_DATAFMT) |
dbanullbind |
Associates an indicator variable with a compute-row column. |
ct_bind |
dbbind |
Binds a regular result column to a program variable. |
ct_bind |
dbbind_ps |
Binds a regular result column to a program variable, with precision and scale support for numeric and decimal data. |
ct_bind |
dbbufsize |
Returns the size of a DBPROCESS row buffer. |
None. Client-Library does not provide built-in support for row buffering. |
dbbylist |
Returns the bylist for a compute row. |
Replace with the following call sequence:
|
dbcancel |
Cancels the current command batch. |
One of the following:
|
dbcanquery |
Cancels any rows pending from the most recently executed query. |
ct_cancel(CS_CANCEL_CURRENT) |
dbchange |
Determines whether a command batch has changed the current database. |
None. Applications that require this functionality can be coded to trap server message number 5701 in the server message handler. The text of the 5701 message contains the database name. |
dbcharsetconv |
Indicates whether the server is performing character set translation. |
ct_con_props(CS_CHARSETCNV) |
dbclose |
Closes and deallocates a single DBPROCESS structure. |
One of the following:
|
dbclrbuf |
Drops rows from the row buffer. |
None. Client-Library does not provide built-in support for row buffering. |
dbclropt |
Clears an option set by dbsetopt. |
ct_options(CS_CLEAR). |
dbcmd |
Adds text to the DBPROCESS language command buffer. |
ct_command(CS_LANG_CMD) puts text into the language buffer. Pass option as CS_MORE if more text will be appended to the language buffer, otherwise, CS_END. |
DBCMDROW |
Determines whether the current command can return rows. |
No direct equivalent. ct_results sets result_type to CS_CMD_SUCCEED to indicate the success of a command that returns no data. For a comparison of ct_results result_type values to DB-Library program logic, see “Code that processes results”. |
dbcolbrowse |
Determines whether the source of a regular result column can be updated using browse-mode updates. |
ct_br_column (The isbrowse field of the CS_BROWSEDESC) |
dbcollen |
Returns the maximum length of the data in a regular result column. |
ct_describe (The maxlength field of the CS_DATAFMT) |
dbcolname |
Returns the name of a regular result column. |
ct_describe (The name field of the CS_DATAFMT) |
dbcolsource |
Returns a pointer to the name of the database column from which the specified regular result column was derived. |
ct_br_column (The origname field of the CS_BROWSEDESC) |
dbcoltype |
Returns the datatype for a regular result column. |
ct_describe (The datatype field of the CS_DATAFMT) |
dbcoltypeinfo |
Returns a structure containing precision and scale values for a numeric column value. |
ct_describe (The precision and scale fields of the CS_DATAFMT) |
dbcolutype |
Returns the user-defined datatype for a regular result column. |
ct_describe (The usertype field of the CS_DATAFMT) |
dbconvert |
Converts data from one datatype to another. |
cs_convert |
dbconvert_ps |
Converts data from one datatype to another, with precision and scale support for numeric and decimal data. |
cs_convert |
DBCOUNT |
Returns the number of rows affected by a Transact-SQL command. |
ct_res_info(CS_ROW_COUNT) Call when ct_results returns a result_type value of CS_CMD_DONE.
|
DBCURCMD |
Returns the number of the current command. |
ct_res_info(CS_CMD_NUMBER) |
DBCURROW |
Returns the number of the row currently being read. |
No direct equivalent. The application can use a counter variable that is incremented when fetching regular and compute result rows. To maintain a count equivalent to DBCURROW’s, follow these steps:
|
dbcursor |
Inserts, updates, deletes, locks, or refreshes a particular row in the fetch buffer. |
ct_cursor ct_cursor commands must be sent with ct_send and their results handled with ct_results.
|
dbcursorbind |
Registers the binding information on the cursor columns. |
ct_bind when ct_results returns with a result_type of CS_CURSOR_RESULT. |
dbcursorclose |
Closes the cursor associated with the given handle, releasing all the data belonging to it. |
|
dbcursorcolinfo |
Returns column information for the specified column number in the open cursor. |
ct_describe when ct_results returns with a result_type of CS_CURSOR_RESULT. |
dbcursorfetch |
Fetches a block of rows into the program variables declared by the user in dbcursorbind. |
ct_fetch when ct_results returns with a result_type of CS_CURSOR_RESULT. |
dbcursorinfo |
Returns the number of columns and the number of rows in the keyset if the keyset hit the end of the result set. |
No direct equivalent. Client-Library cursors are managed by the server, and there is no equivalent concept of a keyset. To find out whether a cursor result set column is a key, call ct_describe, then check the status field in the CS_DATAFMT structure. |
dbcursoropen |
Opens a cursor, specifying the scroll option, the concurrency option, and the size of the fetch buffer (the number of rows retrieved with a single fetch). |
ct_cursor
|
dbdata |
Returns a pointer to the data in a regular result column. |
No direct equivalent. Applications must retrieve data values by binding or with ct_get_data. See “ct_get_data versus dbdata”. |
dbdate4cmp |
Compares two DBDATETIME4 values. |
cs_cmp |
dbdate4zero |
Initializes a DBDATETIME4 variable to Jan 1, 1900 12:00AM. |
No direct equivalent. The application can call cs_convert to convert a string representation to the equivalent CS_DATETIME value. The application can also use memset (or a platform equivalent) to zero the bytes of the CS_DATETIME4 structure. This effectively sets the date value to Jan 1, 1900 12:00AM. The memset technique provides better performance. |
dbdatechar |
Converts an integer component of a DBDATETIME value into character format. |
No direct equivalent. To replace dbdatechar calls that obtain native language month and day names, use cs_dt_info. Other dbdatechar calls just convert an integer to a string of decimal digits. These can be replaced with a call to sprintf (or an equivalent conversion routine). |
dbdatecmp |
Compares two DBDATETIME values. |
cs_cmp |
dbdatecrack |
Converts a machine-readable DBDATETIME value into user-accessible format. |
cs_dt_crack The DBDATEREC and CS_DATEREC structures are identical. |
dbdatename |
Converts the specified component of a DBDATETIME structure into its corresponding character string. |
No direct equivalent. To replace dbdatename calls that obtain native language month and day names, use cs_dt_crack and cs_dt_info. Other calls can be replaced with the following call sequence:
|
dbdateorder |
Returns the date component order for a given language. |
cs_dt_info(CS_DATEORDER) |
dbdatepart |
Returns the specified part of a DBDATETIME value as an integer value. |
No direct equivalent. dbdatepart calls can be replaced by a call to cs_dt_crack and a reference to the appropriate CS_DATEREC field. To replace calls that compute DBDATE_QQ and DBDATE_WK, the application must perform simple arithmetic with the appropriate CS_DATEREC fields. |
dbdatezero |
Initializes a DBDATETIME value to Jan 1, 1900 12:00:00:000AM. |
No direct equivalent. The application can call cs_convert to convert a string representation to the equivalent CS_DATETIME value. The application can also use memset (or a platform-specific equivalent) to zero the bytes of the CS_DATETIME structure. This effectively sets the date value to Jan 1, 1900 12:00:00:000AM. The memset technique provides better performance. |
dbdatlen |
Returns the length of the data in a regular result column. |
No direct equivalent.
|
dbdayname |
Determines the name of a specified weekday in a specified language. |
cs_dt_info(CS_DAYNAME) |
DBDEAD |
Determines whether a particular DBPROCESS is dead. |
ct_con_props(CS_GET, CS_CON_STATUS) Check the CS_CONSTAT_DEAD bit in the returned value. |
dberrhandle |
Installs a user function to handle DB-Library errors. |
|
dbexit |
Closes and deallocates all DBPROCESS structures and cleans up structures initialized by dbinit. |
|
dbfcmd |
Adds text to the DBPROCESS command buffer using C runtime library sprintf-type formatting. |
No direct equivalent. Use sprintf (or your system’s equivalent) to format the language command string before calling ct_command. Pass option as CS_MORE if more text will be appended to the language buffer, or CS_END otherwise. For connections using TDS 5.0 or later, Client-Library allows parameters for language commands. Identify parameters with “@” variables in the text, and pass values with ct_param or ct_setparam. |
DBFIRSTROW |
Returns the number of the first row in the row buffer. |
None. Client-Library does not provide built-in support for row buffering. |
dbfree_xlate |
Frees a pair of character set translation tables. |
No direct equivalent. Character sets are stored as part of the hidden CS_LOCALE structure. Use cs_loc_alloc to allocate a CS_LOCALE structure and cs_loc_drop to free the structure’s memory. |
dbfreebuf |
Clears the command buffer. |
No direct equivalent. System 10 and later Client-Library clears the command buffer with every call to ct_send. If a command has been initiated but not sent, use ct_cancel to clear the command buffer. |
dbfreequal |
Frees the memory allocated by dbqual. |
No direct equivalent. Client-Library does not provide built-in functions to build where clauses. See the entry for dbqual in this table. |
dbfreesort |
Frees a sort order structure allocated by dbloadsort. |
No direct equivalent. Sort orders are stored as part of the hidden CS_LOCALE structure. Use cs_loc_alloc to allocate a CS_LOCALE structure and cs_loc_drop to free the structure’s memory. |
dbgetchar |
Returns a pointer to a character in the command buffer. |
No direct equivalent. Format language commands before passing them to ct_command. The internal language buffer is not accessible to the application. |
dbgetcharset |
Gets the name of the client character set from the DBPROCESS structure. |
Replace with the following call sequence:
|
dbgetloginfo |
Transfers TDS login response information from a DBPROCESS structure to a newly allocated DBLOGINFO structure. |
ct_getloginfo |
dbgetlusername |
Returns the user name from a LOGINREC structure. |
ct_con_props(CS_GET, CS_USERNAME) |
dbgetmaxprocs |
Determines the current maximum number of simultaneously open DBPROCESSes. |
ct_config(CS_GET, CS_MAX_CONNECT) |
dbgetnatlang |
Gets the native language from the DBPROCESS structure. |
Replace with the following call sequence:
|
dbgetoff |
Checks for the existence of Transact-SQL constructs in the command buffer. |
None. |
dbgetpacket |
Returns the TDS packet size currently in use. |
ct_con_props(CS_GET, CS_PACKETSIZE) |
dbgetrow |
Reads the specified row in the row buffer. |
None. Client-Library does not provide built-in support for row buffering. |
DBGETTIME |
Returns the number of seconds that DB-Library will wait for a server response to a SQL command. |
ct_config(CS_GET, CS_TIMEOUT) |
dbgetuserdata |
Returns a pointer to user-allocated data from a DBPROCESS structure. |
User data can be installed at the context, connection, or command level:
|
dbhasretstat |
Determines whether the current command or an RPC generated a return status number. |
ct_results returns a result_type value of CS_STATUS_RESULT when a stored procedure return status arrives. |
dbinit |
Initializes DB-Library. |
|
DBIORDESC (UNIX and AOS/VS only) |
Provides program access to the UNIX or AOS/VS file descriptor used by DB-Library to read data coming from the server. |
ct_con_props(CS_ENDPOINT) The retrieved property value is -1 on platforms that do not support this functionality. |
DBIOWDESC (UNIX and AOS/VS only) |
Provides program access to the UNIX or AOS/VS file descriptor used by DB-Library to write data to the server. |
ct_con_props(CS_ENDPOINT) The retrieved property value is -1 on platforms that do not support this functionality. |
DBISAVAIL |
Determines whether a DBPROCESS is available for general use. |
No direct equivalent. If the program logic relies on DBISAVAIL and DBSETAVAIL, use the Client-Library’s connection-level or command-level CS_USER_DATA properties to replace these calls. |
dbisopt |
Checks the status of a server or DB-Library option. |
ct_options(CS_GET) |
DBLASTROW |
Returns the number of the last row in the row buffer. |
None. Client-Library does not provide built-in support for row buffering. |
dbload_xlate |
Loads a pair of character set translation tables. |
No direct equivalent. Character sets are stored as part of the hidden CS_LOCALE structure. Use cs_loc_alloc to allocate a CS_LOCALE structure and cs_loc_drop to free the structure’s memory. Use cs_locale to change the character set in a CS_LOCALE structure. |
dbloadsort |
Loads a server sort order. |
No direct equivalent. Sort orders are stored as part of the hidden CS_LOCALE structure. Use cs_loc_alloc to allocate a CS_LOCALE structure and cs_loc_drop to free the structure’s memory. Use cs_locale to change a CS_LOCALE’s sort order. |
dblogin |
Allocates a login record for use in dbopen. |
ct_con_alloc See “Code that opens a connection” for usage information. |
dbloginfree |
Frees a login record. |
ct_con_drop |
dbmny4add |
Adds two DBMONEY4 values. |
cs_calc |
dbmny4cmp |
Compares two DBMONEY4 values. |
cs_cmp |
dbmny4copy |
Copies a DBMONEY4 value. |
No built in equivalent. Use the C standard library routine memcpy (or an equivalent): CS_MONEY4 dest_mny4; CS_MONEY4 src_mny4; memcpy(&dest_mny4, &src_mny4, sizeof(CS_MONEY4)); |
dbmny4divide |
Divides one DBMONEY4 value by another. |
cs_calc |
dbmny4minus |
Negate a DBMONEY4 value. |
No direct equivalent. Use cs_calc to subtract the value from a zero-value CS_MONEY4 variable. |
dbmny4mul |
Multiplies two DBMONEY4 values. |
cs_calc |
dbmny4sub |
Subtracts one DBMONEY4 value from another. |
cs_calc |
dbmny4zero |
Initializes a DBMONEY4 variable to $0.0000. |
Use memset (or an equivalent) to zero the fields of the CS_MONEY4 structure. |
dbmnyadd |
Adds two DBMONEY values. |
cs_calc |
dbmnycmp |
Compares two DBMONEY values. |
cs_cmp |
dbmnycopy |
Copies a DBMONEY value. |
No built in equivalent. Use the C standard library routine memcpy (or an equivalent): CS_MONEY dest_mny; CS_MONEY src_mny; memcpy(&dest_mny, &src_mny, sizeof(CS_MONEY)); |
dbmnydec |
Decrements a DBMONEY value by one ten-thousandth of a dollar. |
No direct equivalent. Use cs_convert to convert a one ten-thousandth CS_FLOAT value to a CS_MONEY, then use cs_calc. |
dbmnydivide |
Divides one DBMONEY value by another. |
cs_calc |
dbmnydown |
Divides a DBMONEY value by a positive integer. |
No direct equivalent. Use cs_convert to convert the integer value to a CS_MONEY, then call cs_calc to divide by the converted value. |
dbmnyinc |
Increments a DBMONEY value by one ten-thousandth of a dollar. |
No direct equivalent. Use cs_convert to convert a one ten-thousandth CS_FLOAT value to a CS_MONEY, then use cs_calc. |
dbmnyinit |
Prepares a DBMONEY value for calls to dbmnyndigit. |
No direct equivalent for dbmnyinit and dbmnyndigit. See the entry for dbmnydigit in this table. |
dbmnymaxneg |
Returns the maximum negative DBMONEY value supported. |
None. |
dbmnymaxpos |
Returns the maximum positive DBMONEY value supported. |
None. |
dbmnyminus |
Negates a DBMONEY value. |
No direct equivalent. Use cs_calc to subtract the value from a zero-value CS_MONEY4 variable. |
dbmnymul |
Multiplies two DBMONEY values. |
cs_calc |
dbmnyndigit |
Returns the rightmost digit of a DBMONEY value as a DBCHAR. |
No direct equivalent. Use cs_convert to convert the CS_MONEY value to a character string, then reformat the string as necessary. To avoid losing precision in the conversion to CS_CHAR, use the conversion sequence CS_MONEY to CS_NUMERIC to CS_CHAR. |
dbmnyscale |
Multiplies a DBMONEY value by a positive integer (multiplier) and add a specified amount (addend, in ten-thousandths). |
No direct equivalent. Use cs_convert to convert the multiplier and addend values to equivalent CS_MONEY values, then use cs_calc to perform the multiplication and addition. |
dbmnysub |
Subtracts one DBMONEY value from another. |
cs_calc |
dbmnyzero |
Initializes a DBMONEY value to $0.0000. |
Use memset (or an equivalent) to zero the fields of the CS_MONEY structure. |
dbmonthname |
Determines the name of a specified month in a specified language. |
|
DBMORECMDS |
Indicates whether there are more results to be processed. |
No direct equivalent. ct_results returns CS_END_RESULTS when all results have been processed. Code your results loop to process all results sent by the server, or to cancel unexpected results. For information on converting results-handling code, see “Code that processes results”. For information on canceling commands, see “Canceling results”. |
dbmoretext |
Sends part of a text or image value to the server. |
ct_send_data For usage information, see Table 6-6. |
dbmsghandle |
Installs a user function to handle server messages. |
ct_callback(CS_SERVERMSG_CB) |
dbname |
Returns the name of the current database. |
No direct equivalent. Send the following language command to get the information from Adaptive Server Enterprise: select db_name() |
dbnextrow |
Reads the next result row. |
ct_fetch (and ct_results if the query returns compute rows). See “Code that processes results” for an illustration of how regular and compute rows are handled. To get the compute ID that is returned by dbnextrow, use ct_compute_info(CS_COMP_ID). |
dbnpcreate |
Creates a notification procedure. |
No direct equivalent. Invoke the Open Server system stored procedure sp_regcreate with a Client-Library RPC command. sp_regcreate is documented in the Open Server Server-Library/C Reference Manual. |
dbnpdefine |
Defines a notification procedure. |
No direct equivalent. Invoke the Open Server system stored procedure sp_regcreate with a Client-Library RPC command. sp_regcreate is documented in the Open Server Server-Library/C Reference Manual. |
dbnullbind |
Associates an indicator variable with a regular result row column. |
ct_bind |
dbnumalts |
Returns the number of columns in a compute row. |
ct_res_info(CS_NUMDATA) when ct_results returns with a result_type of CS_COMPUTE_RESULT. |
dbnumcols |
Determines the number of regular columns for the current set of results. |
ct_res_info(CS_NUMDATA) when ct_results returns with a result_type of CS_ROW_RESULT. |
dbnumcompute |
Returns the number of COMPUTE clauses in the current set of results. |
ct_res_info(CS_NUM_COMPUTES) when ct_results returns with a result_type of CS_COMPUTE_RESULT. |
DBNUMORDERS |
Returns the number of columns specified in a Transact-SQL select statement’s order by clause. |
ct_res_info(CS_NUMORDERCOLS) returns with a result_type of CS_ROW_RESULT. |
dbnumrets |
Determines the number of return parameter values generated by a stored procedure. |
ct_res_info(CS_NUMDATA) ct_results returns a result_type of CS_PARAM_RESULT when the return parameter values arrive. |
dbopen |
Creates and initializes a DBPROCESS structure. |
ct_connect See “Code that opens a connection” for usage information. |
dbordercol |
Returns the ID of a column appearing in the most recently executed query’s order by clause. |
Replace with the following call sequence:
|
dbpoll |
Checks if a server response has arrived for a DBPROCESS. |
ct_poll
|
dbprhead |
Prints the column headings for rows returned from the server. |
No direct equivalent. Replace with application code. |
dbprrow |
Prints all the rows returned from the server. |
No direct equivalent. Replace with application code. The example function ex_fetch_data in the exutils.c Client-Library sample program provides similar functionality. For more details of this sample program, see Open Client and Open Server Programmers Supplement for your platform. |
dbprtype |
Converts a token value to a readable string. |
No direct equivalent. Replace with application code. |
dbqual |
Returns a pointer to a where clause suitable for use in updating the current row in a browsable table. |
No direct equivalent. Replace with application code that calls ct_br_column and ct_br_table to get the column and table names for building the where clause. Before sending the browse-mode query, the application must allow the CS_HIDDEN_KEYS command property. The application must also bind to the table’s timestamp column and use the timestamp in the where clause. The format of the where clause is: where key1 = value_1 and key2 = value_2 ... and tsequal(timestamp, ts_value) where:
|
DBRBUF (UNIX and AOS/VS only) |
Determines whether the DB-Library network buffer contains any unread bytes. |
No direct equivalent. Use an asynchronous connection. See the “Asynchronous Programming” topics page in the Open Client Client-Library/C Reference Manual. |
dbreadpage |
Reads a page of binary data from the server. |
None. |
dbreadtext |
Reads part of a text or image value from the server. |
ct_get_data For usage information, see “Retrieving text or image data”. |
dbrecftos |
Records all SQL sent from the application to the server. |
None. Use ct_debug to diagnose application problems. |
dbrecvpassthru |
Receives a TDS packet from a server. |
ct_recvpassthru |
dbregdrop |
Drops a registered procedure. |
No direct equivalent. Invoke the Open Server system stored procedure sp_regdrop with a Client-Library RPC command. sp_regdrop is documented in the Open Server Server-Library/C Reference Manual. |
dbregexec |
Executes a registered procedure. |
ct_send |
dbreghandle |
Installs a handler routine for a registered procedure notification. |
ct_callback (CS_NOTIF_CB) |
dbreginit |
Initiates execution of a registered procedure. |
ct_command (CS_RPC_CMD) |
dbreglist |
Returns a list of registered procedures currently defined in Open Server. |
No direct equivalent. Invoke the Open Server system stored procedure sp_reglist with a Client-Library RPC command. sp_reglist is documented in the Open Server Server-Library/C Reference Manual. |
dbregnowatch |
Cancels a request to be notified when a registered procedure executes. |
No direct equivalent. Invoke the Open Server system stored procedure sp_regnowatch with a Client-Library RPC command. sp_regnowatch is documented in the Open Server Server-Library/C Reference Manual. |
dbregparam |
Defines or describes a registered procedure parameter. |
ct_param or ct_setparam |
dbregwatch |
Requests notification when a registered procedure executes. |
No direct equivalent. Invoke the Open Server system stored procedure sp_regwatch with a Client-Library RPC command. sp_regwatch is documented in the Open Server Server-Library/C Reference Manual. |
dbregwatchlist |
Returns a list of registered procedures that a DBPROCESS is watching for. |
No direct equivalent. Invoke the Open Server system stored procedure sp_regwatchlist with a Client-Library RPC command. sp_regwatchlist is documented in the Open Server Server-Library/C Reference Manual. |
dbresults |
Sets up the results of the next query. |
ct_results |
dbretdata |
Returns a pointer to a return (output) parameter value generated by a stored procedure. |
No direct equivalent. Bind and fetch the return parameter values, or use ct_get_data. |
dbretlen |
Determines the length of a return parameter value generated by a stored procedure. |
No direct equivalent.
|
dbretname |
Determines the name of the stored procedure parameter associated with a particular return parameter value. |
ct_describe (The name field in the CS_DATAFMT.) |
dbretstatus |
Determines the stored procedure status number returned by the current command or RPC. |
No direct equivalent. Bind and fetch the return status value, or use ct_get_data. |
dbrettype |
Determines the datatype of a return parameter value generated by a stored procedure. |
ct_describe (The datatype field in the CS_DATAFMT.) |
DBROWS |
Indicates whether the current command actually returned rows. |
No direct equivalent. ct_results returns a result_type value of CS_ROW_RESULT when a command has returned rows. |
DBROWTYPE |
Returns the type of the current row. |
ct_results indicates the type of the current result set. |
dbrpcinit |
Initializes an RPC. |
ct_command(CS_RPC_COMMAND) |
dbrpcparam |
Adds a parameter to an RPC. |
ct_param or ct_setparam |
dbrpcsend |
Signals the end of an RPC. |
ct_send |
dbrpwclr |
Clears all remote passwords from the LOGINREC structure. |
ct_remote_pwd(CS_CLEAR) |
dbrpwset |
Adds a remote password to the LOGINREC structure. |
ct_remote_pwd(CS_SET) |
dbsafestr |
Doubles the quotes in a character string. |
None. Replace with application code. |
dbsechandle |
Installs user functions to handle secure logins. |
|
dbsendpassthru |
Sends a TDS packet to a server. |
ct_sendpassthru |
dbservcharset |
Obtains the name of the server character set. |
No direct equivalent. For connections to Adaptive Server Enterprise or Open Server, send an RPC command to invoke the sp_serverinfo Adaptive Server Enterprise catalog stored procedure (or the Open Server system registered procedure with the same name). Pass the string “server_csname” as an unnamed CS_CHAR parameter. |
dbsetavail |
Marks a DBPROCESS as being available for general use. |
No direct equivalent. If the program logic relies on DBISAVAIL and DBSETAVAIL, use ct_con_props(CS_USER_DATA) or ct_cmd_props(CS_USER_DATA) to replace these calls. |
dbsetbusy |
Calls a user-supplied function when DB-Library is reading from the server. |
No direct equivalent—use asynchronous connections instead. See the “Asynchronous Programming” topics page in the Open Client Client-Library/C Reference Manual. |
dbsetconnect |
Sets the server connection information. |
ct_con_props(CS_SERVERADDR) |
dbsetdefcharset |
Sets the default character set name for an application. |
The “default” entry in the locales file determines the default character set for a CS_CONTEXT structure. The application can change a context’s character set with cs_loc_alloc, cs_locale, and cs_config(CS_LOC_PROP). |
dbsetdeflang |
Sets the default language name for an application. |
The “default” entry in the locales file determines the default language for a CS_CONTEXT structure. The application can change a context’s language with cs_loc_alloc, cs_locale, and cs_config(CS_LOC_PROP). |
dbsetidle |
Calls a user-supplied function when DB-Library has finished reading from the server. |
No direct equivalent. Use an asynchronous connection. Client-Library calls the connection’s completion callback every time an asynchronous routine completes its work. See the “Asynchronous Programming” topics page in the Open Client Client-Library/C Reference Manual. |
dbsetifile |
Specifies the name and location of the Sybase interfaces file. |
ct_config(CS_IFILE) cs_config(CS_DEFAULT_IFILE) specifies the name and location of the alternate Sybase interfaces file. |
dbsetinterrupt |
Calls user-supplied functions to handle interrupts while waiting on a read from the server. |
No direct equivalent. On platforms where Client-Library uses signal-driven I/O, use ct_callback(CS_SIGNAL_CB) to install system interrupt handlers. If the application requires the ability to cancel pending queries before Client-Library calls complete, then use an asynchronous connection. Use ct_cancel(CS_CANCEL_ATTN) to cancel commands when the completion of a Client-Library call is pending. |
DBSETLAPP |
Sets the application name in the LOGINREC structure. |
ct_con_props(CS_APPNAME) |
DBSETLCHARSET |
Sets the character set in the LOGINREC structure. |
Replace with the following call sequence:
|
DBSETLENCRYPT |
Specifies whether or not password encryption is to be used when logging into Adaptive Server Enterprise. |
ct_con_props(CS_SET, CS_SEC_ENCRYPTION) |
DBSETLHOST |
Sets the host name in the LOGINREC structure. |
ct_con_props(CS_SET, CS_HOSTNAME) |
DBSETLNATLANG |
Sets the national language name in the LOGINREC structure. |
Replace with the following call sequence:
|
dbsetloginfo |
Transfer TDS login information from a DBLOGINFO structure to a LOGINREC structure. |
ct_setloginfo |
dbsetlogintime |
Sets the number of seconds that DB-Library waits for a server response to a request for a DBPROCESS connection. |
ct_config(CS_SET, CS_LOGIN_TIMEOUT) |
DBSETLPACKET |
Sets the TDS packet size in an application’s LOGINREC structure. |
ct_con_props(CS_SET, CS_PACKETSIZE) |
DBSETLPWD |
Sets the user server password in the LOGINREC structure. |
ct_con_props(CS_SET, CS_PASSWORD) |
DBSETLUSER |
Sets the user name in the LOGINREC structure. |
ct_con_props(CS_SET, CS_USERNAME) |
dbsetmaxprocs |
Sets the maximum number of simultaneously open DBPROCESSes. |
ct_config(CS_SET, CS_MAX_CONNECT) |
dbsetnull |
Defines substitution values to be used when binding null values. |
cs_setnull |
dbsetopt |
Sets a server or DB-Library option. |
ct_options sets server options. ct_config, ct_con_props, and ct_cmd_props set Client-Library properties. |
dbsetrow |
Sets a buffered row to “current.” |
None. Client-Library does not provide built-in support for row buffering. |
dbsettime |
Sets the number of seconds that DB-Library will wait for a server response to a SQL command. |
ct_config(CS_SET, CS_TIMEOUT) To cancel when a timeout occurs, call ct_cancel(CS_CANCEL_ATTN) in the client message handler. The timeout error information is:
|
dbsetuserdata |
Uses a DBPROCESS structure to save a pointer to user-allocated data. |
User data can be installed at the context, connection, or command level:
|
dbsetversion |
Specifies a DB-Library version level. |
cs_ctx_alloc and ct_init both take a version number as a parameter. |
dbspid |
Gets the server process ID for the specified DBPROCESS. |
No direct equivalent. For Adaptive Server Enterprise, use the language command: select @@spid |
dbspr1row |
Places one row of server query results into a buffer. |
No direct equivalent. Replace with application code. |
dbspr1rowlen |
Determines how large a buffer to allocate to hold the results returned by dbsprhead, dbsprline, and dbspr1row. |
No direct equivalent. Replace with application code. |
dbsprhead |
Places the server query results header into a buffer. |
No direct equivalent. Replace with application code. |
dbsprline |
Chooses the character with which to underline the column names produced by dbsprhead. |
No direct equivalent. Replace with application code. |
dbsqlexec |
Sends a command batch to the server. |
ct_send sends the batch. ct_results gets the server’s initial response. For information on converting dbsqlexec return code logic, see “Code that processes results”. |
dbsqlok |
Waits for results from the server and verifies the correctness of the instructions the server is responding to. |
ct_results For information on converting dbsqlok return code logic, see “Code that processes results”. |
dbsqlsend |
Sends a command batch to the server and does not wait for a response. |
ct_send If the DB-Library application uses dbpoll after dbsqlsend, then use an asynchronous connection in the converted application. See the “Asynchronous Programming” topics page in the Open Client Client-Library/C Reference Manual. |
dbstrbuild |
Builds a printable string from text containing place holders for variables. |
cs_strbuild |
dbstrcmp |
Compares two character strings using a specified sort order. |
cs_strcmp(CS_COMPARE) |
dbstrcpy |
Copies a portion of the command buffer. |
No direct equivalent. Format language commands before passing them to ct_command. The internal language buffer is not accessible to the application. |
dbstrlen |
Returns the length, in characters, of the command buffer. |
No direct equivalent. Format language commands before passing them to ct_command. The internal language buffer is not accessible to the application. |
dbstrsort |
Determines which of two character strings should appear first in a sorted list. |
cs_strcmp(CS_SORT) |
dbtabbrowse |
Determines whether the specified table can be updated with browse mode updates. |
ct_br_table(CS_ISBROWSE) |
dbtabcount |
Returns the number of tables involved in the current select query. |
ct_br_table(CS_TABNUM) |
dbtabname |
Returns the name of a table based on its number. |
ct_br_table(CS_TABNAME) |
dbtabsource |
Returns the name and number of the table from which a particular result column was derived. |
ct_br_column (The tablename and tablenum fields of CS_BROWSEDESC.) |
DBTDS |
Determines which version of TDS (the Tabular Data Stream protocol) is being used. |
ct_con_props(CS_TDS_VERSION) |
dbtextsize |
Returns the number of text/image bytes that remain to be read for the current row. |
ct_data_info(CS_GET) initializes a CS_IODESC structure. The structure gives the total length of text/image column in the total_txtlen field. |
dbtsnewlen |
Returns the length of the new value of the timestamp column after a browse-mode update. |
No direct equivalent. See the entry for dbtsnewval in this table. |
dbtsnewval |
Returns the new value of the timestamp column after a browse-mode update. |
No direct equivalent. After a browse-mode update, the server sends the new timestamp as a parameter (CS_PARAM_RESULT) result set. The application binds and fetches the new timestamp. The new timestamp can be used to build a where clause that updates the same row again. |
dbtsput |
Puts the new value of the timestamp column into the given table’s current row in the DBPROCESS. |
None. In DB-Library, dbtsput is used with dbtsnewval. Neither routine has a Client-Library equivalent. For a description of how consecutive browse mode updates are implemented with Client-Library, see the entry for dbtsnewval in this table. |
dbtxptr |
Returns the value of the text pointer for a column in the current row. |
ct_data_info(CS_GET) (the textptr field of the CS_IODESC). For usage information, see “Client-Library’s CS_IODESC structure”. |
dbtxtimestamp |
Returns the value of the text timestamp for a column in the current row. |
ct_data_info(CS_GET) (the timestamp field of the CS_IODESC). |
dbtxtsnewval |
Returns the new value of a text timestamp after a call to dbwritetext. |
After the application sends a successful text/image update with ct_send_data, the server sends the new timestamp as a parameter (CS_PARAM_RESULT) result set. The application should bind the returned timestamp to the timestamp field of the CS_IODESC structure that is being used to control the text/image update operation. |
dbtxtsput |
Puts the new value of a text timestamp into the specified column of the current row in the DBPROCESS. |
ct_data_info(CS_SET) The timestamp is represented by the timestamp field of the CS_IODESC structure. For a description of how the new text timestamp is retrieved, see the entry for dbtxtsnewval in this table. |
dbuse |
Uses a particular database. |
No direct equivalent. Send a language command containing a Transact-SQL use database command and process the results. |
dbvarylen |
Determines whether the specified regular result column’s data can vary in length. |
None. |
dbversion |
Determines which version of DB-Library is in use. |
ct_config(CS_GET, CS_VER_STRING) gets the Client-Library version string. (dbversion returns the DB-Library version string.) ct_config(CS_GET, CS_VERSION) gets a CS_INT that matches the version with which ct_init was called to initialize Client-Library for this context. |
dbwillconvert |
Determines whether a specific datatype conversion is available within DB-Library. |
cs_willconvert |
dbwritepage |
Writes a page of binary data to the server. |
None. |
dbwritetext |
Sends a text or image value to the server. |
ct_send_data For usage information, see Table 6-6. |
dbxlate |
Translates a character string from one character set to another. |
No direct equivalent. Use the following call sequence to translate strings from one character set to another:
|