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 
 
SQLServer plugin

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



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sat Aug 09, 2008 5:03    Post subject: SQLServer plugin Reply with quote

SQLServer plugin

Well it's here... a SQLServer plugin for NWNX^2

There has been some major rework of the back-end hence the separate plugin, and not an extra option for the existing ODBC plugin.

I think the major 'usability' improvement, that you'll all love is the removal of all the SQL syntax string manipulation. It's still here, but you have an alternative where it's not required.

Introducing Parameters. Add a parameter indicator ('?') to your SQL Statement and this will be replaced by the value of a SQLBind...() function.

SQLPrepare("{call [stored_proc] (?)}");
// or SQLPrepare("select value from table where key=?");
SQLBindString("MyKey");

Note the new function SQLPrepare(), allows us to SQLBind...() variables, in sequence, before we SQLExecute(). If you are using parameters you must SQLPrepare() the SQL command first. Your SQL will be easier to write AND much easier to read. Wink

Technically we've added 'usability' to Objects. Objects and other data types can now be returned in the same result set. No need for a separate query to get the Object data.

int i = SQLGetInt(1);
object o = SQLGetObject(2);
string s = SQLGetString(3);

will all work from the same result-set (*columns must be accessed in sequence)

NB: A special exception exists for SQLBindObject(). You can only bind one object per SQL statement and it MUST be the last parameter. Hint: adding Object data is best done via a stored procedure.

With the improvements to Object fetching, I no longer needed this - but I left it in, MARS - Multiple ACTIVE result sets. You can now have up to 4 active result sets. A new command SQLContext() enables you to switch between each 'context' to use the results of one as in 'input' for another, without destroying the original.

Getting into trouble? Full ODBC diagnostics are added into the log file, to assist with those queries that 'break' on you Wink

You get all this and more...
(but only with SQLServer 2005 or better - defaulting to the EXPRESS editions *the free ones)
at the give-away price of - Oh yeah I'm giving it away!

Cheers
Gryphyn

PS. Compiled on VistaUltimate SP1 using VisualStudio2008.
I'll release the source once NWNX^2 goes semi-final for NWN1.69 Cool
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 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