[ic] Database transaction?
Stefan Hornburg
racke at linuxia.de
Tue May 31 14:47:03 EDT 2005
On Tue, 31 May 2005 11:32:23 -0500
Mike Heins <mike at perusion.com> wrote:
> Quoting T. Stoffels (tstoffels at gmail.com):
> > I just was pointed towards a different, imho more simple approach:
> > I just do the begin..query..query..commit/rollback stuff myself =)
> > --
> > [tmp mysqlresult_begin][query sql=|begin work|][/query][/tmp]
> >
> > [tmp mysqlresult_del1][query sql=|delete ...|][/query][/tmp]
> >
> > [tmp mysqlresult_del2][query sql=|delete ...|][/query][/tmp]
> >
> >
> > [if type=explicit compare="
> > $Scratch->{mysqlresult_begin} == 1 &&
> > $Scratch->{mysqlresult_del1} == 1 &&
> > $Scratch->{mysqlresult_del2} == 1
> > "]
> > [query sql=|commit|][/query]
> > everything deleted
> >
> > [else]do rollbackhere [/else]
> > [/if]
>
> This won't work for a number of reasons.
>
> First, you need to have [query row-count=1 ....] or [query list=1 ....][sql-
> code][/query] to get a row count back.
>
> Second, unless you set AutoCommit to 0 in the database configuration,
> you won't be in transactions mode and your commit won't do anything.
>
> IMHO, using the [query ...] ITL tag for setting database values is not
> a good idea. It doesn't give you the kind of control you need. It is
> better to either use DBI or to use Interchange's supplied methods
> (set_slice, delete_record, etc.).
Another possibility is multiple table delete as supported by MySQL
4.x (see manual).
Bye
Racke
--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team
More information about the interchange-users
mailing list