1. Trang chủ
  2. » Công Nghệ Thông Tin

PHP Developer''''s Dictionary- P92 potx

5 203 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 363,21 KB

Nội dung

PHP Developer’s Dictionary IT-SC book 455 The ODBC functions enable you to access data not only from databases for which ODBC drivers exist, but also from databases that have borrowed the semantics of ODBC. Such databases include Adabas D, IBM DB2, iODBC, Solid, and Sybase SQL Anywhere. Although ODBC was originally developed by Microsoft, it is now widely available on several platforms including most UNIX/Linux variations. odbc_autocommit() Syntax int odbc_autocommit (int connection_id [, int OnOff]) Description The odbc_autocommit() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, returns the autocommit status for the connection_id if no OnOff value is supplied. A TRUE value means that autocommit is on, and FALSE indicates that it is off or an error occurred. Supply a value for the OnOff parameter to set it accordingly. Turning off autocommit is equivalent to starting a transaction. odbc_binmode() Syntax int odbc_binmode (int result_id, int mode) Description The odbc_binmode() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, determines how binary data should be handled. The possible mode values are as follows: ODBC_BINMODE_PASSTHRU —Passthru BINARY data ODBC_BINMODE_RETURN —Return as is ODBC_BINMODE_CONVERT —Convert to char and return When binary SQL data is converted to character C data, each byte (8 bits) is expressed as two ASCII characters. The ASCII characters are the hexadecimal equivalent for the binary data. If the result_id parameter is set to 0, these settings will be the default for future calls. odbc_close() PHP Developer’s Dictionary IT-SC book 456 Syntax void obdc_close (int connection_id) Description The odbc_close() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, closes the connection referenced by the connection_id unless transactions are still open. In such a case, the connection will remain open. odbc_close_all() Syntax void odbc_close_all(void) Description The odbc_close_all() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, closes all server connections unless transactions are still open. In such a case, the connections will remain open. odbc_commit() Syntax int odbc_commit (int connection _id) Description The odbc_commit() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, causes all pending transactions on the connection_id to be committed. The return value is TRUE on success and FALSE otherwise. odbc_connect() Syntax int odbc_connect (string dsn, string user, string password [, int cursor_type]) PHP Developer’s Dictionary IT-SC book 457 Description The odbc_connect() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, establishes a connection to an ODBC data source. The return value is a connection ID on success and FALSE otherwise. The optional parameter cursor_type can take the values SQL_CUR_USE_IF_NEEDED, SQL_CUR_USE_ODBC, SQL_CUR_USE_DRIVER, and SQL_CUR_DEFAULT. The cursor_type parameter is not normally needed, but can be useful for resolving ODBC driver- related problems. Using SQL_CUR_USE_ODBC will often correct the issue. odbc_cursor() Syntax string odbc_cursor (int result_id) Description The odbc_cursor() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, returns the cursor name for the corresponding result_id . odbc_do() Syntax int odbc_do (int conn_id, string query) Description The odbc_do() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, executes the query on the conn_id connection. odbc_exec() Syntax in odbc_exec (int connection_id, string query_string) Description PHP Developer’s Dictionary IT-SC book 458 The odbc_exec() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, prepares and executes the statement specified in the query_string using the connection_id connection. An ODBC result identifier is returned on success and FALSE otherwise. odbc_execute() Syntax int odbc_execute (int result_id [, array parameters_array]) Description The odbc_execute() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, executes a statement prepared with the odbc_prepare() function. The parameters_array should be used if there are parameters to pass to the statement. The return value is TRUE on success and FALSE otherwise. odbc_fetch_into() Syntax int odbc_fetch_into (int result_id [, int rownumber, array result_array]) Description The odbc_fetch_into() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, fetches a row into the result_array , which should be passed by reference. The array will contain the column values starting at index 0. The rownumber parameter is used to indicate which row in the result set should be fetched, and the result_id references the appropriate result set. odbc_fetch_row() Syntax int odbc_fetch_row (int result_id [, int row_numberM]) Description PHP Developer’s Dictionary IT-SC book 459 The odbc_fetch_row() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, fetches a row from the result set referenced by the result_id so that it may be accessed with the odbc_result() function. The return value is TRUE if a row was fetched and FALSE otherwise. To iterate through the result set, call this function with 1 as the row_number for the first call and omit the row_number for subsequent calls. odbc_field_name() Syntax string odbc_field_name (int result_id, int field_number) Description The odbc_field_name() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, returns the name of the column at the position field_number in the result set referenced by the result_id . The columns are 1- based and FALSE is returned if no columns exist or an error occurs. odbc_field_type() Syntax int odbc_field_type (int result_id, string field_number) Description The odbc_field_type() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, returns the SQL type of the column at the field_ number in the result set referenced by the result_id . Note that the column numbering starts at 1. odbc_field_len() Syntax int odbc_field_len (int result_id, int field_number) Description . int cursor_type]) PHP Developer’s Dictionary IT-SC book 457 Description The odbc_connect() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, establishes. query_string) Description PHP Developer’s Dictionary IT-SC book 458 The odbc_exec() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, prepares and. row_numberM]) Description PHP Developer’s Dictionary IT-SC book 459 The odbc_fetch_row() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, fetches

Ngày đăng: 07/07/2014, 05:20