Re: All table names
| From: | Andrew M. Yochum | Date: | Thu, 25 Oct 2001 05:10:26 +0000 |
| Subject: | Re: All table names | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-421@lists.php.net to get a copy of this message | ||
This should give you a start for Sybase... this will give tables and column metadata:
select
sysobjects.id,
sysobjects.name,
syscolumns.name as colname,
systypes.name as typename,
syscolumns.length,
syscolumns.status
from
sysobjects,
syscolumns,
systypes
where
sysobjects.type = 'U'
and
syscolumns.id = sysobjects.id
and
systypes.usertype = syscolumns.usertype
order by
sysobjects.name,
syscolumns.name
On Thu, 25 Oct 2001, Tomas V.V.Cox wrote:
> Joao Prado Maia wrote:
> >
> > On Wed, 24 Oct 2001, Pablo DallOglio wrote:
> >
> > > Anyone knows how do I get all table names of database using Pear::DB ?
> > >
> >
> > Just run a query for 'SHOW TABLES' on MySQL for instance. Every Database
> > has its own way to show this information, so I guess it could be possible
> > to add code on every driver for a 'showTables()' method.
> >
> > I'm not sure if this is desired though. Is PEAR::DB objective to do
> > everything for the user of the class ? If so, this would be a good
> > addition IMO.
> >
>
> Sure, it would be a great contribution. Let's take a look at Metabase or
> ADODB? ;-)
>
> Directly from phplib sources:
> Oracle: SELECT table_name,tablespace_name FROM user_tables
> PostgreSQL: select relname from pg_class where relkind = 'r' and not
> relname like 'pg_%'
>
>
> Tomas V.V.Cox
>
>
--
Andrew Yochum
Digital Pulp, Inc.
212-679-0676x255