<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Microsoft SQL Server 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="udm_set_agent_param" HREF="function.udm-set-agent-param.html"><LINK REL="NEXT" TITLE="mssql_bind" HREF="function.mssql-bind.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.udm-set-agent-param.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.mssql-bind.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.mssql" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XCII. Microsoft SQL Server Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN127727" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="mssql.intro" >简介</A ></H1 ><P > These functions allow you to access MS SQL Server database. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="mssql.requirements" >需求</A ></H1 ><P > Requirements for Win32 platforms. </P ><P > The extension requires the MS SQL Client Tools to be installed on the system where PHP is installed. The Client Tools can be installed from the MS SQL Server CD or by copying <TT CLASS="filename" >ntwdblib.dll</TT > from <TT CLASS="filename" >\winnt\system32</TT > on the server to <TT CLASS="filename" >\winnt\system32</TT > on the PHP box. Copying <TT CLASS="filename" >ntwdblib.dll</TT > will only provide access. Configuration of the client will require installation of all the tools. </P ><P > Requirements for Unix/Linux platforms. </P ><P > To use the MSSQL extension on Unix/Linux, you first need to build and install the FreeTDS library. Source code and installation instructions are available at the FreeTDS home page: <A HREF="http://www.freetds.org/" TARGET="_top" >http://www.freetds.org/</A > </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >注意: </B > In Windows, the DBLIB from Microsoft is used. Functions that return a column name are based on the <TT CLASS="literal" >dbcolname()</TT > function in DBLIB. DBLIB was developed for SQL Server 6.x where the max identifier length is 30. For this reason, the maximum column length is 30 characters. On platforms where FreeTDS is used (Linux), this is not a problem. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="mssql.installation" >安装</A ></H1 ><P > The MSSQL extension is enabled by adding extension=php_mssql.dll to <TT CLASS="filename" >php.ini</TT >. </P ><P > To get these functions to work, you have to compile PHP with <CODE CLASS="option" >--with-mssql[=DIR]</CODE >, where DIR is the FreeTDS install prefix. And FreeTDS should be compiled using <CODE CLASS="option" >--enable-msdblib</CODE >. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="mssql.configuration" >运行时配置</A ></H1 ><P >这些函数的行为受 <TT CLASS="filename" >php.ini</TT > 的影响。</P ><P > <DIV CLASS="table" ><A NAME="AEN127757" ></A ><P ><B >表 1. MS SQL Server 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 >mssql.allow_persistent</TD ><TD >"1"</TD ><TD >PHP_INI_SYSTEM</TD ><TD > </TD ></TR ><TR ><TD >mssql.max_persistent</TD ><TD >"-1"</TD ><TD >PHP_INI_SYSTEM</TD ><TD > </TD ></TR ><TR ><TD >mssql.max_links</TD ><TD >"-1"</TD ><TD >PHP_INI_SYSTEM</TD ><TD > </TD ></TR ><TR ><TD >mssql.min_error_severity</TD ><TD >"10"</TD ><TD >PHP_INI_ALL</TD ><TD > </TD ></TR ><TR ><TD >mssql.min_message_severity</TD ><TD >"10"</TD ><TD >PHP_INI_ALL</TD ><TD > </TD ></TR ><TR ><TD >mssql.compatability_mode</TD ><TD >"0"</TD ><TD >PHP_INI_ALL</TD ><TD > </TD ></TR ><TR ><TD >mssql.connect_timeout</TD ><TD >"5"</TD ><TD >PHP_INI_ALL</TD ><TD > </TD ></TR ><TR ><TD >mssql.timeout</TD ><TD >"60"</TD ><TD >PHP_INI_ALL</TD ><TD >Available since PHP 4.1.0.</TD ></TR ><TR ><TD >mssql.textsize</TD ><TD >"-1"</TD ><TD >PHP_INI_ALL</TD ><TD > </TD ></TR ><TR ><TD >mssql.textlimit</TD ><TD >"-1"</TD ><TD >PHP_INI_ALL</TD ><TD > </TD ></TR ><TR ><TD >mssql.batchsize</TD ><TD >"0"</TD ><TD >PHP_INI_ALL</TD ><TD >Available since PHP 4.0.4.</TD ></TR ><TR ><TD >mssql.datetimeconvert</TD ><TD >"1"</TD ><TD >PHP_INI_ALL</TD ><TD >Available since PHP 4.2.0.</TD ></TR ><TR ><TD >mssql.secure_connection</TD ><TD >"0"</TD ><TD >PHP_INI_SYSTEM</TD ><TD >Available since PHP 4.3.0.</TD ></TR ><TR ><TD >mssql.max_procs</TD ><TD >"-1"</TD ><TD >PHP_INI_ALL</TD ><TD >Available since PHP 4.3.0.</TD ></TR ></TBODY ></TABLE ></DIV > 有关 PHP_INI_* 常量进一步的细节与定义参见<A HREF="ini.html" >附录 H</A >。 </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="mssql.resources" >资源类型</A ></H1 ><P > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="mssql.constants" >预定义常量</A ></H1 ><P >以下常量由本扩展模块定义,因此只有在本扩展模块被编译到 PHP 中,或者在运行时被动态加载后才有效。</P ><P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="constant" ><B >MSSQL_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 >MSSQL_NUM</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >MSSQL_BOTH</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLTEXT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLVARCHAR</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLCHAR</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLINT1</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLINT2</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLINT4</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLBIT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >SQLFLT8</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.mssql-bind.html" >mssql_bind</A > -- Adds a parameter to a stored procedure or a remote stored procedure</DT ><DT ><A HREF="function.mssql-close.html" >mssql_close</A > -- Close MS SQL Server connection</DT ><DT ><A HREF="function.mssql-connect.html" >mssql_connect</A > -- Open MS SQL server connection</DT ><DT ><A HREF="function.mssql-data-seek.html" >mssql_data_seek</A > -- Moves internal row pointer</DT ><DT ><A HREF="function.mssql-execute.html" >mssql_execute</A > -- Executes a stored procedure on a MS SQL server database</DT ><DT ><A HREF="function.mssql-fetch-array.html" >mssql_fetch_array</A > -- Fetch a result row as an associative array, a numeric array, or both</DT ><DT ><A HREF="function.mssql-fetch-assoc.html" >mssql_fetch_assoc</A > -- Returns an associative array of the current row in the result</DT ><DT ><A HREF="function.mssql-fetch-batch.html" >mssql_fetch_batch</A > -- Returns the next batch of records</DT ><DT ><A HREF="function.mssql-fetch-field.html" >mssql_fetch_field</A > -- Get field information</DT ><DT ><A HREF="function.mssql-fetch-object.html" >mssql_fetch_object</A > -- Fetch row as object</DT ><DT ><A HREF="function.mssql-fetch-row.html" >mssql_fetch_row</A > -- Get row as enumerated array</DT ><DT ><A HREF="function.mssql-field-length.html" >mssql_field_length</A > -- Get the length of a field</DT ><DT ><A HREF="function.mssql-field-name.html" >mssql_field_name</A > -- Get the name of a field</DT ><DT ><A HREF="function.mssql-field-seek.html" >mssql_field_seek</A > -- Seeks to the specified field offset</DT ><DT ><A HREF="function.mssql-field-type.html" >mssql_field_type</A > -- Gets the type of a field</DT ><DT ><A HREF="function.mssql-free-result.html" >mssql_free_result</A > -- Free result memory</DT ><DT ><A HREF="function.mssql-free-statement.html" >mssql_free_statement</A > -- Free statement memory</DT ><DT ><A HREF="function.mssql-get-last-message.html" >mssql_get_last_message</A > -- Returns the last message from the server</DT ><DT ><A HREF="function.mssql-guid-string.html" >mssql_guid_string</A > -- Converts a 16 byte binary GUID to a string</DT ><DT ><A HREF="function.mssql-init.html" >mssql_init</A > -- Initializes a stored procedure or a remote stored procedure</DT ><DT ><A HREF="function.mssql-min-error-severity.html" >mssql_min_error_severity</A > -- Sets the lower error severity</DT ><DT ><A HREF="function.mssql-min-message-severity.html" >mssql_min_message_severity</A > -- Sets the lower message severity</DT ><DT ><A HREF="function.mssql-next-result.html" >mssql_next_result</A > -- Move the internal result pointer to the next result</DT ><DT ><A HREF="function.mssql-num-fields.html" >mssql_num_fields</A > -- Gets the number of fields in result</DT ><DT ><A HREF="function.mssql-num-rows.html" >mssql_num_rows</A > -- Gets the number of rows in result</DT ><DT ><A HREF="function.mssql-pconnect.html" >mssql_pconnect</A > -- Open persistent MS SQL connection</DT ><DT ><A HREF="function.mssql-query.html" >mssql_query</A > -- Send MS SQL query</DT ><DT ><A HREF="function.mssql-result.html" >mssql_result</A > -- Get result data</DT ><DT ><A HREF="function.mssql-rows-affected.html" >mssql_rows_affected</A > -- Returns the number of records affected by the query</DT ><DT ><A HREF="function.mssql-select-db.html" >mssql_select_db</A > -- Select MS SQL database</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.udm-set-agent-param.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.mssql-bind.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >udm_set_agent_param</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >mssql_bind</TD ></TR ></TABLE ></DIV ></BODY ></HTML >