Topic: SQL-change needed

Hi there,

i posted this on your facebook as well after your site came back from the death (indeed what odds are it to crash both drives in RAID1).

I noticed how your query's run when adding a card trough the page of the card itself...
however, from time to time it ends up in causing a problem.

I made a screencapture to make it as clear as possible (see at http://www.youtube.com/watch?v=oxLKpstMW_s) I couldn't get it attached

First you see me watching my inventory with 28.085 cards in it.
As i go to another tab in my browser i look up the Island card as i want to add one of Innistrad.

You see how much different ones I have and then see me add the card.

Then i go back to the inventory and you see the card-amount dropping down as your programming first deletes all island i had prior to the change and then re-adding them...

The problem is that it takes time like this. If i change something else during that time I end up with cards which are gone!!!

I had this like 3 time yesterday and gave up and started thinking what happened... (luckely i had an export i could use to get the ones back i already added)

Fact are these:

Your current situation:

POST happens -> SQL-Query to delete all of the lines possible (user - cardname [i think]) -> SQL-Query to add them one by one with a check on the amount and not adding when amount is zero


Worse that can happen: losing a lot of cards when adding a second one right after you added the one prior to it. (in my case it were 800 cards, ending up deleting them all to re-add them using a backup)

My recommendation:

POST happens -> SQL-Query one by one with a SELECT to count a 0 or 1 response -> on 1 do an UPDATE on amount bigger then zero otherwise DELETE // on 0 do an INSERT to add the card you didn't had yet


Worse that can happen: nothing...



PS: keep up the good work smile

With kind regards
Youry

Re: SQL-change needed

Please fix this asap, i needed like a whole day just to add like 100 basic lands...
ended up adding series by series and making backups between each one of them which is crazy sad