logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Losing fields from a NWNX/ODBC query

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Mithreas



Joined: 09 May 2008
Posts: 24

PostPosted: Fri Oct 03, 2008 22:38    Post subject: Losing fields from a NWNX/ODBC query Reply with quote

Hi folks,

Before I start digging into source code, has anyone seen problems like this?

Summary: I populate a row in a table using nwnx-odbc, then retrieve the same row. One (or more?) of the column values are simply blanked in the log of the request, and those column values are blank when retrieved in nwscript. However, the value is populated in the database.

I have only seen this occur when I write really large rows to a database, containing lots of text. It appears to be intermittent - I've not spotted a pattern yet but I've only noticed two occurrances, out of a database with tens of thousands of rows. It's consistent on a particular data set though - each time we make the same query we get the same results, so it's almost certainly something about the data (and no, I'm not trying to store unescaped single quotes!).

Example:

Code:
o Got request: INSERT INTO gsme_messages (id, timestamp, title, text1, text2, text3, text4, author, real_author, anonymous) VALUES ('AAXWC7I3YLHP4RC4', '1099608960', 'The exile of Sir Firi~ing Metiwyn, Elven paladin of Kelemvor', ' I have spoken with Sir Metiwyn at length concerning his exile from Bendir.  It is clear from his words that he labours under several key misunderstandings, and remains decidedly opposed to the actions taken by Guardsman Biad in the defense of Bendir~s law. ', ' Firstly, he states categorically that the use of petrification to restrain an individual is an ending of their life.  In my considered opinion as one with a reasonable understanding of the Arcane, petrification is more akin to suspending life than ending it, and I thus cannot agree with sir Metiwyn~s emotive charge of murder.', ' Secondly, he refuses to accept that, in the face of those refusing to admit the legitimacy of Bendir~s law, Bendir has a right and duty to act to uphold that legitimacy.  The history of Bendir is littered with cases where Bendir failed to stand up for itself and suffered greatly for it.  Guardsman Biad is to be congratulated for ensuring that this did not occur.', ' My firm recommendation would thus be that Sir Metiwyn remains exiled from Bendir, until such time as he makes a public apology both to Guardsman Biad and to the community of Bendir for his actions in interfering with the rightful execution of lawful authority.  In Yondalla~s name,', 'Aramentia Sendia', 'Aramentia Sendia', '0')

mysql> SELECT timestamp, title, text1, text2, text3, text4, author, real_author, anonymous FROM gsme_messages WHERE id='
AAXWC7I3YLHP4RC4' LIMIT 1;
+------------+--------------------------------------------------------------+-------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------+----------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------+---------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------+-------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-+------------------+------------------+-----------+
| timestamp  | title                                                        | text1

                                                                                                 | text2


                                                                    | text3


                                                                            | text4


 | author           | real_author      | anonymous |
+------------+--------------------------------------------------------------+-------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------+----------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------+---------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------+-------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-+------------------+------------------+-----------+
| 1099608960 | The exile of Sir Firi~ing Metiwyn, Elven paladin of Kelemvor |  I have spoken with Sir Metiwyn at length
concerning his exile from Bendir.  It is clear from his words that he labours under several key misunderstandings, and r
emains decidedly opposed to the actions taken by Guardsman Biad in the defense of Bendir~s law.  |  Firstly, he states c
ategorically that the use of petrification to restrain an individual is an ending of their life.  In my considered opini
on as one with a reasonable understanding of the Arcane, petrification is more akin to suspending life than ending it, a
nd I thus cannot agree with sir Metiwyn~s emotive charge of murder. |  Secondly, he refuses to accept that, in the face
of those refusing to admit the legitimacy of Bendir~s law, Bendir has a right and duty to act to uphold that legitimacy.
  The history of Bendir is littered with cases where Bendir failed to stand up for itself and suffered greatly for it.
Guardsman Biad is to be congratulated for ensuring that this did not occur. |  My firm recommendation would thus be that
 Sir Metiwyn remains exiled from Bendir, until such time as he makes a public apology both to Guardsman Biad and to the
community of Bendir for his actions in interfering with the rightful execution of lawful authority.  In Yondalla~s name,
 | Aramentia Sendia | Aramentia Sendia |         0 |
+------------+--------------------------------------------------------------+-------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------+----------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------+---------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------+-------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-+------------------+------------------+-----------+
1 row in set (0.00 sec)


o Got request: SELECT timestamp, title, text1, text2, text3, text4, author, real_author, anonymous FROM gsme_messages WHERE id='AAXWC7I3YLHP4RC4' LIMIT 1
o Sent response (979 bytes): 1099608960¬The exile of Sir Firi~ing Metiwyn, Elven paladin of Kelemvor¬ I have spoken with Sir Metiwyn at length concerning his exile from Bendir.  It is clear from his words that he labours under several key misunderstandings, and remains decidedly opposed to the actions taken by Guardsman Biad in the defense of Bendir~s law. ¬ Firstly, he states categorically that the use of petrification to restrain an individual is an ending of their life.  In my considered opinion as one with a reasonable understanding of the Arcane, petrification is more akin to suspending life than ending it, and I thus cannot agree with sir Metiwyn~s emotive charge of murder.¬¬ My firm recommendation would thus be that Sir Metiwyn remains exiled from Bendir, until such time as he makes a public apology both to Guardsman Biad and to the community of Bendir for his actions in interfering with the rightful execution of lawful authority.  In Yondalla~s name,¬Aramentia Sendia¬Aramentia Sendia¬0


Note that though the database reports the value of the 'text3' column, it's not present in the log when NWNX makes the same query.

System details:

NWN 1.69 running on Windows XP with chat, leto, odbc, vaultster and gigaschatten plugins (the last is a custom Arelith plugin that handles our server restarts for us). Database is MySQL Server version: 5.0.51a-community-nt MySQL Community Edition (GPL) running on the same Windows XP box.

Thanks,
-Mithreas
Back to top
View user's profile Send private message
addicted2rpg



Joined: 01 Aug 2008
Posts: 106

PostPosted: Mon Oct 06, 2008 22:11    Post subject: Reply with quote

Could we see the output of DESC gsme_messages; ?
Back to top
View user's profile Send private message
Mithreas



Joined: 09 May 2008
Posts: 24

PostPosted: Sat Oct 11, 2008 19:22    Post subject: Reply with quote

Code:
mysql> desc gsme_messages;
+-------------+--------------+------+-----+-------------------+-------+
| Field       | Type         | Null | Key | Default           | Extra |
+-------------+--------------+------+-----+-------------------+-------+
| id          | varchar(16)  | YES  | MUL | NULL              |       |
| timestamp   | int(12)      | YES  |     | NULL              |       |
| title       | varchar(64)  | YES  |     | NULL              |       |
| text1       | text         | YES  |     | NULL              |       |
| text2       | text         | YES  |     | NULL              |       |
| text3       | text         | YES  |     | NULL              |       |
| text4       | text         | YES  |     | NULL              |       |
| author      | varchar(255) | YES  |     | NULL              |       |
| real_author | varchar(255) | YES  |     | NULL              |       |
| anonymous   | tinyint(1)   | YES  |     | NULL              |       |
| modified    | timestamp    | YES  |     | CURRENT_TIMESTAMP |       |
+-------------+--------------+------+-----+-------------------+-------+
11 rows in set (0.00 sec)
Back to top
View user's profile Send private message
Disco



Joined: 06 Dec 2006
Posts: 152

PostPosted: Mon Oct 13, 2008 12:53    Post subject: Reply with quote

Did you try changing the entries themselves? My first guess would be that the field is too long for NWNX. Try chopping half of it away in the database and see if it reports afterwards?

Funny to see Bendir Dale passing by, btw. Very Happy
Back to top
View user's profile Send private message
Mithreas



Joined: 09 May 2008
Posts: 24

PostPosted: Mon Oct 13, 2008 20:44    Post subject: Reply with quote

Hm, the line that fails is 366 chars long - the longest other one in the message is 328 (and I think the NWN chat bar allows 408). I'll try digging around in the source code as I'll want to fix it if there's a limit there... very odd that NWNX would be able to -write- long strings but not -read- them....

Edit: having followed the code through it seems that the buffer we pass into NWNX (I'm using something derived from APS so it's the spacer) is 8 * 128 (1024)b long, and if any column would cause us to exceed this length, then we ditch it.

The lengths of each of the columns being returned, in order, are
10
60 (70)
259 (329)
328 (657)
366 (1023) <-- perhaps I miscounted or perhaps there's an overhead, but this is very close to exceeding 1024. If we discount this column...
282 (939)
16 (955)
16 (971)
1 (972)
...then the rest fit. So I'm going to make the spacer bigger. I want to allow about 2000 characters so I'm going to go up to 2048b.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Mon Oct 13, 2008 22:00    Post subject: Reply with quote

Yes, you're right, it's the spacer limit.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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