mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Add new constants.
Explain how INOUT and OUT parameters work in bindParam. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@180769 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
b45f7ffd49
commit
667fa1cc3f
2 changed files with 141 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
|
||||
<section id="pdo.constants">
|
||||
&reftitle.constants;
|
||||
|
@ -60,6 +60,19 @@
|
|||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>PDO_PARAM_INPUT_OUTPUT</constant>
|
||||
(<type>integer</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Specifies that the parameter is an INOUT parameter for a stored
|
||||
procedure. You must bitwise-OR this value with an explicit
|
||||
PDO_PARAM_* data type.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>PDO_FETCH_LAZY</constant>
|
||||
|
@ -174,6 +187,50 @@
|
|||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>PDO_FETCH_FUNC</constant>
|
||||
(<type>integer</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>PDO_FETCH_GROUP</constant>
|
||||
(<type>integer</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>PDO_FETCH_UNIQUE</constant>
|
||||
(<type>integer</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>PDO_FETCH_CLASSTYPE</constant>
|
||||
(<type>integer</type>)
|
||||
</term>
|
||||
<listitem>
|
||||
<simpara>
|
||||
|
||||
</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<constant>PDO_ATTR_AUTOCOMMIT</constant>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<!-- Generated by xml_proto.php v2.1. Found in /scripts directory of phpdoc. -->
|
||||
<refentry id="function.PDOStatement-bindParam">
|
||||
<refnamediv>
|
||||
|
@ -8,11 +8,11 @@
|
|||
Binds a parameter to a the specified variable name
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PDOStatement::bindParam</methodname>
|
||||
<methodparam><type>mixed</type><parameter>parameter_name</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>parameter</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter role="reference">variable</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>data_type</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
|
||||
|
@ -32,6 +32,60 @@
|
|||
For input-only variables, you can pass an array of input values to
|
||||
<function>PDOStatement::execute</function> instead.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>parameter</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Parameter identifier. For a prepared statement using named
|
||||
placeholders, this will be a parameter name of the form
|
||||
<varname>:name</varname>. For a prepared statement using
|
||||
question mark placeholders, this will be the 1-indexed position of
|
||||
the parameter.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>variable</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Name of the PHP variable to bind to the SQL statement parameter.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>data_type</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Explicit data type for the parameter using the PDO_PARAM_*
|
||||
constants. To return an INOUT parameter from a stored procedure,
|
||||
use the bitwise OR operator to set the PDO_PARAM_INPUT_OUTPUT bits
|
||||
for the <parameter>data_type</parameter> parameter.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>length</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Length of the data type. To indicate that a parameter is an OUT
|
||||
parameter from a stored procedure, you must explicitly set the
|
||||
length.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example><title>Execute a prepared statement with named placeholders</title>
|
||||
<programlisting role='php'>
|
||||
<![CDATA[
|
||||
|
@ -68,9 +122,34 @@ $sth->execute();
|
|||
</programlisting>
|
||||
</example>
|
||||
|
||||
<example><title>Call a stored procedure with an INOUT parameter</title>
|
||||
<programlisting role='php'>
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Call a stored procedure with an INOUT parameter */
|
||||
$colour = 'red';
|
||||
$sth = $dbh->prepare('CALL puree_fruit(?)');
|
||||
$sth->bindParam(1, $colour, PDO_PARAM_STR|PDO_PARAM_INPUT_OUTPUT, 12);
|
||||
$sth->execute();
|
||||
print("After pureeing fruit, the colour is: $colour");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PDO::prepare</function></member>
|
||||
<member><function>PDOStatement::execute</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
|
Loading…
Reference in a new issue