[Zope] how to get the created table names

Steve Spicklemire steve@spvi.com
Fri, 24 Nov 2000 11:50:45 -0500 (EST)


Hmm.. I think there is a method of a ZSQL result object called 'names'.. 

Here is a snippet from some working code:

<dtml-let specificTypes="getTypes(ttid=type, name='', tttype='')"
          theNames="specificTypes.names()">

where 'getTypes' is a ZSQL Method and theNames is the list of column names returned
from the query...

-steve

>>>>> "Jose" == Jose Soares <jose@sferacarta.com> writes:

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

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


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


    Jose> José

    Jose> 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 )


    Jose> _______________________________________________ Zope
    Jose> maillist - Zope@zope.org
    Jose> http://lists.zope.org/mailman/listinfo/zope ** No cross
    Jose> posts or HTML encoding!  ** (Related lists -
    Jose> http://lists.zope.org/mailman/listinfo/zope-announce
    Jose> http://lists.zope.org/mailman/listinfo/zope-dev )