Previous Topic

Next Topic

Inhoudsopgave

Book Index

Prepare Procedure

Function Procedure Prepare

Description

Prepares a query for execution.

Remarks

When a query is run, you not only open the query result set, but also specific query metadata. This may concern data such as the number of columns and column names. These metadata are determined for the actual result set. This is called a query prepare, or preparing a query. Preparation of queries will normally take place automatically.

If a query is executed several times (for example, for several inserts or edits), it is useful for performance reasons to carry out this query preparation only once. You can realize this by specifying the Prepare manually before opening the query. If you specify the prepare procedure manually, the Unprepare procedure should also be specified manually. You must do this just before you close the query.

Example

Sub Main()

Dim Query

Dim SQL

SQL = "Select LangCode, Description From Language"

Set Query = Application.DataBase.CreateQuery( SQL )

' Prepare the query

Query.prepare

' Open the query

Query.Open

' Unprepare the query

Query.unprepare

' Close the query

Query.Close

End Sub