(Resolved terminally) What is [...].........[...] the nwnx returned to me?

Edit: The story is I downloaded NWNX Core but missed the plugin NWNX ODBC. I installed ODBC plugin and it is currently working. Thank you for reading.

Why the string sIP in my script returned “…”?

Yeah, a thousand of dots (1024 dots).
Please check my script.

#include “aps_include”
string sSQL = “SELECT ip FROM login WHERE login=’” + GetPCPlayerName(oPC) + “’;”;
string sIP = “”;

if (SQLFetch() != SQL_SUCCESS)
    //it never gets here
    PrintString("[CHECKLOGON]: Could not execute the query.");
    sIP = SQLGetData(1);
PrintString("[CHECKLOGON]: " + sIP);

I am getting this code running: PrintString("[CHECKLOGON]: " + sIP);
And it appears this way: [CHECKLOGON]: …

What is … (1024 times)?

And I am curious: why SQLFetch() is sucess? What DOES MEAN SQLFetch() equal to success?

I am not sure if my database is properly connected. How do I check this?

on my module loads I call SQLInit() normally.
I did check this script and contains this:

void SQLInit()
int i;
object oMod = GetModule();

// Placeholder for ODBC persistence
string sMemory;

for (i = 0; i < 8; i++) // reserve 8*128 bytes
    sMemory += "................................................................................................................................";

SetLocalString(oMod, "NWNX!INIT", "1");
SetLocalString(oMod, "NWNX!ODBC!SPACER", sMemory);


I discovered that 8x128 is exactly 1024.

simplifying, nwnx works by transferring data from inside your module to outside it, so the data can be handled by external routines. once the data have been treated, the results [if any] are communicated back into your module by the same method. the method used in both cases is setting a local string on the module itself [you simply read it back again if a result is supplied]. these data have to be buffered ; that’s what the ‘sMemory’ string is for.

now, having said all that – don’t worry about it. :wink:
you’re already doing the right thing if you want to check the results of your function calls. to answer your question, SQL_SUCCESS is a macro define that you can check against the results of SQLFetch() to make sure your sql call provided you with data that you can later retrieve using SQLGetData(). but first you have to execute the command. in your code snippet above, you’re missing that crucial element, i.e.,


once you’ve executed your query [and btw you don’t need the closing “;”], you can get the result with SQLFetch() and SQLGetData().

one of the best ways to see if your database is connected [and if all of this data handwaving about is working as it should] is to check your nwnx log files. nwnx can log copious amounts of information, some of which can be very useful. for more info on this, see the nwnx documentation.

1 Like

You are correctly I did forget to execute SQLExecute function BUT it was there in my script I just deleted here in the thread.

Thank you for your time and for you answer I am happy to read and I got some information.

Nice to meet you I LIKED YOU you are a good person.