php-doc-en/reference/uodbc/functions/odbc-prepare.xml
Christoph Michael Becker 902c2b77f8 Generate odbc methodsynopses based on stubs
Closes GH-286.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@352189 c90b9560-bf6c-de11-be94-00142212c4b1
2020-12-26 14:11:36 +00:00

116 lines
3.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.odbc-prepare" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>odbc_prepare</refname>
<refpurpose>Prepares a statement for execution</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>resource</type><type>false</type></type><methodname>odbc_prepare</methodname>
<methodparam><type>resource</type><parameter>odbc</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
</methodsynopsis>
<para>
Prepares a statement for execution. The result identifier can be used
later to execute the statement with <function>odbc_execute</function>.
</para>
<para>
Some databases (such as IBM DB2, MS SQL Server, and Oracle) support
stored procedures that accept parameters of type IN, INOUT, and OUT as
defined by the ODBC specification. However, the Unified ODBC driver
currently only supports parameters of type IN to stored procedures.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>odbc</parameter></term>
<listitem>
&odbc.connection.id;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
The query string statement being prepared.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns an ODBC result identifier if the SQL command was prepared
successfully. Returns &false; on error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>odbc_execute</function> and <function>odbc_prepare</function> example</title>
<para>
In the following code, <varname>$success</varname> will only be
&true; if all three parameters to myproc are IN parameters:
</para>
<programlisting role="php">
<![CDATA[
<?php
$a = 1;
$b = 2;
$c = 3;
$stmt = odbc_prepare($conn, 'CALL myproc(?,?,?)');
$success = odbc_execute($stmt, array($a, $b, $c));
?>
]]>
</programlisting>
</example>
</para>
<para>
If you need to call a stored procedure using INOUT or OUT parameters,
the recommended workaround is to use a native extension for your database
(for example, <link linkend="ref.oci8">oci8</link> for Oracle).
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>odbc_execute</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->