From:             jlsalinas at gmx dot net
Operating system: Windows Me
PHP version:      4.3.4
PHP Bug Type:     ODBC related
Bug description:  odbc_data_source returns avaible DNS, not information about argument

Description:
------------
Even though the documentation states that odbc_data_source "Returns
information about a current connection", it returns the list of avaible
DNS (after calling it several times).



This is a good feature, but maybe in a function called odbc_list_dns and
without the need for an argument with a previously established connection
(maybe ODBC internals require the connection to get them, I don't know).



What I expected after reading the docs about odbc_data_source was:

 - odbc driver used (xtg for interbase6 in my case)

 - underlying database (firebird 1.5rc8 in my case)

 - perhaps other information, depending on the dbms



My code is:



----- begin --------------------------

<pre>

<?php

  $conn = odbc_connect ($dns_name, $user, $pass);

  if ($ds = @odbc_data_source ($conn, SQL_FETCH_FIRST)) {

    do {

      var_dump ($ds);

    } while ($ds = @odbc_data_source ($conn, SQL_FETCH_NEXT));

  }

?>

</pre>

----- end ----------------------------



The result (I'm from Spain):



----- begin --------------------------

array(2) {

  ["server"]=>

  string(23) "Archivos de texto ASCII"

  ["description"]=>

  string(36) "Microsoft Text Driver (*.txt; *.csv)"

}

array(2) {

  ["server"]=>

  string(18) "MS Access Database"

  ["description"]=>

  string(31) "Microsoft Access Driver (*.mdb)"

}

[...and some more]

----- end ----------------------------



You see? First, if this function is supposed to give information about the
connection and its data source, why do I need to call it many times? It's
not gonna change! Moreover, the information it gives the first time, with
SQL_FETCH_FIRST, does not correspond with the specified connection.



And, what is the need to specify if it's the first time or not
(SQL_FETCH_FIRST and SQL_FETCH_NEXT constants)? This second argument makes
no sense to me. Even in a odbc_list_dns function, I'd prefer the function
to return all the DNS as an array, and not having to call it several
times, inside a somewhat weird loop.



I think that correct function calls should be:

 - odbc_data_source ($conn)

 - odbc_list_dns ()



Again, I don't know the internals of ODBC. Maybe odbc_list_dns *needs* a
connection to work. Ok. But, please, no different arguments for the first
and the following calls.



Thank you very much. Keep on doing doing such a great job!




-- 
Edit bug report at http://bugs.php.net/?id=27249&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27249&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27249&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27249&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27249&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27249&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27249&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27249&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27249&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27249&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27249&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27249&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27249&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27249&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27249&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27249&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27249&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27249&r=float

Reply via email to