mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
Update documentation
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@181642 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
3c4e14b903
commit
ad2d322256
105 changed files with 3265 additions and 232 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<section id="maxdb.installation">
|
||||
&reftitle.install;
|
||||
<para id="maxdb.configure">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<section id="maxdb.constants">
|
||||
&reftitle.constants;
|
||||
&extension.constants;
|
||||
|
@ -95,6 +95,20 @@
|
|||
index.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>MAXDB_ASSOC_UPPER</entry>
|
||||
<entry>
|
||||
Columns are returned into the array having the upper case fieldname as the array
|
||||
index.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>MAXDB_ASSOC_LOWER</entry>
|
||||
<entry>
|
||||
Columns are returned into the array having the lower case fieldname as the array
|
||||
index.
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>MAXDB_BOTH</entry>
|
||||
<entry>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-affected-rows">
|
||||
<refnamediv>
|
||||
<refname>maxdb_affected_rows</refname>
|
||||
<refname>maxdb->affected_rows</refname>
|
||||
<refpurpose>Gets the number of affected rows in a previous MaxDB operation</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>mixed</type><methodname>maxdb_affected_rows</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>mixed</type><varname>affected_rows</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_affected_rows</function> returns the number of rows affected by the last
|
||||
INSERT, UPDATE, or DELETE query associated with the provided <parameter>link</parameter>
|
||||
|
@ -47,12 +53,58 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
maxdb_report (MAXDB_REPORT_OFF);
|
||||
$maxdb->query("DROP TABLE mycustomer");
|
||||
maxdb_report (MAXDB_REPORT_ERROR);
|
||||
|
||||
/* Insert rows */
|
||||
$maxdb->query("CREATE TABLE mycustomer AS SELECT * from hotel.customer");
|
||||
printf("Affected rows (INSERT): %d\n", $maxdb->affected_rows);
|
||||
|
||||
$maxdb->query("ALTER TABLE mycustomer ADD Status int default 0");
|
||||
|
||||
/* update rows */
|
||||
$maxdb->query("UPDATE mycustomer SET Status=1 WHERE cno > 50");
|
||||
printf("Affected rows (UPDATE): %d\n", $maxdb->affected_rows);
|
||||
|
||||
/* delete rows */
|
||||
$maxdb->query("DELETE FROM mycustomer WHERE cno < 50");
|
||||
printf("Affected rows (DELETE): %d\n", $maxdb->affected_rows);
|
||||
|
||||
/* select all rows */
|
||||
$result = $maxdb->query("SELECT title FROM mycustomer");
|
||||
printf("Affected rows (SELECT): %d\n", $maxdb->affected_rows);
|
||||
|
||||
$result->close();
|
||||
|
||||
/* Delete table Language */
|
||||
$maxdb->query("DROP TABLE mycustomer");
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
if (!$link) {
|
||||
printf("Can't connect to localhost. Error: %s\n", maxdb_connect_error());
|
||||
|
@ -100,7 +152,7 @@ maxdb_close($link);
|
|||
Affected rows (INSERT): 15
|
||||
Affected rows (UPDATE): 15
|
||||
Affected rows (DELETE): 0
|
||||
Affected rows (SELECT): -1
|
||||
Affected rows (SELECT): 15
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-autocommit">
|
||||
<refnamediv>
|
||||
<refname>maxdb_autocommit</refname>
|
||||
<refname> maxdb->auto_commit</refname>
|
||||
<refpurpose>Turns on or off auto-commiting database modifications</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -13,6 +14,15 @@
|
|||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>bool</type><parameter>mode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>auto_commit</methodname>
|
||||
<methodparam><type>bool</type><parameter>mode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_autocommit</function> is used to turn on or off auto-commit mode
|
||||
on queries for the database connection represented by the <parameter>link</parameter>
|
||||
|
@ -34,12 +44,33 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* turn autocommit on */
|
||||
$maxdb->autocommit(TRUE);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
if (!$link) {
|
||||
printf("Can't connect to localhost. Error: %s\n", maxdb_connect_error());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-bind-param">
|
||||
<refnamediv>
|
||||
<refname>maxdb_bind_param</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-bind-result">
|
||||
<refnamediv>
|
||||
<refname>maxdb_bind_result</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-change-user">
|
||||
<refnamediv>
|
||||
<refname>maxdb_change_user</refname>
|
||||
<refname>maxdb->change_user</refname>
|
||||
<refpurpose>Changes the user of the specified database connection</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -15,6 +16,17 @@
|
|||
<methodparam><type>string</type><parameter>password</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>database</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>change_user</methodname>
|
||||
<methodparam><type>string</type><parameter>user</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>password</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>database</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_change_user</function> is used to change the user of the specified
|
||||
database connection as given by the <parameter>link</parameter> parameter and to set the
|
||||
|
@ -50,12 +62,46 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* connect database test */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($result = $maxdb->query("SELECT * FROM dual")) {
|
||||
$row = $result->fetch_row();
|
||||
printf("Result: %s\n", $row[0]);
|
||||
$result->free();
|
||||
}
|
||||
|
||||
/* reset all and select a new database */
|
||||
if (!$maxdb->change_user("MONA", "RED", "XXXXXXX")) {
|
||||
printf("Database not running\n");
|
||||
} else {
|
||||
printf("Database running\n");
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-character-set-name">
|
||||
<refnamediv>
|
||||
<refname>maxdb_character_set_name</refname>
|
||||
<refname>maxdb->character_set_name</refname>
|
||||
<refpurpose>Returns the default character set for the database connection</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>string</type><methodname>maxdb_character_set_name</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>string</type>
|
||||
<methodname>character_set_name</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns the current character set for the database connection specified by the
|
||||
<parameter>link</parameter> parameter.
|
||||
|
@ -30,12 +40,35 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Print current character set */
|
||||
$charset = $maxdb->character_set_name();
|
||||
printf ("Current character set is %s\n", $charset);
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-client-encoding">
|
||||
<refnamediv>
|
||||
<refname>maxdb_client_encoding</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-close-long-data">
|
||||
<refnamediv>
|
||||
<refname>maxdb_close_long_data</refname>
|
||||
<refname>maxdb->close_long_data</refname>
|
||||
<refpurpose>Alias for <function>maxdb_stmt_close_long_data</function></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-close">
|
||||
<refnamediv>
|
||||
<refname>maxdb_close</refname>
|
||||
<refname>maxdb->close</refname>
|
||||
<refpurpose>Closes a previously opened database connection</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>bool</type><methodname>maxdb_close</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>close</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_close</function> function closes a previously opened database
|
||||
connection specified by the <parameter>link</parameter> parameter.
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-commit">
|
||||
<refnamediv>
|
||||
<refname>maxdb_commit</refname>
|
||||
<refname>maxdb->commit</refname>
|
||||
<refpurpose>Commits the current transaction</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>bool</type><methodname>maxdb_commit</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>commit</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Commits the current transaction for the database connection specified by the
|
||||
<parameter>link</parameter> parameter.
|
||||
|
@ -32,12 +42,47 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* set autocommit to off */
|
||||
$maxdb->autocommit(FALSE);
|
||||
|
||||
maxdb_report (MAXDB_REPORT_OFF);
|
||||
$maxdb->query("DROP TABLE mycustomer");
|
||||
maxdb_report (MAXDB_REPORT_ERROR);
|
||||
|
||||
$maxdb->query("CREATE TABLE mycustomer LIKE hotel.customer");
|
||||
|
||||
/* Insert some values */
|
||||
$maxdb->query("INSERT INTO mycustomer VALUES (3000,'Mrs','Jenny','Porter','10580','1340 N.Ash Street, #3')");
|
||||
$maxdb->query("INSERT INTO mycustomer VALUES (3100,'Mr','Peter','Brown','48226','1001 34th Str., APT.3')");
|
||||
|
||||
/* commit transaction */
|
||||
$maxdb->commit();
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-connect-errno">
|
||||
<refnamediv>
|
||||
<refname>maxdb_connect_errno</refname>
|
||||
|
@ -57,10 +57,8 @@ if (!$link) {
|
|||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Affected rows (INSERT): 15
|
||||
Affected rows (UPDATE): 15
|
||||
Affected rows (DELETE): 0
|
||||
Affected rows (SELECT): -1
|
||||
PHP Warning: maxdb_connect(): -4008 POS(1) Unknown user name/password combination [08004] <...>
|
||||
Can't connect to localhost. Errorcode: -4008
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-connect-error">
|
||||
<refnamediv>
|
||||
<refname>maxdb_connect_error</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-connect">
|
||||
<refnamediv>
|
||||
<refname>maxdb_connect</refname>
|
||||
<refname>maxdb()</refname>
|
||||
<refpurpose>Open a new connection to the MaxDB server</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -17,6 +18,19 @@
|
|||
<methodparam choice='opt'><type>int</type><parameter>port</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (constructor):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<constructorsynopsis>
|
||||
<methodname>__construct</methodname>
|
||||
<methodparam choice='opt'><type>string</type><parameter>host</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>username</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>passwd</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>dbname</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>int</type><parameter>port</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam>
|
||||
</constructorsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_connect</function> function attempts to open a connection to the MaxDB Server
|
||||
running on <parameter>host</parameter> which can be either a host name or an IP address. Passing the
|
||||
|
@ -49,12 +63,33 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
printf("Host information: %s\n", $maxdb->host_info);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-data-seek">
|
||||
<refnamediv>
|
||||
<refname>maxdb_data_seek</refname>
|
||||
<refname>result->data_seek</refname>
|
||||
<refpurpose>Adjusts the result pointer to an arbitary row in the result</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -13,6 +14,15 @@
|
|||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>data_seek</methodname>
|
||||
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_data_seek</function> function seeks to an arbitrary result pointer
|
||||
specified by the <parameter>offset</parameter> in the result set represented by
|
||||
|
@ -36,12 +46,47 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, state FROM hotel.city ORDER BY name";
|
||||
if ($result = $maxdb->query( $query)) {
|
||||
|
||||
/* seek to row no. 10 */
|
||||
$result->data_seek(10);
|
||||
|
||||
/* fetch row */
|
||||
$row = $result->fetch_row();
|
||||
|
||||
printf ("City: %s State: %s\n", $row[0], $row[1]);
|
||||
|
||||
/* free result set*/
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-debug">
|
||||
<refnamediv>
|
||||
<refname>maxdb_debug</refname>
|
||||
|
@ -11,6 +11,21 @@
|
|||
<type>void</type><methodname>maxdb_debug</methodname>
|
||||
<methodparam><type>string</type><parameter>debug</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_debug</function> can be used to trace the SQLDBC communication. The following
|
||||
strings can be used as a parameter to <function>maxdb_debug</function>:
|
||||
</para>
|
||||
<simplelist>
|
||||
<member>TRACE SHORT ON|OFF - Enables/disables method call trace.</member>
|
||||
<member>TRACE LONG ON|OFF - Enables/disables method argument and detail debug trace.</member>
|
||||
<member>TRACE PACKET ON|OFF|<size> - Enables/disables packet trace, limiting the size of the
|
||||
traced object to the specified number of bytes, or 1000 if no size is specified.</member>
|
||||
<member>TRACE SQL ON|OFF - Enables/disables high level api trace.</member>
|
||||
<member>TRACE TIMESTAMP ON|OFF - Enables/disables a timestamp prefix on each line that is
|
||||
traced.</member>
|
||||
<member>TRACE SIZE <size> - Limits the size of the trace file to <size> bytes,
|
||||
at least 8192 bytes are required.</member>
|
||||
</simplelist>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Return values</title>
|
||||
|
@ -24,10 +39,18 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* Create a trace file in '/tmp/client.trace' on the local (client) machine: */
|
||||
/* NOTE: Does nothing in case of MaxDB */
|
||||
maxdb_debug("d:t:0,/tmp/client.trace");
|
||||
|
||||
maxdb_debug("trace packet 200");
|
||||
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
maxdb_close($link);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-disable-reads-from-master">
|
||||
<refnamediv>
|
||||
<refname>maxdb_disable_reads_from_master</refname>
|
||||
<refname>maxdb->disable_reads_from_master</refname>
|
||||
<refpurpose>Disable reads from master</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>maxdb_disable_reads_from_master</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>disable_reads_from_master</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
&warn.experimental.func;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-disable-rpl-parse">
|
||||
<refnamediv>
|
||||
<refname>maxdb_disable_rpl_parse</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-embedded-connect">
|
||||
<refnamediv>
|
||||
<refname>maxdb_embedded_connect</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-enable-reads-from-master">
|
||||
<refnamediv>
|
||||
<refname>maxdb_enable_reads_from_master</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-enable-rpl-parse">
|
||||
<refnamediv>
|
||||
<refname>maxdb_enable_rpl_parse</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-errno">
|
||||
<refnamediv>
|
||||
<refname>maxdb_errno</refname>
|
||||
<refname>maxdb->errno</refname>
|
||||
<refpurpose>Returns the error code for the most recent function call</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>int</type><methodname>maxdb_errno</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>int</type><varname>errno</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_errno</function> function will return the last error code for
|
||||
the most recent MaxDB function call that can succeed or fail with respect to the
|
||||
|
@ -36,12 +42,35 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!$maxdb->query("SELECT xxx FROM hotel.city")) {
|
||||
printf("Errorcode: %d\n", $maxdb->errno);
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-error">
|
||||
<refnamediv>
|
||||
<refname>maxdb_error</refname>
|
||||
|
@ -12,6 +12,11 @@
|
|||
<type>string</type><methodname>maxdb_error</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>error</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_error</function> function is identical to the corresponding
|
||||
<function>maxdb_errno</function> function in every way, except instead of returning
|
||||
|
@ -38,12 +43,35 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!$maxdb->query("SELECT xxx FROM hotel.city")) {
|
||||
printf("Errormessage: %s\n", $maxdb->error);
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-escape-string">
|
||||
<refnamediv>
|
||||
<refname>maxdb_escape_string</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-execute">
|
||||
<refnamediv>
|
||||
<refname>maxdb_execute</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-fetch-array">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_array</refname>
|
||||
<refname>result->fetch_array</refname>
|
||||
<refpurpose>Fetch a result row as an associative, a numeric array, or both</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -13,6 +14,15 @@
|
|||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>int</type><parameter>resulttype</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>fetch_array</methodname>
|
||||
<methodparam choice='opt'><type>int</type><parameter>resulttype</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns an array that corresponds to the fetched row or &null; if there are no more rows for the
|
||||
resultset represented by the <parameter>result</parameter> parameter.
|
||||
|
@ -33,8 +43,10 @@
|
|||
<para>
|
||||
The optional second argument <parameter>resulttype</parameter> is a constant indicating what
|
||||
type of array should be produced from the current row data. The possible values for this parameter
|
||||
are the constants MAXDB_ASSOC, MAXDB_NUM, or MAXDB_BOTH. By default the
|
||||
<function>maxdb_fetch_array</function> function will assume MAXDB_BOTH for this parameter.
|
||||
are the constants MAXDB_ASSOC, MAXDB_ASSOC_UPPER, MAXDB_ASSOC_LOWER, MAXDB_NUM, or MAXDB_BOTH.
|
||||
By default the
|
||||
<function>maxdb_fetch_array</function> function will assume MAXDB_BOTH, which is a combination of
|
||||
MAXDB_NUM and MAXDB_ASSOC for this parameter.
|
||||
</para>
|
||||
<para>
|
||||
By using the MAXDB_ASSOC constant this function will behave identically to the
|
||||
|
@ -42,6 +54,14 @@
|
|||
<function>maxdb_fetch_row</function> function. The final option MAXDB_BOTH will create a single
|
||||
array with the attributes of both.
|
||||
</para>
|
||||
<para>
|
||||
By using the MAXDB_ASSOC_UPPER constant, the behaviour of this function is identical to the use
|
||||
of MAXDB_ASSOC except the array index of a column is the fieldname in upper case.
|
||||
</para>
|
||||
<para>
|
||||
By using the MAXDB_ASSOC_LOWER constant, the behaviour of this function is identical to the use
|
||||
of MAXDB_ASSOC except the array index of a column is the fieldname in lower case.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Return values</title>
|
||||
|
@ -59,12 +79,49 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, state FROM hotel.city ORDER by zip";
|
||||
$result = $maxdb->query($query);
|
||||
|
||||
/* numeric array */
|
||||
$row = $result->fetch_array(MAXDB_NUM);
|
||||
printf ("%s (%s)\n", $row[0], $row[1]);
|
||||
|
||||
/* associative array */
|
||||
$row = $result->fetch_array(MAXDB_ASSOC);
|
||||
printf ("%s (%s)\n", $row["NAME"], $row["STATE"]);
|
||||
|
||||
/* associative and numeric array */
|
||||
$row = $result->fetch_array(MAXDB_BOTH);
|
||||
printf ("%s (%s)\n", $row[0], $row["STATE"]);
|
||||
|
||||
/* free result set */
|
||||
$result->close();
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-fetch-assoc">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_assoc</refname>
|
||||
<refname>maxdb->fetch_assoc</refname>
|
||||
<refpurpose>Fetch a result row as an associative array</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>array</type><methodname>maxdb_fetch_assoc</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>array</type>
|
||||
<methodname>fetch_assoc</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns an associative array that corresponds to the fetched row or &null; if there are
|
||||
no more rows.
|
||||
|
@ -48,12 +58,44 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, state FROM hotel.city ORDER by zip";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* fetch associative array */
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
printf ("%s (%s)\n", $row["NAME"], $row["STATE"]);
|
||||
}
|
||||
|
||||
/* free result set */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-fetch-field-direct">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_field_direct</refname>
|
||||
<refname>result->fetch_field_direct</refname>
|
||||
<refpurpose>
|
||||
Fetch meta-data for a single field
|
||||
</refpurpose>
|
||||
|
@ -15,6 +16,15 @@
|
|||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>fieldnr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>fetch_field_direct</methodname>
|
||||
<methodparam><type>int</type><parameter>fieldnr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_fetch_field_direct</function> returns an resource which contains
|
||||
field definition informations from specified resultset. The value of fieldnr must be in the
|
||||
|
@ -24,7 +34,7 @@
|
|||
<refsect1>
|
||||
<title>Return values</title>
|
||||
<para>
|
||||
Returns a resource which contains field definition information or &false; if no field information
|
||||
Returns an resource which contains field definition informations or &false; if no field information
|
||||
for specified <literal>fieldnr</literal> is available.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -69,12 +79,47 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, cno from hotel.customer ORDER BY name";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* Get field information for column 'SurfaceArea' */
|
||||
$finfo = $result->fetch_field_direct(1);
|
||||
|
||||
printf("Name: %s\n", $finfo->name);
|
||||
printf("Table: %s\n", $finfo->table);
|
||||
printf("max. Len: %d\n", $finfo->max_length);
|
||||
printf("Flags: %d\n", $finfo->flags);
|
||||
printf("Type: %d\n", $finfo->type);
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-fetch-field">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_field</refname>
|
||||
<refname>result->fetch_field</refname>
|
||||
<refpurpose>Returns the next field in the result set</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,14 @@
|
|||
<type>mixed</type><methodname>maxdb_fetch_field</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>fetch_field</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_fetch_field</function> returns the definition of one column
|
||||
of a result set as an resource. Call this function repeatedly to retrieve
|
||||
|
@ -23,7 +32,7 @@
|
|||
<refsect1>
|
||||
<title>Return values</title>
|
||||
<para>
|
||||
Returns a resource which contains field definition information or &false; if no field information
|
||||
Returns an resource which contains field definition informations or &false; if no field information
|
||||
is available.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -69,12 +78,47 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* Get field information for all columns */
|
||||
while ($finfo = $result->fetch_field()) {
|
||||
|
||||
printf("Name: %s\n", $finfo->name);
|
||||
printf("Table: %s\n", $finfo->table);
|
||||
printf("max. Len: %d\n", $finfo->max_length);
|
||||
printf("Flags: %d\n", $finfo->flags);
|
||||
printf("Type: %d\n\n", $finfo->type);
|
||||
}
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-fetch-fields">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_fields</refname>
|
||||
<refname>result->fetch_fields</refname>
|
||||
<refpurpose>Returns an array of resources representing the fields in a result set</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>mixed</type><methodname>maxdb_fetch_fields</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>fetch_fields</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
This function serves an identical purpose to the <function>maxdb_fetch_field</function>
|
||||
function with the single difference that, instead of returning one resource at a time for
|
||||
|
@ -21,7 +31,7 @@
|
|||
<refsect1>
|
||||
<title>Return values</title>
|
||||
<para>
|
||||
Returns an array of resources which contains field definition information or &false; if no field information
|
||||
Returns an array of resources which contains field definition informations or &false; if no field information
|
||||
is available.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -66,12 +76,48 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* Get field information for all columns */
|
||||
$finfo = $result->fetch_fields();
|
||||
|
||||
for ($i=0; $i < count($finfo); $i++) {
|
||||
printf("Name: %s\n", $finfo[$i]->name);
|
||||
printf("Table: %s\n", $finfo[$i]->table);
|
||||
printf("max. Len: %d\n", $finfo[$i]->max_length);
|
||||
printf("Flags: %d\n", $finfo[$i]->flags);
|
||||
printf("Type: %d\n\n", $finfo[$i]->type);
|
||||
}
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-fetch-lengths">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_lengths</refname>
|
||||
<refname>result->lengths</refname>
|
||||
<refpurpose>Returns the lengths of the columns of the current row in the result set</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>mixed</type><methodname>maxdb_fetch_lengths</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<fieldsynopsis><type>mixed</type><varname>lengths</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_fetch_lengths</function> function returns an array containing the
|
||||
lengths of every column of the current row within the result set represented by the
|
||||
|
@ -33,12 +39,44 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT * from hotel.customer WHERE cno = 3000";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
$row = $result->fetch_row();
|
||||
|
||||
/* display column lengths */
|
||||
for ($i=0; $i < count($result->lengths); $i++) {
|
||||
printf("Field %2d has Length %2d\n", $i+1, $result->lengths[$i]);
|
||||
}
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,27 +1,37 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<refentry id="function.maxdb-fetch-resource">
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-fetch-object">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_resource</refname>
|
||||
<refpurpose>Returns the current row of a result set as an resource</refpurpose>
|
||||
<refname>maxdb_fetch_object</refname>
|
||||
<refname>result->fetch_object</refname>
|
||||
<refpurpose>Returns the current row of a result set as an object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>maxdb_fetch_resource</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<type>mixed</type><methodname>maxdb_fetch_object</methodname>
|
||||
<methodparam><type>object</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>fetch_object</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_fetch_resource</function> will return the current row result set
|
||||
as an resource where the attributes of the resource represent the names of the fields found
|
||||
The <function>maxdb_fetch_object</function> will return the current row result set
|
||||
as an object where the attributes of the object represent the names of the fields found
|
||||
within the result set. If no more rows exist in the current result set, &null; is returned.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Return values</title>
|
||||
<para>
|
||||
Returns an resource that corresponds to the fetched row or &null; if there are no more rows in resultset.
|
||||
Returns an object that corresponds to the fetched row or &null; if there are no more rows in resultset.
|
||||
</para>
|
||||
&database.field-case;
|
||||
&database.fetch-null;
|
||||
|
@ -36,12 +46,44 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, state FROM hotel.city ORDER by zip";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* fetch object array */
|
||||
while ($obj = $result->fetch_object()) {
|
||||
printf ("%s (%s)\n", $obj->NAME, $obj->STATE);
|
||||
}
|
||||
|
||||
/* free result set */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-fetch-row">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch_row</refname>
|
||||
<refname>result->fetch_row</refname>
|
||||
<refpurpose>Get a result row as an enumerated array</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>mixed</type><methodname>maxdb_fetch_row</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>fetch_row</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns an array that corresponds to the fetched row, or &null; if there are no more rows.
|
||||
</para>
|
||||
|
@ -41,12 +51,44 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, state FROM hotel.city ORDER by zip";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* fetch object array */
|
||||
while ($row = $result->fetch_row()) {
|
||||
printf ("%s (%s)\n", $row[0], $row[1]);
|
||||
}
|
||||
|
||||
/* free result set */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-fetch">
|
||||
<refnamediv>
|
||||
<refname>maxdb_fetch</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-field-count">
|
||||
<refnamediv>
|
||||
<refname>maxdb_field_count</refname>
|
||||
<refname>maxdb->field_count</refname>
|
||||
<refpurpose>Returns the number of columns for the most recent query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -10,8 +11,17 @@
|
|||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>maxdb_field_count</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>int</type>
|
||||
<methodname>field_count</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns the number of columns for the most recent query on the connection
|
||||
represented by the <parameter>link</parameter> parameter. This function
|
||||
|
@ -27,12 +37,45 @@
|
|||
<refsect1>
|
||||
<title>Example</title>
|
||||
<para>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role='php'>
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
maxdb_report (MAXDB_REPORT_OFF);
|
||||
$maxdb->query("DROP TABLE friends");
|
||||
maxdb_report (MAXDB_REPORT_ERROR);
|
||||
|
||||
$maxdb->query( "CREATE TABLE friends (id int, name varchar(20))");
|
||||
|
||||
$maxdb->query( "INSERT INTO friends VALUES (1,'Hartmut')");
|
||||
$maxdb->query( "INSERT INTO friends VALUES (2, 'Ulf')");
|
||||
|
||||
if ($maxdb->field_count()) {
|
||||
/* this was a select/show or describe query */
|
||||
$result = $maxdb->store_result();
|
||||
|
||||
/* process resultset */
|
||||
$row = $result->fetch_row();
|
||||
|
||||
/* free resultset */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role='php'>
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
maxdb_report (MAXDB_REPORT_OFF);
|
||||
maxdb_query($link,"DROP TABLE friends");
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-field-seek">
|
||||
<refnamediv>
|
||||
<refname>maxdb_field_seek</refname>
|
||||
<refname>result->field_seek</refname>
|
||||
<refpurpose>
|
||||
Set result pointer to a specified field offset
|
||||
</refpurpose>
|
||||
|
@ -12,9 +13,18 @@
|
|||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>maxdb_field_seek</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter>result</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>fieldnr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>int</type>
|
||||
<methodname>field_seek</methodname>
|
||||
<methodparam><type>int</type><parameter>fieldnr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Sets the field cursor to the given offset. The next call to <function>maxdb_fetch_field</function>
|
||||
will retrieve the field definition of the column associated with that offset.
|
||||
|
@ -37,12 +47,48 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* Get field information for 2nd column */
|
||||
$result->field_seek(1);
|
||||
$finfo = $result->fetch_field();
|
||||
|
||||
printf("Name: %s\n", $finfo->name);
|
||||
printf("Table: %s\n", $finfo->table);
|
||||
printf("max. Len: %d\n", $finfo->max_length);
|
||||
printf("Flags: %d\n", $finfo->flags);
|
||||
printf("Type: %d\n\n", $finfo->type);
|
||||
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-field-tell">
|
||||
<refnamediv>
|
||||
<refname>maxdb_field_tell</refname>
|
||||
<refname>result->current_field</refname>
|
||||
<refpurpose>
|
||||
Get current field offset of a result pointer
|
||||
</refpurpose>
|
||||
|
@ -14,6 +15,14 @@
|
|||
<type>int</type><methodname>maxdb_field_tell</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<fieldsynopsis>
|
||||
<type>int</type>
|
||||
<varname>current_field</varname>
|
||||
</fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns the position of the field cursor used for the last
|
||||
<function>maxdb_fetch_field</function> call. This value can
|
||||
|
@ -35,12 +44,51 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
|
||||
|
||||
if ($result = $maxdb->query($query)) {
|
||||
|
||||
/* Get field information for all columns */
|
||||
while ($finfo = $result->fetch_field()) {
|
||||
|
||||
/* get fieldpointer offset */
|
||||
$currentfield = $result->current_field;
|
||||
|
||||
printf("Column %d:\n", $currentfield);
|
||||
printf("Name: %s\n", $finfo->name);
|
||||
printf("Table: %s\n", $finfo->table);
|
||||
printf("max. Len: %d\n", $finfo->max_length);
|
||||
printf("Flags: %d\n", $finfo->flags);
|
||||
printf("Type: %d\n\n", $finfo->type);
|
||||
}
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-free-result">
|
||||
<refnamediv>
|
||||
<refname>maxdb_free_result</refname>
|
||||
<refname>result->free</refname>
|
||||
<refpurpose>Frees the memory associated with a result</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>void</type><methodname>maxdb_free_result</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>void</type>
|
||||
<methodname>free</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_free_result</function> function frees the memory
|
||||
associated with the result represented by the
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-get-client-info">
|
||||
<refnamediv>
|
||||
<refname>maxdb_get_client_info</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-get-client-version">
|
||||
<refnamediv>
|
||||
<refname>maxdb_get_client_version</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-get-host-info">
|
||||
<refnamediv>
|
||||
<refname>maxdb_get_host_info</refname>
|
||||
<refname>maxdb->get_host_info</refname>
|
||||
<refpurpose>Returns a string representing the type of connection used</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>string</type><methodname>maxdb_get_host_info</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>host_info</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_get_host_info</function> function returns a string
|
||||
describing the connection represented by the <parameter>link</parameter>
|
||||
|
@ -32,12 +38,34 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* print host information */
|
||||
printf("Host info: %s\n", $maxdb->host_info);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-get-metadata">
|
||||
<refnamediv>
|
||||
<refname>maxdb_get_metadata</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-get-proto-info">
|
||||
<refnamediv>
|
||||
<refname>maxdb_get_proto_info</refname>
|
||||
<refname>maxdb->protocol_version</refname>
|
||||
<refpurpose>Returns the version of the MaxDB protocol used</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>int</type><methodname>maxdb_get_proto_info</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>protocol_version</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns an integer representing the MaxDB protocol version used by the
|
||||
connection represented by the <parameter>link</parameter> parameter.
|
||||
|
@ -31,12 +37,34 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* print protocol version */
|
||||
printf("Protocol version: %d\n", $maxdb->protocol_version);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-get-server-info">
|
||||
<refnamediv>
|
||||
<refname>maxdb_get_server_info</refname>
|
||||
<refname>maxdb->server_info</refname>
|
||||
<refpurpose>Returns the version of the MaxDB server</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>string</type><methodname>maxdb_get_server_info</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>server_info</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns a string representing the version of the MaxDB server that the
|
||||
MaxDB extension is connected to (represented by the
|
||||
|
@ -34,12 +40,34 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* print server version */
|
||||
printf("Server version: %s\n", $maxdb->server_info);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-get-server-version">
|
||||
<refnamediv>
|
||||
<refname>maxdb_get_server_version</refname>
|
||||
|
@ -12,6 +12,11 @@
|
|||
<type>int</type><methodname>maxdb_get_server_version</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>int</type><varname>server_version</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_get_server_version</function> function returns the
|
||||
version of the server connected to (represented by the
|
||||
|
@ -39,12 +44,34 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* print server version */
|
||||
printf("Server version: %d\n", $maxdb->server_version);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-info">
|
||||
<refnamediv>
|
||||
<refname>maxdb_info</refname>
|
||||
<refname>maxdb->info</refname>
|
||||
<refpurpose>Retrieves information about the most recently executed query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>string</type><methodname>maxdb_info</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>info</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_info</function> function returns a string providing
|
||||
information about the last query executed. The nature of this string is
|
||||
|
@ -75,12 +81,37 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.t1 LIKE hotel.city");
|
||||
|
||||
/* INSERT INTO .. SELECT */
|
||||
$maxdb->query("INSERT INTO temp.t1 SELECT * FROM hotel.city");
|
||||
printf("%s\n", $maxdb->info);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-init">
|
||||
<refnamediv>
|
||||
<refname>maxdb_init</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-insert-id">
|
||||
<refnamediv>
|
||||
<refname>maxdb_insert_id</refname>
|
||||
<refname>maxdb->insert_id</refname>
|
||||
<refpurpose>Returns the auto generated id used in the last query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>mixed</type><methodname>maxdb_insert_id</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>mixed</type><varname>insert_id</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_insert_id</function> function returns the ID generated
|
||||
by a query on a table with a column having the DEFAULT SERIAL attribute. If
|
||||
|
@ -37,12 +43,46 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
maxdb_report (MAXDB_REPORT_OFF);
|
||||
$maxdb->query("DROP TABLE mycity");
|
||||
maxdb_report (MAXDB_REPORT_ERROR);
|
||||
|
||||
$maxdb->query("CREATE TABLE mycity LIKE hotel.city");
|
||||
$maxdb->query("ALTER TABLE mycity ADD id FIXED(11) DEFAULT SERIAL");
|
||||
|
||||
$query = "INSERT INTO mycity (zip,name,state) VALUES ('12203','Albany' ,'NY')";
|
||||
$maxdb->query($query);
|
||||
|
||||
printf ("New Record has id %d.\n", $maxdb->insert_id);
|
||||
|
||||
/* drop table */
|
||||
$maxdb->query("DROP TABLE mycity");
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-kill">
|
||||
<refnamediv>
|
||||
<refname>maxdb_kill</refname>
|
||||
<refname>maxdb->kill</refname>
|
||||
<refpurpose>Disconnects from a MaxDB server</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -13,6 +14,15 @@
|
|||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>processid</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>kill</methodname>
|
||||
<methodparam><type>int</type><parameter>processid</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
This function is used to disconnect from a MaxDB server specified
|
||||
by the <parameter>processid</parameter> parameter.
|
||||
|
@ -30,12 +40,43 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* determine our thread id */
|
||||
$thread_id = $maxdb->thread_id;
|
||||
|
||||
/* Kill connection */
|
||||
$maxdb->kill($thread_id);
|
||||
|
||||
/* This should produce an error */
|
||||
if (!$maxdb->query("CREATE TABLE myCity LIKE City")) {
|
||||
printf("Error: %s\n", $maxdb->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-master-query">
|
||||
<refnamediv>
|
||||
<refname>maxdb_master_query</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-more-results">
|
||||
<refnamediv>
|
||||
<refname>maxdb_more_results</refname>
|
||||
<refname>maxdb->more_results</refname>
|
||||
<refpurpose>Check if there any more query results from a multi query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-multi-query">
|
||||
<refnamediv>
|
||||
<refname>maxdb_multi_query</refname>
|
||||
<refname>maxdb->multi_query</refname>
|
||||
<refpurpose>Performs a query on the database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -13,6 +14,15 @@
|
|||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>multi_query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_multi_query</function> works like the function
|
||||
<function>maxdb_query</function>. Multiple queries are not yet supported.
|
||||
|
@ -35,12 +45,51 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM dual";
|
||||
$query .= "SELECT name FROM hotel.city ORDER BY zip";
|
||||
|
||||
/* execute multi query */
|
||||
if ($maxdb->multi_query($query)) {
|
||||
do {
|
||||
/* store first result set */
|
||||
if ($result = $maxdb->store_result()) {
|
||||
while ($row = $result->fetch_row()) {
|
||||
printf("%s\n", $row[0]);
|
||||
}
|
||||
$result->close();
|
||||
}
|
||||
/* print divider */
|
||||
if ($maxdb->more_results()) {
|
||||
printf("-----------------\n");
|
||||
}
|
||||
} while ($maxdb->next_result());
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-next-result">
|
||||
<refnamediv>
|
||||
<refname>maxdb_next_result</refname>
|
||||
<refname>maxdb->next_result</refname>
|
||||
<refpurpose>Prepare next result from multi_query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-num-fields">
|
||||
<refnamediv>
|
||||
<refname>maxdb_num_fields</refname>
|
||||
<refname>result->field_count</refname>
|
||||
<refpurpose>
|
||||
Get the number of fields in a result
|
||||
</refpurpose>
|
||||
|
@ -14,6 +15,11 @@
|
|||
<type>int</type><methodname>maxdb_num_fields</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>result</classname></ooclass>
|
||||
<fieldsynopsis><type>int</type><varname>field_count</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_num_fields</function> returns the number of fields from specified result set.
|
||||
</para>
|
||||
|
@ -30,12 +36,42 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($result = $maxdb->query("SELECT * FROM hotel.city ORDER BY zip")) {
|
||||
|
||||
/* determine number of fields in result set */
|
||||
$field_cnt = $result->field_count;
|
||||
|
||||
printf("Result set has %d fields.\n", $field_cnt);
|
||||
|
||||
/* close result set */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-num-rows">
|
||||
<refnamediv>
|
||||
<refname>maxdb_num_rows</refname>
|
||||
|
@ -14,6 +14,11 @@
|
|||
<type>mixed</type><methodname>maxdb_num_rows</methodname>
|
||||
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>mixed</type><varname>num_rows</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns the number of rows in the result set.
|
||||
</para>
|
||||
|
@ -48,12 +53,42 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($result = $maxdb->query("SELECT cno, name FROM hotel.customer ORDER BY name")) {
|
||||
|
||||
/* determine number of rows result set */
|
||||
$row_cnt = $result->num_rows;
|
||||
|
||||
printf("Result set has %d rows.\n", $row_cnt);
|
||||
|
||||
/* close result set */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
@ -83,7 +118,7 @@ maxdb_close($link);
|
|||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Result set has -1 rows.
|
||||
Result set has 15 rows.
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-options">
|
||||
<refnamediv>
|
||||
<refname>maxdb_options</refname>
|
||||
<refname>maxdb->options</refname>
|
||||
<refpurpose>Set options</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -14,6 +15,16 @@
|
|||
<methodparam><type>int</type><parameter>option</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>options</methodname>
|
||||
<methodparam><type>int</type><parameter>option</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_options</function> can be used to set extra connect options
|
||||
and affect behavior for a connection.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-param-count">
|
||||
<refnamediv>
|
||||
<refname>maxdb_param_count</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-ping">
|
||||
<refnamediv>
|
||||
<refname>maxdb_ping</refname>
|
||||
<refname>maxdb->ping</refname>
|
||||
<refpurpose>
|
||||
Pings a server connection, or tries to reconnect if the connection has gone down
|
||||
</refpurpose>
|
||||
|
@ -14,6 +15,14 @@
|
|||
<type>bool</type><methodname>maxdb_ping</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>ping</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Checks whether the connection to the server is working. If it has gone
|
||||
down, and global option <literal>maxdb.reconnect</literal> is enabled
|
||||
|
@ -31,12 +40,38 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* check if server is alive */
|
||||
if ($maxdb->ping()) {
|
||||
printf ("Our connection is ok!\n");
|
||||
} else {
|
||||
printf ("Error: %s\n", $maxdb->error);
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-prepare">
|
||||
<refnamediv>
|
||||
<refname>maxdb_prepare</refname>
|
||||
<refname>maxdb->prepare</refname>
|
||||
<refpurpose>
|
||||
Prepare a SQL statement for execution
|
||||
</refpurpose>
|
||||
|
@ -15,6 +16,15 @@
|
|||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>prepare</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_prepare</function> prepares the SQL query pointed to by the
|
||||
null-terminated string query, and returns a statement handle to be used for
|
||||
|
@ -72,12 +82,54 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$city = "Rosemont";
|
||||
|
||||
/* create a prepared statement */
|
||||
if ($stmt = $maxdb->prepare("SELECT state FROM hotel.city WHERE name=?")) {
|
||||
|
||||
/* bind parameters for markers */
|
||||
$stmt->bind_param("s", $city);
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
/* bind result variables */
|
||||
$stmt->bind_result($district);
|
||||
|
||||
/* fetch value */
|
||||
$stmt->fetch();
|
||||
|
||||
printf("%s is in district %s\n", $city, $district);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-query">
|
||||
<refnamediv>
|
||||
<refname>maxdb_query</refname>
|
||||
<refname>maxdb->query</refname>
|
||||
<refpurpose>Performs a query on the database</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -14,6 +15,15 @@
|
|||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>int</type><parameter>resultmode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_query</function> function is used to simplify the
|
||||
act of performing a query against the database represented by the
|
||||
|
@ -38,12 +48,48 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Create table doesn't return a resultset */
|
||||
if ($maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city") === TRUE) {
|
||||
printf("Table mycity successfully created.\n");
|
||||
}
|
||||
|
||||
/* Select queries return a resultset */
|
||||
if ($result = $maxdb->query("SELECT name FROM hotel.city")) {
|
||||
printf("Select returned %d rows.\n", $result->num_rows);
|
||||
|
||||
/* free result set */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* If we have to retrieve large amount of data we use MAXDB_USE_RESULT */
|
||||
if ($result = $maxdb->query("SELECT * FROM hotel.city", MAXDB_USE_RESULT)) {
|
||||
$result->close();
|
||||
}
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
@ -80,7 +126,7 @@ maxdb_close($link);
|
|||
<screen>
|
||||
<![CDATA[
|
||||
Table mycity successfully created.
|
||||
Select returned -1 rows.
|
||||
Select returned 25 rows.
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-real-connect">
|
||||
<refnamediv>
|
||||
<refname>maxdb_real_connect</refname>
|
||||
<refname>maxdb->real_connect</refname>
|
||||
<refpurpose>Opens a connection to a MaxDB server</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -18,6 +19,20 @@
|
|||
<methodparam choice='opt'><type>int</type><parameter>port</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>real_connect</methodname>
|
||||
<methodparam choice='opt'><type>string</type><parameter>hostname</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>username</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>passwd</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>dbname</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>int</type><parameter>port</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>socket</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_real_connect</function> attempts to establish a
|
||||
connection to a MaxDB database engine running on
|
||||
|
@ -56,6 +71,35 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
/* create a connection object which is not connected */
|
||||
$maxdb = maxdb_init();
|
||||
|
||||
/* set connection options */
|
||||
$maxdb->options(MAXDB_UNICODE, "FALSE");
|
||||
$maxdb->options(MAXDB_TIMEOUT, 5);
|
||||
|
||||
/* connect to server */
|
||||
$maxdb->real_connect('localhost', 'MONA', 'RED', 'DEMODB');
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
printf ("Connection: %s\n.", $maxdb->host_info);
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
|
@ -70,7 +114,7 @@ maxdb_options($link, MAXDB_UNICODE, "FALSE");
|
|||
maxdb_options($link, MAXDB_TIMEOUT, 5);
|
||||
|
||||
/* connect to server */
|
||||
maxdb_real_connect($link, 'localhost', 'MONA', 'RED');
|
||||
maxdb_real_connect($link, 'localhost', 'MONA', 'RED', 'DEMODB');
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-real-escape-string">
|
||||
<refnamediv>
|
||||
<refname>maxdb_real_escape_string</refname>
|
||||
<refname>maxdb->real_escape_string</refname>
|
||||
<refpurpose>
|
||||
Escapes special characters in a string for use in a SQL statement,
|
||||
taking into account the current charset of the connection
|
||||
|
@ -16,6 +17,15 @@
|
|||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>string</type>
|
||||
<methodname>real_escape_sring</methodname>
|
||||
<methodparam><type>string</type><parameter>escapestr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
This function is used to create a legal SQL string that you can use in a SQL statement.
|
||||
The string <literal>escapestr</literal> is encoded to an escaped SQL string, taking into
|
||||
|
@ -39,12 +49,46 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
|
||||
$city = "'s Hertogenbosch";
|
||||
|
||||
/* this query will fail, cause we didn't escape $city */
|
||||
if (!$maxdb->query("INSERT into temp.mycity VALUES ('11111','$city','NY')")) {
|
||||
printf("Error: %s\n", $maxdb->sqlstate);
|
||||
}
|
||||
|
||||
$city = $maxdb->real_escape_string($city);
|
||||
|
||||
/* this query with escaped $city will work */
|
||||
if ($maxdb->query("INSERT into temp.mycity VALUES ('22222','$city','NY')")) {
|
||||
printf("%d Row inserted.\n", $maxdb->affected_rows);
|
||||
}
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-real-query">
|
||||
<refnamediv>
|
||||
<refname>maxdb_real_query</refname>
|
||||
<refname>maxdb->real_query</refname>
|
||||
<refpurpose>Execute an SQL query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -13,6 +14,15 @@
|
|||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>real_query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_real_query</function> is functionally identical
|
||||
with the <function>maxdb_query</function>.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-report">
|
||||
<refnamediv>
|
||||
<refname>maxdb_report</refname>
|
||||
|
@ -23,7 +23,7 @@
|
|||
/* activate reporting */
|
||||
maxdb_report(MAXDB_REPORT_ERROR);
|
||||
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-rollback">
|
||||
<refnamediv>
|
||||
<refname>maxdb_rollback</refname>
|
||||
<refname>maxdb->rollback</refname>
|
||||
<refpurpose>Rolls back current transaction</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -11,6 +12,14 @@
|
|||
<type>bool</type><methodname>maxdb_rollback</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>rollback</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Rollbacks the current transaction for the database specified by the
|
||||
<parameter>link</parameter> parameter.
|
||||
|
@ -31,12 +40,62 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* disable autocommit */
|
||||
$maxdb->autocommit(FALSE);
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
$maxdb->query("INSERT INTO temp.mycity SELECT * FROM hotel.city");
|
||||
|
||||
/* commit insert */
|
||||
$maxdb->commit();
|
||||
|
||||
/* delete all rows */
|
||||
$maxdb->query("DELETE FROM temp.mycity");
|
||||
|
||||
if ($result = $maxdb->query("SELECT COUNT(*) FROM temp.mycity")) {
|
||||
$row = $result->fetch_row();
|
||||
printf("%d rows in table mycity.\n", $row[0]);
|
||||
/* Free result */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* Rollback */
|
||||
$maxdb->rollback();
|
||||
|
||||
if ($result = $maxdb->query("SELECT COUNT(*) FROM temp.mycity")) {
|
||||
$row = $result->fetch_row();
|
||||
printf("%d rows in table mycity (after rollback).\n", $row[0]);
|
||||
/* Free result */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* Drop table myCity */
|
||||
$maxdb->query("DROP TABLE temp.mycity");
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-rpl-parse-enabled">
|
||||
<refnamediv>
|
||||
<refname>maxdb_rpl_parse_enabled</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-rpl-probe">
|
||||
<refnamediv>
|
||||
<refname>maxdb_rpl_probe</refname>
|
||||
|
|
|
@ -1,17 +1,25 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-rpl-query-type">
|
||||
<refnamediv>
|
||||
<refname>maxdb_rpl_query_type</refname>
|
||||
<refname>maxdb->rpl_query_type</refname>
|
||||
<refpurpose>Returns RPL query type</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>maxdb_rpl_query_type</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>rpl_query_type</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
&warn.experimental.func;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-select-db">
|
||||
<refnamediv>
|
||||
<refname>maxdb_select_db</refname>
|
||||
<refname>maxdb->select_db</refname>
|
||||
<refpurpose>Selects the default database for database queries</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -40,12 +41,47 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* return name of current default database */
|
||||
if ($result = $maxdb->query("SELECT SERVERDB FROM USERS WHERE USERNAME='MONA'")) {
|
||||
$row = $result->fetch_row();
|
||||
printf("Default database is %s.\n", $row[0]);
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* change db to world db */
|
||||
$maxdb->select_db("XXXXXXXX");
|
||||
|
||||
/* return name of current default database */
|
||||
if ($result = $maxdb->query("SELECT SERVERDB FROM USERS WHERE USERNAME='MONA'")) {
|
||||
$row = $result->fetch_row();
|
||||
printf("Default database is %s.\n", $row[0]);
|
||||
$result->close();
|
||||
}
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
@ -80,7 +116,7 @@ maxdb_close($link);
|
|||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Default database is DB76.
|
||||
Default database is <...>.
|
||||
|
||||
Warning: maxdb_select_db(): -10709 Connection failed (RTE:database not running) <...>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-send-long-data">
|
||||
<refnamediv>
|
||||
<refname>maxdb_send_long_data</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-send-query">
|
||||
<refnamediv>
|
||||
<refname>maxdb_send_query</refname>
|
||||
<refname>maxdb->send_query</refname>
|
||||
<refpurpose>Send the query and return</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,14 @@
|
|||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>send_query</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
&warn.experimental.func;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-server-end">
|
||||
<refnamediv>
|
||||
<refname>maxdb_server_end</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-server-init">
|
||||
<refnamediv>
|
||||
<refname>maxdb_server_init</refname>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-set-opt">
|
||||
<refnamediv>
|
||||
<refname>maxdb_set_opt</refname>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-sqlstate">
|
||||
<refnamediv>
|
||||
<refname>maxdb_sqlstate</refname>
|
||||
<refname>maxdb->sqlstate</refname>
|
||||
<refpurpose>Returns the SQLSTATE error from previous MaxDB operation</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>string</type><methodname>maxdb_sqlstate</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>sqlstate</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns a string containing the SQLSTATE error code for the last error.
|
||||
The error code consists of five characters. <literal>'00000'</literal> means no error.
|
||||
|
@ -40,12 +46,35 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Table City already exists, so we should get an error */
|
||||
if (!$maxdb->query("CREATE TABLE hotel.city (ID INT, Name VARCHAR(30))")) {
|
||||
printf("Error - SQLSTATE %s.\n", $maxdb->sqlstate);
|
||||
}
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-ssl-set">
|
||||
<refnamediv>
|
||||
<refname>maxdb_ssl_set</refname>
|
||||
<refname>maxdb->ssl_set</refname>
|
||||
<refpurpose>Used for establishing secure connections using SSL</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -11,12 +12,24 @@
|
|||
<methodsynopsis>
|
||||
<type>bool</type><methodname>maxdb_ssl_set</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>cert</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>ca</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>capath</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>cipher</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>cert</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>ca</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>capath</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>cipher</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>ssl_set</methodname>
|
||||
<methodparam choice='opt'><type>string</type><parameter>key</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>cert</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>ca</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>capath</parameter></methodparam>
|
||||
<methodparam choice='opt'><type>string</type><parameter>cipher</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
&warn.experimental.func;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stat">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stat</refname>
|
||||
<refname>maxdb->stat</refname>
|
||||
<refpurpose>Gets the current system status</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,14 @@
|
|||
<type>mixed</type><methodname>maxdb_stat</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>maxdb->stat</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stat</function> returns a string containing several
|
||||
information about the MaxDB server running.
|
||||
|
@ -31,12 +40,32 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
printf ("System status: %s\n", $maxdb->stat());
|
||||
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-affected-rows">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_affected_rows</refname>
|
||||
<refname>maxdb_stmt->affected_rows</refname>
|
||||
<refpurpose>Returns the total number of rows changed, deleted, or
|
||||
inserted by the last executed statement
|
||||
</refpurpose>
|
||||
|
@ -14,6 +15,11 @@
|
|||
<type>mixed</type><methodname>maxdb_stmt_affected_rows</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<fieldsynopsis><type>mixed</type><varname>affected_rows</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stmt_affected_rows</function> returns the number of rows affected
|
||||
by INSERT, UPDATE, or DELETE query. If the last query was invalid or the
|
||||
|
@ -38,12 +44,52 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* create temp table */
|
||||
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
|
||||
$query = "INSERT INTO temp.mycity SELECT * FROM hotel.city WHERE state LIKE ?";
|
||||
|
||||
/* prepare statement */
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* Bind variable for placeholder */
|
||||
$code = 'N%';
|
||||
$stmt->bind_param("s", $code);
|
||||
|
||||
/* execute statement */
|
||||
$stmt->execute();
|
||||
|
||||
printf("rows inserted: %d\n", $stmt->affected_rows);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-stmt-bind-param">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_bind_param</refname>
|
||||
<refname>stmt->bind_param</refname>
|
||||
<refpurpose>Binds variables to a prepared statement as parameters</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,15 +13,43 @@
|
|||
<type>bool</type><methodname>maxdb_stmt_bind_param</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>types</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter role="reference">var1</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>&var1</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>&...</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>bind_param</methodname>
|
||||
<methodparam><type>array</type><parameter>types</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>&var1</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>&...</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stmt_bind_param</function> is used to bind variables for the
|
||||
parameter markers in the SQL statement that was passed to
|
||||
<function>maxdb_prepare</function>.
|
||||
The string <parameter>types</parameter> contains one or more characters which specify
|
||||
the types for the corresponding bind variables
|
||||
the types for the corresponding bind variables.
|
||||
</para>
|
||||
<para>
|
||||
Variables for SELECT INTO SQL statements can also be bound using <function>maxdb_stmt_bind_param</function>.
|
||||
Parameters for database procedures can be bound using <function>maxdb_stmt_bind_param</function>. See the
|
||||
examples how to use <function>maxdb_stmt_bind_param</function> in this cases.
|
||||
</para>
|
||||
<para>
|
||||
If a variable bound as INTO variable to a SQL statement was used before, the content of this variable
|
||||
is overwritten by the data of the SELECT INTO statement. A reference to this variable will be invalid after a call to
|
||||
<function>maxdb_stmt_bind_param</function>.
|
||||
</para>
|
||||
<para>
|
||||
For INOUT parameters of database procedures the content of the bound INOUT variable is overwritten by the output
|
||||
value of the database procedure. A reference to this variable will be invalid after a call to
|
||||
<function>maxdb_stmt_bind_param</function>.
|
||||
</para>
|
||||
<para>
|
||||
<table>
|
||||
<title>Type specification chars</title>
|
||||
<tgroup cols='2'>
|
||||
|
@ -72,12 +101,53 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb('localhost', 'MONA', 'RED', 'DEMODB');
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$maxdb->query ("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
$maxdb->query ("INSERT INTO temp.mycity SELECT * FROM hotel.city");
|
||||
|
||||
$stmt = $maxdb->prepare("INSERT INTO temp.mycity VALUES (?, ?, ?)");
|
||||
$stmt->bind_param('sss', $zip, $name, $state);
|
||||
|
||||
$zip = '11111';
|
||||
$name = 'Georgetown';
|
||||
$state = 'NY';
|
||||
|
||||
/* execute prepared statement */
|
||||
$stmt->execute();
|
||||
|
||||
printf("%d Row inserted.\n", $stmt->affected_rows);
|
||||
|
||||
/* close statement and connection */
|
||||
$stmt->close();
|
||||
|
||||
/* Clean up table CountryLanguage */
|
||||
$maxdb->query("DELETE FROM temp.mycity WHERE name='Georgetown'");
|
||||
printf("%d Row deleted.\n", $maxdb->affected_rows);
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
|
@ -120,6 +190,91 @@ maxdb_close($link);
|
|||
<![CDATA[
|
||||
1 Row inserted.
|
||||
1 Row deleted.
|
||||
]]>
|
||||
</screen>
|
||||
<example>
|
||||
<title>Procedural style (SELECT INTO)</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* Performing SQL query */
|
||||
$stmt = maxdb_prepare ($link, "SELECT price INTO ? FROM hotel.room where hno = ? and type = ?");
|
||||
if (!$stmt) {
|
||||
printf ("Prepare failed: %s\n", maxdb_error($link));
|
||||
}
|
||||
|
||||
$hno = "50";
|
||||
$rtype = "suite";
|
||||
|
||||
maxdb_stmt_bind_param($stmt, 'dss', $price, $hno, $rtype);
|
||||
maxdb_stmt_execute($stmt);
|
||||
|
||||
printf ("%f\n", $price);
|
||||
|
||||
maxdb_stmt_close ($stmt);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The above examples would produce the following output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
21.600000
|
||||
]]>
|
||||
</screen>
|
||||
<example>
|
||||
<title>Procedural style (DB procedure)</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
maxdb_report (MAXDB_REPORT_OFF);
|
||||
maxdb_query($link,"DROP DBPROC test_proc");
|
||||
maxdb_report (MAXDB_REPORT_ERROR);
|
||||
|
||||
$query = "create dbproc test_proc (INOUT e_text char(72)) AS select * from SYSDBA.DUAL; fetch into :e_text;";
|
||||
|
||||
maxdb_query($link, $query);
|
||||
|
||||
/* Performing SQL query */
|
||||
$stmt = maxdb_prepare ($link, "CALL test_proc (?)");
|
||||
if (!$stmt) {
|
||||
printf ("Prepare failed: %s\n", maxdb_error($link));
|
||||
}
|
||||
|
||||
maxdb_stmt_bind_param($stmt, 's', $result);
|
||||
maxdb_stmt_execute($stmt);
|
||||
|
||||
printf ("%s\n", $result);
|
||||
|
||||
maxdb_stmt_close ($stmt);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The above examples would produce the following output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
a
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-stmt-bind-result">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_bind_result</refname>
|
||||
<refname>stmt->bind_result</refname>
|
||||
<refpurpose>Binds variables to a prepared statement for result storage</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -11,9 +12,19 @@
|
|||
<methodsynopsis>
|
||||
<type>bool</type><methodname>maxdb_stmt_bind_result</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter role="reference">var1</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>&var1</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>&...</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>bind_result</methodname>
|
||||
<methodparam><type>mixed</type><parameter>&var1</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>&...</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stmt_bind_result</function> is used to associate (bind) columns in the result
|
||||
set to variables. When <function>maxdb_stmt_fetch</function> is called to fetch data, the MaxDB
|
||||
|
@ -52,12 +63,46 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* prepare statement */
|
||||
if ($stmt = $maxdb->prepare("SELECT zip, name FROM hotel.city ORDER BY name")) {
|
||||
$stmt->execute();
|
||||
|
||||
/* bind variables to prepared statement */
|
||||
$stmt->bind_result($col1, $col2);
|
||||
|
||||
/* fetch values */
|
||||
while ($stmt->fetch()) {
|
||||
printf("%s %s\n", $col1, $col2);
|
||||
}
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (!$link) {
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-stmt-close-long-data">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_close_long_data</refname>
|
||||
<refname>stmt->close_long_data</refname>
|
||||
<refpurpose>Ends a sequence of <function>maxdb_stmt_send_long_data</function></refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<para>Procedural style:</para>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>maxdb_stmt_close_long_data</methodname>
|
||||
<type>bool</type><methodname>maxdb_stmt_send_long_data</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>param_nr</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb_stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>maxdb_stmt->close_long_data</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
This function has to be called after a sequence of
|
||||
<function>maxdb_stmt_send_long_data</function>, that was started
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-close">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_close</refname>
|
||||
<refname>maxdb_stmt->close</refname>
|
||||
<refpurpose>Closes a prepared statement</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,14 @@
|
|||
<type>bool</type><methodname>maxdb_stmt_close</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb_stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>maxdb_stmt->close</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Closes a prepared statement. <function>maxdb_stmt_close</function> also deallocates the
|
||||
statement handle pointed to by <parameter>stmt</parameter>.
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-data-seek">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_data_seek</refname>
|
||||
<refname>stmt->data_seek</refname>
|
||||
<refpurpose>Seeks to an arbitray row in statement result set</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -13,6 +14,15 @@
|
|||
<methodparam><type>resource</type><parameter>statement</parameter></methodparam>
|
||||
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>data_seek</methodname>
|
||||
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_stmt_data_seek</function> function seeks to an arbitrary result pointer
|
||||
specified by the <parameter>offset</parameter> in the statement result set represented by
|
||||
|
@ -34,13 +44,57 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, zip FROM hotel.city ORDER BY name";
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
/* bind result variables */
|
||||
$stmt->bind_result($name, $code);
|
||||
|
||||
/* store result */
|
||||
$stmt->store_result();
|
||||
|
||||
/* seek to row no. 5 */
|
||||
$stmt->data_seek(5);
|
||||
|
||||
/* fetch values */
|
||||
$stmt->fetch();
|
||||
|
||||
printf ("City: %s Zip: %s\n", $name, $code);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-errno">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_errno</refname>
|
||||
<refname>maxdb_stmt->errno</refname>
|
||||
<refpurpose>Returns the error code for the most recent statement call</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>int</type><methodname>maxdb_stmt_errno</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<fieldsynopsis><type>int</type><varname>errno</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
For the statement specified by <literal>stmt</literal>, <function>maxdb_stmt_errno</function>
|
||||
returns the error code for the most recently invoked statement function that can succeed or fail.
|
||||
|
@ -38,13 +44,52 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
$maxdb->query("INSERT INTO temp.mycity SELECT * FROM hotel.city");
|
||||
|
||||
|
||||
$query = "SELECT name, zip FROM temp.mycity ORDER BY name";
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* drop table */
|
||||
$maxdb->query("DROP TABLE temp.mycity");
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
printf("Error: %d.\n", $stmt->errno);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-error">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_error</refname>
|
||||
<refname>maxdb_stmt->error</refname>
|
||||
<refpurpose>Returns a string description for last statement error</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>string</type><methodname>maxdb_stmt_error</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<fieldsynopsis><type>string</type><varname>error</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
For the statement specified by <literal>stmt</literal>, <function>maxdb_stmt_error</function>
|
||||
returns a containing the error message for the most recently invoked statement function that
|
||||
|
@ -33,13 +39,52 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
$maxdb->query("INSERT INTO temp.mycity SELECT * FROM hotel.city");
|
||||
|
||||
|
||||
$query = "SELECT name, zip FROM temp.mycity ORDER BY name";
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* drop table */
|
||||
$maxdb->query("DROP TABLE temp.mycity");
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
printf("Error: %s.\n", $stmt->error);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-execute">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_execute</refname>
|
||||
<refname>stmt->execute</refname>
|
||||
<refpurpose>Executes a prepared Query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>bool</type><methodname>maxdb_stmt_execute</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>execute</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_stmt_execute</function> function executes a query that has been previously
|
||||
prepared using the <function>maxdb_prepare</function> function represented by the
|
||||
|
@ -43,12 +53,69 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
|
||||
/* Prepare an insert statement */
|
||||
$query = "INSERT INTO temp.mycity (zip, name, state) VALUES (?,?,?)";
|
||||
$stmt = $maxdb->prepare($query);
|
||||
|
||||
$stmt->bind_param("sss", $val1, $val2, $val3);
|
||||
|
||||
$val1 = '11111';
|
||||
$val2 = 'Georgetown';
|
||||
$val3 = 'NY';
|
||||
|
||||
/* Execute the statement */
|
||||
$stmt->execute();
|
||||
|
||||
$val1 = '22222';
|
||||
$val2 = 'Hubbatown';
|
||||
$val3 = 'CA';
|
||||
|
||||
/* Execute the statement */
|
||||
$stmt->execute();
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
|
||||
/* retrieve all rows from myCity */
|
||||
$query = "SELECT zip, name, state FROM temp.mycity";
|
||||
if ($result = $maxdb->query($query)) {
|
||||
while ($row = $result->fetch_row()) {
|
||||
printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]);
|
||||
}
|
||||
/* free result set */
|
||||
$result->close();
|
||||
}
|
||||
|
||||
/* remove table */
|
||||
$maxdb->query("DROP TABLE temp.mycity");
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-fetch">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_fetch</refname>
|
||||
<refname>stmt->fetch</refname>
|
||||
<refpurpose>
|
||||
Fetch results from a prepared statement into the bound variables
|
||||
</refpurpose>
|
||||
|
@ -14,6 +15,15 @@
|
|||
<type>mixed</type><methodname>maxdb_stmt_fetch</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>fetch</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stmt_fetch</function> returns row data using the variables bound by <function>maxdb_stmt_bind_result</function>.
|
||||
</para>
|
||||
|
@ -62,12 +72,50 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT zip, name FROM hotel.city ORDER by name";
|
||||
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* execute statement */
|
||||
$stmt->execute();
|
||||
|
||||
/* bind result variables */
|
||||
$stmt->bind_result($name, $code);
|
||||
|
||||
/* fetch values */
|
||||
while ($stmt->fetch()) {
|
||||
printf ("%s (%s)\n", $name, $code);
|
||||
}
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-free-result">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_free_result</refname>
|
||||
<refname>stmt->free_result</refname>
|
||||
<refpurpose>Frees stored result memory for the given statement handle</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>void</type><methodname>maxdb_stmt_free_result</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>void</type>
|
||||
<methodname>free_result</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_stmt_free_result</function> function frees the result memory
|
||||
associated with the statement represented by the
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-init">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_init</refname>
|
||||
<refname>maxdb->stmt_init</refname>
|
||||
<refpurpose>
|
||||
Initializes a statement and returns an resource for use with maxdb_stmt_prepare
|
||||
</refpurpose>
|
||||
|
@ -14,6 +15,15 @@
|
|||
<type>resource</type><methodname>maxdb_stmt_init</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>object</type>
|
||||
<methodname>stmt_init</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Allocates and initializes a statement resource suitable for
|
||||
<function>maxdb_stmt_prepare</function>.
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-num-rows">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_num_rows</refname>
|
||||
<refname>stmt->num_rows</refname>
|
||||
<refpurpose>Return the number of rows in statements result set</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>mixed</type><methodname>maxdb_stmt_num_rows</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<fieldsynopsis><type>int</type><varname>num_rows</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Returns the number of rows in the result set.
|
||||
</para>
|
||||
|
@ -32,13 +38,48 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT zip, name FROM hotel.city ORDER BY name";
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
/* store result */
|
||||
$stmt->store_result();
|
||||
|
||||
printf("Number of rows: %d.\n", $stmt->num_rows);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
@ -72,7 +113,7 @@ maxdb_close($link);
|
|||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Number of rows: -1.
|
||||
Number of rows: 25.
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-param-count">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_param_count</refname>
|
||||
<refname>stmt->param_count</refname>
|
||||
<refpurpose>Returns the number of parameter for the given statement</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>int</type><methodname>maxdb_stmt_param_count</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<fieldsynopsis><type>int</type><varname>param_count</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stmt_param_count</function> returns the number of parameter
|
||||
markers present in the prepared statement.
|
||||
|
@ -31,12 +37,40 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($stmt = $maxdb->prepare("SELECT name FROM hotel.city WHERE name=? OR state=?")) {
|
||||
|
||||
$marker = $stmt->param_count;
|
||||
printf("Statement has %d markers.\n", $marker);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-prepare">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_prepare</refname>
|
||||
<refname>stmt->prepare</refname>
|
||||
<refpurpose>
|
||||
Prepare a SQL statement for execution
|
||||
</refpurpose>
|
||||
|
@ -15,6 +16,15 @@
|
|||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>prepare</methodname>
|
||||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stmt_prepare</function> prepares the SQL query pointed to by the
|
||||
null-terminated string query. The statement resource has to be allocated by
|
||||
|
@ -74,12 +84,55 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$city = "Portland";
|
||||
|
||||
/* create a prepared statement */
|
||||
$stmt = $maxdb->stmt_init();
|
||||
if ($stmt->prepare("SELECT state FROM hotel.city WHERE name=?")) {
|
||||
|
||||
/* bind parameters for markers */
|
||||
$stmt->bind_param("s", $city);
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
/* bind result variables */
|
||||
$stmt->bind_result($district);
|
||||
|
||||
/* fetch value */
|
||||
$stmt->fetch();
|
||||
|
||||
printf("%s is in district %s\n", $city, $district);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-reset">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_reset</refname>
|
||||
<refname>stmt->reset</refname>
|
||||
<refpurpose>Resets a prepared statement</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>bool</type><methodname>maxdb_stmt_reset</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type>
|
||||
<methodname>reset</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
|
||||
&warn.experimental.func;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-result-metadata">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_result_metadata</refname>
|
||||
|
@ -12,6 +12,15 @@
|
|||
<type>mixed</type><methodname>maxdb_stmt_result_metadata</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>result_metadata</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
If a statement passed to <function>maxdb_prepare</function> is one that produces
|
||||
a result set, <function>maxdb_stmt_result_metadata</function> returns the result resource
|
||||
|
@ -62,12 +71,44 @@
|
|||
<refsect1>
|
||||
<title>Example</title>
|
||||
<para>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role='php'>
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.friends (id int, name varchar(20))");
|
||||
|
||||
$maxdb->query("INSERT INTO temp.friends VALUES (1,'Hartmut')");
|
||||
$maxdb->query("INSERT INTO temp.friends VALUES (2, 'Ulf')");
|
||||
|
||||
$stmt = $maxdb->prepare("SELECT id, name FROM temp.friends");
|
||||
$stmt->execute();
|
||||
|
||||
/* get resultset for metadata */
|
||||
$result = $stmt->result_metadata();
|
||||
|
||||
/* retrieve field information from metadata result set */
|
||||
$field = $result->fetch_field();
|
||||
|
||||
printf("Fieldname: %s\n", $field->name);
|
||||
|
||||
/* close resultset */
|
||||
$result->close();
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role='php'>
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
maxdb_query($link, "CREATE TABLE temp.friends (id int, name varchar(20))");
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<!-- $Revision: 1.3 $ -->
|
||||
<refentry id="function.maxdb-stmt-send-long-data">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_send_long_data</refname>
|
||||
<refname>stmt->send_long_data</refname>
|
||||
<refpurpose>Send data in blocks</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -14,6 +15,15 @@
|
|||
<methodparam><type>int</type><parameter>param_nr</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method)</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>stmt</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>stmt_send_long_data</methodname>
|
||||
<methodparam><type>int</type><parameter>param_nr</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
Allows to send parameter data to the server in pieces (or chunks).
|
||||
This function can be called multiple times to send the parts of a character or
|
||||
|
@ -26,7 +36,7 @@
|
|||
</para>
|
||||
<note>
|
||||
<para>
|
||||
For efficiency reasons, this function should be used after calling
|
||||
For efficency reasons, this function should be used after calling
|
||||
<function>maxdb_execute</function>. In this case, the data is not stored
|
||||
on the client side. The end of the sequence must end with a call
|
||||
to <function>maxdb_stmt_close_long_data</function>.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-sqlstate">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_sqlstate</refname>
|
||||
|
@ -40,13 +40,51 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$maxdb->query("CREATE TABLE temp.mycity LIKE hotel.city");
|
||||
$maxdb->query("INSERT INTO temp.mycity SELECT * FROM hotel.city");
|
||||
|
||||
$query = "SELECT name, zip FROM temp.mycity ORDER BY name";
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* drop table */
|
||||
$maxdb->query("DROP TABLE temp.mycity");
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
printf("Error: %s.\n", $stmt->sqlstate);
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-stmt-store-result">
|
||||
<refnamediv>
|
||||
<refname>maxdb_stmt_store_result</refname>
|
||||
<refname>maxdb->store_result</refname>
|
||||
<refpurpose>Transfers a result set from a prepared statement</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>bool</type><methodname>maxdb_stmt_store_result</methodname>
|
||||
<methodparam><type>resource</type><parameter>stmt</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>object</type>
|
||||
<methodname>store_result</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
<function>maxdb_stmt_store_result</function> has no functionally effect
|
||||
and should not be used for retrieving data from MaxDB server.
|
||||
|
@ -31,13 +41,51 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
$query = "SELECT name, zip FROM hotel.city ORDER BY name";
|
||||
if ($stmt = $maxdb->prepare($query)) {
|
||||
|
||||
/* execute query */
|
||||
$stmt->execute();
|
||||
|
||||
/* store result */
|
||||
$stmt->store_result();
|
||||
|
||||
printf("Number of rows: %d.\n", $stmt->num_rows);
|
||||
|
||||
/* free result */
|
||||
$stmt->free_result();
|
||||
|
||||
/* close statement */
|
||||
$stmt->close();
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/* Open a connection */
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
@ -74,7 +122,7 @@ maxdb_close($link);
|
|||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Number of rows: -1.
|
||||
Number of rows: 25.
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-store-result">
|
||||
<refnamediv>
|
||||
<refname>maxdb_store_result</refname>
|
||||
<refname>maxdb->store_result</refname>
|
||||
<refpurpose>Transfers a result set from the last query</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,15 @@
|
|||
<type>resource</type><methodname>maxdb_store_result</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (method):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<methodsynopsis>
|
||||
<type>object</type>
|
||||
<methodname>store_result</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
This function has no functionally effect.
|
||||
</para>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1.1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.maxdb-thread-id">
|
||||
<refnamediv>
|
||||
<refname>maxdb_thread_id</refname>
|
||||
<refname>maxdb->thread_id</refname>
|
||||
<refpurpose>Returns the thread ID for the current connection</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
|
@ -12,6 +13,11 @@
|
|||
<type>int</type><methodname>maxdb_thread_id</methodname>
|
||||
<methodparam><type>resource</type><parameter>link</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>Object oriented style (property):</para>
|
||||
<classsynopsis>
|
||||
<ooclass><classname>maxdb</classname></ooclass>
|
||||
<fieldsynopsis><type>int</type><varname>thread_id</varname></fieldsynopsis>
|
||||
</classsynopsis>
|
||||
<para>
|
||||
The <function>maxdb_thread_id</function> function returns the thread
|
||||
ID for the current connection which can then be killed using the
|
||||
|
@ -41,12 +47,43 @@
|
|||
</refsect1>
|
||||
<refsect1>
|
||||
<title>Example</title>
|
||||
<example>
|
||||
<title>Object oriented style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
printf("Connect failed: %s\n", maxdb_connect_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
/* determine our thread id */
|
||||
$thread_id = $maxdb->thread_id;
|
||||
|
||||
/* Kill connection */
|
||||
$maxdb->kill($thread_id);
|
||||
|
||||
/* This should produce an error */
|
||||
if (!$maxdb->query("CREATE TABLE mycity LIKE hotel.city")) {
|
||||
printf("Error: %s\n", $maxdb->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
/* close connection */
|
||||
$maxdb->close();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Procedural style</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$link = maxdb_connect("localhost", "MONA", "RED");
|
||||
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
||||
|
||||
/* check connection */
|
||||
if (maxdb_connect_errno()) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue