		     Internals of The SQL gateway

			     Paul Lindner



Intro....

The SQL gateway accepts gopher requests and translates them into
SQL requests that get passed via TCP to a Sybase Database Server.


Requirements.....

You will need a machine with the Sybase client libraries (usually
stored in /usr/sybase) and a special version of perl called sybperl.


Commands understood by the Gateway...

o   tables [<search>]

    This command uses the data dictionary to make a gopher directory
    list of the different tables in the database.  This is most useful
    for allowing raw database access.  This command generates
    "columns" commands that the client will execute.

    An optional search item will restrict the tables to match the
    search term.


o   columns <tablename> [<search>]
    
    This command uses the data dictionary to make a gopher directory
    list of the columns in <tablename>.  This command generates "list"
    commands for the client to execute.

    An optional search item will restrict the tables to match the
    search term.


o   list <tablename.columnname> [<fromtables> [<query>]] [<search>]

    This command generates a listing of the unique items in the given
    table and column.

    This command can be part of a multiple series of queries by
    specifying an optional list of tables to choose from and an query.
    This gets translated into SQL that looks like this:

      select .....
      from  <fromtables>
      where <query>

    An optional search can search for specific titles in the specified
    table and column.


o   get <tablename.columnname> <fromtables> <query>

    This command actually retrieves a record from the database as a
    textual item.  The default is to print out each column name, a
    colon and the data contained in it.  Multiple records are
    separated with a line of "dashes".

    Optionally one may define a module for a specific table.  This
    module is a file containing perl code that can do sub-queries and
    fancy reformatting of the data into any format you desire.
