php-doc-en/functions/ibase.xml
2000-04-18 10:48:25 +00:00

399 lines
12 KiB
XML

<reference id="ref.ibase">
<title>InterBase functions</title>
<titleabbrev>InterBase</titleabbrev>
<partintro>
<para>
InterBase is a popular database put out by Borland/Inprise. More
information about InterBase is available at <ulink
url="&url.ibase;">&url.ibase;</ulink>. Oh, by the way, Interbase
just joined the open source movement!
</para>
</partintro>
<refentry id="function.ibase-connect">
<refnamediv>
<refname>ibase_connect</refname>
<refpurpose>
Open a connection to an InterBase database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_connect</function></funcdef>
<paramdef>string <parameter>database</parameter></paramdef>
<paramdef>string
<parameter><optional>username</optional></parameter>
</paramdef>
<paramdef>string
<parameter><optional>password</optional></parameter>
</paramdef>
<paramdef>string
<parameter><optional>charset</optional></parameter>
</paramdef>
<paramdef>string
<parameter><optional>role</optional></parameter>
</paramdef>
</funcsynopsis>
<para>
Establishes a connection to a InterBase server. The database argument
has to be a valid path to database file. Username and password can also
be specified with PHP configuration directives ibase.default_user and
ibase.default_password. In case a second call is made to
<function>ibase_connect</function> with the same arguments, no new link
will be established, but instead, the link identifier of the already opened
link will be returned. The link to the server will be closed as soon as the
execution of the script ends, unless it's closed earlier by explicitly calling
<function>ibase_close</function>.
<example>
<title><function>Ibase_connect</function> example</title>
<programlisting role="php">
$dbh = ibase_connect ($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query ($dbh, $stmt);
while ($row = ibase_fetch_object ($sth)) {
print $row->email . "\n";
}
ibase_close ($dbh);
</programlisting>
</example>
</para>
<note>
<para>
<parameter>role</parameter> was added in PHP4-RC2. It is functional
only with InterBase 5 and versions higher than that.
</para>
</note>
<para>
See also: <function>ibase_pconnect</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.ibase-pconnect">
<refnamediv>
<refname>ibase_pconnect</refname>
<refpurpose>
Creates an persistent connection to an InterBase database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_connect</function></funcdef>
<paramdef>string <parameter>database</parameter></paramdef>
<paramdef>string
<parameter><optional>username</optional></parameter>
</paramdef>
<paramdef>string
<parameter><optional>password</optional></parameter>
</paramdef>
<paramdef>string
<parameter><optional>charset</optional></parameter>
</paramdef>
<paramdef>string
<parameter><optional>role</optional></parameter>
</paramdef>
</funcsynopsis>
<para>
<function>ibase_pconnect</function> acts very much like
<function>ibase_connect</function> with two major differences.
First, when connecting, the function will first try to find a
(persistent) link that's already opened with the same parameters.
If one is found, an identifier for it will be returned instead of
opening a new connection. Second, the connection to the InterBase
server will not be closed when the execution of the script ends.
Instead, the link will remain open for future use
(<function>ibase_close</function> will not close links established
by <function>ibase_pconnect</function>). This type of link is
therefore called 'persistent'.
</para>
<para>
See also <function>ibase_connect</function> for the meaning of
parameters passed to this function. They are exactly the same.
</para>
</refsect1>
</refentry>
<refentry id="function.ibase-close">
<refnamediv>
<refname>ibase_close</refname>
<refpurpose>
Close a connection to an InterBase database
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_close</function></funcdef>
<paramdef>int
<parameter><optional>connection_id</optional></parameter>
</paramdef>
</funcsynopsis>
<para>
Closes the link to an InterBase database that's associated with
a connection id returned from <function>ibase_connect</function>.
If the connection id is omitted, the last opened link is assumed.
Default transaction on link is committed, other transactions are
rolled back.
</para>
</refsect1>
</refentry>
<refentry id="function.ibase-query">
<refnamediv>
<refname>ibase_query</refname>
<refpurpose>Execute a query on an InterBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_query</function></funcdef>
<paramdef>int
<parameter><optional>link_identifier</optional></parameter>
</paramdef>
<paramdef>string <parameter>query</parameter> </paramdef>
<paramdef>int
<parameter><optional>bind_args</optional></parameter>
</paramdef>
</funcsynopsis>
<simpara>
Performs a query on an InterBase database, returning a result
identifier for use with <function>ibase_fetch_row</function>,
<function>ibase_free_result</function> and
<function>ibase_free_query</function>.
</simpara>
<note>
<para>
Although this function supports variable binding to parameter
placeholders, there is not very much meaning using this capability
with it. For real life use and an example, see
<function>ibase_prepare</function> and
<function>ibase_execute</function>.
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.ibase-fetch-row">
<refnamediv>
<refname>ibase_fetch_row</refname>
<refpurpose>Fetch a row from an InterBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_fetch_row</function></funcdef>
<paramdef>int <parameter>result_identifier</parameter></paramdef>
</funcsynopsis>
<simpara>
Returns the next row specified by the result identifier obtained
using the <function>ibase_query</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ibase-fetch-object">
<refnamediv>
<refname>ibase_fetch_object</refname>
<refpurpose>Get an object from a InterBase database</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_fetch_object</function></funcdef>
<paramdef>int <parameter>result_id</parameter></paramdef>
</funcsynopsis>
<para>
Fetches a row as a pseudo-object from a
<parameter>result_id</parameter> obtained either by
<function>ibase_query</function> or
<function>ibase_execute</function>.
<informalexample>
<programlisting role="php">
$dbh = ibase_connect ($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query ($dbh, $stmt);
while ($row = ibase_fetch_object ($sth)) {
print $row->email . "\n";
}
ibase_close ($dbh);
</programlisting>
</informalexample>
</para>
<para>
See also <function>ibase_fetch_row</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.ibase-free-result">
<refnamediv>
<refname>ibase_free_result</refname>
<refpurpose>Free a result set</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_free_result</function></funcdef>
<paramdef>int <parameter>result_identifier</parameter></paramdef>
</funcsynopsis>
<simpara>
Free's a result set the has been created by
<function>ibase_query</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ibase-prepare">
<refnamediv>
<refname>ibase_prepare</refname>
<refpurpose>
Prepare a query for later binding of parameter placeholders and
execution
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_prepare</function></funcdef>
<paramdef>int
<parameter><optional>link_identifier</optional></parameter>
</paramdef>
<paramdef>string <parameter>query</parameter></paramdef>
</funcsynopsis>
<simpara>
Prepare a query for later binding of parameter placeholders and
execution (via <function>ibase_execute</function>).
</simpara>
</refsect1>
</refentry>
<refentry id="function.ibase-execute">
<refnamediv>
<refname>ibase_execute</refname>
<refpurpose>Execute a previously prepared query</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_execute</function></funcdef>
<paramdef>int <parameter>query</parameter></paramdef>
</funcsynopsis>
<simpara>
Execute a query prepared (and perhaps binded) by
<function>ibase_prepare</function> and
<function>ibase_bind</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ibase-free-query">
<refnamediv>
<refname>ibase_free_query</refname>
<refpurpose>
Free memory allocated by a prepared query
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_free_query</function></funcdef>
<paramdef>int <parameter>query</parameter></paramdef>
</funcsynopsis>
<simpara>
Free a query prepared by <function>ibase_prepare</function>.
</simpara>
</refsect1>
</refentry>
<refentry id="function.ibase-timefmt">
<refnamediv>
<refname>ibase_timefmt</refname>
<refpurpose>
Sets the format of datetime columns returned from queries
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_timefmt</function></funcdef>
<paramdef>string <parameter>format</parameter></paramdef>
</funcsynopsis>
<simpara>
Sets the format of the datetime columns returned from queries.
</simpara>
<note>
<para>
<function>Ibase_timefmt</function> is currently not functional
in PHP4.
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.ibase-num-fields">
<refnamediv>
<refname>ibase_num_fields</refname>
<refpurpose>
Get the number of rows in a result set
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ibase_num_fields</function></funcdef>
<paramdef>int <parameter>result_id</parameter></paramdef>
</funcsynopsis>
<para>
Returns an integer containing the number of fields in a result
set.
<informalexample>
<programlisting role="php">
$dbh = ibase_connect ($host, $username, $password);
$stmt = 'SELECT * FROM tblname';
$sth = ibase_query ($dbh, $stmt);
if (ibase_num_fields($sth) > 0) {
while ($row = ibase_fetch_object ($sth)) {
print $row->email . "\n";
}
} else {
die ("No Results were found for your query");
}
ibase_close ($dbh);
</programlisting>
</informalexample>
</para>
<para>
See also: <function>ibase_field_info</function>.
</para>
<note>
<para>
<function>Ibase_num_fields</function> is currently not functional
in PHP4.
</para>
</note>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->