[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] Database transaction?


On Tue, 31 May 2005 11:32:23 -0500
Mike Heins <suppressed> wrote:

> Quoting T. Stoffels (suppressed):
> > 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

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.