Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Transaction Patterns » Delete2 deletes the wrong records... where's my error?
icon5.gif  Delete2 deletes the wrong records... where's my error? [message #1202] Fri, 28 December 2007 18:05 Go to previous message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
(first time poster, radicore newb on an existing system)

i am working on a link table transaction between tables A and B. the link table (call it X) has a_id, b_id, and a date field. X's primary key is (a_id, b_id).

there was already a working multi2 transaction set up that used X as the inner table and A as the outer, and i used that as a guide to create my own multi2 with X as the inner and B as the outer.

so i created my own multi2, add3, and popup screens, but used the existing delete2 (because it contains just the table_id and the 'require std.delete2').

the multi2 and add3 work fine... but the delete2 displays strange behavior. there are about 4700 existing records in X, and i have used my add3 to enter 2 more. 4702 records, let's say.

i when i select the 2 records i added and press the button for my delete2 script, i get a message in green that 2 records were deleted. the record count has decreased by 2... but my 2 records still appear in the multi2. i can do this many times, and it continues to successfully delete records -- the wrong records.

if i delete all the records in X and add my 2 records, it will be able to delete them.

i have logged the SQL for this, and it seems to be getting the primary key wrong on the delete. this is what i would have typed manually on the mysql command line:
delete from x where a_id=37 and b_id=105
delete from x where a_id=37 and b_id=205

this is what i see instead:
delete from x where a_id=20 and b_id=303
delete from x where a_id=21 and b_id=303

in other words, radicore is creating delete statements where b_id is staying constant and a_id is changing, while the reverse should be true... and the ids for both are completely wrong. as there is already existing data in this table, i'm having trouble figuring out whether the constant/changing IDs are caused by my code or just coincidence within the pre-existing records.

where would i start troubleshooting something like this?
 
Read Message icon5.gif
Read Message
Read Message icon9.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: POPUP transaction probelm
Next Topic: can't get _cm_popupReturn to execute
Goto Forum:
  


Current Time: Thu Apr 18 21:35:56 EDT 2024

Total time taken to generate the page: 0.01056 seconds