SqlBindObject(sqlquery, string, object)

From NWN Lexicon
Revision as of 23:38, 13 March 2021 by Jasperre (talk | contribs)
Jump to: navigation, search
Nwnee logo.jpg Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Bind an object to a named parameter of the given prepared query.

void SqlBindObject(
    sqlquery sqlQuery,
    string sParam,
    object oObject


An already prepared SQL query
Parameter referenced in sqlQuery to bind
Object to serialise and bind


Bind a object to a named parameter of the given prepared query.

Objects are serialized, NOT stored as a reference! This is identical to StoreCampaignObject and all caveats of that apply to this.

Currently supported object types: Creatures, Items, Placeables, Waypoints, Stores, Doors, Triggers

Presumably like CopyObject if oObject is a player, it will serialise a "NPC version" of them.


This allows much easier inputting of variables into a pre-prepared query, removing the need for a large amount of string parsing to simply update certain variables of a query.

You utilise this by defining the parameter to alter in the prepared query, and reference it as the sParam part.

See SqlBindString for how you can store an object reference using ObjectToString rather than the entire object itself.


This function was added in 1.80.8193.14 of NWN:EE.


    sqlquery v = SqlPrepareQueryObject(GetModule(), "insert into test (col) values (@myint);");
    object oNPC = GetObjectByTag("NPC");
    SqlBindObject(v, "@myint", oNPC);

See Also


SqlPrepareQueryCampaign SqlPrepareQueryObject SqlBindInt SqlBindFloat SqlBindString SqlBindVector