cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luis Gois <lg...@despodata.pt>
Subject ESQL and 'lock'ing tables for exclusive access
Date Wed, 23 May 2001 17:40:26 GMT

Hello!

I need to have exclusive (read/wite) access to a table for selecting a
MAX() value of a column, then I must insert a new row with value MAX()+1
in the column from where the MAX() was obtained. How can I use locks for
this?

	I tried 
		SET LOCK MODE TO WAIT
		LOCK TABLE table IN EXCLUSIVE MODE

	and then 
		SELECT MAX(column_name) FROM table

	and finally
		INSERT INTO table (column_name) VALUES (<xsp:expr>max+1</xsp:expr>)

	All of this using ESQL in a way that can be found at the cocoon samples
:

	<esql:connection> (...)
		<esql:results>
			<esql:connection> (...) 
				<esql:results>
					<esql:connection> (...)
	
	This looks really ugly for me (but it seemed logical for the guy who
did it ... and I understand why he did it this way ... I could also make
a logicsheet for a simpler use of this ESQL structure, as I did for a
pageable index generation of results), and also doesn't work. Is there a
more simple way to do it. Couldn't I just modify this to a single or
prepared query to get advantage of SQL atomic operation for each query?
(I'm using Informix DBMS, though I also use MySQL and I know that  a
SELECT 'inside' another SELECT isn't suported - at least in the MySQL
version I have installed)


I really apreciate any hint you may give me!
Thanks in advance!
-- 
Luis A. Gois
---
Projecto WAP -- DESPODATA/INESC --
http://theclints.inesc.pt/~jts/wap.html

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message