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 
 
Resetplugin disconnects sqlite

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support
View previous topic :: View next topic  
Author Message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Wed May 08, 2013 19:22    Post subject: Resetplugin disconnects sqlite Reply with quote

Tested this out exhaustingly and found the cause. Whenever the server resets from the resetplugin it disconnects with sqlite... Is there a way to remedy this problem? If I manually turn off nwserver then it works fine so it's literally only that plugin.

EDIT= By disconnect I mean it deletes everything created in the database-journal instead of dumping it into the actual sqlite.db
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Wed May 08, 2013 20:06    Post subject: Reply with quote

not sure if this works for sqlite but try calling this on module load:

Code:
SetLocalString(GetModule(), "NWNX!ODBC!EXEC", "SET AUTOCOMMIT=1");

_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Wed May 08, 2013 20:25    Post subject: Reply with quote

Ok I'll try that and hopefully it works. I want to use SQL, but when you're only using it to store single instances of variables it appears sqlite is faster. I just need to make it permanently store it lol.
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Wed May 08, 2013 23:59    Post subject: Reply with quote

It didn't work. This is the statement returned:

NWNX ODBC2 plugin V.0.9.2.5
(c) 2005 by Ingmar Stieger (Papillon) and Jeroen Broekhuizen
visit us at http://www.nwnx.org

o Logfile maximum size limit is: 524288 bytes
o Log level: Everything will be logged.
o Using SQLite connection.
o Hooking SCO....hooked at 5d5830
o Hooking RCO....hooked at 5d5710
o Connect successful.
o Got request: SET AUTOCOMMIT=1
! SQL Error: near "SET": syntax error
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Thu May 09, 2013 1:31    Post subject: Reply with quote

I downloaded your system_data_2 plugin to see if the terminateprocess in it will allow my server to reset without breaking SQL connection, lol waiting for a natural reset to test it out.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Thu May 09, 2013 10:06    Post subject: Reply with quote

Try this version
http://data.virusman.ru/nwn/nwnx_reset-0.2-win32.rar
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Thu May 09, 2013 19:45    Post subject: Reply with quote

It didn't work when I used Terra's system_data_2 to close it down :/. The automatic(and only automatic) reset still causes the sqlite to not dump the database-journal to the database.

EDIT= Virusman I originally did use that plugin, but it caused the binds to be lost as well. Is there something I'm missing that will make sqlite actually dump the journal files to database without me manually turning off nwserver?
Back to top
View user's profile Send private message
eeriegeek



Joined: 07 Jan 2008
Posts: 59

PostPosted: Fri May 10, 2013 6:11    Post subject: Reply with quote

Last time I worked with the Linux sqlite db handler, it was explicitly beginning a transaction on initialization. This requires an explicit commit to avoid a rollback on shutdown. You could try issuing a COMMIT just before calling the reset plugin. Something like:
Code:

SetLocalString(GetModule(), "NWNX!ODBC!EXEC", "COMMIT");

should work. It would probably be good to call COMMIT followed by a new BEGIN periodically during server operation to avoid growing really large journal files or losing data on server crashes.
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Sat May 11, 2013 2:28    Post subject: Reply with quote

You sir are amazing! Thank you for the assistance. Issuing the commit right before server reset does infact work to dump the journal files into the database where they belong. You said I have to issue a BEGIN statement after issuing a commit statement. Does that mean if I issue a commit statement without issuing a BEGIN afterwards it won't write any more information?
Back to top
View user's profile Send private message
eeriegeek



Joined: 07 Jan 2008
Posts: 59

PostPosted: Sun May 12, 2013 3:11    Post subject: Reply with quote

Hey, glad it's working. Issuing a new BEGIN just opens a new transaction, it will have to be followed at some point with another COMMIT. The sqlite plugin presumably uses transactions this way for the side effect that sets of statements in a transaction run faster. If you close the current transaction with a COMMIT and continue to run SQL statements, sqlite conveniently goes into autocommit mode and wraps each statement with a transaction as needed, but this is somewhat slower.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows technical support 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