[fpc-pascal] Create dynamic SQL according to available params

Luiz Americo Pereira Camara luizamericop at gmail.com
Thu Apr 7 14:00:21 CEST 2016

I enconter the following pattern frequently (simplified):

Select * From Customers Where FieldX = 1

Later i need a similar query that uses a different filter like

Select * From Customers Where FieldX = 1 and FieldY = :paramy

Is there any code that given a SQL Template would generate the second
filter when paramy is available and keep blank when not available?

Select * From Customers Where FieldX = 1 ${paramtemplate paramy}

The param not necessarily have to be in TParams, in my case the param is
both in a JSON object and in TParams

If there's not in pascal, someone knows such templating in another
languages? The hard part is getting a flexible and functional syntax

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160407/888172ea/attachment.html>

More information about the fpc-pascal mailing list