<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >dbx Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="函数参考" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="dbmreplace" HREF="function.dbmreplace.html"><LINK REL="NEXT" TITLE="dbx_close" HREF="function.dbx-close.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="reference" 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 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.dbmreplace.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.dbx-close.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.dbx" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XXVII. dbx Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN34917" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="dbx.intro" >简介</A ></H1 ><P > The dbx module is a database abstraction layer (db 'X', where 'X' is a supported database). The dbx functions allow you to access all supported databases using a single calling convention. The dbx-functions themselves do not interface directly to the databases, but interface to the modules that are used to support these databases. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > 本扩展已被移动到 <A HREF="http://pecl.php.net" TARGET="_top" >PECL</A > 库中且自以下版本起不再被绑定到 PHP 中:5.1.0. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="dbx.required" >需求</A ></H1 ><P > To be able to use a database with the dbx-module, the module must be either linked or loaded into PHP, and the database module must be supported by the dbx-module. Currently, the following databases are supported, but others will follow: <P ></P ><UL ><LI ><P > <A HREF="ref.fbsql.html" >FrontBase</A > (available from PHP 4.1.0). </P ></LI ><LI ><P > <A HREF="ref.mssql.html" >Microsoft SQL Server</A > </P ></LI ><LI ><P > <A HREF="ref.mysql.html" >MySQL</A > </P ></LI ><LI ><P > <A HREF="ref.uodbc.html" >ODBC</A > </P ></LI ><LI ><P > <A HREF="ref.pgsql.html" >PostgreSQL</A > </P ></LI ><LI ><P > <A HREF="ref.sybase.html" >Sybase-CT</A > (available from PHP 4.2.0). </P ></LI ><LI ><P > <A HREF="ref.oci8.html" >Oracle (oci8)</A > (available from PHP 4.3.0). </P ></LI ><LI ><P > <A HREF="ref.sqlite.html" >SQLite</A > (PHP 5). </P ></LI ></UL > </P ><P > Documentation for adding additional database support to dbx can be found at <A HREF="http://www.guidance.nl/php/dbx/doc/" TARGET="_top" >http://www.guidance.nl/php/dbx/doc/</A >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="dbx.installation" >安装</A ></H1 ><P > In order to have these functions available, you must compile PHP with dbx support by using the <CODE CLASS="option" >--enable-dbx</CODE > option and all options for the databases that will be used, e.g. for MySQL you must also specify <CODE CLASS="option" >--with-mysql=[DIR]</CODE >. To get other supported databases to work with the dbx-module refer to their specific documentation. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="dbx.configuration" >运行时配置</A ></H1 ><P >这些函数的行为受 <TT CLASS="filename" >php.ini</TT > 的影响。</P ><P > <DIV CLASS="table" ><A NAME="AEN34964" ></A ><P ><B >表 1. DBX Configuration Options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >Default</TH ><TH >Changeable</TH ><TH >Changelog</TH ></TR ></THEAD ><TBODY ><TR ><TD >dbx.colnames_case</TD ><TD >"unchanged"</TD ><TD >PHP_INI_SYSTEM</TD ><TD >Available since PHP 4.3.0.</TD ></TR ></TBODY ></TABLE ></DIV > 有关 PHP_INI_* 常量进一步的细节与定义参见<A HREF="ini.html" >附录 H</A >。 </P ><P >以下是配置选项的简要解释。</P ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><A NAME="ini.dbx.colnames-case" ></A ><CODE CLASS="parameter" >dbx.colnames_case</CODE > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > Columns names can be returned "unchanged" or converted to "uppercase" or "lowercase". This directive can be overridden with a flag to <A HREF="function.dbx-query.html" ><B CLASS="function" >dbx_query()</B ></A >. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="dbx.resources" >资源类型</A ></H1 ><P > There are two resource types used in the dbx module. The first one is the link-<A HREF="language.types.object.html" ><B CLASS="type" >object</B ></A > for a database connection, the second a result-<A HREF="language.types.object.html" ><B CLASS="type" >object</B ></A > which holds the result of a query. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="constants.dbx" >预定义常量</A ></H1 ><P >以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。</P ><P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="constant" ><B >DBX_MYSQL</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_ODBC</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_PGSQL</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_MSSQL</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_FBSQL</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_OCI8</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >) (available from PHP 4.3.0)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_SYBASECT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_SQLITE</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >) (PHP 5)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_PERSISTENT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_RESULT_INFO</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_RESULT_INDEX</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_RESULT_ASSOC</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_RESULT_UNBUFFERED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >) (PHP 5)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_COLNAMES_UNCHANGED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >) (available from PHP 4.3.0)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_COLNAMES_UPPERCASE</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >) (available from PHP 4.3.0)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_COLNAMES_LOWERCASE</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >) (available from PHP 4.3.0)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_CMP_NATIVE</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_CMP_TEXT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_CMP_NUMBER</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_CMP_ASC</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >DBX_CMP_DESC</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ></DL ></DIV ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >目录</B ></DT ><DT ><A HREF="function.dbx-close.html" >dbx_close</A > -- Close an open connection/database</DT ><DT ><A HREF="function.dbx-compare.html" >dbx_compare</A > -- Compare two rows for sorting purposes</DT ><DT ><A HREF="function.dbx-connect.html" >dbx_connect</A > -- Open a connection/database</DT ><DT ><A HREF="function.dbx-error.html" >dbx_error</A > -- Report the error message of the latest function call in the module </DT ><DT ><A HREF="function.dbx-escape-string.html" >dbx_escape_string</A > -- Escape a string so it can safely be used in an sql-statement </DT ><DT ><A HREF="function.dbx-fetch-row.html" >dbx_fetch_row</A > -- Fetches rows from a query-result that had the <TT CLASS="constant" ><B >DBX_RESULT_UNBUFFERED</B ></TT > flag set</DT ><DT ><A HREF="function.dbx-query.html" >dbx_query</A > -- Send a query and fetch all results (if any)</DT ><DT ><A HREF="function.dbx-sort.html" >dbx_sort</A > -- Sort a result from a dbx_query by a custom sort function </DT ></DL ></DIV ></DIV ></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.dbmreplace.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.dbx-close.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >dbmreplace</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >dbx_close</TD ></TR ></TABLE ></DIV ></BODY ></HTML >