[Lazarus] WebData
Leonardo M. Ramé
l.rame at griensu.com
Fri Oct 15 14:40:23 CEST 2010
On 2010-10-15 14:24:48 +0200, Michael Van Canneyt wrote:
> >After removing the TSqlQuery and TSQLTransaction components from my app,
> >a new question came to my mind, in the case of complex inserts/updates
> >that involves more than one database table, is it possible to use
> >transactions?.
>
> Hm. Not if you use the TSQLDBWebDataProvider. To do that, you would
> have to use TSQLSuery and a regular TWebDataProvider, and hook into
> the Before/after post events of the TSQLQuery.
>
> But I'm certainly open for suggestions for improvements.
>
> Michael.
Well, It's not an issue at all, I could create a stored procedure in
charge of receiveing the params from the dataprovider, then adapt them to
their respective tables. It's not an issue because I usually work with
Firebird and PostgreSql, and they have stored procedures.
I ask this because I'm thinking of adding a new layer of abstraction by
letting the TFPWebProviderDataModule load a configuration from, say, an
XML file with the list of Providers and its Select, Insert, Update, and
Delete statements, like this:
<Module name="ClientesProvider">
<Provider name="all-customers">
<Select>select * from customers</Select>
</Provider>
<Provider name="one-customer">
<Select>
select * from customers where IdCustomer=:IdCustomer
</Select>
<Insert>
insert into customers(Name, Age)
values(:Name, :Age)
</Insert>
<Update>
update customers set Name=:Name, Age=:Age
where IdCustomer=:IdCustomer
</Update>
<Delete>
delete from customers where IdCustomer=:IdCustomer
</Delete>
</Provider>
</Module>
With this data, the cgi/fcgi app could dynamically create the
TPWebProviderDataModule and everything else.
What do you think about this?
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the Lazarus
mailing list