[ Where“ = ] SEND (file, '/WHERE [ where-clause ]' )
The SQL Accelerator drivers automatically build SQL WHERE clauses when your Clarion code contains a SET followed by a NEXT or PREVIOUS. You can customize the driver generated WHERE clause by using the WHERE driver string. You can also set the WHERE driver string at runtime with the use of PROP:WHERE. PROP:WHERE is a write-only property.
The SEND must be executed after the SET statement and before the NEXT or PREVIOUS statement.
The SET statement clears any WHERE clause set by the SEND statement.
Because the SQL driver's generated SELECT statement is not compiled until the NEXT or PREVIOUS statement, the SEND function posts no error code and returns no result. For example:
Orders FILE,PRE(Ord),DRIVER('ODBC'),NAME('Ord')
NameDate KEY(+Ord:NameId,-Ord:Date)
Record RECORD
Name STRING(12),NAME('NameId')
Date DATE,NAME('OrderDate')
Type STRING(1),NAME('OrderType')
Details STRING(20),NAME('OrderDetails')
END
END
CODE
Ord:Name = 'SMITH'
SET(Ord:NameDate,Ord:NameDate)
SEND(Orders, '/WHERE OrderType = “M”')
LOOP
NEXT(Orders)
!…some processing
END
This generates a SELECT statement similar to:
SELECT NameId,OrderDate,OrderType,OrderDetails FROM Orders
WHERE (NameID >= 'SMITH') AND (OrderType = 'M')