[Zope] Generating HTML and SQL from results of Describe Table queries.

Dieter Maurer dieter@handshake.de
Sun, 17 Dec 2000 10:34:04 +0100 (CET)


Lloyd Kvam writes:
 > .... 
 >   T. J. Mannos has written
 > how to apply wrappers to html to turn them into DTML Documents.  I could not
 > find any equivalent description for Z SQL Methods.
A Z SQL Method uses a template (in fact a DTML template with additional
commands) to construct a command (in fact a sequence of commands)
to a database from the arguments provided and its context.

Thus, you have 2 options:

  1.  if your operations fall into well defined classes
      easily described by a DTML template with arguments,

      then you define a Z SQL method for each of these templates.

      e.g.

      Arguments: TableName ColumnName ColumnType
      Template:

        MODIFY <dtml-var TableName>
	ADD COLUMN <dtml-var ColumnName> <dtml-var ColumnType>


  2.  otherwise, you define a very general Z SQL method

      Arguments: command
      Template:
        
	<dtml-var command>

      and build your "command" with any appropriate tool
      (e.g. an external method or Python script)
      and pass it as a parameter.

      Be *VERY* careful, not to make such a Z SQL method accessible
      from the Internet, as it allows very malicious operations
      on your system!


You will probably go for option 1.



Dieter