Navigation:  Programming Cookbook > Database Connectivity > Preparing SQL for Later Execution >

Preparing Queries

Previous pageReturn to chapter overviewNext page

In addition to preparing SQL statements for later execution, you can also prepare SELECT queries. For example:

ps := c prepare: 'select * from Customers where CompanyName >= ?'.

ps paramCols: ((c columns: 'Customers') select: [:col | col name='CompanyName']).

 

Then execute later and retrieve the results with a #results message.

ps values: #('G').

ps exec.

ps results. "Inspect it"

 

and:

ps values: #('Rattlesnake').

ps exec.

ps results. "Inspect it"