update docs for CUBRID PHP R4.0

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@310533 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Esen Sagynov 2011-04-27 02:03:18 +00:00
parent 0748b3b2d2
commit 6370ba265f
14 changed files with 946 additions and 124 deletions

View file

@ -5,8 +5,9 @@
&reftitle.constants;
&extension.constants;
<para>
The following constants can be used when executing SQL statement. They can be passed to <function>cubrid_prepare</function>
and <function>cubrid_execute</function>.
The following constants can be used when executing SQL statement. They can
be passed to <function>cubrid_prepare</function> and
<function>cubrid_execute</function>.
<table>
<title>CUBRID SQL execution flags</title>
<tgroup cols="2">
@ -25,14 +26,20 @@
<entry>CUBRID_ASYNC</entry>
<entry>Execute the query in asynchronous mode.</entry>
</row>
<row>
<entry>CUBRID_EXEC_QUERY_ALL</entry>
<entry>Execute the query in synchronous mode. This flag must be set
when executing multiple SQL statements.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
The following constants can be used when fetching the results to specify fetch behaviour. They can be passed to <function>cubrid_fetch</function>
and <function>cubrid_fetch_array</function>.
The following constants can be used when fetching the results to specify
fetch behaviour. They can be passed to <function>cubrid_fetch</function> and
<function>cubrid_fetch_array</function>.
<table>
<title>CUBRID fetch flags</title>
<tgroup cols="2">
@ -65,7 +72,8 @@
</para>
<para>
The following constants can be used when positioning the cursor in query results. They can be passed to or returned by
The following constants can be used when positioning the cursor in query
results. They can be passed to or returned by
<function>cubrid_move_cursor</function>.
<table>
<title>CUBRID cursor position flags</title>
@ -107,7 +115,114 @@
</para>
<para>
The following constants can be used when getting schema information. They can be passed to <function>cubrid_schema</function>.
The following constants can be used when setting the auto-commit mode for
the database connection. They can be passed to
<function>cubrid_set_autocommit</function> or returned by
<function>cubrid_get_autocommit</function>.
<table>
<title>CUBRID auto-commit mode flags</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>CUBRID_AUTOCOMMIT_TRUE</entry>
<entry>Enable the auto-commit mode.</entry>
</row>
<row>
<entry>CUBRID_AUTOCOMMIT_FALSE</entry>
<entry>Disable the auto-commit mode.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
The following constants can be used when setting the database parameter.
They can be passed to <function>cubrid_set_db_parameter</function>.
<table>
<title>CUBRID parameter flags</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>CUBRID_PARAM_ISOLATION_LEVEL</entry>
<entry>Transaction isolation level for the database connection.</entry>
</row>
<row>
<entry>CUBRID_PARAM_LOCK_TIMEOUT</entry>
<entry>Transaction timeout in seconds.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
The following constants can be used when setting the transaction isolation
level. They can be passed to <function>cubrid_set_db_parameter</function>
or returned by <function>cubrid_get_db_parameter</function>.
<table>
<title>CUBRID isolation level flags</title>
<tgroup cols="2">
<thead>
<row>
<entry>Constant</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>TRAN_COMMIT_CLASS_UNCOMMIT_INSTANCE</entry>
<entry>The lowest isolation level (1). A dirty, non-repeatable or
phantom read may occur for the tuple and a non-repeatable read may
occur for the table as well.</entry>
</row>
<row>
<entry>TRAN_COMMIT_CLASS_COMMIT_INSTANCE</entry>
<entry>A relatively low isolation level (2). A dirty read does not
occur, but non-repeatable or phantom read may occur.</entry>
</row>
<row>
<entry>TRAN_REP_CLASS_UNCOMMIT_INSTANCE</entry>
<entry>The default isolation of CUBRID (3). A dirty, non-repeatable or
phantom read may occur for the tuple, but repeatable read is ensured
for the table.</entry>
</row>
<row>
<entry>TRAN_REP_CLASS_COMMIT_INSTANCE</entry>
<entry>A relatively low isolation level (4). A dirty read does not
occur, but non-repeatable or phantom read may.</entry>
</row>
<row>
<entry>TRAN_REP_CLASS_REP_INSTANCE</entry>
<entry>A relatively high isolation level (5). A dirty or non-repeatable
read does not occur, but a phantom read may.</entry>
</row>
<row>
<entry>TRAN_SERIALIZABLE</entry>
<entry>The highest isolation level (6). Problems concerning concurrency
(e.g. dirty read, non-repeatable read, phantom read, etc.) do not
occur.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
The following constants can be used when getting schema information. They
can be passed to <function>cubrid_schema</function>.
<table>
<title>CUBRID schema flags</title>
<tgroup cols="2">

View file

@ -12,20 +12,23 @@
<methodsynopsis>
<type>bool</type><methodname>cubrid_bind</methodname>
<methodparam><type>resource</type><parameter>req_identifier</parameter></methodparam>
<methodparam><type>int</type><parameter>bind_index</parameter></methodparam>
<methodparam><type>string</type><parameter>bind_value</parameter></methodparam>
<methodparam><type>mixed</type><parameter>bind_param</parameter></methodparam>
<methodparam><type>mixed</type><parameter>bind_value</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>bind_value_type</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_bind</function> function is used to bind values in a
<function>cubrid_prepare</function> variable, a various types in PHP and
corresponding types in SQL. If bind_value_type is not given, string will
be the default.
The <function>cubrid_bind</function> function is used to bind values to a
corresponding named or question mark placeholder in the SQL statement that
was passed to <function>cubrid_prepare</function>. If
<parameter>bind_value_type</parameter> is not given, string will be the
default.
</para>
<note>
<para>
Known issue: If column data type is CLOB, binding parameter will fail.
This bug will fixed later.
If the type of data to be bound is BLOB/CLOB, CUBRID will try to map the
data as a PHP stream. If the actually bind value type is not stream,
CUBRID will convert it to string, and use it as the full path and file
name of a file on the client filesystem.
</para>
</note>
<para>
@ -139,15 +142,20 @@
<function>cubrid_prepare</function>.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>bind_index</parameter></term>
<listitem><para>Index for binding.</para></listitem>
<term><parameter>bind_param</parameter></term>
<listitem><para>Parameter identifier. For a prepared statement using named
placeholders, this will be a parameter name of the form :name (Note that
the name can only contain digit, alphabet, and underscore, and it can not
begin with digit. The name length can not be longer than 32). For a prepared
statement using question mark placeholders, this will be the 1-indexed
position of the parameter.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>bind_value</parameter></term>
<listitem><para>Actual value for binding.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>bind_index</parameter></term>
<term><parameter>bind_value_type</parameter></term>
<listitem><para>A type of the value to bind. (It is omitted by default.
Thus, system internally use string by default. However, you need to
specify the exact type of the value as an argument when they are NCHAR,
@ -179,6 +187,13 @@
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Added named parameter support; When binding the LOB data type, it can
directly binding the path name of a file.
</entry>
</row>
<row>
<entry>8.3.1</entry>
<entry>
@ -246,6 +261,53 @@ Barkley Charles
</screen>
</example>
<example>
<title><function>cubrid_bind</function> named parameter example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$sql_stmt = <<<EOD
SELECT s.name FROM stadium s, game g
WHERE s.code = g.stadium_code AND g.medal = :medal_type
GROUP BY g.stadium_code ORDER BY count(medal) DESC LIMIT 1;
EOD;
$req = cubrid_prepare($conn, $sql_stmt);
printf("%-30s %s\n", "Medal Type", "Stadium where most medals were ever won");
cubrid_bind($req, ":medal_type", "G");
cubrid_execute($req);
$row = cubrid_fetch_assoc($req);
printf("%-30s %s\n", "Gold", $row["name"]);
cubrid_bind($req, ":medal_type", "S");
cubrid_execute($req);
$row = cubrid_fetch_assoc($req);
printf("%-30s %s\n", "Silver", $row["name"]);
cubrid_bind($req, ":medal_type", "B");
cubrid_execute($req);
$row = cubrid_fetch_assoc($req);
printf("%-30s %s\n", "Bronze", $row["name"]);
cubrid_close_request($req);
cubrid_disconnect($conn);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Medal Type Stadium where most medals were ever won
Gold Olympic Aquatic Centre
Silver Olympic Aquatic Centre
Bronze Sydney Convention and Exhibition Centre
]]>
</screen>
</example>
<example>
<title><function>cubrid_bind</function> BLOB/CLOB example</title>
<programlisting role="php">
@ -258,7 +320,25 @@ if ($con) {
$fp = fopen("book.txt", "rb");
cubrid_bind($req, 1, $fp, "blob");
cubrid_bind($req, 1, $fp, "clob");
cubrid_execute($req);
}
?>
]]>
</programlisting>
</example>
<example>
<title><function>cubrid_bind</function> BLOB/CLOB example</title>
<programlisting role="php">
<![CDATA[
<?php
$con = cubrid_connect("localhost", 33000, "foo");
if ($con) {
$sql = "INSERT INTO php_cubrid_lob_test(image) VALUES(?)";
$req = cubrid_prepare($con, $sql);
cubrid_bind($req, 1, "cubrid_logo.png", "blob");
cubrid_execute($req);
}
?>
@ -267,7 +347,7 @@ if ($con) {
</example>
</refsect1>
<refsect1 role="seealso">
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>

View file

@ -11,7 +11,7 @@
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>cubrid_commit</methodname>
<methodparam><type>resource</type><parameter>conn_identifier</parameter></methodparam> </methodsynopsis>
<methodparam><type>resource</type><parameter>conn_identifier</parameter></methodparam></methodsynopsis>
<para>
The <function>cubrid_commit</function> function is used to execute commit
on the transaction pointed by <parameter>conn_identifier</parameter>,
@ -21,9 +21,10 @@
</para>
<para>
In CUBRID PHP, an auto-commit mode is disabled by default for transaction
management, and it can't be enabled in current version CUBRID PHP. It can
be set in next version. And auto commit modes can be applied only for
SELECT statements by setting broker parameters.
management, and you can set it by using
<function>cubrid_set_autocommit</function>, and get its status by using
<function>cubrid_get_autocommit</function>. Before you start a transaction,
remember to disable the auto-commit mode.
</para>
</refsect1>
@ -32,14 +33,14 @@
<para>
<variablelist>
<varlistentry>
<term><parameter>conn_identifier</parameter></term>
<listitem><para>Connection identifier.</para></listitem>
<term><parameter>conn_identifier</parameter></term>
<listitem><para>Connection identifier.</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true;, when process is successful.
@ -56,7 +57,7 @@
<programlisting role="php">
<![CDATA[
<?php
$conn = cubrid_connect("127.0.0.1", 33000, "demodb");
$conn = cubrid_connect("localhost", 33000, "demodb");
@cubrid_execute($conn, "DROP TABLE publishers");
@ -125,11 +126,13 @@ P04 Tenterhooks Press Berkeley CA USA
</example>
</refsect1>
<refsect1 role="seealso">
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_rollback</function></member>
<member><function>cubrid_get_autocommit</function></member>
<member><function>cubrid_set_autocommit</function></member>
</simplelist>
</para>
</refsect1>

View file

@ -16,20 +16,21 @@
<methodparam choice="opt"><type>string</type><parameter>passwd</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_connect_with_url</function> function is used to
establish the environment for connecting to your server by using
connection information passed with an url string argument. If the HA
feature is enabled in CUBRID, you must specify the connection information
of the standby server, which is used for failover when failure occurs, in
the url string argument of this function. If the user name and password is
not given, then the "PUBLIC" connection will be made by default.
The <function>cubrid_connect_with_url</function> function is used to
establish the environment for connecting to your server by using connection
information passed with an url string argument. If the HA feature is
enabled in CUBRID, you must specify the connection information of the
standby server, which is used for failover when failure occurs, in the url
string argument of this function. If the user name and password is not
given, then the "PUBLIC" connection will be made by default.
</para>
<para>
&lt;url&gt; ::= cci:CUBRID:&lt;host&gt;:&lt;db_name&gt;:&lt;db_user&gt;:&lt;db_password&gt;:[?&lt;properties&gt;]
&lt;properties&gt; ::= &lt;property&gt; [&amp;&lt;propertygt;]
&lt;alternative_hosts&gt; ::= &lt;standby_broker1_host&gt;:&lt;port&gt; [,&lt;standby_broker2_host&gt;:&lt;port&gt;]
&lt;host&gt; := HOSTNAME | IP_ADDR
&lt;time&gt; := SECOND
&lt;url&gt; ::= cci:CUBRID:&lt;host&gt;:&lt;db_name&gt;:&lt;db_user&gt;:&lt;db_password&gt;:[?&lt;properties&gt;]
&lt;properties&gt; ::= &lt;property&gt; [&amp;&lt;propertygt;]
&lt;properties&gt; ::= autocommit=&lt;autocommit_mode&gt;
&lt;alternative_hosts&gt; ::= &lt;standby_broker1_host&gt;:&lt;port&gt; [,&lt;standby_broker2_host&gt;:&lt;port&gt;]
&lt;host&gt; := HOSTNAME | IP_ADDR
&lt;time&gt; := SECOND
</para>
<para>
<simplelist>
@ -37,6 +38,7 @@
<member>db_name : A name of the database</member>
<member>db_user : A name of the database user</member>
<member>db_password : A database user password</member>
<member>autocommit : The database connection auto-commit mode</member>
<member>alhosts: Specifies the broker information of the standby server, which is used for failover when it is impossible to connect to the active server. You can specify multiple brokers for failover, and the connection to the brokers is attempted in the order listed in alhosts</member>
<member>rctime : An interval between the attempts to connect to the active broker in which failure occurred. After a failure occurs, the system connects to the broker specified by althosts (failover), terminates the transaction, and then attempts to connect to the active broker of the master database at every rctime. The default value is 600 seconds.</member>
</simplelist>
@ -80,12 +82,12 @@
<programlisting role="php">
<![CDATA[
<?php
$conn_url = "cci:CUBRID:127.0.0.1:33088:demodb:dba:123456:"
$conn_url = "cci:CUBRID:127.0.0.1:33088:demodb:dba:123456:?autocommit=off"
$con = cubrid_connect_with_url ($conn_url);
if ($con) {
echo "connected successfully";
$req =cubrid_execute($con, "insert into person values(1,James)");
$req =cubrid_execute($con, "insert into person values(1,'James')");
if ($req) {
cubrid_close_request ($req);
@ -105,12 +107,12 @@ if ($con) {
<programlisting role="php">
<![CDATA[
<?php
$conn_url = "cci:CUBRID:127.0.0.1:33088:demodb:dba:123456:?althost=10.34.63.132:33088&rctime=100"
$conn_url = "cci:CUBRID:127.0.0.1:33088:demodb:dba:123456:?autocommit=off&althost=10.34.63.132:33088&rctime=100"
$con = cubrid_connect_with_url ($conn_url);
if ($con) {
echo "connected successfully";
$req =cubrid_execute($con, "insert into person values(1,James)");
$req =cubrid_execute($con, "insert into person values(1,'James')");
if ($req) {
cubrid_close_request ($req);
@ -124,7 +126,6 @@ if ($con) {
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">

View file

@ -21,29 +21,50 @@
<methodparam choice="opt"><type>int</type><parameter>option</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_execute</function> function is used to execute
the given SQL sentence. It executes the query by using
<parameter>conn_identifier</parameter> and SQL, and then returns the
request identifier created. It is used for simple execution of query,
where the parameter binding is not needed. In addition, the
<function>cubrid_execute</function> function is used to execute the
prepared statement by means of <function>cubrid_prepare</function> and
<function>cubrid_bind</function>. At this time, you need to specify
arguments of <parameter>request_identifier</parameter> and
<parameter>option</parameter>.
The <function>cubrid_execute</function> function is used to execute the
given SQL sentence. It executes the query by using
<parameter>conn_identifier</parameter> and SQL, and then returns the
request identifier created. It is used for simple execution of query,
where the parameter binding is not needed. In addition, the
<function>cubrid_execute</function> function is used to execute the
prepared statement by means of <function>cubrid_prepare</function> and
<function>cubrid_bind</function>. At this time, you need to specify
arguments of <parameter>request_identifier</parameter> and
<parameter>option</parameter>.
</para>
<para>
You can use the <parameter>option</parameter> argument to tell whether
to receive oid of the row after the execution, and, whether to execute
the query in asynchronous mode. You can use it by setting the
CUBRID_INCLUDE_OID and CUBRID_ASYNC using bitwise or operator. If the
both variables are not explicitly given, they are not selected by
default.
The <parameter>option</parameter> is used to determine whether to get OID
after query execution and whether to execute the query in synchronous or
asynchronous mode. CUBRID_INCLUDE_OID and CUBRID_ASYNC (or
CUBRID_EXEC_QUERY_ALL if you want to execute multiple SQL statements) can
be specified by using a bitwise OR operator. If not specified, neither of
them isselected. If the flag CUBRID_EXEC_QUERY_ALL is set, a synchronous
mode (sync_mode) is used to retrieve query results, and in such cases the
following rules are applied:
</para>
<para>
If the first argument is <parameter>request_identifier</parameter> to
execute the <function>cubrid_prepare</function> function, you can
specify an option, CUBRID_ASYNC only.
<simplelist>
<member>The return value is the result of the first query.</member>
<member>
If an error occurs in any query, the execution is processed as a
failure.
</member>
<member>
For a query composed of in a query composed of q1 q2 q3 if an error
occurs in q2 after q1 succeeds the execution, the result of q1 remains
valid. That is, the previous successful query executions are not rolled
back when an error occurs.
</member>
<member>
If a query is executed successfully, the result of the second query can
be obtained using <function>cubrid_next_result()</function>.
</member>
</simplelist>
</para>
<para>
If the first argument is <parameter>request_identifier</parameter> to
execute the <function>cubrid_prepare</function> function, you can specify
an option, CUBRID_ASYNC only.
</para>
</refsect1>
@ -61,7 +82,7 @@
</varlistentry>
<varlistentry>
<term><parameter>option</parameter></term>
<listitem><para>Query execution option CUBRID_INCLUDE_OID, CUBRID_ASYNC.</para></listitem>
<listitem><para>Query execution option CUBRID_INCLUDE_OID, CUBRID_ASYNC, CUBRID_EXEC_QUERY_ALL.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>request_identifier</parameter></term>
@ -83,6 +104,30 @@
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Add new option CUBRID_EXEC_QUERY_ALL.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
@ -128,11 +173,12 @@ Phelps Michael 2004 51.25 time
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_prepare</function></member>
<member><function>cubrid_bind</function></member>
<member><function>cubrid_next_result</function></member>
<member><function>cubrid_close_request</function></member>
<member><function>cubrid_commit</function></member>
<member><function>cubrid_rollback</function></member>
<member><function>cubrid_prepare</function></member>
<member><function>cubrid_bind</function></member>
</simplelist>
</para>
</refsect1>

View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 308986 $ -->
<refentry xml:id="function.cubrid-get-autocommit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>cubrid_get_autocommit</refname>
<refpurpose>Get auto-commit mode of the connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>cubrid_get_autocommit</methodname>
<methodparam><type>resource</type><parameter>conn_identifier</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_get_autocommit</function> function is used to get the status of CUBRID
database connection auto-commit mode.
</para>
<para>
In CUBRID PHP, an auto-commit mode is disabled by default for transaction
management.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn_identifier</parameter></term>
<listitem><para>Connection identifier.</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true;, when process is successful.
</para>
<para>
&false;, when process is unsuccessful.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_set_autocommit</function></member>
<member><function>cubrid_commit</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -20,10 +20,10 @@
</para>
<para>
<simplelist>
<member><constant>PARAM_ISOLATION_LEVEL</constant></member>
<member><constant>LOCK_TIMEOUT</constant></member>
<member><constant>MAX_STRING_LENGTH</constant></member>
<member><constant>PARAM_AUTO_COMMIT</constant></member>
<member><constant>PARAM_ISOLATION_LEVEL</constant></member>
<member><constant>PARAM_LOCK_TIMEOUT</constant></member>
<member><constant>PARAM_MAX_STRING_LENGTH</constant></member>
<member><constant>PARAM_AUTO_COMMIT</constant></member>
</simplelist>
</para>
<para>
@ -39,35 +39,29 @@
<tbody>
<row>
<entry>PARAM_ISOLATION_LEVEL</entry>
<entry>In current version CUBRID PHP, you can set the level of
transaction isolation by using isolation_level in the
$CUBRID/conf/cubrid.conf or the SET TRANSACTION statement. In next
version, isolation level can be set using new CUBRID PHP API.
</entry>
<entry>The transaction isolation level.</entry>
</row>
<row>
<entry>LOCK_TIMEOUT</entry>
<entry>CUBRID provides the lock timeout feature, which sets the waiting
time for the lock until the transaction lock setting is allowed. The
system parameter lock_timeout_in_secs in the $CUBRID/conf/cubrid.conf
file or the SET TRANSACTION statement sets the timeout (in seconds).
In next version, lock timeout can be set using new CUBRID PHP API.
The default value of the lock_timeout_in_secs parameter is -1, which
means the application client will wait indefinitely until the
transaction lock is allowed.</entry>
time (in seconds) for the lock until the transaction lock setting is
allowed. The default value of the lock_timeout_in_secs parameter is
-1, which means the application client will wait indefinitely until
the transaction lock is allowed.
</entry>
</row>
<row>
<entry>PARAM_AUTO_COMMIT</entry>
<entry>In CUBRID PHP, an auto-commit mode is disabled by default for
transaction management, and it can't be enabled in current version
CUBRID PHP. It can be set in next version. And auto commit modes can
be applied only for SELECT statements by setting broker
parameters.</entry>
transaction management. It can be set by using
<function>cubrid_set_autocommit</function>.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
The following table shows the isolation levels from 1 to 6. It consists of
table schema (row) and isolation level:
@ -158,6 +152,31 @@
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Change LOCK_TIMEOUT to PARAM_LOCK_TIMEOUT, and MAX_STRING_LENGTH to
PARAM_MAX_STRING_LENGTH in result.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
@ -206,8 +225,8 @@ cubrid_disconnect($conn);
CUBRID PHP Version: 8.3.1.0005
PARAM_ISOLATION_LEVEL 3
LOCK_TIMEOUT -1
MAX_STRING_LENGTH 1073741823
PARAM_LOCK_TIMEOUT -1
PARAM_MAX_STRING_LENGTH 1073741823
PARAM_AUTO_COMMIT 0
Server Info: 8.3.1.0173
@ -218,6 +237,16 @@ CUBRID Charset: iso8859-1
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_set_db_parameter</function></member>
<member><function>cubrid_get_autocommit</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,37 +4,36 @@
<refentry xml:id="function.cubrid-insert-id" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>cubrid_insert_id</refname>
<refpurpose>Return an array with the IDs generated for the <constant>AUTO_INCREMENT</constant> columns</refpurpose>
<refpurpose>Return the ID generated for the lastest updated <constant>AUTO_INCREMENT</constant> column</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>cubrid_insert_id</methodname>
<methodparam><type>string</type><parameter>class_name</parameter></methodparam>
<type>string</type><methodname>cubrid_insert_id</methodname>
<methodparam choice="opt"><type>resource</type><parameter>conn_identifier</parameter></methodparam>
</methodsynopsis>
<para>
This function returns an array with the IDs generated for the
<constant>AUTO_INCREMENT</constant> columns that were updated by the
previous INSERT query. It returns an array with all the
<constant>AUTO_INCREMENT</constant> columns and their values. It returns 0
if the previous query does not generate new rows, or it returns FALSE on
failure.
The <function>cubrid_insert_id</function> function retrieves the ID
generated for the AUTO_INCREMENT column which is updated by the previous
INSERT query. It returns 0 if the previous query does not generate new
rows, or FALSE on failure.
</para>
<note>
<para>
CUBRID supports AUTO_INCREMENT for more than one columns in a table. In
most cases, there will be a single AUTO_INCREMENT column in a table. If
there are multiple AUTO_INCREMENT columns, this function should not be
used even if it will return a value.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>class_name</parameter></term>
<listitem><para>
The name of the class (table) that was used in the last INSERT statement
for which the auto increment values are retrieved.
</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>conn_identifier</parameter></term>
<listitem><para>
@ -43,22 +42,48 @@
</para></listitem>
</varlistentry>
</variablelist>
</para>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
An associative array with all the AUTO_INCREMENT columns and their values, on success.
A string representing the ID generated for an AUTO_INCREMENT column by the
previous query, on success.
</para>
<para>
0, if the previous query does not generate new rows.
</para>
<para>
<para>
&false; on failure.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Change the return value from an array to string; Remove the first
parameter class_name.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
@ -75,8 +100,8 @@ for ($i = 0; $i < 10; $i++) {
cubrid_execute($conn, "INSERT INTO cubrid_test(t) VALUES('cubrid_test')");
}
$id_list = cubrid_insert_id("cubrid_test");
var_dump($id_list);
$id = cubrid_insert_id();
var_dump($id);
cubrid_disconnect($conn);
?>
@ -85,10 +110,7 @@ cubrid_disconnect($conn);
&example.outputs;
<screen>
<![CDATA[
array(1) {
["d"]=>
int(19)
}
string(2) "19"
]]>
</screen>
</example>

View file

@ -10,19 +10,12 @@
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>cubrid_lob_size</methodname>
<type>string</type><methodname>cubrid_lob_size</methodname>
<methodparam><type>resource</type><parameter>lob_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>cubrid_lob_size</function> is used to get BLOB/CLOB data size.
</para>
<note>
<para>
The maximum length of BLOB/CLOB data is the maximum file size creatable in an
external storage. But there is no integer type such as long long in PHP.
If you do need it, maybe you should use 64bit PHP.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
@ -40,13 +33,38 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
LOB data size, when process is successful.
A string representing LOB data size, when process is successful.
</para>
<para>
&false;, when process is unsuccessful.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.4.0</entry>
<entry>
Change return value type from int to string.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>

View file

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 308986 $ -->
<refentry xml:id="function.cubrid-next-result" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>cubrid_next_result</refname>
<refpurpose>Get result of next query when executing multiple SQL statements</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>cubrid_next_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_next_result</function> function is used to get
results of next query if multiple SQL statements are executed and
CUBRID_EXEC_QUERY_ALL flag is set upon
<function>cubrid_execute()</function>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem><para><parameter>result</parameter> comes from a call to <function>cubrid_execute</function></para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>&true;, when process is successful.</para>
<para>&false;, when process is unsuccessful.</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>cubrid_next_result</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = cubrid_connect("127.0.0.1", 33000, "demodb");
$sql_stmt = "SELECT * FROM code; SELECT * FROM history WHERE host_year=2004 AND event_code=20281";
$res = cubrid_execute($conn, $sql_stmt, CUBRID_EXEC_QUERY_ALL);
get_result_info($res);
cubrid_next_result($res);
get_result_info($res);
function get_result_info($req)
{
printf("\n------------ get_result_info --------------------\n");
$row_num = cubrid_num_rows($req);
$col_num = cubrid_num_cols($req);
$column_name_list = cubrid_column_names($req);
$column_type_list = cubrid_column_types($req);
$column_last_name = cubrid_field_name($req, $col_num - 1);
$column_last_table = cubrid_field_table($req, $col_num - 1);
$column_last_type = cubrid_field_type($req, $col_num - 1);
$column_last_len = cubrid_field_len($req, $col_num - 1);
$column_1_flags = cubrid_field_flags($req, 1);
printf("%-30s %d\n", "Row count:", $row_num);
printf("%-30s %d\n", "Column count:", $col_num);
printf("\n");
printf("%-30s %-30s %-15s\n", "Column Names", "Column Types", "Column Len");
printf("------------------------------------------------------------------------------\n");
$size = count($column_name_list);
for($i = 0; $i < $size; $i++) {
$column_len = cubrid_field_len($req, $i);
printf("%-30s %-30s %-15s\n", $column_name_list[$i], $column_type_list[$i], $column_len);
}
printf("\n\n");
printf("%-30s %s\n", "Last Column Name:", $column_last_name);
printf("%-30s %s\n", "Last Column Table:", $column_last_table);
printf("%-30s %s\n", "Last Column Type:", $column_last_type);
printf("%-30s %d\n", "Last Column Len:", $column_last_len);
printf("%-30s %s\n", "Second Column Flags:", $column_1_flags);
printf("\n\n");
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
------------ get_result_info --------------------
Row count: 6
Column count: 2
Column Names Column Types Column Len
------------------------------------------------------------------------------
s_name char(1) 1
f_name varchar(6) 6
Last Column Name: f_name
Last Column Table: code
Last Column Type: varchar(6)
Last Column Len: 6
Second Column Flags:
------------ get_result_info --------------------
Row count: 4
Column count: 5
Column Names Column Types Column Len
------------------------------------------------------------------------------
event_code integer 11
athlete varchar(40) 40
host_year integer 11
score varchar(10) 10
unit varchar(5) 5
Last Column Name: unit
Last Column Table: history
Last Column Type: varchar(5)
Last Column Len: 5
Second Column Flags: not_null primary_key unique_key
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_execute</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -17,7 +17,12 @@
<methodparam choice="opt"><type>string</type><parameter>attr_name</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_schema</function> function is used to get the requested schema information from database. You have to designate <parameter>class_name</parameter>, if you want to get information on certain class, <parameter>attr_name</parameter>, if you want to get information on certain attribute (can be used only with CUBRID_ SCH_ATTR_PRIVILEGE).
The <function>cubrid_schema</function> function is used to get the
requested schema information from database. You have to designate
<parameter>class_name</parameter>, if you want to get information on
certain class, <parameter>attr_name</parameter>, if you want to get
information on certain attribute (can be used only with CUBRID_
SCH_ATTR_PRIVILEGE).
</para>
<para>

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 308986 $ -->
<refentry xml:id="function.cubrid-set-autocommit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>cubrid_set_autocommit</refname>
<refpurpose>Set autocommit mode of the connection</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>cubrid_set_autocommit</methodname>
<methodparam><type>resource</type><parameter>conn_identifier</parameter></methodparam>
<methodparam><type>bool</type><parameter>mode</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_set_autocommit</function> function is used to set the
CUBRID database auto-commit mode of the current database connection.
</para>
<para>
In CUBRID PHP, an auto-commit mode is disabled by default for transaction
management. When auto-commit mode is truned from off to on, any pending work is
automatically committed.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn_identifier</parameter></term>
<listitem><para>Connection identifier.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>Auto-commit mode. The following constants can be used:</para>
<para>
<simplelist>
<member><constant>CUBRID_AUTOCOMMIT_FALSE</constant></member>
<member><constant>CUBRID_AUTOCOMMIT_TRUE</constant></member>
</simplelist>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true;, when process is successful.
</para>
<para>
&false;, when process is unsuccessful.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_get_autocommit</function></member>
<member><function>cubrid_commit</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 308986 $ -->
<refentry xml:id="function.cubrid-set-db-parameter" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>cubrid_set_db_parameter</refname>
<refpurpose>Sets the CUBRID database parameters</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>cubrid_set_db_parameter</methodname>
<methodparam><type>resource</type><parameter>conn_identifier</parameter></methodparam>
<methodparam><type>int</type><parameter>param_type</parameter></methodparam>
<methodparam><type>int</type><parameter>param_value</parameter></methodparam>
</methodsynopsis>
<para>
The <function>cubrid_set_db_parameter</function> function is used to set
the CUBRID database parameters. It can set the following CUBRID database
parameters:
</para>
<para>
<simplelist>
<member><constant>PARAM_ISOLATION_LEVEL</constant></member>
<member><constant>PARAM_LOCK_TIMEOUT</constant></member>
</simplelist>
</para>
<note>
<para>
The auto-commit mode can be set by using
<function>cubrid_set_autocommit</function>.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>conn_identifier</parameter></term>
<listitem><para>
The CUBRID connection. If the connection identifier is not specified,
the last link opened by <function>cubrid_connect</function> is assumed.
</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>param_type</parameter></term>
<listitem><para>Database parameter type.</para></listitem>
</varlistentry>
<varlistentry>
<term><parameter>param_value</parameter></term>
<listitem><para>Isolation level value (1-6) or lock timeout (in seconds) value.</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; on success.
</para>
<para>
&false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>cubrid_get_db_parameter</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = cubrid_connect("localhost", 33000, "demodb");
$params = cubrid_get_db_parameter($conn);
var_dump($params);
cubrid_set_autocommit($conn, CUBRID_AUTOCOMMIT_TRUE);
cubrid_set_db_parameter($conn, CUBRID_PARAM_ISOLATION_LEVEL, 2);
$params_new = cubrid_get_db_parameter($conn);
var_dump($params_new);
cubrid_disconnect($conn);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
array(4) {
["PARAM_ISOLATION_LEVEL"]=>
int(3)
["PARAM_LOCK_TIMEOUT"]=>
int(-1)
["PARAM_MAX_STRING_LENGTH"]=>
int(1073741823)
["PARAM_AUTO_COMMIT"]=>
int(0)
}
array(4) {
["PARAM_ISOLATION_LEVEL"]=>
int(2)
["PARAM_LOCK_TIMEOUT"]=>
int(-1)
["PARAM_MAX_STRING_LENGTH"]=>
int(1073741823)
["PARAM_AUTO_COMMIT"]=>
int(1)
}
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>cubrid_get_db_parameter</function></member>
<member><function>cubrid_set_autocommit</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View file

@ -48,6 +48,7 @@
<function name='cubrid_field_type' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_free_result' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_get' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_get_autocommit' from='PECL CUBRID &gt;= 8.4.0'/>
<function name='cubrid_get_charset' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_get_class_name' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_get_client_info' from='PECL CUBRID &gt;= 8.3.0'/>
@ -66,6 +67,7 @@
<function name='cubrid_lock_write' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_move_cursor' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_new_glo' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_next_result' from='PECL CUBRID &gt;= 8.4.0'/>
<function name='cubrid_num_cols' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_num_fields' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_num_rows' from='PECL CUBRID &gt;= 8.3.0'/>
@ -83,6 +85,8 @@
<function name='cubrid_seq_insert' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_seq_put' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_set_add' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_set_autocommit' from='PECL CUBRID &gt;= 8.4.0'/>
<function name='cubrid_set_db_parameter' from='PECL CUBRID &gt;= 8.4.0'/>
<function name='cubrid_set_drop' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_unbuffered_query' from='PECL CUBRID &gt;= 8.3.0'/>
<function name='cubrid_version' from='PECL CUBRID &gt;= 8.3.0'/>