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 
 
Concurrence with MySQL

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



Joined: 24 Aug 2010
Posts: 7

PostPosted: Tue Aug 24, 2010 15:37    Post subject: Concurrence with MySQL Reply with quote

Hello again..

First, sorry for my english because I'm French. I'm scripter on FastFrench (french server) and I'm recoding totally my module. So I come here to ask you a question about concurrency in MySQL.

The situation : I use the function SQLExecDirect(sQuery) and after, the script SQLFetch() and again after SQLGetData(1) in a event script.

When a Client is entering into the mod, all theses function fires but, what happens if two client enter into the mod simultaneously ?

I mean :

Player A enter into the mod, the event OnClientEnter fires and the script oncliententer_script is executed.

Now, precisely when the SQLExecDirect() function is done, the seconde player log in and fires OnClientEnter and executes oncliententer_script.
So SQLExecDirect() is executed twice, so Player A's datas must become the same as Players B's datas.

A Schema :

Code:

1. Player A Enter               
2. SQLExecDirect               2. Player B Enter
3. SQLFetch                    3. SQLExecDirect
4. SQLGetData                  4. SQLFetch


Problem...

How to solve this ? Can I make a Semaphore in NWNScript or NWNX takes care of that ?
Back to top
View user's profile Send private message
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Tue Aug 24, 2010 16:41    Post subject: Reply with quote

Two scripts will never execute simultaneously, and the nwnx_odbc calls are synchronous, so you don't need to worry about it at all. Player A's OnClientEnter will finish before Player B's begins.
_________________
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
View user's profile Send private message Visit poster's website
Ephasme



Joined: 24 Aug 2010
Posts: 7

PostPosted: Tue Aug 24, 2010 20:56    Post subject: Reply with quote

Thank you very much ! I prefer that. Smile
Back to top
View user's profile Send private message
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