reference/uodbc/functions/odbc-data-source.xml
db22a7cfcbc3af221f67e228336ac3e2d62aaf2c
...
...
@@ -3,13 +3,13 @@
3
3
<refentry xml:id="function.odbc-data-source" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>odbc_data_source</refname>
6
-
<refpurpose>Returns information about a current connection</refpurpose>
6
+
<refpurpose>Returns information about available DSNs</refpurpose>
7
7
</refnamediv>
8
8
<refsect1 role="description">
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
-
<type>array</type><methodname>odbc_data_source</methodname>
12
-
<methodparam><type>resource</type><parameter>connection_id</parameter></methodparam>
11
+
<type class="union"><type>array</type><type>null</type><type>false</type></type><methodname>odbc_data_source</methodname>
12
+
<methodparam><type>resource</type><parameter>odbc</parameter></methodparam>
13
13
<methodparam><type>int</type><parameter>fetch_type</parameter></methodparam>
14
14
</methodsynopsis>
15
15
<para>
...
...
@@ -22,7 +22,7 @@
22
22
<para>
23
23
<variablelist>
24
24
<varlistentry>
25
-
<term><parameter>connection_id</parameter></term>
25
+
<term><parameter>odbc</parameter></term>
26
26
<listitem>
27
27
&odbc.connection.id;
28
28
</listitem>
...
...
@@ -44,11 +44,45 @@
44
44
<refsect1 role="returnvalues">
45
45
&reftitle.returnvalues;
46
46
<para>
47
-
Returns &false; on error, and an array upon success.
47
+
Returns &false; on error, an &array; upon success, and &null; after fetching
48
+
the last available DSN.
48
49
</para>
49
50
</refsect1>
50
-
</refentry>
51
51

52
+
<refsect1 role="examples">
53
+
&reftitle.examples;
54
+
<example xml:id="odbc-data-source.example.basic">
55
+
<title>List available DSNs</title>
56
+
<programlisting role="php">
57
+
<![CDATA[
58
+
<?php
59
+
$conn = odbc_connect('dsn', 'user', 'pass');
60
+
$dsn_info = odbc_data_source($conn, SQL_FETCH_FIRST);
61
+
while ($dsn_info) {
62
+
print_r($dsn_info);
63
+
$dsn_info = odbc_data_source($conn, SQL_FETCH_NEXT);
64
+
}
65
+
?>
66
+
]]>
67
+
</programlisting>
68
+
&example.outputs.similar;
69
+
<screen>
70
+
<![CDATA[
71
+
Array
72
+
(
73
+
[server] => dsn
74
+
[description] => ODBC Driver 17 for SQL Server
75
+
)
76
+
Array
77
+
(
78
+
[server] => other_dsn
79
+
[description] => Microsoft Access Driver (*.mdb, *.accdb)
80
+
)]]>
81
+
</screen>
82
+
</example>
83
+
</refsect1>
84
+

85
+
</refentry>
52
86
<!-- Keep this comment at the end of the file
53
87
Local variables:
54
88
mode: sgml
55
89