1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

sqlsrv: fix XML to remove useless wrapping para tags via script

This commit is contained in:
Gina Peter Banyard
2026-01-26 15:26:38 +00:00
parent 1ca2d4af94
commit 2471b0dc9b
28 changed files with 2224 additions and 2416 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-begin-transaction">
<refnamediv>
<refname>sqlsrv_begin_transaction</refname>
<refpurpose>Begins a database transaction</refpurpose>
@@ -12,50 +12,47 @@
<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 commit/roll
back transactions. For more information, see
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 commit/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>
<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>
</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">
<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";
@@ -80,8 +77,8 @@ $params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
@@ -97,23 +94,19 @@ if( $stmt1 && $stmt2 ) {
}
?>
]]>
</programlisting>
&example.outputs.similar;
</example>
</para>
</programlisting>
&example.outputs.similar;
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_commit</function></member>
<member><function>sqlsrv_rollback</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_commit</function></member>
<member><function>sqlsrv_rollback</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -133,4 +126,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-cancel">
<refnamediv>
<refname>sqlsrv_cancel</refname>
<refpurpose>Cancels a statement</refpurpose>
@@ -12,44 +12,41 @@
<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
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>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement resource to be cancelled.
</para>
</listitem>
</varlistentry>
</variablelist>
</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">
<example>
<title><function>sqlsrv_cancel</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -88,33 +85,29 @@ echo "$count sales accounted for the first $$salesTotal in revenue.<br />";
sqlsrv_cancel( $stmt);
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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
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>
<simplelist>
<member><function>sqlsrv_free_stmt</function></member>
<member><function>sqlsrv_prepare</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -134,4 +127,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-client-info">
<refnamediv>
<refname>sqlsrv_client_info</refname>
<refpurpose>Returns information about the client and specified connection</refpurpose>
@@ -15,28 +15,26 @@
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>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection about which information is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an associative array with keys described in the table below.
Returns &false; otherwise.
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">
@@ -68,13 +66,12 @@
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_client_info</function> example</title>
<programlisting role="php">
<example>
<title><function>sqlsrv_client_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -94,21 +91,17 @@ if( $client_info = sqlsrv_client_info( $conn)) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_server_info</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_server_info</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -128,4 +121,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-close">
<refnamediv>
<refname>sqlsrv_close</refname>
<refpurpose>Closes an open connection and releases resourses associated with the connection</refpurpose>
@@ -15,36 +15,33 @@
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>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection to be closed.
</para>
</listitem>
</varlistentry>
</variablelist>
</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">
<example>
<title><function>sqlsrv_close</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpres";
@@ -62,21 +59,17 @@ if( $conn === false ) {
sqlsrv_close( $conn );
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_connect</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_connect</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -96,4 +89,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-commit">
<refnamediv>
<refname>sqlsrv_commit</refname>
<refpurpose>Commits a transaction that was begun with <function>sqlsrv_begin_transaction</function></refpurpose>
@@ -12,51 +12,48 @@
<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 commit/roll back
transactions. For more information, see
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 commit/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>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection on which the transaction is to be committed.
</para>
</listitem>
</varlistentry>
</variablelist>
</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">
<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";
@@ -81,8 +78,8 @@ $params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
@@ -98,22 +95,18 @@ if( $stmt1 && $stmt2 ) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_begin_transaction</function></member>
<member><function>sqlsrv_rollback</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_begin_transaction</function></member>
<member><function>sqlsrv_rollback</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -133,4 +126,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-configure">
<refnamediv>
<refname>sqlsrv_configure</refname>
<refpurpose>Changes the driver error handling and logging configurations</refpurpose>
@@ -16,83 +16,78 @@
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>
<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>
</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>
<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>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -112,4 +107,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-connect">
<refnamediv>
<refname>sqlsrv_connect</refname>
<refpurpose>Opens a connection to a Microsoft SQL Server database</refpurpose>
@@ -13,54 +13,51 @@
<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
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 backward 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>
<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 backward 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>
</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">
<example>
<title>Connect using Windows Authentication.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\\sqlexpress"; //serverName\instanceName
@@ -78,13 +75,11 @@ if( $conn ) {
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Connect by specifying a user name and password.</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>Connect by specifying a user name and password.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\\sqlexpress"; //serverName\instanceName
@@ -99,13 +94,11 @@ if( $conn ) {
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Connect on a specified port.</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>Connect on a specified port.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\\sqlexpress, 1542"; //serverName\instanceName, portNumber (default is 1433)
@@ -120,41 +113,37 @@ if( $conn ) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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
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"
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>
<simplelist>
<member><function>sqlsrv_close</function></member>
<member><function>sqlsrv_errors</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -174,4 +163,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-errors">
<refnamediv>
<refname>sqlsrv_errors</refname>
<refpurpose>Returns error and warning information about the last SQLSRV operation performed</refpurpose>
@@ -16,32 +16,30 @@
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>
<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>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If errors and/or warnings occurred on the last sqlsrv operation, an array of
arrays containing error information is returned. If no errors and/or warnings
occurred on the last sqlsrv operation, &null; is returned. The following table
If errors and/or warnings occurred on the last sqlsrv operation, an array of
arrays containing error information is returned. If no errors and/or warnings
occurred 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>
@@ -55,17 +53,17 @@
<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
<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
<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>
@@ -78,13 +76,12 @@
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>functionname</function> example</title>
<programlisting role="php">
<example>
<title><function>functionname</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName/sqlexpress";
@@ -110,33 +107,29 @@ if( $stmt === false ) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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>
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>
<simplelist>
<member><function>sqlsrv_configure</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-execute">
<refnamediv>
<refname>sqlsrv_execute</refname>
<refpurpose>Executes a statement prepared with <function>sqlsrv_prepare</function></refpurpose>
@@ -12,46 +12,43 @@
<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
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>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource returned by <function>sqlsrv_prepare</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</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">
<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";
@@ -65,7 +62,7 @@ $sql = "UPDATE Table_1
SET OrderQty = ?
WHERE SalesOrderID = ?";
// Initialize parameters and prepare the statement.
// 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));
@@ -73,47 +70,43 @@ if( !$stmt ) {
die( print_r( sqlsrv_errors(), true));
}
// Set up the SalesOrderDetailID and OrderQty information.
// 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.
// values are used with each execution of the statement.
if( sqlsrv_execute( $stmt ) === false ) {
die( print_r( sqlsrv_errors(), true));
}
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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
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>
<simplelist>
<member><function>sqlsrv_prepare</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -133,4 +126,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-fetch-array">
<refnamediv>
<refname>sqlsrv_fetch_array</refname>
<refpurpose>Returns a row as an array</refpurpose>
@@ -15,80 +15,77 @@
<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
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_prepare.
</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>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Specifies the row to be accessed if the row parameter is set to
<constant>SQLSRV_SCROLL_ABSOLUTE</constant> or
<constant>SQLSRV_SCROLL_RELATIVE</constant>. Note that the first row in
a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
A statement resource returned by sqlsrv_query or sqlsrv_prepare.
</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>
<varlistentry>
<term><parameter>offset</parameter></term>
<listitem>
<para>
Specifies the row to be accessed if the row parameter is set to
<constant>SQLSRV_SCROLL_ABSOLUTE</constant> or
<constant>SQLSRV_SCROLL_RELATIVE</constant>. Note that the first row in
a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array on success, &null; if there are no more rows to return, and
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">
<example>
<title>Retrieving an associative array.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\instanceName";
@@ -111,13 +108,11 @@ while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
sqlsrv_free_stmt( $stmt);
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Retrieving a numeric array.</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>Retrieving a numeric array.</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\instanceName";
@@ -140,41 +135,37 @@ while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_NUMERIC) ) {
sqlsrv_free_stmt( $stmt);
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<para>
Not specifying the <parameter>fetchType</parameter> or explicitly using the
<constant>SQLSRV_FETCH_TYPE</constant> constant in the examples above will
return an array that has both associative and numeric keys.
Not specifying the <parameter>fetchType</parameter> or explicitly 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.
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
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>
<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>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-fetch-object">
<refnamediv>
<refname>sqlsrv_fetch_object</refname>
<refpurpose>Retrieves the next row of data in a result set as an object</refpurpose>
@@ -16,94 +16,91 @@
<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
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
<constant>SQLSRV_SCROLL_ABSOLUTE</constant> or
<constant>SQLSRV_SCROLL_RELATIVE</constant>. Note that the first row in
a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</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
<constant>SQLSRV_SCROLL_ABSOLUTE</constant> or
<constant>SQLSRV_SCROLL_RELATIVE</constant>. Note that the first row in
a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an object on success, &null; if there are no more rows to return,
<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">
<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";
@@ -127,19 +124,18 @@ while( $obj = sqlsrv_fetch_object( $stmt)) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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
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>
@@ -147,28 +143,25 @@ while( $obj = sqlsrv_fetch_object( $stmt)) {
<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
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
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>
<simplelist>
<member><function>sqlsrv_fetch</function></member>
<member><function>sqlsrv_fetch_array</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-fetch">
<refnamediv>
<refname>sqlsrv_fetch</refname>
<refpurpose>Makes the next row in a result set available for reading</refpurpose>
@@ -15,76 +15,73 @@
<methodparam choice="opt"><type>int</type><parameter>offset</parameter></methodparam>
</methodsynopsis>
<para>
Makes the next row in a result set available for reading. Use
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
<constant>SQLSRV_SCROLL_ABSOLUTE</constant> or
<constant>SQLSRV_SCROLL_RELATIVE</constant>. Note that the first row in
a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</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
<constant>SQLSRV_SCROLL_ABSOLUTE</constant> or
<constant>SQLSRV_SCROLL_RELATIVE</constant>. Note that the first row in
a result set has index 0.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the next row of a result set was successfully retrieved,
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">
<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";
@@ -94,7 +91,7 @@ if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT Name, Comment
$sql = "SELECT Name, Comment
FROM Table_1
WHERE ReviewID=1";
$stmt = sqlsrv_query( $conn, $sql);
@@ -116,24 +113,20 @@ $comment = sqlsrv_get_field( $stmt, 1);
echo $comment;
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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>
<simplelist>
<member><function>sqlsrv_get_field</function></member>
<member><function>sqlsrv_fetch_array</function></member>
<member><function>sqlsrv_fetch_object</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,9 +1,9 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-field-metadata">
<refnamediv>
<refname>sqlsrv_field_metadata</refname>
<refpurpose>Retrieves metadata for the fields of a statement prepared by
<refpurpose>Retrieves metadata for the fields of a statement prepared by
<function>sqlsrv_prepare</function> or <function>sqlsrv_query</function>
</refpurpose>
</refnamediv>
@@ -14,33 +14,31 @@
<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
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 statement resource for which metadata is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement resource for which metadata is returned.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an array of arrays on success. Otherwise, &false; is returned.
Returns an array of arrays on success. Otherwise, &false; is returned.
Each returned array is described by the following table:
<table>
<title>Array returned by sqlsrv_field_metadata</title>
@@ -62,7 +60,7 @@
</row>
<row>
<entry>Size</entry>
<entry>The number of characters for fields of character type, the number of
<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>
@@ -75,23 +73,22 @@
</row>
<row>
<entry>Nullable</entry>
<entry>An enumeration indicating whether the column is nullable, not nullable,
<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>
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">
<example>
<title><function>sqlsrv_field_metadata</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -112,21 +109,17 @@ foreach( sqlsrv_field_metadata( $stmt ) as $fieldMetadata ) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_client_info</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_client_info</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -146,4 +139,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-free-stmt">
<refnamediv>
<refname>sqlsrv_free_stmt</refname>
<refpurpose>Frees all resources for the specified statement</refpurpose>
@@ -12,45 +12,42 @@
<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
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 statement 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>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement 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>
</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">
<example>
<title><function>sqlsrv_free_stmt</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -74,31 +71,27 @@ sqlsrv_free_stmt( $stmt);
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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
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>
<simplelist>
<member><function>sqlsrv_cancel</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -118,4 +111,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-get-config">
<refnamediv>
<refname>sqlsrv_get_config</refname>
<refpurpose>Returns the value of the specified configuration setting</refpurpose>
@@ -15,42 +15,37 @@
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>
<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>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the value of the specified setting. If an invalid setting is specified,
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>
<simplelist>
<member><function>sqlsrv_configure</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -70,4 +65,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-get-field">
<refnamediv>
<refname>sqlsrv_get_field</refname>
<refpurpose>Gets field data from the currently selected row</refpurpose>
@@ -14,68 +14,65 @@
<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
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>
<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>
</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">
<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";
@@ -85,7 +82,7 @@ if( $conn === false ) {
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT Name, Comment
$sql = "SELECT Name, Comment
FROM Table_1
WHERE ReviewID=1";
$stmt = sqlsrv_query( $conn, $sql);
@@ -107,23 +104,19 @@ $comment = sqlsrv_get_field( $stmt, 1);
echo $comment;
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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>
<simplelist>
<member><function>sqlsrv_fetch</function></member>
<member><function>sqlsrv_fetch_array</function></member>
<member><function>sqlsrv_fetch_object</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -143,4 +136,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-has-rows">
<refnamediv>
<refname>sqlsrv_has_rows</refname>
<refpurpose>Indicates whether the specified statement has rows</refpurpose>
@@ -15,38 +15,35 @@
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>
<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>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the specified statement has rows and &false; if the statement
Returns &true; if the specified statement has rows and &false; if the statement
does not have rows or if an error occurred.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_has_rows</function> example</title>
<programlisting role="php">
<example>
<title><function>sqlsrv_has_rows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$server = "serverName\sqlexpress";
@@ -59,27 +56,23 @@ if ($stmt) {
$rows = sqlsrv_has_rows( $stmt );
if ($rows === true)
echo "There are rows. <br />";
else
else
echo "There are no rows. <br />";
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_num_rows</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_num_rows</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-next-result">
<refnamediv>
<refname>sqlsrv_next_result</refname>
<refpurpose>Makes the next result of the specified statement active</refpurpose>
@@ -13,48 +13,45 @@
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Makes the next result of the specified statement active. Results include result
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 statement on which the next result is being called.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement on which the next result is being called.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; if the next result was successfully retrieved, &false; if an error
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">
<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";
@@ -72,7 +69,7 @@ echo "Rows affected: ".sqlsrv_rows_affected($stmt)."<br />";
$next_result = sqlsrv_next_result($stmt);
if( $next_result ) {
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC)){
echo $row['id'].": ".$row['data']."<br />";
echo $row['id'].": ".$row['data']."<br />";
}
} elseif( is_null($next_result)) {
echo "No more results.<br />";
@@ -81,23 +78,19 @@ if( $next_result ) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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>
<simplelist>
<member><function>sqlsrv_query</function></member>
<member><function>sqlsrv_fetch_array</function></member>
<member><function>sqlsrv_rows_affected</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -117,4 +110,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-num-fields">
<refnamediv>
<refname>sqlsrv_num_fields</refname>
<refpurpose>Retrieves the number of fields (columns) on a statement</refpurpose>
@@ -15,38 +15,35 @@
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 statement 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>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement 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>
</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">
<example>
<title><function>sqlsrv_num_fields</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -66,30 +63,26 @@ $numFields = sqlsrv_num_fields( $stmt );
while( sqlsrv_fetch( $stmt )) {
// Iterate through the fields of each row.
for($i = 0; $i < $numFields; $i++) {
for($i = 0; $i < $numFields; $i++) {
echo sqlsrv_get_field($stmt, $i)." ";
}
echo "<br />";
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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>
<simplelist>
<member><function>sqlsrv_field_metadata</function></member>
<member><function>sqlsrv_fetch</function></member>
<member><function>sqlsrv_get_field</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -109,4 +102,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-num-rows">
<refnamediv>
<refname>sqlsrv_num_rows</refname>
<refpurpose>Retrieves the number of rows in a result set</refpurpose>
@@ -12,48 +12,45 @@
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
</methodsynopsis>
<para>
Retrieves the number of rows in a result set. This function requires that the
statement 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>
Retrieves the number of rows in a result set. This function requires that the
statement 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 statement 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>
<variablelist>
<varlistentry>
<term><parameter>stmt</parameter></term>
<listitem>
<para>
The statement for which the row count is returned. The statement 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>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the number of rows retrieved on success and &false; if an error occurred.
Returns the number of rows retrieved on success and &false; if an error occurred.
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">
<example>
<title><function>sqlsrv_num_rows</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$server = "serverName\sqlexpress";
@@ -66,29 +63,25 @@ $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>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_has_rows</function></member>
<member><function>sqlsrv_rows_affected</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_has_rows</function></member>
<member><function>sqlsrv_rows_affected</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-prepare">
<refnamediv>
<refname>sqlsrv_prepare</refname>
<refpurpose>Prepares a query for execution</refpurpose>
@@ -15,144 +15,141 @@
<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
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 specifying query property options. The supported keys are described
in the following table:
<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>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>
<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 specifying 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>
</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">
<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";
@@ -166,7 +163,7 @@ $sql = "UPDATE Table_1
SET OrderQty = ?
WHERE SalesOrderID = ?";
// Initialize parameters and prepare the statement.
// 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));
@@ -174,47 +171,43 @@ if( !$stmt ) {
die( print_r( sqlsrv_errors(), true));
}
// Set up the SalesOrderDetailID and OrderQty information.
// 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.
// values are used with each execution of the statement.
if( sqlsrv_execute( $stmt ) === false ) {
die( print_r( sqlsrv_errors(), true));
}
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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
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>
<simplelist>
<member><function>sqlsrv_execute</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -234,4 +227,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-query">
<refnamediv>
<refname>sqlsrv_query</refname>
<refpurpose>Prepares and executes a query</refpurpose>
@@ -18,136 +18,133 @@
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 specifying query property options. The supported keys are described
in the following table:
<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>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>
<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 specifying 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>
</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">
<example>
<title><function>sqlsrv_query</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -166,31 +163,27 @@ if( $stmt === false ) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</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
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>
<simplelist>
<member><function>sqlsrv_prepare</function></member>
<member><function>sqlsrv_execute</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -210,4 +203,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,9 +1,9 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-rollback">
<refnamediv>
<refname>sqlsrv_rollback</refname>
<refpurpose>Rolls back a transaction that was begun with
<refpurpose>Rolls back a transaction that was begun with
<function>sqlsrv_begin_transaction</function></refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -13,44 +13,41 @@
<methodparam><type>resource</type><parameter>conn</parameter></methodparam>
</methodsynopsis>
<para>
Rolls back a transaction that was begun with <function>sqlsrv_begin_transaction</function>
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>
<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>
</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">
<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";
@@ -75,8 +72,8 @@ $params1 = array( $orderId, $qty, $productId );
$stmt1 = sqlsrv_query( $conn, $sql1, $params1 );
/* Set up and execute the second query. */
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
$sql2 = "UPDATE InventoryTable
SET Quantity = (Quantity - ?)
WHERE ProductID = ?";
$params2 = array($qty, $productId);
$stmt2 = sqlsrv_query( $conn, $sql2, $params2 );
@@ -92,22 +89,18 @@ if( $stmt1 && $stmt2 ) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_begin_transaction</function></member>
<member><function>sqlsrv_commit</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_begin_transaction</function></member>
<member><function>sqlsrv_commit</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -127,4 +120,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,9 +1,9 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-rows-affected">
<refnamediv>
<refname>sqlsrv_rows_affected</refname>
<refpurpose>Returns the number of rows modified by the last INSERT, UPDATE, or
<refpurpose>Returns the number of rows modified by the last INSERT, UPDATE, or
DELETE query executed</refpurpose>
</refnamediv>
<refsect1 role="description">
@@ -13,43 +13,40 @@
<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
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>
<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>
</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
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 occurred, &false; is returned.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_rows_affected</function> example</title>
<programlisting role="php">
<example>
<title><function>sqlsrv_rows_affected</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -75,21 +72,17 @@ if( $rows_affected === false) {
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_num_rows</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_num_rows</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-send-stream-data">
<refnamediv>
<refname>sqlsrv_send_stream_data</refname>
<refpurpose>Sends data from parameter streams to the server</refpurpose>
@@ -12,41 +12,38 @@
<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
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>
<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>
</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">
<example>
<title><function>sqlsrv_send_stream_data</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -70,7 +67,7 @@ $stmt = sqlsrv_prepare( $conn, $sql, $params, $options);
sqlsrv_execute( $stmt);
// Send up to 8K of parameter data to the server
// 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)) {
@@ -79,22 +76,18 @@ while( sqlsrv_send_stream_data( $stmt)) {
echo "$i calls were made.";
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_prepare</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_prepare</function></member>
<member><function>sqlsrv_query</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -114,4 +107,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,6 +1,6 @@
<?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">
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="function.sqlsrv-server-info">
<refnamediv>
<refname>sqlsrv_server_info</refname>
<refpurpose>Returns information about the server</refpurpose>
@@ -15,21 +15,19 @@
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>
<variablelist>
<varlistentry>
<term><parameter>conn</parameter></term>
<listitem>
<para>
The connection resource that connects the client and the server.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
@@ -56,16 +54,15 @@
</row>
</tbody>
</tgroup>
</table>
</table>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>sqlsrv_server_info</function> example</title>
<programlisting role="php">
<example>
<title><function>sqlsrv_server_info</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$serverName = "serverName\sqlexpress";
@@ -85,21 +82,17 @@ if( $server_info )
}
?>
]]>
</programlisting>
</example>
</para>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>sqlsrv_client_info</function></member>
</simplelist>
</para>
<simplelist>
<member><function>sqlsrv_client_info</function></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -119,4 +112,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->

View File

@@ -1,51 +1,47 @@
<?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">
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sqlsrv.configuration">
&reftitle.runtime;
&extension.runtime;
<para>The following table lists the configuration options available in the SQLSRV
extension. For more information about these options, see
<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><constant>INI_ALL</constant></entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
<row>
<entry>sqlsrv.LogSubsystems</entry>
<entry>0</entry>
<entry><constant>INI_ALL</constant></entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
<row>
<entry>sqlsrv.LogSeverity</entry>
<entry>1</entry>
<entry><constant>INI_ALL</constant></entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
</tbody>
</tgroup>
</table>
<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><constant>INI_ALL</constant></entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
<row>
<entry>sqlsrv.LogSubsystems</entry>
<entry>0</entry>
<entry><constant>INI_ALL</constant></entry>
<entry>Available since SQLSRV 1.0</entry>
</row>
<row>
<entry>sqlsrv.LogSeverity</entry>
<entry>1</entry>
<entry><constant>INI_ALL</constant></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">
@@ -55,14 +51,13 @@
</term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para> -->
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -82,4 +77,4 @@ End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
-->