Help Search Campus Map Directories Webmail Home Alumnae Academics Admission Athletics Student Life Offices & Services Library & Technology News & Events About the College Navigation Bar
MHC Home Using the Document Interface
Next Page

The .DBDUMP Command

Syntax: .DBDUMP DBVar= Fmt= [StartRow=] [EndRow=]

This command dumps the contents of a database which were previously read into a variable. It is designed for repeatedly outputting several rows of data, using the same format for each row.

The command is repeated for each row of the variable whose value is specified by DBVar in the (inclusive) range StartRow to EndRow. If StartRow is omitted, then output starts at row 0. If EndRow is omitted, then output ends at the last row of the database.

The Fmt parameter describes the format of the output line. It is a string that gets interpreted for each line that is echoed. The variable $row is created for the duration of the command, and automatically contains the index of the current row being dumped. If there is already a user-defined variable with this name, it is returned to its previous value once the .DBDUMP command has finished.

To include the $row variable in the Fmt, you must either precede the $ with a \, or enclose the entire string in single-quotes. This prevents the DI from interpreting the parameter prematurely.

The following commands read data from the file foo.txt and echo the first two columns of the first rows as part of a table:

<!--.dbarray array="dbtest.txt"-->
<table>
<!--.dbdump dbvar="$array" endrow=1 fmt='<tr>
<td>$row</td> <td>$array[$row][0]</td> <td>$array[$row][1]</td> </tr>'--> </table>

For more information on how to extract elements from arrays and hashes, refer to the section on database variable syntax.

----------------------------------------
Next Page

Home | Directories | Web Email | Calendar | Campus Map | Search | Help

About the College | Admission | Academics | Student Life | Athletics
Offices & Services | Giving | News & Events | Alumnae | Library & Technology

Copyright © 1999 Mount Holyoke College. This page created by the OIS Operations Group and maintained by Webmaster. Last modified on April 8, 1999.