Skip to content

sql Row

Sub-commandData (SQL)New in Reforged
sql row {n}
Sets
#SqlRes

Also searchable as: sql Row

sql row loads row n (from 1 to #SqlCnt) of the last sql query into % variables named after the columns. A number out of range leaves the variables alone and sets #SqlRes to row … out of range.

sql open :memory:
sql exec CREATE TABLE wanted(item TEXT, price INTEGER)
sql exec INSERT INTO wanted VALUES('bandage', 5), ('arrow', 2)
sql query SELECT item, price FROM wanted
for %i 1 #SqlCnt
{
sql row %i
display ok Buy %item for up to %price gold
}
halt

See Using SQL for how statements are written and how variables go in and out.

See also