Difference between revisions of "SqlGetInt"

From NWN Lexicon
Jump to: navigation, search
(corrected function name in code block)
m
Line 2: Line 2:
 
Retrieve a column cast as an integer of the currently stepped row.
 
Retrieve a column cast as an integer of the currently stepped row.
 
<nwscript>
 
<nwscript>
void SqlGetInt(
+
int SqlGetInt(
 
     sqlquery sqlQuery,
 
     sqlquery sqlQuery,
 
     int nIndex
 
     int nIndex

Revision as of 21:58, 18 February 2021

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.

Retrieve a column cast as an integer of the currently stepped row.

int SqlGetInt(
    sqlquery sqlQuery,
    int nIndex
);

Parameters

sqlQuery
An already prepared SQL query
nIndex
Index of the integer to retrieve

Description

Retrieve a column cast as an integer of the currently stepped row.

You can call this after SqlStep() returned TRUE.

In case of error, 0 will be returned.

In traditional fashion, nIndex starts at 0.

Remarks

Use this to retrieve data from a select SQL query.

Version

This function was added in 1.80.8193.14 of NWN:EE.

Example

    // "Widget" is cast as an integer
    sqlquery n = SqlPrepareQueryObject(GetFirstPC(), "select widget from widgets;");
    while (SqlStep(n))
    {
        SendMessageToPC(GetFirstPC(), "Found widget integer: " + IntToString(SqlGetInt(n, 0)));
    }

See Also

functions:

SqlPrepareQueryCampaign SqlPrepareQueryObject SqlGetFloat SqlGetString SqlGetVector SqlGetObject