Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Темы без сохранившегося раздела (https://postpacific.mmorpg-game.online/forumdisplay.php?f=10001)
-   -   Need help with sql cleanup script (https://postpacific.mmorpg-game.online/showthread.php?t=1891)

LDragonL 22.09.2005 20:59

Need help with sql cleanup script
 
Hi,
I'm trying to make a cleanup script to delete accoutns from db that aren't used for like a month.
I tried much out myself (some examples below)
Can someone teach me how to use the correct commands.
Tried to look for explanations on google but i didn't find any understandable explanations.
Would be nice if someone can advice me on this one.

Greetz


DELETE FROM user_account WHERE last_logout < 20-8-2005 8:00:00
DELETE FROM user_account WHERE last_logout < 208200580000
DELETE FROM user_account where last_login = NULL

bob1122 22.09.2005 22:00

You basically have it, except data format is incorrect, try

Code:

DELETE FROM user_account WHERE last_logout < 20/08/2005
As for the entries with null, thats what i used to do, but the script was a little tricky you dont use < / = / > / blah blah you use IS

Code:

DELETE FROM user_account WHERE last_ip IS NULL
Hope Thats what you need, But i think you might want to wipe more than just the account, maybe user_auth, user_info. but its up to you.

P.S. sorry to pull the chain but, could you please pm me LDragon (Good thing :P)

bwgreen 22.09.2005 22:28

don't forget to make note of the account numbers so you can delete the characters to go with it :o the accounts take up very little.. the characters take up the most. especially the user_item

LDragonL 24.09.2005 11:45

Hi i want to thank you both for the nice reaction. :wink:
Now i only need to find out how to convert the time and date together in the script because the time and dae are like this in the db:
"10-9-2005 17:28:4"
Now i tried only the date but there are no rows affected when i do it like that so i must have the time too but i don't know how to describe the : symbol and in he db there seems to be a space between the date and time wich i can't define too.

Greetz LdragonL

BiGBoY 24.09.2005 15:45

Before u delete any data from db like "DELETE FROM user_account WHERE last_ip IS NULL" think again.
there r also data refering to that account in other tables like ssn, user_auth, etc...
I suggest u to do the script which will first check for crossreferences and than delete them all at once if u dont want to have buggy db.

bob1122 24.09.2005 15:47

Quote:

Originally Posted by LDragonL
Hi i want to thank you both for the nice reaction. :wink:
Now i only need to find out how to convert the time and date together in the script because the time and dae are like this in the db:
"10-9-2005 17:28:4"
Now i tried only the date but there are no rows affected when i do it like that so i must have the time too but i don't know how to describe the : symbol and in he db there seems to be a space between the date and time wich i can't define too.

Greetz LdragonL

Umm well it might not of worked because i set the delete script to delete acconuts older than 4 days :|... What date do you want ?

LDragonL 25.09.2005 09:18

No the script doesn't work because in the db there is date with time. When we fill in only the date the script doesn't find any rows matching the script.

i just need to know wich symbol must be replaced in the script for this ":"

like 12/4/2005 10:30:00 but the space between it is causing an error too in sql query manager :S

iamrend 25.09.2005 15:00

Re: Need help with sql cleanup script
 
Quote:

Originally Posted by LDragonL
DELETE FROM user_account WHERE last_logout < 20-8-2005 8:00:00
DELETE FROM user_account WHERE last_logout < 208200580000
DELETE FROM user_account where last_login = NULL

Do this is similar to do nothing. you must delete characters too and others fields like user_acount etc...

LDragonL 25.09.2005 16:59

Mm yes, it's not as easy as i thought.
But i keep working on it when i learn those darn sql db scripts.


All times are GMT. The time now is 21:45.