[fpc-pascal] Create dynamic SQL according to available params
mailinglists at geldenhuys.co.uk
Thu Apr 7 14:20:08 CEST 2016
On 2016-04-07 13:00, Luiz Americo Pereira Camara wrote:
> If there's not in pascal, someone knows such templating in another
> languages? The hard part is getting a flexible and functional syntax
I have written such code for the tiOPF project, but it should be quick
to detach any tiOPF dependencies. The code is well unit tested too (see
the tiCriteria_TST.pas unit). The unit test code is also good for usage
It can't handle all complex cases, but is fairly good. It also has an
option to inject any SQL as-is, in case you need a complex WHERE clause.
In summary, you use the TtiCriteria class to add your desired criteria,
then call tiCriteriaAsSQL(...) which will generate the SQL WHERE clause
string for you.
tiOPF is available on SourceForge or Github:
tiCriteria.pas lives in the Core/ directory.
- Graeme -
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal