Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 1957

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>odbc_setoption</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Unified ODBC functions"
HREF="ref.odbc.html"><LINK
REL="PREVIOUS"
TITLE="odbc_rollback"
HREF="function.odbc-rollback.html"><LINK
REL="NEXT"
TITLE="odbc_specialcolumns"
HREF="function.odbc-specialcolumns.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.odbc-rollback.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.odbc-specialcolumns.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.odbc-setoption"
></A
>odbc_setoption</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN65808"
></A
><P
>    (PHP 3&#62;= 3.0.6, PHP 4 )</P
>odbc_setoption&nbsp;--&nbsp;
     Adjust ODBC settings. Returns <TT
CLASS="constant"
><B
>FALSE</B
></TT
> if an error occurs, otherwise
     <TT
CLASS="constant"
><B
>TRUE</B
></TT
>.
    </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN65813"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>odbc_setoption</B
> ( resource id, int function, int option, int param)<BR
></BR
><P
>&#13;     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.
    </P
><P
>&#13;     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.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>id</I
></TT
> 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.
    </P
><P
>&#13;     <TT
CLASS="parameter"
><I
>Function</I
></TT
> is the ODBC function to use. The
     value should be 1 for SQLSetConnectOption() and 2 for
     SQLSetStmtOption().
    </P
><P
>&#13;     Parameter <TT
CLASS="parameter"
><I
>option</I
></TT
> is the option to set.</P
><P
>&#13;     Parameter <TT
CLASS="parameter"
><I
>param</I
></TT
> is the value for the
     given <TT
CLASS="parameter"
><I
>option</I
></TT
>.
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN65841"
></A
><P
><B
>Example 1. ODBC Setoption Examples</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>// 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);</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.odbc-rollback.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.odbc-specialcolumns.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>odbc_rollback</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.odbc.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>odbc_specialcolumns</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>