reference/ibase/functions/ibase-service-attach.xml
b95d28e6ec86e4a71e012737d36ebdc1cf009180
...
...
@@ -9,14 +9,133 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>resource</type><methodname>ibase_service_attach</methodname>
12
+
<type class="union"><type>resource</type><type>false</type></type><methodname>ibase_service_attach</methodname>
13
13
<methodparam><type>string</type><parameter>host</parameter></methodparam>
14
14
<methodparam><type>string</type><parameter>dba_username</parameter></methodparam>
15
15
<methodparam><type>string</type><parameter>dba_password</parameter></methodparam>
16
16
</methodsynopsis>
17
+
</refsect1>
18
+
19
+
<refsect1 role="parameters">
20
+
&reftitle.parameters;
21
+
<para>
22
+
<variablelist>
23
+
<varlistentry>
24
+
<term><parameter>host</parameter></term>
25
+
<listitem>
26
+
<para>
27
+
The name or ip address of the database host. You can define the port by adding
28
+
'/' and port number. If no port is specified, port 3050 will be used.
29
+
</para>
30
+
</listitem>
31
+
</varlistentry>
32
+
<varlistentry>
33
+
<term><parameter>dba_username</parameter></term>
34
+
<listitem>
35
+
<para>
36
+
The name of any valid user.
37
+
</para>
38
+
</listitem>
39
+
</varlistentry>
40
+
<varlistentry>
41
+
<term><parameter>dba_password</parameter></term>
42
+
<listitem>
43
+
<para>
44
+
The user's password.
45
+
</para>
46
+
</listitem>
47
+
</varlistentry>
48
+
</variablelist>
49
+
</para>
50
+
</refsect1>
51
+

52
+
<refsect1 role="returnvalues">
53
+
&reftitle.returnvalues;
54
+
<para>
55
+
Returns a Interbase / Firebird link identifier on success&return.falseforfailure;.
56
+
</para>
57
+
</refsect1>
58
+
59
+
<refsect1 role="examples">
60
+
&reftitle.examples;
61
+
<para>
62
+
<example>
63
+
<title><function>ibase_service_attach</function> example</title>
64
+
<programlisting role="php">
65
+
<![CDATA[
66
+
<?php
67
+
// Attach to the remote Firebird server by ip address
68
+
if (($service = ibase_service_attach('10.1.1.199', 'sysdba', 'masterkey')) != FALSE) {
69
+
70
+
// Successfully attached.
71
+
// Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')
72
+
$server_version = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
73
+

74
+
// Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')
75
+
$server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);
76
+

77
+
// Detach from server (disconnect)
78
+
ibase_service_detach($service);
17
79

18
-
&warn.undocumented.func;
80
+
// Output the info
81
+
echo "Server version: " . $server_version . "<br/>";
82
+
echo "Server implementation: " . $server_implementation;
83
+
}
84
+
else {
85
+
// Output message on error
86
+
$conn_error = ibase_errmsg();
87
+
die($conn_error);
88
+
}
89
+

90
+
?>
91
+
]]>
92
+
</programlisting>
93
+
</example>
94
+
</para>
95
+
96
+
<para>
97
+
<example>
98
+
<title><function>ibase_service_attach</function> example using <literal>hostname/port</literal> syntax</title>
99
+
<programlisting role="php">
100
+
<![CDATA[
101
+
<?php
102
+
// Attach to the remote Firebird server by name. Use Port 3050.
103
+
if (($service = ibase_service_attach('FB-SRV-01.contoso.local/3050', 'sysdba', 'masterkey')) != FALSE) {
104
+
105
+
// Successfully attached.
106
+
// Fetch server version (something like 'LI-V3.0.4.33054 Firebird 3.0')
107
+
$server_version = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
108
+

109
+
// Fetch server implementation (something like 'Firebird/Linux/AMD/Intel/x64')
110
+
$server_implementation = ibase_server_info($service, IBASE_SVC_IMPLEMENTATION);
111
+

112
+
// Detach from server (disconnect)
113
+
ibase_service_detach($service);
114
+

115
+
// Output the info
116
+
echo "Server version: " . $server_version . "<br/>";
117
+
echo "Server implementation: " . $server_implementation;
118
+
}
119
+
else {
120
+
// Output message on error
121
+
$conn_error = ibase_errmsg();
122
+
die($conn_error);
123
+
}
124
+

125
+
?>
126
+
]]>
127
+
</programlisting>
128
+
</example>
129
+
</para>
130
+
</refsect1>
19
131

132
+
<refsect1 role="seealso">
133
+
&reftitle.seealso;
134
+
<para>
135
+
<simplelist>
136
+
<member><function>ibase_service_detach</function></member>
137
+
</simplelist>
138
+
</para>
20
139
</refsect1>
21
140

22
141
</refentry>
23
142