#27249 [Opn->Ana]: odbc_data_source returns avaible DNS, not information about argument

From: Date: Sun, 18 Jul 2004 23:31:27 +0000
Subject: #27249 [Opn->Ana]: odbc_data_source returns avaible DNS, not information about argument
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969361965@lists.php.net to get a copy of this message
ID: 27249 Updated by: kalowsky@php.net Reported By: jlsalinas at gmx dot net -Status: Open +Status: Analyzed -Bug Type: Feature/Change Request +Bug Type: Documentation problem Operating System: Windows Me PHP Version: 4.3.4 New Comment: The documentation may be out of whack, but your request to remove the SQL_FETCH_FIRST and SQL_FETCH_NEXT calls is denied. Unfortunately, the SQL call underneath requires these to be passed in. As for the connection issue, unfortunately due to the nature of the ODBC system, an environment variable must be passed to the call. The only place the environment variable exists is within a connection. Previous Comments: ------------------------------------------------------------------------ [2004-02-14 00:18:35] jlsalinas at gmx dot net 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 this bug report at http://bugs.php.net/?id=27249&edit=1

« previous php.doc (#969361965) next »