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 
 
On reloading a module/restarting after server crash/shutdown

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Gavinus



Joined: 31 Mar 2005
Posts: 3

PostPosted: Thu Mar 31, 2005 20:07    Post subject: On reloading a module/restarting after server crash/shutdown Reply with quote

Hi there,

i am pretty new at this, but I was able to get the ATS system working in my Module. It works perfectly.

However, of the server crashes or the module is shut down and restarted, the players tradeskills are all reset to '0'!!

Please can someone tellme if there is an easy way to sort this?

As said - the ATS works perfectly until the server is restarted in some way, then rather than looking into the existing database - it simply seems to create a new table.

Please help!!

Gavinus
Back to top
View user's profile Send private message
Primogenitor



Joined: 08 Jan 2005
Posts: 88

PostPosted: Thu Mar 31, 2005 20:12    Post subject: Reply with quote

What database are you using? Is it SQLite, the built-in one? If so, try adding this to the module load
Code:

#include "aps_include"
void SQLCommit()
{
    DelayCommand(300.0, SQLCommit());
    string SQL = "COMMIT";
    SQLExecDirect(SQL);
    SQL = "BEGIN IMMEDIATE";
    SQLExecDirect(SQL);
}

void main()
{
    DelayCommand(300.0, SQLCommit());
}


And the explanation:
SQLite uses transactions. This means that no harddisk access is done while a transaction is active, which significantly increases speed. However, if the server crashes during a transaction then since no harddisk access has been done, all the changes since the transaction started are lost.
What this function does is tell the server to end the current transaction, thus writing the data to the disk, and start a new one.
Back to top
View user's profile Send private message
Gavinus



Joined: 31 Mar 2005
Posts: 3

PostPosted: Thu Mar 31, 2005 20:17    Post subject: Thanx Reply with quote

I am using Mysql and i think the ODBC connections
Back to top
View user's profile Send private message
NoMercy



Joined: 03 Jan 2005
Posts: 123
Location: UK

PostPosted: Thu Mar 31, 2005 23:52    Post subject: Reply with quote

I'm not sure but I think ATS might fall back on local variables when the database isn't available, have you checked that it's actually writing data out to the database?

Also if your using MySQL, you may want to use the direct conenction method rather than going via ODBC, as ODBC does slow down the DB access (don't be scared off by the 'beta' label on the odbc2 module, it's rather stable, even the new features are pretty solid in it now).
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gavinus



Joined: 31 Mar 2005
Posts: 3

PostPosted: Thu Mar 31, 2005 23:54    Post subject: Thanx dude! Reply with quote

Hiya,

Yes the database functions all work correctly - except if the server goes down for whatever reason.

I need something to hook up so that existing players' characters info is uploaded from the database on login.

Have any ideas?

Kind regards,

Gavinus
Back to top
View user's profile Send private message
NoMercy



Joined: 03 Jan 2005
Posts: 123
Location: UK

PostPosted: Fri Apr 01, 2005 1:53    Post subject: Reply with quote

I'm not sure if it's the version of ATS that your using, but this one: http://nwvault.ign.com/Files/scripts/data/1074016469703.shtml worked on by Makzimia (a frequenter of these forums) includes NWNX support.. if it is the version your using, then I'm out of clues, if not looking at it might help you.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related 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