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

PHP Developer''''s Dictionary- P93 ppsx

5 226 0
Tài liệu đã được kiểm tra trùng lặp

Đ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 364,43 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

The odbc_field_len function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, returns the length of the field referenced by the field_number in the result s

Trang 1

The odbc_field_len() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, returns the length of the field referenced by the

field_number in the result set referenced by the result_id Note that the column

numbering starts at 1

odbc_free_result()

Syntax

int odbc_free_result (int result_id)

Description

The odbc_free_result() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, frees the resources associated with the result set referenced by the result_id Because the result set is automatically freed at the

end of a script's processing, it is normally not necessary to call this function Note that if autocommit is not set, any pending transactions are rolled back when this function is called

odbc_longreadlen()

Syntax

int odbc_longreadlen (int result_id, int length)

Description

The odbc_longreadlen() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, sets the number of bytes returned to PHP, where 0 indicates that long column data is passed through to the client

odbc_num_fields()

Syntax

int odbc_num_fields (int result_id)

Description

Trang 2

The odbc_num_fields() function, which is available from PHP 3.0.6 to PHP 3.0.16 along with PHP 4.0 and higher, returns the number of columns in the result set referenced by the result_id parameter The return value will be FALSE if an error

occurred

odbc_pconnect()

Syntax

int odbc_pconnect (string dsn, string user,

string password [, int cursor_type])

Description

The odbc_pconnect() function, which is available with PHP 3.0.6 and higher, establishes a persistent 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 The connection will remain even after a script's processing is complete If a persistent connection already exists that was created with the same arguments, that connection ID will be returned instead of creating a new one

odbc_prepare()

Syntax

int odbc_prepare (int connection_id, string query_string )

Description

The odbc_prepare() function, which is available from PHP 3.0.6 and higher, prepares the query_string SQL statement for execution and returns an ODBC result identifier if successful The result identifier is used when executing the statement

odbc_num_rows()

Syntax

int odbc_num_rows (int result_id)

Trang 3

Description

The odbc_num_rows() function, which is available with PHP 3.0.6 and higher, is used

to return the number of rows in an ODBC result set referenced by a result_id For

insert, update, and delete statements, the return value is the number of rows affected; for a select statement, the return value is the number of rows available in the result set Note that this function returns –1 for many drivers when used with the result set of a select statement

odbc_result()

Syntax

string odbc_result (int result_id, mixed field)

Description

The odbc_result() function, which is available with PHP 3.0.6 and higher, returns the contents of the field in the result_id result set, at the field position The

field parameter can be either an integer representing the column number (1

based), or a string with the name of the column The return value will be FALSE if the column name or number is invalid

odbc_result_all()

Syntax

int odbc_result_all (int result_id [, string format])

Description

The odbc_result_all() function, which is available with PHP 3.0.6 and higher, returns all the rows in the result set referenced by the result_id parameter, in a

formatted HTML table The optional format parameter represents any additional

formatting that should be used with the table, such as borders or shading

odbc_rollback()

Syntax

int odbc_rollback (int connection_id)

Trang 4

Description

The odbc_rollback() function, which is available with PHP 3.0.6 and higher, rolls back all pending transactions that are tied to the connection_id The return value

is TRUE on success and FALSE otherwise

odbc_setoption()

Syntax

int odbc_setoption (int id, int function, int option, int param)

Description

The odbc_setoption() function, which is available with PHP 3.0.6 and higher, is used to modify the options for a result set or connection The options and results of this function vary with ODBC drivers, so an ODBC programmer's reference should be consulted before using this function The id parameter represents either the result

ID or the connection ID to which you want to apply the parameters The function parameter represents the ODBC function to use, where 0 is SQLSetConnectOption() and 1 is SQLSetStmtOption() The option and param parameters represent the

option and the value you want to set

Oracle

The following functions enable you to access data stored in an Oracle database with interface libraries prior to OCI8 If you need more recent library support, you should use the OCI functions in the next section The following example opens the users table and retrieves user123's password from the user table:

<?

$oracle_db = ora_logon("username@mytnsname","password");

ora_parse (1,"select password from user where username=user123",0); ora_exec(1);

ora_fetch(1);

echo ora_getcolumn (1,"password");

ora_close(1);

ora_logoff ($oracle_db);

?>

ora_bind()

Syntax

Trang 5

int ora_bind (int cursor, string PHP_variable_name,

string SQL_parameter_name, int length, [, int type])

Description

The ora_bind() function, which is available with PHP 3.0 and higher, binds the

PHP_variable_name to the SQL_parameter_name , which must be in the form

':name' The optional type parameter is used to indicate how the SQL parameter will be used A value of 0 (which is the default) indicates in/out A value of 1 represents in and 2 represents out With PHP 3.0.1 and higher, you may also use the constant values ORA_BIND_INOUT, ORA_BIND_IN, and ORA_BIND_OUT instead This function must be called after ora_parse() and before ora_exec()

ora_close()

Syntax

int ora_close (int cursor)

Description

The ora_close() function, which is available with PHP 3.0 and higher, is used to close the cursor The return value is TRUE for success and FALSE otherwise This

function is used in tandem with ora_close()

ora_columnname()

Syntax

string ora_columnname (int cursor, int column)

Description

The ora_columnname() function, which is available with PHP 3.0 and higher, returns the name of the column in the cursor at the column position Note that the name is

returned in all uppercase letters

ora_columntype()

Syntax

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

TỪ KHÓA LIÊN QUAN