Page 1 of 1

mysql psuedo delete

Posted: Wed Apr 23, 2008 11:58 pm
by s.dot
Is it possible to run a delete query without actually deleting the rows? Like just have MySQL tell me which rows were to be deleted if I ran it.

Of course I can run a select with the same where clause to see which rows will be deleted, but I want to ensure the delete query matches.

Re: mysql psuedo delete

Posted: Thu Apr 24, 2008 1:29 am
by John Cartwright
You could write your own transaction script that temporarily stores the results in memory, delete the results, make sure they match, if not restore the results from memory.

:crazy:

Re: mysql psuedo delete

Posted: Thu Apr 24, 2008 1:48 am
by Kieran Huggins
just do a "SELECT id FROM" instead of a "DELETE FROM"

optionally, you could use a transaction and roll it back, though I'm not sure that would tell you WHICH rows are deleted.

Re: mysql psuedo delete

Posted: Thu Apr 24, 2008 11:21 am
by aceconcepts
Can't remember exactly how I used it but I have used "ON DELETE" in the past - thought it might be worth looking into.

Forgive me if it's got nothing to do with it :D

Re: mysql psuedo delete

Posted: Thu Apr 24, 2008 2:13 pm
by s.dot
Jcart wrote:You could write your own transaction script that temporarily stores the results in memory, delete the results, make sure they match, if not restore the results from memory.

:crazy:
LOL thanks for the crazy emoticon. That was funny LOL
It does seem a bit crazy actually.

But I am dealing with a large (about 1.5M rows) table, and that kinda makes me feel :crazy: