Selecting a row from a table
The examples for selecting a row from a table show two basic techniques for issuing a SELECT statement in Smalltalk:
You can include the SELECT statement directly in your code.
You can invoke a query specification that has been defined in a database access set.
This second technique is available in the visual parts-based VA Smalltalk only. VAST Base does not use access sets to store query specifications.
Each example does the following:
1. Creates an ordered collection to store the result table in
2. Returns a connection for the database manager
3. Opens the database against which the query is to be issued
4. Defines or selects the query to be issued
5. Issues the query
6. Adds each row in the result table to the ordered collection
7. Returns the ordered collection containing the result table rows
You can use these examples as a basis for creating your own queries and modify them as needed. These examples issue the following SELECT statements:
Select every row from the STAFF table in the SAMPLE database
Join the ORG and STAFF tables
Select every row in the STAFF and group them by job type
To use the examples that retrieve a query specification from an access set, create an access set and add the query specifications to it. Then, in the sample code, replace the access set and query specification names given with the names of your own access sets and query specifications.
Last modified date: 02/27/2021