mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-22 20:08:55 +00:00

Closes GH-286. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@352189 c90b9560-bf6c-de11-be94-00142212c4b1
105 lines
2.8 KiB
XML
105 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="function.odbc-data-source" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>odbc_data_source</refname>
|
|
<refpurpose>Returns information about available DSNs</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>array</type><type>false</type></type><methodname>odbc_data_source</methodname>
|
|
<methodparam><type>resource</type><parameter>odbc</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>fetch_type</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function will return the list of available DSN (after calling it
|
|
several times).
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>odbc</parameter></term>
|
|
<listitem>
|
|
&odbc.connection.id;
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>fetch_type</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The <parameter>fetch_type</parameter> can be one of two constant types:
|
|
<constant>SQL_FETCH_FIRST</constant>, <constant>SQL_FETCH_NEXT</constant>.
|
|
Use <constant>SQL_FETCH_FIRST</constant> the first time this function is
|
|
called, thereafter use the <constant>SQL_FETCH_NEXT</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns &false; on error, an &array; upon success, and &null; after fetching
|
|
the last available DSN.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example xml:id="odbc-data-source.example.basic">
|
|
<title>List available DSNs</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = odbc_connect('dsn', 'user', 'pass');
|
|
$dsn_info = odbc_data_source($conn, SQL_FETCH_FIRST);
|
|
while ($dsn_info) {
|
|
print_r($dsn_info);
|
|
$dsn_info = odbc_data_source($conn, SQL_FETCH_NEXT);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[server] => dsn
|
|
[description] => ODBC Driver 17 for SQL Server
|
|
)
|
|
Array
|
|
(
|
|
[server] => other_dsn
|
|
[description] => Microsoft Access Driver (*.mdb, *.accdb)
|
|
)]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|