[Zope] how to get the created table names

Jose Soares jose@sferacarta.com
Fri, 24 Nov 2000 13:02:38 +0100


There isn't a SQL standard command to show the tables in the database.
Thus evry database has a different command to do such job.
For example:

DBMaker:
  to show TABLES:  select  *  from SYSTABLE
  to show COLUMNS: SELECT  COLUMN_NAME,TYPE_NAME,PRECISION  FROM
SYSCOLUMN  WHERE  TABLE_NAME='<table_name>'
MySQL:
  to show TABLES:  SHOW TABLES
  to show COLUMNS: DESC <table_name>
PostreSQL:
  to show TABLES:  select tablename from pg_tables where tablename not
like 'pg_%'
  to show COLUMNS: SELECT a.attname, t.typname, CASE WHEN a.attlen > 0
THEN attlen ELSE a.atttypmod END as length FROM pg_class c, pg_attribute
a, pg_type t WHERE c.relname = '<table_name>' AND a.attnum > 0 AND
a.attrelid = c.oid AND a.atttypid = t.oid


I wrote a couple of ZSQL Methods to emulate a generic ISQL
to query a database using the SQL language
which shows the names of every table in the database
and every column name, type and length of every table.
If you want I can send you it.


José

subrahmanyan kalathur wrote:

> hi,
>
> I would like to know the names of the created table in zsql method.
> Kindly give me the tag for displaying the table names.( if exists.)
>
> thanks
> bye
> yours,
>
> K.H.Subrahmanyan
>
> ( subrahmanyan.kalathur@wipro.com )
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )