First commit First commit for the SQLSRV and PDO_SQLSRV extension documentation.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@313179 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jonathan Guerin 2011-07-12 17:41:34 +00:00
parent 7acae97626
commit 1ce857a993
37 changed files with 5404 additions and 0 deletions

View file

@ -57,6 +57,10 @@
<row>
<entry><link linkend="ref.pdo-sqlite">PDO_SQLITE</link></entry>
<entry>SQLite 3 and SQLite 2</entry>
</row>
<row>
<entry><link linkend="ref.pdo-sqlsrv">PDO_SQLSRV</link></entry>
<entry>Microsoft SQL Server / SQL Azure</entry>
</row>
<row>
<entry><link linkend="ref.pdo-4d">PDO_4D</link></entry>
@ -74,6 +78,7 @@
&reference.pdo-ibm.reference;
&reference.pdo-informix.reference;
&reference.pdo-mysql.reference;
&reference.pdo-sqlsrv.reference;
&reference.pdo-oci.reference;
&reference.pdo-odbc.reference;
&reference.pdo-pgsql.reference;

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="ref.pdo-sqlsrv.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
The PDO_SQLSRV extension is enabled by adding appropriate DLL file to your PHP
extension directory and the corresponding entry to the &php.ini; file. The
PDO_SQLSRV download comes with several driver files. Which driver file you
use will depend on 3 factors: the PHP version you are using, whether you are
using thread-safe or non-thread-safe PHP, and whether your PHP installation
was compiled with the VC6 or VC9 compiler. For example, if you are running
PHP 5.3, you are using non-thread-safe PHP, and your PHP installation was
compiled with the VC9 compiler, you should use the php_pdo_sqlsrv_53_nts_vc9.dll
file. (You should use a non-thread-safe version compiled with the VC9 compiler
if you are using IIS as your web server). If you are running PHP 5.2, you are
using thread-safe PHP, and your PHP installation was compiled with the VC6
compiler, you should use the php_pdo_sqlsrv_52_ts_vc6.dll file.
</para>
<para>
For more information about system requirements, see
<link xlink:href="&url.sqlsrv.system.requirements;">SQLSRV System Requirements</link>.
</para>
<para>
The PDO_SQLSRV extension is only compatible with PHP running on Windows.
</para>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,179 @@
<?xml version='1.0' encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="pdo-sqlsrv.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&pdo.driver-constants;
<variablelist>
<varlistentry>
<term>
<constant>PDO::SQLSRV_TXN_READ_UNCOMMITTED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation.
This constant sets the transaction isolation level for the connection to
Read Uncommitted.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_TXN_READ_COMMITTED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation.
This constant sets the transaction isolation level for the connection to
Read Committed.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_TXN_REPEATABLE_READ</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation.
This constant sets the transaction isolation level for the connection to
Repeateable Read.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_TXN_SNAPSHOT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation.
This constant sets the transaction isolation level for the connection to Snapshot.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_TXN_SERIALIZABLE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation.
This constant sets the transaction isolation level for the connection to
Serializable.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_ENCODING_BINARY</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that data is sent/retrieved as a raw byte stream to/from the server
without performing encoding or translation. This constant can be passed to
PDOStatement::setAttribute, PDO::prepare, PDOStatement::bindColumn, and
PDOStatement::bindParam.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_ENCODING_SYSTEM</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that data is sent/retrieved to/from the server as 8-bit characters
as specified in the code page of the Windows locale that is set on the system.
Any multi-byte characters or characters that do not map into this code page
are substituted with a single byte question mark (?) character. This constant
can be passed to PDOStatement::setAttribute, PDO::setAttribute, PDO::prepare,
PDOStatement::bindColumn, and PDOStatement::bindParam.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_ENCODING_UTF8</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that data is sent/retrieved to/from the server in UTF-8 encoding.
This is the default encoding. This constant can be passed to
PDOStatement::setAttribute, PDO::setAttribute, PDO::prepare,
PDOStatement::bindColumn, and PDOStatement::bindParam.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_ENCODING_DEFAULT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that data is sent/retrieved to/from the server according to
PDO::SQLSRV_ENCODING_SYSTEM if specified during connection. The connection's
encoding is used if specified in a prepare statement. This constant can be
passed to PDOStatement::setAttribute, PDO::setAttribute, PDO::prepare,
PDOStatement::bindColumn, and PDOStatement::bindParam.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_ATTR_QUERY_TIMEOUT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
A non-negative integer representing the timeout period, in seconds. Zero (0)
is the default and means no timeout. This constant can be passed to
PDOStatement::setAttribute, PDO::setAttribute, and PDO::prepare.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>PDO::SQLSRV_ATTR_DIRECT_QUERY</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Indicates that a query should be executed directly, without being prepared.
This constant can be passed to PDO::setAttribute, and PDO::prepare. For more
information, see
<link xlink:href="&url.sqlsrv.direct.execution;">Direct and Prepared Statement Execution</link>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,225 @@
<?xml version='1.0' encoding="utf-8"?>
<!-- $Revision$ -->
<!-- Purpose: database.vendors -->
<!-- Membership: bundled, external, pecl -->
<reference xml:id="ref.pdo-sqlsrv" xmlns="http://docbook.org/ns/docbook">
<title>Microsoft SQL Server Functions (PDO_SQLSRV)</title>
<titleabbrev>MS SQL Server (PDO)</titleabbrev>
<partintro>
<section xml:id="pdo-sqlsrv.intro">
&reftitle.intro;
<para>
PDO_SQLSRV is a driver that implements the <link linkend="intro.pdo">PHP
Data Objects (PDO) interface</link>
to enable access from PHP to MS SQL Server (starting with SQL Server 2005)
and SQL Azure databases.
</para>
</section>
&reference.pdo-sqlsrv.configure;
&reference.pdo-sqlsrv.constants;
</partintro>
<refentry xml:id="ref.pdo-sqlsrv.connection">
<refnamediv>
<refname>PDO_SQLSRV DSN</refname>
<refpurpose>Connecting to MS SQL Server and SQL Azure databases</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
The PDO_SQLSRV Data Source Name (DSN) is composed of the following elements:
<variablelist>
<varlistentry>
<term>DSN prefix</term>
<listitem>
<para>
The DSN prefix is <userinput>sqlsrv:</userinput>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>APP</constant></term>
<listitem>
<para>
The application name used in tracing.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>ConnectionPooling</constant></term>
<listitem>
<para>
Specifies whether the connection is assigned from a connection pool
(1 or &true;) or not (0 or &false;).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>Database</constant></term>
<listitem>
<para>
The name of the database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>Encrypt</constant></term>
<listitem>
<para>
Specifies whether the communication with SQL Server is encrypted
(1 or &true;) or unencrypted (0 or &false;).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>Failover_Partner</constant></term>
<listitem>
<para>
Specifies the server and instance of the database's mirror (if enabled
and configured) to use when the primary server is unavailable.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>LoginTimeout</constant></term>
<listitem>
<para>
Specifies the number of seconds to wait before failing the connection attempt.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>MultipleActiveResultSets</constant></term>
<listitem>
<para>
Disables or explicitly enables support for multiple active Result sets (MARS).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>QuotedId</constant></term>
<listitem>
<para>
Specifies whether to use SQL-92 rules for quoted identifiers (1 or &true;)
or to use legacy Transact-SQL rules (0 or false).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>Server</constant></term>
<listitem>
<para>
The name of the database server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>TraceFile</constant></term>
<listitem>
<para>
Specifies the path for the file used for trace data.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>TraceOn</constant></term>
<listitem>
<para>
Specifies whether ODBC tracing is enabled (1 or &true;) or disabled
(0 or &false;) for the connection being established.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>TransactionIsolation</constant></term>
<listitem>
<para>
Specifies the transaction isolation level. The accepted values for this
option are PDO::SQLSRV_TXN_READ_UNCOMMITTED, PDO::SQLSRV_TXN_READ_COMMITTED,
PDO::SQLSRV_TXN_REPEATABLE_READ, PDO::SQLSRV_TXN_SNAPSHOT, and
PDO::SQLSRV_TXN_SERIALIZABLE.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>TrustServerCertificate</constant></term>
<listitem>
<para>
Specifies whether the client should trust (1 or &true;) or reject
(0 or &false;) a self-signed server certificate.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>WSID</constant></term>
<listitem>
<para>
Specifies the name of the computer for tracing.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>PDO_SQLSRV DSN examples</title>
<para>
The following example shows how to connecto to a specified MS SQL Server database:
<programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=localhost;Database=testdb", "UserName", "Password");
]]>
</programlisting>
</para>
<para>
The following example shows how to connect to a MS SQL Server database on
a specified port:
<programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=localhost,1521;Database=testdb", "UserName", "Password");
]]>
</programlisting>
</para>
<para>
The following example shows how to connecto to a SQL Azure database with
server ID 12345abcde. Note that when you connect to SQL Azure with PDO,
your username will be UserName@12345abcde (UserName@ServerId).
<programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=12345abcde.database.windows.net;Database=testdb", "UserName@12345abcde", "Password");
]]>
</programlisting>
</para>
</example>
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

48
reference/sqlsrv/book.xml Normal file
View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.sqlsrv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Microsoft SQL Server Driver for PHP</title>
<titleabbrev>SQLSRV</titleabbrev>
<!-- {{{ preface -->
<preface xml:id="intro.sqlsrv">
&reftitle.intro;
<para>
The SQLSRV extension allows you to access Microsoft SQL Server and SQL Azure
databases when running PHP on Windows.
</para>
<para>
The SQLSRV extension is supported by Microsoft and available for download here:
<link xlink:href="&url.sqlsrv;">&url.sqlsrv;</link>.
</para>
</preface>
<!-- }}} -->
&reference.sqlsrv.setup;
&reference.sqlsrv.constants;
&reference.sqlsrv.reference;
</book>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="sqlsrv.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.install;
<para>
The SQLSRV extension is enabled by adding appropriate DLL file to your PHP
extension directory and the corresponding entry to the &php.ini; file. The
SQLSRV download comes with several driver files. Which driver file you use
will depend on 3 factors: the PHP version you are using, whether you are using
thread-safe or non-thread-safe PHP, and whether your PHP installation was
compiled with the VC6 or VC9 compiler. For example, if you are running PHP 5.3,
you are using non-thread-safe PHP, and your PHP installation was compiled with
the VC9 compiler, you should use the php_sqlsrv_53_nts_vc9.dll file. (You should
use a non-thread-safe version compiled with the VC9 compiler if you are using
IIS as your web server). If you are running PHP 5.2, you are using thread-safe
PHP, and your PHP installation was compiled with the VC6 compiler, you should
use the php_sqlsrv_52_ts_vc6.dll file.
</para>
<para>
For more information about SQLSRV requirements, see
<link xlink:href="&url.sqlsrv.system.requirements;">SQLSRV System Requirements</link>.
</para>
<para>
The SQLSRV extension is only compatible with PHP running on Windows.
</para>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,982 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<appendix xml:id="sqlsrv.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&extension.constants;
<para>
<variablelist>
<varlistentry>
<term>
<constant>SQLSRV_FETCH_ASSOC</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Forces <function>sqlsrv_fetch_array</function> to return an associative
array when passed as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_FETCH_NUMERIC</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Forces <function>sqlsrv_fetch_array</function> to return an array with
numeric when passed as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_FETCH_BOTH</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Forces <function>sqlsrv_fetch_array</function> to return an array with both
associative and numeric keys when passed as a parameter (the default behavior).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_ERR_ALL</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Forces <function>sqlsrv_errors</function> to return both errors and warings
when passed as a parameter (the default behavior).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_ERR_ERRORS</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Forces <function>sqlsrv_errors</function> to return errors only (no warnings)
when passed as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_ERR_WARNINGS</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Forces <function>sqlsrv_errors</function> to return warnings only (no errors)
when passed as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SYSTEM_ALL</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Turns on logging of all subsystems when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SYSTEM_CONN</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Turns on logging of connection activity when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SYSTEM_INIT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Turns on logging of initialization activity when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SYSTEM_OFF</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Turns off logging of all subsystems when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SYSTEM_STMT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Turns on logging of statement activity when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SYSTEM_UTIL</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Turns on logging of error function activity when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SEVERITY_ALL</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that errors, warnings, and notices will be logged
when passed to <function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SEVERITY_ERROR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that errors will be logged when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SEVERITY_NOTICE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that notices will be logged when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_LOG_SEVERITY_WARNING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that warnings will be logged when passed to
<function>sqlsrv_configure</function> as a parameter.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_NULLABLE_YES</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Indicates that a column is nullable.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_NULLABLE_NO</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Indicates that a column is not nullable.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_NULLABLE_UNKNOWN</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Indicates that it is not known if a column is nullable.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PARAM_IN</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Indicates an input parameter when passed to <function>sqlsrv_query</function>
or <function>sqlsrv_prepare</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PARAM_INOUT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Indicates a bidirectional parameter when passed to <function>sqlsrv_query</function>
or <function>sqlsrv_prepare</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PARAM_OUT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Indicates an output parameter when passed to <function>sqlsrv_query</function> or
<function>sqlsrv_prepare</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PHPTYPE_INT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies an integer PHP data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PHPTYPE_DATETIME</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies a datetime PHP data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PHPTYPE_FLOAT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies a float PHP data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PHPTYPE_STREAM</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies a PHP stream. This constant works like a function and accepts an
encoding constant. See the SQLSRV_ENC_* constants. For usage information, see
<link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_PHPTYPE_STRING</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies a string PHP data type. This constant works like a function and
accepts an encoding constant. See the SQLSRV_ENC_* constants. For usage information,
see <link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_ENC_BINARY</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that data is returned as a raw byte stream from the server without
performing encoding or translation. For usage information, see
<link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_ENC_CHAR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Data is returned in 8-bit characters as specified in the code page of the
Windows locale that is set on the system. Any multi-byte characters or characters
that do not map into this code page are substituted with a single byte question
mark (?) character. This is the default encoding. For usage information,
see <link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>UTF-8</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies that data is returned with UTF-8 encoding. For usage information,
see <link xlink:href="&url.sqlsrv.specify.phptype;">How to: Specify PHP Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_BIGINT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the bigint SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_BINARY</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the binary SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_BIT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the bit SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_CHAR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the char SQL Server data type. This constant works like a function
and accepts a parameter indicating the number characters. For usage information,
see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_DATE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the date SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_DATETIME</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the datetime SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_DATETIME2</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the datetime2 SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_DATETIMEOFFSET</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the datetimeoffset SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_DECIMAL</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the decimal SQL Server data type. This constant works like a function
and accepts two parameters indicating (in order) precision and scale. For usage information,
see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_FLOAT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the float SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_IMAGE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the image SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_INT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the int SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_MONEY</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the money SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_NCHAR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the nchar SQL Server data type. This constant works like a function
and accepts a single parameter indicating the character count. For usage information,
see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_NUMERIC</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the numeric SQL Server data type. This constant works like a function
and accepts two parameter indicating (in order) precision and scale. For usage
information, see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_NVARCHAR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the nvarchar SQL Server data type. This constant works like a function
and accepts a single parameter indicating the character count. For usage
information, see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_NVARCHAR('max')</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the nvarchar(MAX) SQL Server data type. For usage information,
see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_NTEXT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the ntext SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_REAL</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the real SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_SMALLDATETIME</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the smalldatetime SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_SMALLINT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the smallint SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_SMALLMONEY</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the smallmoney SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_TEXT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the text SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_TIME</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the time SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_TIMESTAMP</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the timestamp SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_TINYINT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the tinyint SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_UNIQUEIDENTIFIER</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the uniqueidentifier SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_UDT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the UDT SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_VARBINARY</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the varbinary SQL Server data type. This constant works like a function
and accepts a single parameter indicating the byte count. For usage information,
see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_VARBINARY('max')</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the varbinary(MAX) SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_VARCHAR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the varchar SQL Server data type. This constant works like a function
and accepts a single parameter indicating the character count. For usage information,
see <link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_VARCHAR('max')</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the varchar(MAX) SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SQLTYPE_XML</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Describes the XML SQL Server data type. For usage information, see
<link xlink:href="&url.sqlsrv.specify.sqltype;">How to: Specify SQL Types</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_TXN_READ_UNCOMMITTED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a transaction isolation level of READ UNCOMMITTED. This value is
used to set the TransactionIsolation level in the $connectionOptions arrary
passed to <function>sqlsrv_connect</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_TXN_READ_COMMITTED</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a transaction isolation level of READ COMMITTED. This value is
used to set the TransactionIsolation level in the $connectionOptions arrary
passed to <function>sqlsrv_connect</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_TXN_REPEATABLE_READ</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a transaction isolation level of REPEATABLE READ. This value is
used to set the TransactionIsolation level in the $connectionOptions arrary
passed to <function>sqlsrv_connect</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_TXN_SNAPSHOT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a transaction isolation level of SNAPSHOT. This value is used to
set the TransactionIsolation level in the $connectionOptions arrary passed
to <function>sqlsrv_connect</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_TXN_READ_SERIALIZABLE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a transaction isolation level of SERIALIZABLE. This value is used
to set the TransactionIsolation level in the $connectionOptions arrary passed
to <function>sqlsrv_connect</function>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_CURSOR_FORWARD</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a forward-only cursor. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_CURSOR_STATIC</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a static cursor. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_DYNAMIC</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a dynamic cursor. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_CURSOR_KEYSET</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Inidicates a keyset cursor. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SCROLL_NEXT</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies which row to select in a result set. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type and Select Rows</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SCROLL_PRIOR</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies which row to select in a result set. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type and Select Rows</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SCROLL_FIRST</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies which row to select in a result set. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type and Select Rows</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SCROLL_LAST</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies which row to select in a result set. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type and Select Rows</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SCROLL_ABSOLUTE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies which row to select in a result set. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type and Select Rows</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<constant>SQLSRV_SCROLL_RELATIVE</constant>
(<type>integer</type>)
</term>
<listitem>
<simpara>
Specifies which row to select in a result set. For usage information, see
<link xlink:href="&url.sqlsrv.specify.cursortype;">How to: Specify a Cursor Type and Select Rows</link>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
</appendix>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,26 @@
&reference.sqlsrv.functions.sqlsrv-begin-transaction;
&reference.sqlsrv.functions.sqlsrv-cancel;
&reference.sqlsrv.functions.sqlsrv-client-info;
&reference.sqlsrv.functions.sqlsrv-close;
&reference.sqlsrv.functions.sqlsrv-commit;
&reference.sqlsrv.functions.sqlsrv-configure;
&reference.sqlsrv.functions.sqlsrv-connect;
&reference.sqlsrv.functions.sqlsrv-errors;
&reference.sqlsrv.functions.sqlsrv-execute;
&reference.sqlsrv.functions.sqlsrv-fetch-array;
&reference.sqlsrv.functions.sqlsrv-fetch-object;
&reference.sqlsrv.functions.sqlsrv-fetch;
&reference.sqlsrv.functions.sqlsrv-field-metadata;
&reference.sqlsrv.functions.sqlsrv-free-stmt;
&reference.sqlsrv.functions.sqlsrv-get-config;
&reference.sqlsrv.functions.sqlsrv-get-field;
&reference.sqlsrv.functions.sqlsrv-has-rows;
&reference.sqlsrv.functions.sqlsrv-next-result;
&reference.sqlsrv.functions.sqlsrv-num-fields;
&reference.sqlsrv.functions.sqlsrv-num-rows;
&reference.sqlsrv.functions.sqlsrv-prepare;
&reference.sqlsrv.functions.sqlsrv-query;
&reference.sqlsrv.functions.sqlsrv-rollback;
&reference.sqlsrv.functions.sqlsrv-rows-affected;
&reference.sqlsrv.functions.sqlsrv-send-stream-data;
&reference.sqlsrv.functions.sqlsrv-server-info;

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-begin-transaction" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_begin_transaction</refname>
<refpurpose>Begins a database transaction</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_begin_transaction</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
The transaction begun by <function>sqlsrv_begin_transaction</function> includes
all statements that were executed after the call to
<function>sqlsrv_begin_transaction</function> and before calls to
<function>sqlsrv_rollback</function> or <function>sqlsrv_commit</function>.
Explicit transactions should be started and committed or rolled back using
these functions instead of executing SQL statements that begin and committ/roll
back transactions. For more information, see
<link xlink:href="&url.sqlsrv.transaction.handling;">SQLSRV Transactions</link>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection resource returned by a call to <function>sqlsrv_connect</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_begin_transaction</function> example</title>
<para>
The following example demonstrates how to use
<function>sqlsrv_begin_transaction</function> together with
<function>sqlsrv_commit</function> and <function>sqlsrv_rollback</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Begin the transaction. */
if ( sqlsrv_begin_transaction( $conn ) === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Initialize parameter values. */
$orderId = 1; $qty = 10; $productId = 100;
/* Set up and execute the first query. */
$sql1 = "INSERT INTO OrdersTable (ID, Quantity, ProductID)
VALUES (?, ?, ?)";
$params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
/* If both queries were successful, commit the transaction. */
/* Otherwise, rollback the transaction. */
if( $stmt1 && $stmt2 ) {
sqlsrv_commit( $conn );
echo "Transaction committed.<br />";
} else {
sqlsrv_rollback( $conn );
echo "Transaction rolled back.<br />";
}
?>
]]>
</programlisting>
&example.outputs.similar;
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_commit</function></member>
<member><function>sqlsrv_rollback</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-cancel" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_cancel</refname>
<refpurpose>Cancels a statement</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_cancel</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Cancels a statement. Any results associated with the statement that have not
been consumed are deleted. After <function>sqlsrv_cancel</function> has been
called, the specified statement can be re-executed if it was created with
<function>sqlsrv_prepare</function>. Calling <function>sqlsrv_cancel</function>
is not necessary if all the results associated with the statement have been
consumed.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement resource to be cancelled.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_cancel</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT Sales FROM Table_1";
$stmt = sqlsrv_prepare( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
if( sqlsrv_execute( $stmt ) === false) {
die( print_r( sqlsrv_errors(), true));
}
$salesTotal = 0;
$count = 0;
while( ($row = sqlsrv_fetch_array( $stmt)) && $salesTotal <=100000)
{
$qty = $row[0];
$price = $row[1];
$salesTotal += ( $price * $qty);
$count++;
}
echo "$count sales accounted for the first $$salesTotal in revenue.<br />";
// Cancel the pending results. The statement can be reused.
sqlsrv_cancel( $stmt);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
The main difference between <function>sqlsrv_cancel</function> and
<function>sqlsrv_free_stmt</function> is that a statement resource cancelled with
<function>sqlsrv_cancel</function> can be re-executed if it was created with
<function>sqlsrv_prepare</function>. A statement resource cancelled with
<function>sqlsrv_free_statement</function> cannot be re-executed.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_free_stmt</function></member>
<member><function>sqlsrv_prepare</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-client-info" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_client_info</refname>
<refpurpose>Returns information about the client and specified connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>sqlsrv_client_info</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
Returns information about the client and specified connection
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection about which information is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an associative array with keys described in the table below.
Returns &false; otherwise.
<table>
<title>Array returned by sqlsrv_client_info</title>
<tgroup cols="2">
<thead>
<row>
<entry>Key</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>DriverDllName</entry>
<entry>SQLNCLI10.DLL</entry>
</row>
<row>
<entry>DriverODBCVer</entry>
<entry>ODBC version (xx.yy)</entry>
</row>
<row>
<entry>DriverVer</entry>
<entry>SQL Server Native Client DLL version (10.5.xxx)</entry>
</row>
<row>
<entry>ExtensionVer</entry>
<entry>php_sqlsrv.dll version (2.0.xxx.x)</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_client_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connOptions = array("UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connOptions );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
if( $client_info = sqlsrv_client_info( $conn)) {
foreach( $client_info as $key => $value) {
echo $key.": ".$value."<br />";
}
} else {
echo "Error in retrieving client info.<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_server_info</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-close" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_close</refname>
<refpurpose>Closes an open connection and releases resourses associated with the connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_close</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
Closes an open connection and releases resourses associated with the connection.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection to be closed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_close</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpres";
$connOptions = array("UID"=>"username", "PWD"=>"password", "Database"=>"dbname");
$conn = sqlsrv_connect( $serverName, $connOptions );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
//-------------------------------------
// Perform database operations here.
//-------------------------------------
// Close the connection.
sqlsrv_close( $conn );
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_connect</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-commit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_commit</refname>
<refpurpose>Commits a transaction that was begun with <function>sqlsrv_begin_transaction</function></refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_commit</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
Commits a transaction that was begun with <function>sqlsrv_begin_transaction</function>.
The connection is returned to auto-commit mode after <function>sqlsrv_commit</function>
is called. The transaction that is committed includes all statements that were
executed after the call to <function>sqlsrv_begin_transaction</function>.
Explicit transactions should be started and committed or rolled back using these
functions instead of executing SQL statements that begin and committ/roll back
transactions. For more information, see
<link xlink:href="&url.sqlsrv.transaction.handling;">SQLSRV Transactions</link>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection on which the transaction is to be committed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_commit</function> example</title>
<para>
The following example demonstrates how to use <function>sqlsrv_commit</function>
together with <function>sqlsrv_begin_transaction</function> and
<function>sqlsrv_rollback</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Begin the transaction. */
if ( sqlsrv_begin_transaction( $conn ) === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Initialize parameter values. */
$orderId = 1; $qty = 10; $productId = 100;
/* Set up and execute the first query. */
$sql1 = "INSERT INTO OrdersTable (ID, Quantity, ProductID)
VALUES (?, ?, ?)";
$params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
/* If both queries were successful, commit the transaction. */
/* Otherwise, rollback the transaction. */
if( $stmt1 && $stmt2 ) {
sqlsrv_commit( $conn );
echo "Transaction committed.<br />";
} else {
sqlsrv_rollback( $conn );
echo "Transaction rolled back.<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_begin_transaction</function></member>
<member><function>sqlsrv_rollback</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-configure" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_configure</refname>
<refpurpose>Changes the driver error handling and logging configurations</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_configure</methodname>
<methodparam><type>string</type><parameter>setting</parameter></methodparam>
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Changes the driver error handling and logging configurations.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>setting</parameter></term>
<listitem>
<para>
The name of the setting to set. The possible values are
"WarningsReturnAsErrors", "LogSubsystems", and "LogSeverity".
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value of the specified setting. The following table shows possible values:
<table>
<title>Error and Logging Setting Options</title>
<tgroup cols="2">
<thead>
<row>
<entry>Setting</entry>
<entry>Options</entry>
</row>
</thead>
<tbody>
<row>
<entry>WarningsReturnAsErrors</entry>
<entry>1 (&true;) or 0 (&false;)</entry>
</row>
<row>
<entry>LogSubsystems</entry>
<entry>SQLSRV_LOG_SYSTEM_ALL (-1)
SQLSRV_LOG_SYSTEM_CONN (2)
SQLSRV_LOG_SYSTEM_INIT (1)
SQLSRV_LOG_SYSTEM_OFF (0)
SQLSRV_LOG_SYSTEM_STMT (4)
SQLSRV_LOG_SYSTEM_UTIL (8)</entry>
</row>
<row>
<entry>LogSeverity</entry>
<entry>SQLSRV_LOG_SEVERITY_ALL (-1)
SQLSRV_LOG_SEVERITY_ERROR (1)
SQLSRV_LOG_SEVERITY_NOTICE (4)
SQLSRV_LOG_SEVERITY_WARNING (2)</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link xlink:href="&url.sqlsrv.error.handling;">SQLSRV Error Handling</link>.</member>
<member><link xlink:href="&url.sqlsrv.logging.activity;">Logging SQLSRV Activity</link>.</member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-connect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_connect</refname>
<refpurpose>Opens a connection to a Microsoft SQL Server database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>sqlsrv_connect</methodname>
<methodparam><type>string</type><parameter>serverName</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>connectionInfo</parameter></methodparam>
</methodsynopsis>
<para>
Opens a connection to a Microsoft SQL Server database. By default, the connection
is attempted using Windows Authentication. To connect using SQL Server
Authentication, include "UID" and "PWD" in the connection options array.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>serverName</parameter></term>
<listitem>
<para>
The name of the server to which a connection is established. To connect
to a specific instance, follow the server name with a forward slash
and the instance name (e.g. serverName\sqlexpress).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>connectionInfo</parameter></term>
<listitem>
<para>
An associative array that specifies options for connecting to the server.
If values for the UID and PWD keys are not specified, the connection
will be attempted using Windows Authentication. For a complete list of supported
keys, see <link xlink:href="&url.sqlsrv.connection.options;">SQLSRV Connection Options</link>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A connection resource. If a connection cannot be successfully opened, &false; is returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Connect using Windows Authentication.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress"; //serverName\instanceName
// Since UID and PWD are not specified in the $connectionInfo array,
// The connection will be attempted using Windows Authentication.
$connectionInfo = array( "Database"=>"dbName");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Connect by specifying a user name and password.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress"; //serverName\instanceName
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Connect on a specifed port.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress, 1542"; //serverName\instanceName, portNumber (default is 1433)
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
By default, the <function>sqlsrv_connect</function> uses connection pooling to
improve connection performance. To turn off connection pooling (i.e. force a
new connection on each call), set the "ConnectionPooling" option in the
$connectionOptions array to 0 (or &false;). For more information, see
<link xlink:href="&url.sqlsrv.connection.pooling;">SQLSRV Connection Pooling</link>.
</para>
<para>
The SQLSRV extension does not have a dedicated function for changing which
database is connected to. The target database is specified in the
$connectionOptions array that is passed to sqlsrv_connect. To change the
database on an open connection, execute the following query "USE dbName"
(e.g. sqlsrv_query($conn, "USE dbName")).
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_close</function></member>
<member><function>sqlsrv_errors</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-errors" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_errors</refname>
<refpurpose>Returns error and warning information about the last SQLSRV operation performed</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<!-- Example: All functions have this -->
<type>mixed</type><methodname>sqlsrv_errors</methodname>
<methodparam choice="opt"><type>int</type><parameter>errorsOrWarnings</parameter></methodparam>
</methodsynopsis>
<para>
Returns error and warning information about the last SQLSRV operation performed.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>errorsOrWarnings</parameter></term>
<listitem>
<para>
Determines whether error information, warning information, or both are
returned. If this parameter is not supplied, both error information and
warning information are returned. The following are the supported values
for this parameter: SQLSRV_ERR_ALL, SQLSRV_ERR_ERRORS, SQLSRV_ERR_WARNINGS.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If errors and/or warnings occured on the last sqlsrv operation, and array of
arrays containing error information is returned. If no errors and/or warnings
occured on the last sqlsrv operation, &null; is returned. The following table
describes the structure of the returned arrays:
<table>
<title>Array returned by sqlsrv_errors</title>
<tgroup cols="2">
<thead>
<row>
<entry>Key</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>SQLSTATE</entry>
<entry>For errors that originate from the ODBC driver, the SQLSTATE returned
by ODBC. For errors that originate from the Microsoft Drivers for PHP for
SQL Server, a SQLSTATE of IMSSP. For warnings that originate from the
Microsoft Drivers for PHP for SQL Server, a SQLSTATE of 01SSP.
</entry>
</row>
<row>
<entry>code</entry>
<entry>For errors that originate from SQL Server, the native SQL Server
error code. For errors that originate from the ODBC driver, the error
code returned by ODBC. For errors that originate from the Microsoft Drivers
for PHP for SQL Server, the Microsoft Drivers for PHP for SQL Server error code.
</entry>
</row>
<row>
<entry>message</entry>
<entry>A description of the error.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>functionname</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName/sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
/* Set up a query to select an invalid column name. */
$sql = "SELECT BadColumnName FROM Table_1";
/* Execution of the query will fail because of the bad column name. */
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false ) {
if( ($errors = sqlsrv_errors() ) != null) {
foreach( $errors as $error ) {
echo "SQLSTATE: ".$error[ 'SQLSTATE']."<br />";
echo "code: ".$error[ 'code']."<br />";
echo "message: ".$error[ 'message']."<br />";
}
}
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
By default, warnings generated on a call to any SQLSRV function are treated
as errors. This means that if a warning occurs on a call to a SQLSRV function,
the function returns &false;. However, warnings that correspond to SQLSTATE
values 01000, 01001, 01003, and 01S02 are never treated as errors. For
information about changing this behavior, see <function>sqlsrv_configure</function>
and the WarningsReturnAsErrors setting.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_configure</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-execute" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_execute</refname>
<refpurpose>Executes a statement prepared with <function>sqlsrv_prepare</function></refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_execute</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Executes a statement prepared with <function>sqlsrv_prepare</function>. This
function is ideal for executing a prepared statement multiple times with
different parameter values.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource returned by <function>sqlsrv_prepare</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_execute</function> example</title>
<para>
This example demonstrates how to prepare a statement with
<function>sqlsrv_prepare</function> and re-execute it multiple times (with
different parameter values) using <function>sqlsrv_execute</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "UPDATE Table_1
SET OrderQty = ?
WHERE SalesOrderID = ?";
// Initialize parameters and prepare the statement.
// Variables $qty and $id are bound to the statement, $stmt.
$qty = 0; $id = 0;
$stmt = sqlsrv_prepare( $conn, $sql, array( &$qty, &$id));
if( !$stmt ) {
die( print_r( sqlsrv_errors(), true));
}
// Set up the SalesOrderDetailID and OrderQty information.
// This array maps the order ID to order quantity in key=>value pairs.
$orders = array( 1=>10, 2=>20, 3=>30);
// Execute the statement for each order.
foreach( $orders as $id => $qty) {
// Because $id and $qty are bound to $stmt1, their updated
// values are used with each execution of the statement.
if( sqlsrv_execute( $stmt ) === false ) {
die( print_r( sqlsrv_errors(), true));
}
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
When you prepare a statement that uses variables as parameters, the variables
are bound to the statement. This means that if you update the values of the
variables, the next time you execute the statement it will run with updated
parameter values. For statements that you plan to execute only once, use
<function>sqlsrv_query</function>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_prepare</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-fetch-array" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_fetch_array</refname>
<refpurpose>Returns a row as an array</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>sqlsrv_fetch_array</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>fetchType</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Returns the next available row of data as an associative array, a numeric
array, or both (the default).
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource returned by sqlsrv_query or sqlsrv_execute.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fetchType</parameter></term>
<listitem>
<para>
A predefined constant specifying the type of array to return. Possible
values are <constant>SQLSRV_FETCH_ASSOC</constant>,
<constant>SQLSRV_FETCH_NUMERIC</constant>, and
<constant>SQLSRV_FETCH_BOTH</constant> (the default).
</para>
<para>
A fetch type of SQLSRV_FETCH_ASSOC should not be used when consuming a
result set with multiple columns of the same name.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>row</parameter></term>
<listitem>
<para>
Specifies the row to access in a result set that uses a scrollable cursor.
Possible values are <constant>SQLSRV_SCROLL_NEXT</constant>,
<constant>SQLSRV_SCROLL_PRIOR</constant>, <constant>SQLSRV_SCROLL_FIRST</constant>,
<constant>SQLSRV_SCROLL_LAST</constant>, <constant>SQLSRV_SCROLL_ABSOLUTE</constant> and,
<constant>SQLSRV_SCROLL_RELATIVE</constant> (the default). When this parameter
is specified, the <parameter>fetchType</parameter> must be explicitly defined.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array on success, &null; if there are no more rows to return, and
&false; if an error occurs.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Retrieving an associative array.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\instanceName";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT FirstName, LastName FROM SomeTable";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo $row['LastName'].", ".$row['FirstName']."<br />";
}
sqlsrv_free_stmt( $stmt);
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Retrieving a numeric array.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\instanceName";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT FirstName, LastName FROM SomeTable";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
echo $row[0].", ".$row[1]."<br />";
}
sqlsrv_free_stmt( $stmt);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
Not specifying the <parameter>fetchType</parameter> or explicity using the
<constant>SQLSRV_FETCH_TYPE</constant> constant in the examples above will
return an array that has both associative and numeric keys.
</para>
<para>
If more than one column is returned with the same name, the last column will
take precedence. To avoid field name collisions, use aliases.
</para>
<para>
If a column with no name is returned, the associative key for the array element
will be an empty string ("").
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_connect</function></member>
<member><function>sqlsrv_query</function></member>
<member><function>sqlsrv_errors</function></member>
<member><function>sqlsrv_fetch</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-fetch-object" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_fetch_object</refname>
<refpurpose>Retrieves the next row of data in a result set as an object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_fetch_object</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>className</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>ctorParams</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves the next row of data in a result set as an instance of the specified
class with properties that match the row field names and values that correspond
to the row field values.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource created by <function>sqlsrv_query</function> or
<function>sqlsrv_execute</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>className</parameter></term>
<listitem>
<para>
The name of the class to instantiate. If no class name is specified,
stdClass is instantiated.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ctorParams</parameter></term>
<listitem>
<para>
Values passed to the constructor of the specified class. If the constructor
of the specified class takes parameters, the ctorParams array must be
supplied.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>row</parameter></term>
<listitem>
<para>
The row to be accessed. This parameter can only be used if the specified
statement was prepared with a scrollable cursor. In that case, this parameter
can take on one of the following values:
<simplelist>
<member>SQLSRV_SCROLL_NEXT</member>
<member>SQLSRV_SCROLL_PRIOR</member>
<member>SQLSRV_SCROLL_FIRST</member>
<member>SQLSRV_SCROLL_LAST</member>
<member>SQLSRV_SCROLL_ABSOLUTE</member>
<member>SQLSRV_SCROLL_RELATIVE</member>
</simplelist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Specifies the row to be accessed if the row parameter is set to
SQLSRV_SCROLL_ABSOLUTE or SQLSRV_SCROLL_RELATIVE. Note that the first row
in a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an object on success, &null; if there are no more rows to return,
and &false; if an error occurs or if the specified class does not exist.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_fetch_object</function> example</title>
<para>
The following example demonstrates how to retrieve a row as a stdClass object.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT fName, lName FROM Table_1";
$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
// Retrieve each row as an object.
// Because no class is specified, each row will be retrieved as a stdClass object.
// Property names correspond to field names.
while( $obj = sqlsrv_fetch_object( $stmt)) {
echo $obj->fName.", ".$obj->lName."<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
If a class name is specified with the optional $className parameter and the
class has properties whose names match the result set field names, the corresponding
result set values are applied to the properties. If a result set field name
does not match a class property, a property with the result set field name is added
to the object and the result set value is applied to the property. The following
rules apply when using the $className parameter:
<simplelist>
<member>Field-property name matching is case-sensitive.</member>
<member>Field-property matching occurs regardless of access modifiers.</member>
<member>Class property data types are ignored when applying a field value to a property.</member>
<member>If the class does not exist, the function returns &false; and adds an error to the error collection.</member>
</simplelist>
Regardless of whether the $className parameter is supplied, if a field with no
name is returned, the field value will be ignored and a warning will be added
to the error collection.
</para>
<para>
When consuming a result set that has multiple columns with the same name, it may
be better to use <function>sqlsrv_fetch_array</function> or the combination of
<function>sqlsrv_fetch</function> and <function>sqlsrv_get_field</function>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_fetch</function></member>
<member><function>sqlsrv_fetch_array</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-fetch" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_fetch</refname>
<refpurpose>Makes the next row in a result set available for reading</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<!-- Example: All functions have this -->
<type>mixed</type><methodname>sqlsrv_fetch</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Makes the next row in a result set available for reading. Use
<function>sqlsrv_get_field</function> to read the fields of the row.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource created by executing <function>sqlsrv_query</function>
or <function>sqlsrv_execute</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>row</parameter></term>
<listitem>
<para>
The row to be accessed. This parameter can only be used if the specified
statement was prepared with a scrollable cursor. In that case, this parameter
can take on one of the following values:
<simplelist>
<member>SQLSRV_SCROLL_NEXT</member>
<member>SQLSRV_SCROLL_PRIOR</member>
<member>SQLSRV_SCROLL_FIRST</member>
<member>SQLSRV_SCROLL_LAST</member>
<member>SQLSRV_SCROLL_ABSOLUTE</member>
<member>SQLSRV_SCROLL_RELATIVE</member>
</simplelist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Specifies the row to be accessed if the row parameter is set to
SQLSRV_SCROLL_ABSOLUTE or SQLSRV_SCROLL_RELATIVE. Note that the first
row in a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the next row of a result set was successfully retrieved,
&false; if an error occurs, and &null; if there are no more rows in the result set.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_fetch</function> example</title>
<para>
The following example demonstrates how to retrieve a row with
<function>sqlsrv_fetch</function> and get the row fields with
<function>sqlsrv_get_field</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT Name, Comment
FROM Table_1
WHERE ReviewID=1";
$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
// Make the first (and in this case, only) row of the result set available for reading.
if( sqlsrv_fetch( $stmt ) === false) {
die( print_r( sqlsrv_errors(), true));
}
// Get the row fields. Field indeces start at 0 and must be retrieved in order.
// Retrieving row fields by name is not supported by sqlsrv_get_field.
$name = sqlsrv_get_field( $stmt, 0);
echo "$name: ";
$comment = sqlsrv_get_field( $stmt, 1);
echo $comment;
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_get_field</function></member>
<member><function>sqlsrv_fetch_array</function></member>
<member><function>sqlsrv_fetch_object</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,149 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-field-metadata" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_field_metadata</refname>
<refpurpose>Retrieves metadata for the fields of a statement prepared by
<function>sqlsrv_prepare</function> or <function>sqlsrv_query</function>
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_field_metadata</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves metadata for the fields of a statement prepared by
<function>sqlsrv_prepare</function> or <function>sqlsrv_query</function>.
<function>sqlsrv_field_metadata</function> can be called on a statement before
or after statement execution.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statment resource for which metadata is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array of arrays is returned on success. Otherwise, &false; is returned.
Each returned array is described by the following table:
<table>
<title>Array returned by sqlsrv_field_metadata</title>
<tgroup cols="2">
<thead>
<row>
<entry>Key</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>Name</entry>
<entry>The name of the field.</entry>
</row>
<row>
<entry>Type</entry>
<entry>The numeric value for the SQL type.</entry>
</row>
<row>
<entry>Size</entry>
<entry>The number of characters for fields of character type, the number of
bytes for fields of binary type, or &null; for other types.</entry>
</row>
<row>
<entry>Precision</entry>
<entry>The precision for types of variable precision, &null; for other types.</entry>
</row>
<row>
<entry>Scale</entry>
<entry>The scale for types of variable scale, &null; for other types.</entry>
</row>
<row>
<entry>Nullable</entry>
<entry>An enumeration indicating whether the column is nullable, not nullable,
or if it is not known.</entry>
</row>
</tbody>
</tgroup>
</table>
For more information, see <link xlink:href="&url.sqlsrv.field.metadata;">sqlsrv_field_metadata</link>
in the Microsoft SQLSRV documentation.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_field_metadata</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"AdventureWorks", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT * FROM Table_1";
$stmt = sqlsrv_prepare( $conn, $sql );
foreach( sqlsrv_field_metadata( $stmt ) as $fieldMetadata ) {
foreach( $fieldMetadata as $name => $value) {
echo "$name: $value<br />";
}
echo "<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_client_info</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-free-stmt" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_free_stmt</refname>
<refpurpose>Frees all resources for the specified statement</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_free_stmt</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Frees all resources for the specified statement. The statement cannot be used
after <function>sqlsrv_free_stmt</function> has been called on it. If
<function>sqlsrv_free_stmt</function> is called on an in-progress statement
that alters server state, statement execution is terminated and the statement
is rolled back.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statment for which resources are freed.
Note that &null; is a valid parameter value. This allows the function to be
called multiple times in a script.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_free_stmt</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$stmt = sqlsrv_query( $conn, "SELECT * FROM Table_1");
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
/*-------------------------------
Process query results here.
-------------------------------*/
/* Free the statement resources. */
sqlsrv_free_stmt( $stmt);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
The main difference between <function>sqlsrv_free_stmt</function> and
<function>sqlsrv_cancel</function> is that a statement resource cancelled with
<function>sqlsrv_cancel</function> can be re-executed if it was created with
<function>sqlsrv_prepare</function>. A statement resource cancelled with
<function>sqlsrv_free_statement</function> cannot be re-executed.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_cancel</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-get-config" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_get_config</refname>
<refpurpose>Returns the value of the specified configuration setting</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_get_config</methodname>
<methodparam><type>string</type><parameter>setting</parameter></methodparam>
</methodsynopsis>
<para>
Returns the value of the specified configuration setting.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>setting</parameter></term>
<listitem>
<para>
The name of the setting for which the value is returned. For a list of
configurable settings, see <function>sqlsrv_configure</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the value of the specified setting. If an invalid setting is specified,
&false; is returned.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_configure</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-get-field" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_get_field</refname>
<refpurpose>Gets field data from the currently selected row</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_get_field</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
<methodparam><type>int</type><parameter>fieldIndex</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>getAsType</parameter></methodparam>
</methodsynopsis>
<para>
Gets field data from the currently selected row. Fields must be accessed in
order. Field indices start at 0.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource returned by <function>sqlsrv_query</function> or
<function>sqlsrv_execute</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fieldIndex</parameter></term>
<listitem>
<para>
The index of the field to be retrieved. Field indices start at 0. Fields
must be accessed in order. i.e. If you access field index 1, then field
index 0 will not be available.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>getAsType</parameter></term>
<listitem>
<para>
The PHP data type for the returned field data. If this parameter is not
set, the field data will be returned as its default PHP data type.
For information about default PHP data types, see
<link xlink:href="&url.sqlsrv.default.phptypes;">Default PHP Data Types</link>
in the Microsoft SQLSRV documentation.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns data from the specified field on success. Returns &false; otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_get_field</function> example</title>
<para>
The following example demonstrates how to retrieve a row with
<function>sqlsrv_fetch</function> and get the row fields with
<function>sqlsrv_get_field</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT Name, Comment
FROM Table_1
WHERE ReviewID=1";
$stmt = sqlsrv_query( $conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
// Make the first (and in this case, only) row of the result set available for reading.
if( sqlsrv_fetch( $stmt ) === false) {
die( print_r( sqlsrv_errors(), true));
}
// Get the row fields. Field indeces start at 0 and must be retrieved in order.
// Retrieving row fields by name is not supported by sqlsrv_get_field.
$name = sqlsrv_get_field( $stmt, 0);
echo "$name: ";
$comment = sqlsrv_get_field( $stmt, 1);
echo $comment;
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_fetch</function></member>
<member><function>sqlsrv_fetch_array</function></member>
<member><function>sqlsrv_fetch_object</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-has-rows" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_has_rows</refname>
<refpurpose>Indicates whether the specified statement has rows</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_has_rows</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Indicates whether the specified statement has rows.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource returned by <function>sqlsrv_query</function> or
<function>sqlsrv_execute</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the specified statement has rows and &false; if the statement
does not have rows or if an error occured.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_has_rows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$server = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" )
$conn = sqlsrv_connect( $server, $connectionInfo );
$stmt = sqlsrv_query( $conn, "SELECT * FROM Table_1");
if ($stmt) {
$rows = sqlsrv_has_rows( $stmt );
if ($rows === true)
echo "There are rows. <br />";
else
echo "There are no rows. <br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_num_rows</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-next-result" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_next_result</refname>
<refpurpose>Makes the next result of the specified statement active</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_next_result</methodname>
<!-- Example: Required parameter -->
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Makes the next result of the specified statement active. Results include result
sets, row counts, and output parameters.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statment on which the next result is being called.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the next result was successfully retrieved, &false; if an error
occurred, and &null; if there are no more results to retrieve.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_next_result</function> example</title>
<para>
The following example executes a batch query that inserts into a table and
then selects from the table. This produces two results on the statement:
one for the rows affected by the INSERT and one for the rows returned by
the SELECT. To get to the rows returned by the SELECT,
<function>sqlsrv_next_result</function> must be called to move past the first result.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array("Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$query = "INSERT INTO Table_1 (id, data) VALUES (?,?); SELECT * FROM TABLE_1;";
$params = array(1, "some data");
$stmt = sqlsrv_query($conn, $query, $params);
// Consume the first result (rows affected by INSERT) without calling sqlsrv_next_result.
echo "Rows affected: ".sqlsrv_rows_affected($stmt)."<br />";
// Move to the next result and display results.
$next_result = sqlsrv_next_result($stmt);
if( $next_result ) {
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC)){
echo $row['id'].": ".$row['data']."<br />";
}
} elseif( is_null($next_result)) {
echo "No more results.<br />";
} else {
die(print_r(sqlsrv_errors(), true));
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_query</function></member>
<member><function>sqlsrv_fetch_array</function></member>
<member><function>sqlsrv_rows_affected</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-num-fields" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_num_fields</refname>
<refpurpose>Retrieves the number of fields (columns) on a statement</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_num_fields</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves the number of fields (columns) on a statement.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statment for which the number of fields is returned.
<function>sqlsrv_num_fields</function> can be called on a statement before
or after statement execution.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the number of fields on success. Returns &false; otherwise.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_num_fields</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT * FROM Table_1";
$stmt = sqlsrv_query($conn, $sql);
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true));
}
$numFields = sqlsrv_num_fields( $stmt );
while( sqlsrv_fetch( $stmt )) {
// Iterate through the fields of each row.
for($i = 0; $i < $numFields; $i++) {
{
echo sqlsrv_get_field($stmt, $i)." ";
}
echo "<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_field_metadata</function></member>
<member><function>sqlsrv_fetch</function></member>
<member><function>sqlsrv_get_field</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-num-rows" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_num_rows</refname>
<refpurpose>Retrieves the number of rows in a result set</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_num_rows</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves the number of rows in a result set. This function requires that the
statment resource be created with a static or keyset cursor. For more information,
see <function>sqlsrv_query</function>, <function>sqlsrv_prepare</function>,
or <link xlink:href="&url.sqlsrv.specify.cursortype;">Specifying a Cursor Type and Selecting Rows</link>
in the Microsoft SQLSRV documentation.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement for which the row count is returned. The statment resource
must be created with a static or keyset cursor. For more information, see
<function>sqlsrv_query</function>, <function>sqlsrv_prepare</function>, or
<link xlink:href="&url.sqlsrv.specify.cursortype;">Specifying a Cursor Type and Selecting Rows</link>
in the Microsoft SQLSRV documentation.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the number of rows retrieved on success and &false; if an error occured.
If a forward cursor (the default) or dynamic cursor is used, &false; is returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_num_rows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$server = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $server, $connectionInfo );
$sql = "SELECT * FROM Table_1";
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$stmt = sqlsrv_query( $conn, $sql , $params, $options );
$row_count = sqlsrv_num_rows( $stmt );
if ($row_count === false)
echo "Error in retrieveing row count.";
else
echo $row_count;
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_has_rows</function></member>
<member><function>sqlsrv_rows_affected</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-prepare" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_prepare</refname>
<refpurpose>Prepares a query for execution</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_prepare</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
<methodparam><type>string</type><parameter>sql</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>params</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
Prepares a query for execution. This function is ideal for preparing a query
that will be executed multiple times with different parameter values.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
A connection resource returned by <function>sqlsrv_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>sql</parameter></term>
<listitem>
<para>
The string that defines the query to be prepared and executed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>params</parameter></term>
<listitem>
<para>
An array specifying parameter information when executing a parameterized
query. Array elements can be any of the following:
<simplelist>
<member>A literal value</member>
<member>A PHP variable</member>
<member>An array with this structure:
array($value [, $direction [, $phpType [, $sqlType]]])</member>
</simplelist>
The following table describes the elements in the array structure above:
</para>
<table>
<title>Array structure</title>
<tgroup cols="2">
<thead>
<row>
<entry>Element</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>$value</entry>
<entry>A literal value, a PHP variable, or a PHP by-reference variable.</entry>
</row>
<row>
<entry>$direction (optional)</entry>
<entry>One of the following SQLSRV constants used to indicate the
parameter direction: SQLSRV_PARAM_IN, SQLSRV_PARAM_OUT, SQLSRV_PARAM_INOUT.
The default value is SQLSRV_PARAM_IN. </entry>
</row>
<row>
<entry>$phpType (optional)</entry>
<entry>A SQLSRV_PHPTYPE_* constant that specifies PHP data type of the
returned value.</entry>
</row>
<row>
<entry>$sqlType (optional)</entry>
<entry>A SQLSRV_SQLTYPE_* constant that specifies the SQL Server data
type of the input value.</entry>
</row>
</tbody>
</tgroup>
</table>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
An array specifing query property options. The supported keys are described
in the following table:
</para>
<table>
<title>Query Options</title>
<tgroup cols="3">
<thead>
<row>
<entry>Key</entry>
<entry>Values</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>QueryTimeout</entry>
<entry>A positive integer value.</entry>
<entry>Sets the query timeout in seconds. By default, the driver will
wait indefinitely for results.</entry>
</row>
<row>
<entry>SendStreamParamsAtExec</entry>
<entry>&true; or &false; (the default is &true;)</entry>
<entry>Configures the driver to send all stream data at execution (&true),
or to send stream data in chunks (&false;). By default, the value is set to &true;.
For more information, see <function>sqlsrv_send_stream_data</function>.</entry>
</row>
<row>
<entry>Scrollable</entry>
<entry>SQLSRV_CURSOR_FORWARD, SQLSRV_CURSOR_STATIC, SQLSRV_CURSOR_DYNAMIC,
or SQLSRV_CURSOR_KEYSET</entry>
<entry>See <link xlink:href="&url.sqlsrv.specify.cursortype;">Specifying a Cursor Type and Selecting Rows</link>
in the Microsoft SQLSRV documentation.</entry>
</row>
</tbody>
</tgroup>
</table>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a statement resource on success and &false; if an error occurred.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_prepare</function> example</title>
<para>
This example demonstrates how to prepare a statement with <function>sqlsrv_prepare</function>
and re-execute it multiple times (with different parameter values) using <function>sqlsrv_execute</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "UPDATE Table_1
SET OrderQty = ?
WHERE SalesOrderID = ?";
// Initialize parameters and prepare the statement.
// Variables $qty and $id are bound to the statement, $stmt.
$qty = 0; $id = 0;
$stmt = sqlsrv_prepare( $conn, $sql, array( &$qty, &$id));
if( !$stmt ) {
die( print_r( sqlsrv_errors(), true));
}
// Set up the SalesOrderDetailID and OrderQty information.
// This array maps the order ID to order quantity in key=>value pairs.
$orders = array( 1=>10, 2=>20, 3=>30);
// Execute the statement for each order.
foreach( $orders as $id => $qty) {
// Because $id and $qty are bound to $stmt1, their updated
// values are used with each execution of the statement.
if( sqlsrv_execute( $stmt ) === false ) {
die( print_r( sqlsrv_errors(), true));
}
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
When you prepare a statement that uses variables as parameters, the variables
are bound to the statement. This means that if you update the values of the
variables, the next time you execute the statement it will run with updated
parameter values. For statements that you plan to execute only once, use
<function>sqlsrv_query</function>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_execute</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-query" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_query</refname>
<refpurpose>Prepares and executes a query.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_query</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
<methodparam><type>string</type><parameter>sql</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>params</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
Prepares and executes a query.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
A connection resource returned by <function>sqlsrv_connect</function>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>sql</parameter></term>
<listitem>
<para>
The string that defines the query to be prepared and executed.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>params</parameter></term>
<listitem>
<para>
An array specifying parameter information when executing a parameterized query.
Array elements can be any of the following:
<simplelist>
<member>A literal value</member>
<member>A PHP variable</member>
<member>An array with this structure:
array($value [, $direction [, $phpType [, $sqlType]]])</member>
</simplelist>
The following table describes the elements in the array structure above:
</para>
<table>
<title>Array structure</title>
<tgroup cols="2">
<thead>
<row>
<entry>Element</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>$value</entry>
<entry>A literal value, a PHP variable, or a PHP by-reference variable.</entry>
</row>
<row>
<entry>$direction (optional)</entry>
<entry>One of the following SQLSRV constants used to indicate the
parameter direction: SQLSRV_PARAM_IN, SQLSRV_PARAM_OUT, SQLSRV_PARAM_INOUT.
The default value is SQLSRV_PARAM_IN.</entry>
</row>
<row>
<entry>$phpType (optional)</entry>
<entry>A SQLSRV_PHPTYPE_* constant that specifies PHP data type of the
returned value.</entry>
</row>
<row>
<entry>$sqlType (optional)</entry>
<entry>A SQLSRV_SQLTYPE_* constant that specifies the SQL Server data
type of the input value.</entry>
</row>
</tbody>
</tgroup>
</table>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
An array specifing query property options. The supported keys are described
in the following table:
</para>
<table>
<title>Query Options</title>
<tgroup cols="3">
<thead>
<row>
<entry>Key</entry>
<entry>Values</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>QueryTimeout</entry>
<entry>A positive integer value.</entry>
<entry>Sets the query timeout in seconds. By default, the driver will
wait indefinitely for results.</entry>
</row>
<row>
<entry>SendStreamParamsAtExec</entry>
<entry>&true; or &false; (the default is &true;)</entry>
<entry>Configures the driver to send all stream data at execution (&true;),
or to send stream data in chunks (&false;). By default, the value is set
to &true;. For more information, see <function>sqlsrv_send_stream_data</function>.</entry>
</row>
<row>
<entry>Scrollable</entry>
<entry>SQLSRV_CURSOR_FORWARD, SQLSRV_CURSOR_STATIC, SQLSRV_CURSOR_DYNAMIC,
or SQLSRV_CURSOR_KEYSET</entry>
<entry>See <link xlink:href="&url.sqlsrv.specify.cursortype;">Specifying
a Cursor Type and Selecting Rows</link> in the Microsoft SQLSRV documentation.</entry>
</row>
</tbody>
</tgroup>
</table>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a statement resource on success and &false; if an error occurred.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_query</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "INSERT INTO Table_1 (id, data) VALUES (?, ?)";
$params = array(1, "some data");
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
For statements that you plan to execute only once, use <function>sqlsrv_query</function>.
If you intend to re-execute a statement with different parameter values, use
the combination of <function>sqlsrv_prepare</function> and <function>sqlsrv_execute</function>.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_prepare</function></member>
<member><function>sqlsrv_execute</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-rollback" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_rollback</refname>
<refpurpose>Rolls back a transaction that was begun with
<function>sqlsrv_begin_transaction</function></refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_rollback</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
Rolls back a transaction that was begun with <function>sqlsrv_begin_transaction</function>
and returns the connection to auto-commit mode.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection resource returned by a call to <function>sqlsrv_connect</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_rollback</function> example</title>
<para>
The following example demonstrates how to use <function>sqlsrv_begin_transaction</function>
together with <function>sqlsrv_commit</function> and <function>sqlsrv_rollback</function>.
</para>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"userName", "PWD"=>"password");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Begin the transaction. */
if ( sqlsrv_begin_transaction( $conn ) === false ) {
die( print_r( sqlsrv_errors(), true ));
}
/* Initialize parameter values. */
$orderId = 1; $qty = 10; $productId = 100;
/* Set up and execute the first query. */
$sql1 = "INSERT INTO OrdersTable (ID, Quantity, ProductID)
VALUES (?, ?, ?)";
$params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
/* If both queries were successful, commit the transaction. */
/* Otherwise, rollback the transaction. */
if( $stmt1 && $stmt2 ) {
sqlsrv_commit( $conn );
echo "Transaction committed.<br />";
} else {
sqlsrv_rollback( $conn );
echo "Transaction rolled back.<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_begin_transaction</function></member>
<member><function>sqlsrv_commit</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-rows-affected" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_rows_affected</refname>
<refpurpose>Returns the number of rows modified by the last INSERT, UPDATE, or
DELETE query executed</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>sqlsrv_rows_affected</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Returns the number of rows modified by the last INSERT, UPDATE, or DELETE
query executed. For information about the number of rows returned by a SELECT
query, see <function>sqlsrv_num_rows</function>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The executed statement resource for which the number of affected rows is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the number of rows affected by the last INSERT, UPDATE, or DELETE query.
If no rows were affected, 0 is returned. If the number of affected rows cannot
be determined, -1 is returned. If an error occured, &false; is returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_rows_affected</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "UPDATE Table_1 SET data = ? WHERE id = ?";
$params = array("updated data", 1);
$stmt = sqlsrv_query( $conn, $sql, $params);
$rows_affected = sqlsrv_rows_affected( $stmt);
if( $rows_affected === false) {
die( print_r( sqlsrv_errors(), true));
} elseif( $rows_affected == -1) {
echo "No information available.<br />";
} else {
echo $rows_affected." rows were updated.<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_num_rows</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-send-stream-data" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_send_stream_data</refname>
<refpurpose>Sends data from parameter streams to the server</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>sqlsrv_send_stream_data</methodname>
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Send data from parameter streams to the server. Up to 8 KB of data is sent
with each call.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource returned by <function>sqlsrv_query</function> or
<function>sqlsrv_execute</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if there is more data to send and &false; if there is not.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_send_stream_data</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" );
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "UPDATE Table_1 SET data = ( ?) WHERE id = 100";
// Open parameter data as a stream and put it in the $params array.
$data = fopen( "data://text/plain,[ Lengthy content here. ]", "r");
$params = array( &$data);
// Prepare the statement. Use the $options array to turn off the
// default behavior, which is to send all stream data at the time of query
// execution.
$options = array("SendStreamParamsAtExec"=>0);
$stmt = sqlsrv_prepare( $conn, $sql, $params, $options);
sqlsrv_execute( $stmt);
// Send up to 8K of parameter data to the server
// with each call to sqlsrv_send_stream_data.
$i = 1;
while( sqlsrv_send_stream_data( $stmt)) {
$i++;
}
echo "$i calls were made.";
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_prepare</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sqlsrv-server-info" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>sqlsrv_server_info</refname>
<refpurpose>Returns information about the server</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>sqlsrv_server_info</methodname>
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
Returns information about the server.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection resource that connects the client and the server.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array as described in the following table:
<table>
<title>Returned Array</title>
<tgroup cols="2">
<thead>
<row>
<entry>CurrentDatabase</entry>
<entry>The connected-to database.</entry>
</row>
</thead>
<tbody>
<row>
<entry>SQLServerVersion</entry>
<entry>The SQL Server version.</entry>
</row>
<row>
<entry>SQLServerName</entry>
<entry>The name of the server.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_server_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
$conn = sqlsrv_connect( $serverName);
if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$server_info = sqlsrv_server_info( $conn);
if( $server_info )
{
foreach( $server_info as $key => $value) {
echo $key.": ".$value."<br />";
}
} else {
die( print_r( sqlsrv_errors(), true));
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_client_info</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

85
reference/sqlsrv/ini.xml Normal file
View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="sqlsrv.configuration" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.runtime;
&extension.runtime;
<para>The following table lists the configuration options available in the SQLSRV
extension. For more information about these options, see
<link xlink:href="&url.sqlsrv.error.handling;">Handling SQLSRV Warnings and Errors</link>.</para>
<para>
<table>
<title>SQLSRV &ConfigureOptions;</title>
<tgroup cols="4">
<thead>
<row>
<entry>&Name;</entry>
<entry>&Default;</entry>
<entry>&Changeable;</entry>
<entry>Changelog</entry>
</row>
</thead>
<tbody>
<row>
<entry>sqlsrv.WarningsReturnAsErrors</entry>
<entry>1 (&true;)</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
<row>
<entry>sqlsrv.LogSubsystems</entry>
<entry>0</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
<row>
<entry>sqlsrv.LogSeverity</entry>
<entry>1</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
</tbody>
</tgroup>
</table>
<!-- &php_ini_constants; -->
</para>
<!--&ini.descriptions.title;
<para>
<variablelist>
<varlistentry xml:id="ini.extname.theini-option">
<term>
<parameter>theini_option</parameter>
<type>thetype</type>
</term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para> -->
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- Purpose: xx -->
<!-- Membership: xx -->
<!-- State: xx -->
<reference xml:id="ref.sqlsrv" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>SQLSRV &Functions;</title>
<!--<partintro>
<section xml:id="sqlsrv.refintro">
&reftitle.intro;
</section>
</partintro>-->
&reference.sqlsrv.entities.functions;
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="sqlsrv.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.setup;
<!-- {{{ Requirements -->
<section xml:id="sqlsrv.requirements">
&reftitle.required;
<para>
The SQLSRV extension can be used on the following operating systems:
<simplelist>
<member>Windows Server 2003 Service Pack 1</member>
<member>Windows XP Service Pack 3</member>
<member>Windows Vista Service Pack 1 or later</member>
<member>Windows Server 2008</member>
<member>Windows Server 2008 R2</member>
<member>Windows 7</member>
</simplelist>
</para>
<para>
The SQLSRV extension requires that the Microsoft SQL Server 2008 R2 Native
Client be installed on the same computer that is running PHP. If the Microsoft
SQL Server 2008 R2 is not already installed, click the appropriate link below
to download it:
<simplelist>
<member><link xlink:href="&url.sqlsrv.snac.x86download;">Download the x86 package</link></member>
<member><link xlink:href="&url.sqlsrv.snac.x64download;">Download the x64 package</link></member>
</simplelist>
</para>
<para>
The SQLSRV download comes with several driver files. Which driver file you
use will depend on 3 factors: the PHP version you are using, whether you
are using thread-safe or non-thread-safe PHP, and whether your PHP installation
was compiled with the VC6 or VC9 compiler. For example, if you are running
PHP 5.3, you are using non-thread-safe PHP, and your PHP installation was
compiled with the VC9 compiler, you should use the php_sqlsrv_53_nts_vc9.dll
file. (You should use a non-thread-safe version compiled with the VC9 compiler
if you are using IIS as your web server). If you are running PHP 5.2, you are
using thread-safe PHP, and your PHP installation was compiled with the VC6
compiler, you should use the php_sqlsrv_52_ts_vc6.dll file.
</para>
<para>
For more information about SQLSRV requirements, see
<link xlink:href="&url.sqlsrv.system.requirements;">SQLSRV System Requirements</link>.
</para>
</section>
<!-- }}} -->
<!-- {{{ Installation -->
&reference.sqlsrv.configure;
<!-- }}} -->
<!-- {{{ Configuration -->
&reference.sqlsrv.ini;
<!-- }}} -->
<!-- {{{ Resources -->
<section xml:id="sqlsrv.resources">
&reftitle.resources;
<section xml:id="sqlsrv.resources.link">
<title>Connection resource</title>
<para>
A connection resource returned by <function>sqlsrv_connect</function>.
</para>
</section>
<section xml:id="sqlsrv.resources.statement">
<title>Statement resource</title>
<para>
A statement resource returned by <function>sqlsrv_query</function> or by
<function>sqlsrv_prepare</function>.
</para>
</section>
</section>
<!-- }}} -->
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->