The query in the following example returns all rows in the STAFF table of the SAMPLE database. The first block of code issues the SQL statement directly in the code. The second block retrieves the SQL statement from an access set. To look at the results of this query, follow these steps:
"Selects rows from a table" | querySpec result resultCollection connection | resultCollection := OrderedCollection new. connection := AbtDbmSystem activeDatabaseConnectionWithAlias: 'SAMPLE'. querySpec := (AbtQuerySpec new) statement: 'SELECT * FROM STAFF'. result := connection resultTableFromQuerySpec: querySpec. result do: [:eachRow | resultCollection add: (eachRow asString)]. ^resultCollection. "Selects rows from a table using an access set" | result resultCollection connection | resultCollection := OrderedCollection new. connection := AbtDbmSystem activeDatabaseConnectionWithAlias: 'SAMPLE'. result := connection resultTableFromQuerySpec: (AccessSetName getQuerySpecNamed: #SelectAll). result do: [:eachRow | resultCollection add: (eachRow asString)]. ^resultCollection.