View previous topic :: View next topic |
Author |
Message |
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Sun Aug 06, 2006 12:04 Post subject: Cleaning up SQL Database |
|
|
Hey!
So we've been using NWNx2 for a while as a lot of you may know. We use NWNx2 to store a dozen things, I prefer NWNx2 over BioWare database. But. When people delete their character, we need 'something' to clean up the database. It's a in-human work to sit and delete everytime someone decides to make a new character, so is there anything, anything at all to check for inactivity for a month or so in the database and then deletes all datas with the character name? Or something like that? Shouldn't be impossible, should it? :/
Thanks for reading this.
Last edited by Rami_Ahmed on Sat Aug 12, 2006 15:51; edited 1 time in total |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Sun Aug 06, 2006 13:28 Post subject: |
|
|
The timestamp column in the pwdata table was made for exactly this reason. There should be a SQL command somewhere on this forum that deletes old data based on that column. _________________ Papillon |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Wed Aug 09, 2006 13:05 Post subject: |
|
|
Hi!
I've been searching for the post you mentioned, but can't seem to find it. Could anyone point me in the direction or something?
Furthermore I don't really understand anything of SQLCommands and the like, so an idiot-proof description of how to set something like what I want up, would be ... great. |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Sat Aug 12, 2006 15:51 Post subject: |
|
|
Argh I've been searching numerous web sites and forums for a solution. Can't find anything. Does anyone have time and patience to help? |
|
Back to top |
|
|
Zunath
Joined: 06 Jul 2006 Posts: 183
|
Posted: Mon Aug 14, 2006 1:38 Post subject: |
|
|
Oh, our project is definitely going to need this as well. Is there anyone out there that can help us two? |
|
Back to top |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Tue Aug 15, 2006 20:26 Post subject: |
|
|
Hi!
Thank you for the answer and the link. It doesn't really help me though, I can't see what to do with that script? As I said, I don't know SQL commands or scripting or what ever it's called.
An idiot-proof explanation is needed if this it to really help, sorry.
I know how to script in nwn and how to use the aps_include, but that's about that. |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Sun Aug 27, 2006 10:42 Post subject: |
|
|
~ Bump ~ |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Sun Aug 27, 2006 14:31 Post subject: |
|
|
I have a scheduled task (Windows; cronjob for Linux freaks ) that executes a couple SQL statements at 2 AM every day. For example:
delete from pwdata where expire!=0 and datediff(curdate(),last)>expire;
This will work for every table with an expire and last column. The others shouldn't need expiration. Just place a bunch of those lines in a file, changing the table name as you desire, and run it with mysql. |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Sun Aug 27, 2006 17:33 Post subject: |
|
|
Uhm... maybe I should just give up, I don't even know how to 'run MySQL'. My scripting abilites are only self-taught and only in NWScript..
But thank you very much for answering. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Sun Aug 27, 2006 20:26 Post subject: |
|
|
Assuming:
1. mysql.exe is in your path (otherwise, find it and put the full path here instead; it's wherever you installed MySQL under the 'bin' directory),
2. You connect to DB nwndbname with user nwnusername and password PASSWORD, and
3. You put the expire commands in a file called expire.sql,
You need to run this command:
mysql -u nwnusername -pPASSWORD nwndbname < expire.sql |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Mon Aug 28, 2006 17:44 Post subject: |
|
|
We use SQLite so I never installed MySQl. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Mon Aug 28, 2006 19:18 Post subject: |
|
|
Oh. Then no clue.
Something to that effect, but I have NO idea how to do it. |
|
Back to top |
|
|
Rami_Ahmed
Joined: 07 Dec 2005 Posts: 37 Location: Denmark
|
Posted: Mon Aug 28, 2006 22:44 Post subject: |
|
|
Zebranky wrote: | Oh. Then no clue.
Something to that effect, but I have NO idea how to do it. |
Argh what a shame.
Thank you so much for answering and taking the time though, no one else really did that, other than Papillon. |
|
Back to top |
|
|
odenien
Joined: 26 Sep 2005 Posts: 37
|
Posted: Tue Aug 29, 2006 13:56 Post subject: |
|
|
We do a similar delete task like Zebranky is talking about, but we use mySQL. You probably could use the delete character schemes that are used in-game; although it probably would cause some lag. |
|
Back to top |
|
|
|