<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Prepare a query for later execution</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ingres-pconnect.html">ingres_pconnect</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ingres-query.html">ingres_query</a></div> <div class="up"><a href="ref.ingres.html">Ingres Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.ingres-prepare" class="refentry"> <div class="refnamediv"> <h1 class="refname">ingres_prepare</h1> <p class="verinfo">(PECL ingres >= 1.1.0)</p><p class="refpurpose"><span class="refname">ingres_prepare</span> — <span class="dc-title">Prepare a query for later execution</span></p> </div> <div class="refsect1 description" id="refsect1-function.ingres-prepare-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>ingres_prepare</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$query</code></span> )</div> <p class="para rdfs-comment"> Prepares a query for execution by <span class="function"><a href="function.ingres-execute.html" class="function">ingres_execute()</a></span>. </p> <p class="para"> The query becomes part of the currently open transaction. If there is no open transaction, <span class="function"><a href="function.ingres-query.html" class="function">ingres_query()</a></span> opens a new transaction. To close the transaction, you can call either <span class="function"><a href="function.ingres-commit.html" class="function">ingres_commit()</a></span> to commit the changes made to the database or <span class="function"><a href="function.ingres-rollback.html" class="function">ingres_rollback()</a></span> to cancel these changes. When the script ends, any open transaction is rolled back (by calling <span class="function"><a href="function.ingres-rollback.html" class="function">ingres_rollback()</a></span>). You can also use <span class="function"><a href="function.ingres-autocommit.html" class="function">ingres_autocommit()</a></span> before opening a new transaction to have every SQL query immediately committed. </p> <blockquote class="note"><p><strong class="note">Note</strong>: <strong>Related Configurations</strong><br /> <p class="para"> See also the <a href="ingres.configuration.html#ini.ingres.describe" class="link">ingres.describe</a>, <a href="ingres.configuration.html#ini.ingres.scrollable" class="link">ingres.scrollable</a> and <a href="ingres.configuration.html#ini.ingres.utf8" class="link">ingres.utf8</a> directives in <a href="ingres.configuration.html" class="link">Runtime Configuration</a>. </p> </p></blockquote> </div> <div class="refsect1 parameters" id="refsect1-function.ingres-prepare-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">link</code></em></span> <dd> <p class="para"> The connection link identifier </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">query</code></em></span> <dd> <p class="para"> A valid SQL query (see the Ingres <em>SQL reference guide</em>) in the Ingres documentation. See the <a href="function.ingres-query.html#function.ingres-query.query" class="link">query</a> parameter in <span class="function"><a href="function.ingres-query.html" class="function">ingres_query()</a></span> for a list of SQL statements which cannot be executed using <span class="function"><strong>ingres_prepare()</strong></span> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.ingres-prepare-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> <span class="function"><strong>ingres_prepare()</strong></span> returns a query result identifier that is used with <span class="function"><a href="function.ingres-execute.html" class="function">ingres_execute()</a></span> to execute the query. To see if an error occurred, use <span class="function"><a href="function.ingres-errno.html" class="function">ingres_errno()</a></span>, <span class="function"><a href="function.ingres-error.html" class="function">ingres_error()</a></span>, or <span class="function"><a href="function.ingres-errsqlstate.html" class="function">ingres_errsqlstate()</a></span>. </p> </div> <div class="refsect1 seealso" id="refsect1-function.ingres-prepare-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.ingres-unbuffered-query.html" class="function" rel="rdfs-seeAlso">ingres_unbuffered_query()</a> - Send an unbuffered SQL query to Ingres</span></li> <li class="member"> <span class="function"><a href="function.ingres-fetch-array.html" class="function" rel="rdfs-seeAlso">ingres_fetch_array()</a> - Fetch a row of result into an array</span></li> <li class="member"> <span class="function"><a href="function.ingres-fetch-assoc.html" class="function" rel="rdfs-seeAlso">ingres_fetch_assoc()</a> - Fetch a row of result into an associative array</span></li> <li class="member"> <span class="function"><a href="function.ingres-fetch-object.html" class="function" rel="rdfs-seeAlso">ingres_fetch_object()</a> - Fetch a row of result into an object</span></li> <li class="member"> <span class="function"><a href="function.ingres-fetch-row.html" class="function" rel="rdfs-seeAlso">ingres_fetch_row()</a> - Fetch a row of result into an enumerated array</span></li> <li class="member"> <span class="function"><a href="function.ingres-commit.html" class="function" rel="rdfs-seeAlso">ingres_commit()</a> - Commit a transaction</span></li> <li class="member"> <span class="function"><a href="function.ingres-rollback.html" class="function" rel="rdfs-seeAlso">ingres_rollback()</a> - Roll back a transaction</span></li> <li class="member"> <span class="function"><a href="function.ingres-autocommit.html" class="function" rel="rdfs-seeAlso">ingres_autocommit()</a> - Switch autocommit on or off</span></li> <li class="member"> <span class="function"><a href="function.ingres-set-environment.html" class="function" rel="rdfs-seeAlso">ingres_set_environment()</a> - Set environment features controlling output options</span></li> <li class="member"> <span class="function"><a href="function.ingres-errno.html" class="function" rel="rdfs-seeAlso">ingres_errno()</a> - Get the last Ingres error number generated</span></li> <li class="member"> <span class="function"><a href="function.ingres-error.html" class="function" rel="rdfs-seeAlso">ingres_error()</a> - Get a meaningful error message for the last error generated</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ingres-pconnect.html">ingres_pconnect</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ingres-query.html">ingres_query</a></div> <div class="up"><a href="ref.ingres.html">Ingres Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>