#22204 [Csd]: DB tableInfo(): table set where it should not be

From: Date: Mon, 05 May 2003 15:22:07 +0000
Subject: #22204 [Csd]: DB tableInfo(): table set where it should not be
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15900@lists.php.net to get a copy of this message
ID: 22204 User updated by: marc at links2linux dot de Reported By: marc at links2linux dot de Status: Closed Bug Type: PEAR related Operating System: Linux PHP Version: 4.2.3 Assigned To: ssb New Comment: Yes, but in my case I am in a generic class that handles many different queries and the query can be set dynamically so I cannot know the tables that are in use. I think if the API is the showstopper here, a little note in the docs would be very good. -Marc Previous Comments: ------------------------------------------------------------------------ [2003-05-05 08:15:14] lsmith@php.net actually let me clarify: if you pass a result to tableinfo then you are getting infos on the "structure" of the result set. If you are interested in getting information on the structure of the table dont pass it a resultset but the name of the table you are interested in. ------------------------------------------------------------------------ [2003-05-04 11:40:25] lsmith@php.net there isnt much we can do here since the mysql API does not give us this sort of infos (doubt other APIs do). So I guess all we can do is document this. ------------------------------------------------------------------------ [2003-04-28 03:59:32] arnaud@php.net changing status ------------------------------------------------------------------------ [2003-02-13 07:04:35] marc at links2linux dot de Hi! I use the PEAR DB tableInfo() funtion to get information about table fields (mysql). if you say "SELECT id FROM table1 ..." then the table attribute for id is set to "table1". Thats correct because I can use "table1.id" to refer to that field in a WHERE clause for example. If I use something like SELECT CONCAT(anschr_1, ' - ', IFNULL(anschr_2,''), ' - ', IFNULL(anschr_3,'')) AS customer_name FROM table1 then the table attribute is *not* set. That very OK because the field table1.customer_name does not exist. Now the problem: If I say "SELECT table1.id AS id2 ,table2.foo FROM table1, table2 ..." then the "table" attribute of "id2" in tableInfo() is set to "table1" which is IMHO *not* OK because table1.id2 is not a valid field. I hope It's clear what I am pointing to... -Marc ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22204&edit=1

« previous php.pear.dev (#15900) next »