Getting table and field names

Jan Schenkel janschenkel at yahoo.com
Mon Aug 6 15:07:04 EDT 2007


--- Mikey <mikeythek at gmail.com> wrote:
> Jan,
> Then how does RR's query builder build the list of
> tables in the second tab?
> 

Hi Mikey,

It basically uses two approaches: if it's a database
type for which Revolution has a native driver, then it
uses the undocumented function 'revdb_tablenames' to
get the table names from a connection.
If it's an ODBC connection, it tries from a series of
prebuilt queries.

Here's the relevant portion from the 'revDatabase'
frontscript:
##
put revdb_dbtype(connectionid) into tType
      switch item 1 of tType
      case "mysql"
      case "oracle"
      case "valentina"
      case "postgresql"
      case "frontbase"
      case "sqlite"
        put revdb_tablenames(connectionid) into
tResult
        break
      case "odbc"
        switch item 2 of tType
        case "mysql"
          put
revdb_querylist(tab,return,connectionid,"SHOW
tables;") into tResult
          break
        case "oracle"
          put
revdb_querylist(tab,return,connectionid,"SELECT * from
tab;") into tResult
          break
        case "postgresql"
          put
revdb_querylist(tab,return,connectionid,"SELECT
tablename FROM pg_tables WHERE tablename NOT LIKE
'pg%';") into tResult
          break
        case "access"
          put
revdb_querylist(tab,return,connectionid,"SELECT name
FROM MSysObjects WHERE type IN (1,6) AND name NOT LIKE
'MSys%';") into tResult
          break
        default
          put revdb_tablenames(connectionid) into
tResult
          break
        end switch
        break
      end switch
##

The 'revDatabase' frontscript is the infrastructure
behind the automated queries and the controls that can
be linked to them.

Hope this helped,

Jan Schenkel.

Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


       
____________________________________________________________________________________
Pinpoint customers who are looking for what you sell. 
http://searchmarketing.yahoo.com/



More information about the use-livecode mailing list