View previous topic :: View next topic |
Author |
Message |
Palamor
Joined: 08 May 2010 Posts: 8
|
Posted: Wed Mar 30, 2011 4:54 Post subject: Is anyone successfully using sqlite with NWNX4? |
|
|
I have used NWNX4 for over 1 year now and I am just getting around to adding a database. I am having problems, and based on other posts here, it appears NWNX4/sqlite is broke? Is that true?
In my case, I did get one database write to work, but none after. According to xp_sqlite.txt there are reads and writes going on, but my reads in game are getting nothing from the database.
I am a software guy, but not a database guy. Any help is appreciated. |
|
Back to top |
|
|
Zebranky
Joined: 04 Jun 2006 Posts: 415
|
Posted: Thu Mar 31, 2011 0:59 Post subject: |
|
|
Are you using the Get/SetPersistent* functions in the nwnx_sql include? If not, you probably should be, as those eliminate the need to write SQL. To use them, you need to create the pwdata table. To do so, you can run this query in the sqlite.db file with an admin tool:
Code: | CREATE TABLE pwdata (player varchar(64) NOT NULL default '~', tag varchar(64) NOT NULL default '~', name varchar(64) NOT NULL default '~', val text, expire int(11) default NULL, last timestamp NOT NULL default current_timestamp, PRIMARY KEY (player,tag,name)) |
(Disclaimer: this is the NWNX2 table structure; I could be a bit off.) _________________ Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/
<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.
<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for? |
|
Back to top |
|
|
Palamor
Joined: 08 May 2010 Posts: 8
|
Posted: Thu Mar 31, 2011 1:19 Post subject: |
|
|
Thanks for the reply.
Yes, I am including nwnx_sql and using the get/write persistent functions. The pdwata table was created automatically, as was the pwobjdata table. I use SQLite Administrator by Orbmu2k to peek into the tables.
Here is one of my scripts
Code: | #include "nwnx_sql"
void main()
{
object oPC = GetPCSpeaker();
SetPersistentInt(oPC, "faction", 2);
SetLocalInt(oPC, "faction", 2);
} |
Consequently, last night I had a 2nd write to the database succeed and I don't know why. I don't think I did anything different. |
|
Back to top |
|
|
Palamor
Joined: 08 May 2010 Posts: 8
|
Posted: Sat Apr 02, 2011 20:55 Post subject: |
|
|
OK, I may have solved the problem. More extensive testing is need to be sure. Anyway, it turns out my problem was the data was not being transferred to the database from the sqlite journal on a server reset - at least not consistently. I doubled the time allowed for the server to do a graceful shutdown (in NWNX.ini) from 5 to 10 seconds (I was getting the warning that the server did not shut down gracefully). All seems to be working well now. |
|
Back to top |
|
|
Palamor
Joined: 08 May 2010 Posts: 8
|
Posted: Mon Jun 06, 2011 6:06 Post subject: |
|
|
OK, I thought i had this solved. Lately I have been getting the shutdown failures (WARNING: Failed to gracefully shutdown the server process.) whenever there was a lot of activity on the database. The result is I end up with a "sqlite.db-journal" file leftover. This file apparently contains all the activity since the server started, and hence is LOST (it is not folded into the database). Argh.
Is there anyway around this? It would be nice if that could be folded into the database when the server starts. If there is a server crash (i.e. power failure) I have the same problem. Any help would be appreciated! |
|
Back to top |
|
|
|
|
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
|