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 
 
Introducing NWNX Junior

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Development
View previous topic :: View next topic  
Author Message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Mon Jan 22, 2007 23:21    Post subject: Introducing NWNX Junior Reply with quote

NWNX Junior

The core NWNX4 functionality assumes that you have some familiarity with the roles of the Database Administrator and Database Programmer. In particular you have to be familiar with SQL syntax and also the techniques for encasing this SQL code into NWN Scripting strings. As has been expressed in the forums numerous times many of you do not have this technical expertise.

NWNX Junior is here to help. It has taken the essential parts of NWNX4 and packaged them. Once set up all you need to know are the NWN scripting commands that NWNX Junior provides. The rest is done for you.

I've provided Papillon with the source for this. I'm hoping it will be included into the base source stream as it has some new techniques for handling database interaction. These techniques push a lot of existing NWN Scripting into the plugin itself, providing for improved performance.

Performance aside, NWNX Junior also makes NWN scripting cleaner. The major 'improvement' is the provision of parameter binding. With this it is no longer necessary to build strings for your SQL.

Your SQL is written with tokens in place, these tokens are then bound to the value you provide. eg.
SELECT value FROM table WHERE key = :key then you bind your value to :key. You no longer have to re-build your SQL for different values, simply change the bind value.

To fully realise this you'll need the code examples. Hopefully some of this tach gets put back into the main NWNX plugins as it eliminates some of the issues that keep getting raised in the forums.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Mon Jan 22, 2007 23:44    Post subject: Reply with quote

Sounds very nice indeed. Hopefully it gets incoporated
_________________
Khalidine, a NWN2 persistent world

Looking for volunteers.
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Tue Jan 23, 2007 0:11    Post subject: Reply with quote

Yep, hopefully it gets into NWNX4 (beta).

I was surprized how little effort was involved to put binding (in particular) into place - total 10-15 lines of C++ code. A lot of libraries behind the code, but very little code to make it happen.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Grinning Fool



Joined: 12 Feb 2005
Posts: 264

PostPosted: Tue Jan 23, 2007 0:17    Post subject: Reply with quote

That is very nice; was it done with the underlying Db libraries?

And does this mean I can now store my queries in property files to be lodaed at runtime, and take it out of nwscript entirely?
_________________
Khalidine, a NWN2 persistent world

Looking for volunteers.
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Tue Jan 23, 2007 0:57    Post subject: Reply with quote

Grinning Fool wrote:
That is very nice; was it done with the underlying Db libraries?

And does this mean I can now store my queries in property files to be lodaed at runtime, and take it out of nwscript entirely?


Not with NWNX Junior, but with the techniques used, Yes.
If (when) this is ported for other database plugins, it's possible that NO SQL is scripted into NWN. You would need another flag/function to choose which external SQL you wanted to use. As to the DB libraries, NWNXJr uses SQLite3.3.10. Different databases may had different syntax/requirements for binding but once they are established you can push all you SQL out of NWNScript.

Download the plugin and have a look at the ERF it's SQL Free. In this case the SQL is embedded in the plugin, but there's no reason why it couldn't be loaded from an external source.

Cheers
Gryphyn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Development 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