A Script to Manually Build a Query

Description

This simple example constructs a query as a builder interface would likely do it. It adds tables and columns to a declared query.

dim q as SQL::query
dim c as SQL::query::Columnreference
dim option as N
SQLTestStatement = <<%SQL%
SELECT distinct c.Name as CustomerName, IH.Due_Date, II.Part_Number, P.Description
FROM Customer C, Invoice_Header IH, Invoice_Item II, Part p left outer join part_description pd on pd.name = p.name
%SQL%

Reset the query and parse a string.

q.Reset()
q.SQLStatement = SQLTestStatement
q.Parse()
q.execute(c)