SIMPLE_SQL_RESULT
Query result container holding all rows in memory. Supports iteration via across loops.
Memory vs Streaming
SIMPLE_SQL_RESULT loads all rows into memory. For large result sets, consider using SIMPLE_SQL_CURSOR for lazy iteration or query_stream for callback-based processing.
Access
rows: ARRAYED_LIST [SIMPLE_SQL_ROW]
All rows in the result set.
first: detachable SIMPLE_SQL_ROW
First row in results, or Void if empty.
column_names: ARRAYED_LIST [STRING_8]
Names of all columns in the result set.
Status
is_empty: BOOLEAN
True if no rows were returned.
count: INTEGER
Number of rows in the result set.
column_count: INTEGER
Number of columns in each row.
Iteration
new_cursor: ITERATION_CURSOR [SIMPLE_SQL_ROW]
Create cursor for
across iteration. Returns rows directly.Examples
Basic Iteration
local
result: SIMPLE_SQL_RESULT
do
result := db.query ("SELECT id, name FROM users")
across result as row loop
print (row.integer_value ("id").out + ": " + row.string_value ("name") + "%N")
end
end
Check for Results
result := db.select_from ("users").where ("email = ?", "alice@example.com").execute
if result.is_empty then
print ("User not found%N")
elseif attached result.first as user then
print ("Found: " + user.string_value ("name") + "%N")
end
Access Column Names
result := db.query ("SELECT * FROM users LIMIT 1")
print ("Columns: ")
across result.column_names as col loop
print (col + ", ")
end