★ wanayoo — archive 1999 http://www.php.net/manual/function.odbc-setoption.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to ODBC
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
ODBC
* odbc_autocommit
* odbc_binmode
* odbc_close
* odbc_close_all
* odbc_commit
* odbc_connect
* odbc_cursor
* odbc_do
* odbc_exec
* odbc_execute
* odbc_fetch_into
* odbc_fetch_row
* odbc_field_name
* odbc_field_num
* odbc_field_type
* odbc_field_len
* odbc_field_precision
* odbc_field_scale
* odbc_free_result
* odbc_longreadlen
* odbc_num_fields
* odbc_pconnect
* odbc_prepare
* odbc_num_rows
* odbc_result
* odbc_result_all
* odbc_rollback
* odbc_setoption
* odbc_tables
* odbc_tableprivileges
* odbc_columns
* odbc_columnprivileges
* odbc_gettypeinfo
* odbc_primarykeys
* odbc_foreignkeys
* odbc_procedures
* odbc_procedurecolumns
* odbc_specialcolumns
* odbc_statistics
Manual: odbc_setoption
View the source code for this pageSearch the site



Previous page
 odbc_rollback
 Updated
Sat, 12 Aug 2000
odbc_tables 
Next page


odbc_setoption

(PHP3 >= 3.0.6, PHP4 )

odbc_setoption --  Adjust ODBC settings. Returns false if an error occurs, otherwise true.

Description

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

This function allows fiddling with the ODBC options for a particular connection or query result. It was written to help find work arounds to problems in quirky ODBC drivers. You should probably only use this function if you are an ODBC programmer and understand the effects the various options will have. You will certainly need a good ODBC reference to explain all the different options and values that can be used. Different driver versions support different options.

Because the effects may vary depending on the ODBC driver, use of this function in scripts to be made publicly available is strongly discouraged. Also, some ODBC options are not available to this function because they must be set before the connection is established or the query is prepared. However, if on a particular job it can make PHP work so your boss doesn't tell you to use a commercial product, that's all that really matters.

ID is a connection id or result id on which to change the settings.For SQLSetConnectOption(), this is a connection id. For SQLSetStmtOption(), this is a result id.

Function is the ODBC function to use. The value should be 1 for SQLSetConnectOption() and 2 for SQLSetStmtOption().

Parameter option is the option to set.

Parameter param is the value for the given option.

Example 1. ODBC Setoption Examples


// 1. Option 102 of SQLSetConnectOption() is SQL_AUTOCOMMIT.
//    Value 1 of SQL_AUTOCOMMIT is SQL_AUTOCOMMIT_ON.
//    This example has the same effect as
//    odbc_autocommit($conn, true);

odbc_setoption ($conn, 1, 102, 1);

// 2. Option 0 of SQLSetStmtOption() is SQL_QUERY_TIMEOUT.
//    This example sets the query to timeout after 30 seconds.

$result = odbc_prepare ($conn, $sql);
odbc_setoption ($result, 2, 0, 30);
odbc_execute ($result);
      


 About Notes


Previous page
 odbc_rollback
 Updated
Sat, 12 Aug 2000
odbc_tables 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.