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

2016-04-07 Thread Martin Schreiber
On Thursday 07 April 2016 16:20:16 Santiago A. wrote: > El 07/04/2016 a las 14:00, Luiz Americo Pereira Camara escribió: > > I enconter the following pattern frequently (simplified): > > > > SQL: > > Select * From Customers Where FieldX = 1 > > > > Later i need a similar query that uses a different

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

2016-04-07 Thread Marcos Douglas
On Thu, Apr 7, 2016 at 12:30 PM, Luiz Americo Pereira Camara wrote: > Thanks for all the responses > > The Marcos' one is particular interesting since goes in a direction a did > not think earlier Thanks. I do this for years. The major advantage, I think, is doesn't need to change the SQL in pie

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

2016-04-07 Thread Luiz Americo Pereira Camara
Thanks for all the responses The Marcos' one is particular interesting since goes in a direction a did not think earlier Luiz 2016-04-07 12:06 GMT-03:00 Graeme Geldenhuys : > On 2016-04-07 13:47, Michael Thompson wrote: > > This moves it up that list... > > I can give you many more reason to m

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

2016-04-07 Thread Graeme Geldenhuys
On 2016-04-07 13:47, Michael Thompson wrote: > This moves it up that list... I can give you many more reason to move it up even further. ;-) tiOPF is a treasure trove of goodies (for DB and non-DB projects). Regards, - Graeme - ___ fpc-pascal maillis

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

2016-04-07 Thread Santiago A.
El 07/04/2016 a las 14:00, Luiz Americo Pereira Camara escribió: > I enconter the following pattern frequently (simplified): > > SQL: > 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

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

2016-04-07 Thread Marcos Douglas
On Thu, Apr 7, 2016 at 9:00 AM, Luiz Americo Pereira Camara wrote: > > I enconter the following pattern frequently (simplified): > > SQL: > 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 F

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

2016-04-07 Thread Michael Thompson
On 7 April 2016 at 20:20, Graeme Geldenhuys wrote: > 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 p

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

2016-04-07 Thread Michael Thompson
On 7 April 2016 at 20:06, Luiz Americo Pereira Camara < luizameri...@gmail.com> wrote: > Any chance sharing the code or at least the syntax? (I realise I'm hijacking your conversation with Michael - apologies for that, but this interests me) My code to initialise the grid (which hides all _ID col

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

2016-04-07 Thread Michael Thompson
On 7 April 2016 at 20:00, Luiz Americo Pereira Camara < luizameri...@gmail.com> wrote: > Is there any code that given a SQL Template would generate the second filter when paramy is available and keep blank when not available? Nope, or at least I don't think so. I've spent a long time looking as w

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

2016-04-07 Thread Graeme Geldenhuys
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 dependencie

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

2016-04-07 Thread Michael Van Canneyt
On Thu, 7 Apr 2016, Luiz Americo Pereira Camara wrote: 2016-04-07 9:03 GMT-03:00 Michael Van Canneyt : On Thu, 7 Apr 2016, Luiz Americo Pereira Camara wrote: Is there any code that given a SQL Template would generate the second filter when paramy is available and keep blank when not ava

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

2016-04-07 Thread Luiz Americo Pereira Camara
2016-04-07 9:03 GMT-03:00 Michael Van Canneyt : > > > On Thu, 7 Apr 2016, Luiz Americo Pereira Camara wrote: > > >> Is there any code that given a SQL Template would generate the second >> filter when paramy is available and keep blank when not available? >> >> >> > I have not found such code. I r

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

2016-04-07 Thread Michael Van Canneyt
On Thu, 7 Apr 2016, Luiz Americo Pereira Camara wrote: I enconter the following pattern frequently (simplified): SQL: 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 the