Re: Removing Data Duplicacy

2012-02-23 Thread Johan De Meersman
- Original Message - > From: "Adarsh Sharma" > Thanks Johan, but i mentioned before that adding auto increment > column doesn't solve the issue & it causes errors in the multi > threaded application. If it causes errors, you have other problems than this. > Multiple clients calls this

Re: Removing Data Duplicacy

2012-02-22 Thread Adarsh Sharma
Thanks Johan, but i mentioned before that adding auto increment column doesn't solve the issue & it causes errors in the multi threaded application. Multiple clients calls this insert procedure simultaneously, so it fails the transactions if two or more clients reads the same ID value. I need t

Re: Removing Data Duplicacy

2012-02-22 Thread Johan De Meersman
- Original Message - > From: "Johnny Withers" > > I'm not sure, It seems to me the proper way to do would be to insert > into table1, get the insert ID, then insert into table2 using that ID, > this is pretty standard stuff. > > Not sure why, in this case, he cannot do that. last_insert

Re: Removing Data Duplicacy

2012-02-22 Thread Johnny Withers
I'm not sure, It seems to me the proper way to do would be to insert into table1, get the insert ID, then insert into table2 using that ID, this is pretty standard stuff. Not sure why, in this case, he cannot do that. -JW On Wed, Feb 22, 2012 at 8:54 AM, Rhino wrote: > I miised the first mess

Re: Removing Data Duplicacy

2012-02-22 Thread Johnny Withers
You can also handle this with transactions: CREATE TABLE `seq` ( `seq_num` int(10) unsigned NOT NULL DEFAULT '1000' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 #Initialize sequence numbers INSERT INTO seq(seq_num) VALUES(1000); #Get next sequence number START TRANSACTION; UPDATE seq SET seq_num=L

Re: Removing Data Duplicacy

2012-02-22 Thread Arthur Fuller
I agree with the testicular remedy, but in the case of the iron codpiece, I can think of another approach which may work for you. It still uses Select, but reads a one-row table, so it shouldn't hurt performance much. The table serves no other purpose than storing the next available PK; call the ta

Re: Removing Data Duplicacy

2012-02-22 Thread Johan De Meersman
- Original Message - > From: "Adarsh Sharma" > > Today I noticed some duplicacy in my c_id column which is not Yes, that's what you get if you don't use auto_increments. > I need multiple client select cid from 2 tables & insert data with > adding 1 to previous C_id in isolated manner.