|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-19 01:31 UTC] kalowsky@php.net
[2004-09-16 15:39 UTC] vrana@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 19:00:02 2025 UTC |
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!