Macro | Package: dbi | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## loop-over-results

Arguments: (&key types column-names do-column-names return hstmt width db) &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.

Specifier | Meaning
:int | return as a 4 byte signed value
:long | return as a 4 byte signed value
:double | return as an 8 byte floating point value
t | return as a string or `nil` for the null value (the default)

db should be specified given so that the external format value stored in the database can be used to compute the value.

See aodbc.htm for more information on Allegro ODBC.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version