View previous topic :: View next topic |
Author |
Message |
Kato
Joined: 05 Mar 2010 Posts: 47
|
Posted: Mon May 02, 2011 21:26 Post subject: MySQL returning only 1 row |
|
|
Greetings,
I'm currently coding a guild system for my NWN PW, storing all persistent data in a custom MySQL database. The guild infos are displayed to players via a dynamic dialog, wich sends many different queries, all working fine, except for this one:
string sSQL = "SELECT DISTINCT tag FROM players WHERE guild='" + IntToString(nGuild) + "'";
SQLExecDirect(sSQL);
while(SQLFetch() == SQL_SUCCESS)
{
AddStringElement(SQLGetData(1), PAGE2C, oPC);
}
The tag field is a VARCHAR64, holding the value returned by GetPCPlayerName(); both the odbc log and the dialog display a single row. So, I have raised the buffer from 8 * 128 to 128 * 128, trying each step on the way(16, 32 etc...). Still, only one row is displayed(!?)
Any help would be greatly appreciated, thanks in advance!!!!!!!! |
|
Back to top |
|
|
MaxRock
Joined: 24 Jan 2008 Posts: 196
|
Posted: Tue May 03, 2011 18:16 Post subject: |
|
|
Just for debugging, change AddStringEntry to WriteTimestampedLogEntry; so you can rule out the zdialog scripts.
Put the query into mysql directly (e.g.: mysql query browser) and see if that returns more.
Can you post the odbc log? |
|
Back to top |
|
|
Kato
Joined: 05 Mar 2010 Posts: 47
|
Posted: Tue May 03, 2011 20:21 Post subject: |
|
|
Okay. After testing the query in the query browser, it returns the correct answer, just like WriteTimestampedLogEntry, wich appends these lines to nwnx-odbc.txt:
o Got request: SELECT DISTINCT tag FROM players WHERE guild='1'
o Sent response (7 bytes): Rastin1
o Sent response (8 bytes): ZenBlade
o Sent response (7 bytes): Jearld1
o Sent response (8 bytes): Anaknaej
o Sent response (7 bytes): Rashtin
o Sent response (8 bytes): laskoski
o Sent response (14 bytes): Chaos Maverick
o Sent response (0 bytes):
Also, SendMessageToPC(oPC, SQLGetData(1)) returns the correct answer, wich leads me to think that my problem probably comes from my zdialog scripts. I'll be back with the solution when I find it, thank you for your help, MaxRock. |
|
Back to top |
|
|
Kato
Joined: 05 Mar 2010 Posts: 47
|
Posted: Tue May 03, 2011 21:03 Post subject: |
|
|
Okay, I have found it. There was another call to SQLFetch() on the call stack. Sorry, I feel dumb... |
|
Back to top |
|
|
|
|
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
|