mysql help....???

hi, i need some help with mysql - particular with 'transactions' and innodb tables...

so the general rule about inserting new rows into innodb table X. is that the contnet of each row must be unique and distinct (so no duplicate entries)

so the scenario is this: user A starts a transaction and commits an insert into the table X (which is an innodb table w/ repeatable reads isolation). - this entry inserted is unique and there were no duplicate entries found before inserting..

user B performs a search on table X. searches for duplicates before inserting.. same situation as A.

now. what if A was inserting something - but has not commited it's transaction.. and B starts searching and tries to insert a row (that has the same info as A's uncommited insert).

if A were to commit its insert, B will create a duplicated row as A's entry.. so my solution is that i want to lock table X preventing B from reading table X. and yes i need to use transactions because i may need to perform roll backs etc. and i can't use the typical "LOCK TABLE X" command because it clashes w/ transactions making it auto commit etc.

so any knowledgeable mysql people out there that can help me out. thanks a 1000 in adv.

aberry@uoguelph.ca's picture

I'm not sure what your

I'm not sure what your question is exactly, but why won't transactions do the trick? Using LOCK TABLE seems like it would just amke things more complicated.

--
Andrew

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.