logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Cleaning up SQL Database

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Sun Aug 06, 2006 12:04    Post subject: Cleaning up SQL Database Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Sun Aug 06, 2006 13:28    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Wed Aug 09, 2006 13:05    Post subject: Reply with quote

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. Idea
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Sat Aug 12, 2006 15:51    Post subject: Reply with quote

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? Shocked
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Zunath



Joined: 06 Jul 2006
Posts: 183

PostPosted: Mon Aug 14, 2006 1:38    Post subject: Reply with quote

Oh, our project is definitely going to need this as well. Is there anyone out there that can help us two? Smile
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Aug 15, 2006 16:21    Post subject: Reply with quote

Here is the thread I am talking about:

http://www.nwnx.org/phpBB2/viewtopic.php?t=195

Does that help ?
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Tue Aug 15, 2006 20:26    Post subject: Reply with quote

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. Embarassed
An idiot-proof explanation is needed if this it to really help, sorry. Confused

I know how to script in nwn and how to use the aps_include, but that's about that.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Sun Aug 27, 2006 10:42    Post subject: Reply with quote

~ Bump ~ Embarassed
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Sun Aug 27, 2006 14:31    Post subject: Reply with quote

I have a scheduled task (Windows; cronjob for Linux freaks Razz) 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
View user's profile Send private message Visit poster's website
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Sun Aug 27, 2006 17:33    Post subject: Reply with quote

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..

Embarassed

But thank you very much for answering.
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Sun Aug 27, 2006 20:26    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Mon Aug 28, 2006 17:44    Post subject: Reply with quote

We use SQLite so I never installed MySQl. Sad
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Mon Aug 28, 2006 19:18    Post subject: Reply with quote

Oh. Then no clue. Smile

Something to that effect, but I have NO idea how to do it.
Back to top
View user's profile Send private message Visit poster's website
Rami_Ahmed



Joined: 07 Dec 2005
Posts: 37
Location: Denmark

PostPosted: Mon Aug 28, 2006 22:44    Post subject: Reply with quote

Zebranky wrote:
Oh. Then no clue. Smile

Something to that effect, but I have NO idea how to do it.


Argh what a shame. Embarassed

Thank you so much for answering and taking the time though, no one else really did that, other than Papillon. Crying or Very sad
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
odenien



Joined: 26 Sep 2005
Posts: 37

PostPosted: Tue Aug 29, 2006 13:56    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group