SqlPrepareQueryCampaign(string, string)

From NWN Lexicon
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.

Sets up a query for the campaign database.

void SqlPrepareQueryCampaign(
    string sDatabase,
    string sQuery
);

Parameters

sDatabase
The name of a campaign database.
sQuery
SQL Query to prepare

Description

Sets up a query.

This will NOT run the query; only make it available for parameter binding.

To run the query, you need to call SqlStep(); even if you do not expect result data.

Note that when accessing campaign databases, you do not write access to the builtin tables needed for CampaignDB functionality.

N.B.: You can pass sqlqueries into DelayCommand; HOWEVER they will NOT survive a game save/load. Any commands on a restored sqlquery will fail. It is highly recommended to not use sqlqueries with DelayCommand or AssignCommand at all.

Remarks

This will prepare a SQL query for the campaign database specified. The campaign database is outside of a module, and a player character, meaning it can span modules and even characters. It also exists as a separate file that can be queried, or even edited, separately from the game itself.

While it isn't a very good use case, the sqlite DB created can be changed by other copies of the game or external tools with lock permissions on the filesystem (NFS is not supported).

To find out if a prepared query has completed successfully run SqlGetError.

Version

This function was added in 1.80.8193.14 of NWN:EE.

Example

See Also

functions:

SqlGetError SqlPrepareQueryObject