loop-over-results

Macro

Package: dbi

Arguments: (&key types column-names do-column-names return hstmt width) &body body

After executing a sql statement with rr-sql, this form loops once for each result row, evaluating the body. types specifies how the values for each column should be returned (as it does for sql, see below for possible values of types). If you wish to have a list of the result column names computed, then pass a symbol as the value of column-names and pass a true value for do-column-names. If this is done then the symbol that is the value of column-names will be bound to the list of column names before the first time that body is evaluated. After body is evaluated for the last time the expression return is evaluated and the value of it is the value of the loop-over-results form. The statement handle of the results that are being scanned by this form is hstmt.

Within the body there are two macros defined: column-count and column-value. The macro column-count takes no arguments and its value is the number of columns of results available. The column-value macro takes one argument, the column number, and returns the value in that column for the current row. Note: column numbers are one-based, thus the value passed to column-value should be between 1 and the number of columns returned. The type of value returned by column-value will be a string unless some other type of value is specified in the types argument.

width is the size for character buffers used in retrieving character-valued fields. If not given, then the width for the database, db-width, is used.

types should be either the keyword :auto or a list of type specifiers from the following table. The value :auto means that the types will be determined automatically from the query results.

SpecifierMeaning
:intreturn as a 4 byte signed value
:longreturn as a 4 byte signed value
:doublereturn as an 8 byte floating point value
treturn as a string or nil for the null value (the default)

See aodbc.htm for more information on Allegro ODBC.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.