File: cubrid-connect.xml

package info (click to toggle)
php-doc 20140201-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 74,084 kB
  • ctags: 4,040
  • sloc: xml: 998,137; php: 20,812; cpp: 500; sh: 177; makefile: 63; awk: 28
file content (174 lines) | stat: -rw-r--r-- 5,445 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 330762 $ -->

<refentry xml:id="function.cubrid-connect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>cubrid_connect</refname>
  <refpurpose>Open a connection to a CUBRID Server</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>cubrid_connect</methodname>
   <methodparam><type>string</type><parameter>host</parameter></methodparam>  
   <methodparam><type>int</type><parameter>port</parameter></methodparam>  
   <methodparam><type>string</type><parameter>dbname</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</function> function is used to establish the
    environment for connecting to your server by using your server address,
    port number, database name, user name, and password. If the user name and
    password is not given, then the "PUBLIC" connection will be made by
    default. 
  </para>
 </refsect1>

  <refsect1 role="parameters">
 &reftitle.parameters;
 <para>
  <variablelist>
   <varlistentry>
    <term><parameter>host</parameter></term>
    <listitem><para>Host name or IP address of CUBRID CAS server.</para></listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>port</parameter></term>
    <listitem><para>Port number of CUBRID CAS server (BROKER_PORT configured in $CUBRID/conf/cubrid_broker.conf).</para></listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>dbname</parameter></term>
    <listitem><para>Name of database.</para></listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>userid</parameter></term>
    <listitem><para>User name for the database. If not given, the default
      value is "public".</para></listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>passwd</parameter></term>
    <listitem><para>User password. If not given, the default value is "".</para></listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>new_link</parameter></term>
    <listitem><para>If a second call is made to
      <function>cubrid_connect</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</function> always open a new connection,
      even if <function>cubrid_connect</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</function> example</title>
   <programlisting role="php">
<![CDATA[
<?php
printf("%-30s %s\n", "CUBRID PHP Version:", cubrid_version());

printf("\n");

$conn = cubrid_connect("localhost", 33000, "demodb", "dba");

if (!$conn) {
    die('Connect Error ('. cubrid_error_code() .')' . cubrid_error_msg());
}

$db_params = cubrid_get_db_parameter($conn);

while (list($param_name, $param_value) = each($db_params)) {
    printf("%-30s %s\n", $param_name, $param_value);
}

printf("\n");

$server_info = cubrid_get_server_info($conn);
$client_info = cubrid_get_client_info();

printf("%-30s %s\n", "Server Info:", $server_info);
printf("%-30s %s\n", "Client Info:", $client_info);

printf("\n");

$charset = cubrid_get_charset($conn);

printf("%-30s %s\n", "CUBRID Charset:", $charset);

cubrid_disconnect($conn);
?>
]]>
   </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
CUBRID PHP Version:            9.1.0.0001

PARAM_ISOLATION_LEVEL          3
LOCK_TIMEOUT                   -1
MAX_STRING_LENGTH              1073741823
PARAM_AUTO_COMMIT              1

Server Info:                   9.1.0.0212
Client Info:                   9.1.0

CUBRID Charset:                iso8859-1
]]>
   </screen>
  </example>
 </refsect1>
 
   <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
   <member><function>cubrid_pconnect</function></member>
   <member><function>cubrid_connect_with_url</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
-->