Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting account logic

Status
Not open for further replies.

nemini

Programmer
Sep 22, 2008
21
US
In a member driven environment I offer to the members the opportunity to delete part of or their whole account
The process is quite involving
Deleting/updating/inserting in six tables
Opening and deleting from a video repository
Opening and deleting from an img gallery

As is it works fine

But I am very concerned by any potential glitches that will half way delete the account and leave me with a mess

So I am wondering if my new sight on the logic is fine or if you have a better way of dealing with it.

Before deleting, create a temp table and load data as those to be soon deleted
Copy img and video in a temp
If all systems go then del all temps
If not go back to what failed and reload, while sending detailed message to the site admin
 
Hi

If your database supports transactions, use them. ( See MySQL Transactional and Locking Statements for MySQL or Concurrency Control for PostgreSQL. )

Combined with your previously described file deletion trick would be :
Code:
begin transaction
delete from six tables
if delete files==success
  commit transaction
else
  rollback transaction

Feherke.
 
I simply love it, did not think about it, simplier!
Thanks
 
be a bit careful as only some database engines used by mysql support transactions (the last time i looked anyway). the chaps in mysql forum will be delighted to help, assuming you are using mysql, that is.
 
Yes you are correct, I use MySQL and will have to alter some tables from myISAM to InnoDB
I might post to MySQL but it will spread out the thread
for now the real simple last question becomes:
Is there any problem to foresee while operating a DB with a mixed table engine combo made of MyISAM & InnoDB?

 
i must admit that i have never done so. i have always used myISAM except where atomic transactions are necessary.
 
Thanks all, then I will post in MySQL but will report the results here in order to finish documenting that thread
 
There are no problems in mixing both emgines
however one should pay attention to the following
<<< // from manual
for best results, you should not mix different storage engines within a transaction with autocommit disabled.
>>>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top