Re: Possible to get field names and types in a table without executing a query?



On 6/27/06, Matthew Persico <matthew.persico@xxxxxxxxx> wrote:

So now I need one for every database?


Yes - and there a DBMS that make you do that the hard way, with raw access
to the system catalog.

Despite the prior thread entry refering to

select * from table where 0 = 1

as a hack in the 'bad' sense, I suggest that this is a hack in the 'good'
sense.



It is much more easily portable.


Suppose you have a real query:

select a.foo, b.bar.c.baz
from
a, b, c
where .....

The 0= 1 method works for that too. Contrast that with parsing the
from clause and the where clause to create a tabel catalog query. Yuk.




--
Jonathan Leffler <jonathan.leffler@xxxxxxxxx> #include <disclaimer.h>
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."