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 filter like
> >
> > Select * From Customers Where FieldX = 1 and FieldY = :paramy
>
> I remember a component of RxLib named TRxQuery. It had a published
> property "macros" of type TParams, so you could write this sql
>
> Select * From Customers Where FieldX = 1 and (%extrafilter).

In MSEgui SQL properties are of type TSQLStringList. TSQLStringList has a 
property "Macros" which is an array of TSQLMacroItem. TSQLMacroItem.Value 
inherits from TSQLStringList, so it is possible to build a macro tree which 
items can be accessed by a name path (TMacroProperty.ItemByNames()).

"
select ${fields} from ${table} where ${filter}
"
in example
http://mseide-msegui.sourceforge.net/pics/sqlmacros.png

expands to
"
select FIELD1 from TABLE1 where FIELD1 = 'abc'
"

Martin
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to