GNU Info

Info Node: (slib.info)Database Reports

(slib.info)Database Reports


Next: Database Browser Prev: Database Utilities Up: Relational Database
Enter node , (file) or (file)node

Database Reports
----------------

Code for generating database reports is in `report.scm'.  After writing
it using `format', I discovered that Common-Lisp `format' is not
useable for this application because there is no mechanismm for
truncating fields.  `report.scm' needs to be rewritten using `printf'.

 - Procedure: create-report rdb destination report-name table
 - Procedure: create-report rdb destination report-name
     The symbol REPORT-NAME must be primary key in the table named
     `*reports*' in the relational database RDB.  DESTINATION is a
     port, string, or symbol.  If DESTINATION is a:

    port
          The table is created as ascii text and written to that port.

    string
          The table is created as ascii text and written to the file
          named by DESTINATION.

    symbol
          DESTINATION is the primary key for a row in the table named
          *printers*.

     The report is prepared as follows:

        * `Format' (Note: Format) is called with the `header' field
          and the (list of) `column-names' of the table.

        * `Format' is called with the `reporter' field and (on
          successive calls) each record in the natural order for the
          table.  A count is kept of the number of newlines output by
          format.  When the number of newlines to be output exceeds the
          number of lines per page, the set of lines will be broken if
          there are more than `minimum-break' left on this page and the
          number of lines for this row is larger or equal to twice
          `minimum-break'.

        * `Format' is called with the `footer' field and the (list of)
          `column-names' of the table.  The footer field should not
          output a newline.

        * A new page is output.

        * This entire process repeats until all the rows are output.

  Each row in the table *reports* has the fields:

name
     The report name.

default-table
     The table to report on if none is specified.

header, footer
     A `format' string.  At the beginning and end of each page
     respectively, `format' is called with this string and the (list of)
     column-names of this table.

reporter
     A `format' string.  For each row in the table, `format' is called
     with this string and the row.

minimum-break
     The minimum number of lines into which the report lines for a row
     can be broken.  Use `0' if a row's lines should not be broken over
     page boundaries.

  Each row in the table *printers* has the fields:

name
     The printer name.

print-procedure
     The procedure to call to actually print.


automatically generated by info2www version 1.2.2.9