mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 06:18:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@323121 c90b9560-bf6c-de11-be94-00142212c4b1
199 lines
7.2 KiB
XML
199 lines
7.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="function.cubrid-connect-with-url" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>cubrid_connect_with_url</refname>
|
|
<refpurpose>Establish the environment for connecting to CUBRID server</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>resource</type><methodname>cubrid_connect_with_url</methodname>
|
|
<methodparam><type>string</type><parameter>conn_url</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>userid</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>passwd</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>new_link</parameter><initializer>false</initializer></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.
|
|
</para>
|
|
<para>
|
|
<url> ::= CUBRID:<host>:<db_name>:<db_user>:<db_password>:[?<properties>]
|
|
<properties> ::= <property> [&<property>]
|
|
<properties> ::= autocommit=<autocommit_mode>
|
|
<alternative_hosts> ::= <standby_broker1_host>:<port> [,<standby_broker2_host>:<port>]
|
|
<host> := HOSTNAME | IP_ADDR
|
|
<time> := SECOND
|
|
</para>
|
|
<para>
|
|
or <url> ::= cci:CUBRID:<host>:<db_name>:......
|
|
</para>
|
|
<para>
|
|
<simplelist>
|
|
<member>host : A host name or IP address of the master database</member>
|
|
<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>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
<literal>?</literal> and <literal>:</literal> that are used as identifiers
|
|
in PHP connection URL can't be included in the password. The following is
|
|
an example of a password that is invalid to use as connection URL because it contains
|
|
"<literal>?:</literal>".
|
|
</para>
|
|
<para>
|
|
$url = "CUBRID:localhost:33000:tdb:dba:12?:?autocommit=off";
|
|
</para>
|
|
<para>
|
|
Passwords that contain <literal>?</literal> or <literal>:</literal>
|
|
may be passed as a seperate parameter.
|
|
</para>
|
|
<para>
|
|
$url = "CUBRID:localhost:33000:tbd:::?autocommit=off";
|
|
$conn = cubrid_connect_with_url ($url, "dba", "12?");
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>conn_url</parameter></term>
|
|
<listitem><para>A character string that contains server connection information.</para></listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>userid</parameter></term>
|
|
<listitem><para>User name for the database.</para></listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>passwd</parameter></term>
|
|
<listitem><para>User password.</para></listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>new_link</parameter></term>
|
|
<listitem><para>If a second call is made to
|
|
<function>cubrid_connect_with_url</function> with the same arguments,
|
|
no new connection will be established, but instead, the connection
|
|
identifier of the already opened connection will be returned. The
|
|
<parameter>new_link</parameter> parameter modifies this behavior and
|
|
makes <function> cubrid_connect_with_url</function> always open a new
|
|
connection, even if <function> cubrid_connect_with_url</function> was
|
|
called before with the same parameters.</para></listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Connection identifier, when process is successful.
|
|
</para>
|
|
<para>
|
|
&false;, when process is unsuccessful.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>cubrid_connect_with_url</function> url without properties example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn_url = "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')");
|
|
|
|
if ($req) {
|
|
cubrid_close_request ($req);
|
|
cubrid_commit ($con);
|
|
} else {
|
|
cubrid_rollback ($con);
|
|
}
|
|
cubrid_disconnect ($con);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
|
|
<example>
|
|
<title><function>cubrid_connect_with_url</function> url with properties example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn_url = "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')");
|
|
|
|
if ($req) {
|
|
cubrid_close_request ($req);
|
|
cubrid_commit ($con);
|
|
} else {
|
|
cubrid_rollback ($con);
|
|
}
|
|
cubrid_disconnect ($con);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>cubrid_connect</function></member>
|
|
<member><function>cubrid_pconnect</function></member>
|
|
<member><function>cubrid_pconnect_with_url</function></member>
|
|
<member><function>cubrid_disconnect</function></member>
|
|
<member><function>cubrid_close</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
|
|
-->
|