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 
 
A size limit for strings ?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related
View previous topic :: View next topic  
Author Message
Daneel



Joined: 07 Jan 2005
Posts: 4
Location: Paris (France)

PostPosted: Fri Jan 07, 2005 19:50    Post subject: A size limit for strings ? Reply with quote

Hello!

While reading the FAQ, I noticed that:
Quote:
Q. How does the data get read back into the module? When does this occur?
A. As soon as NWNX detects that APS has issued a request, it sends that request to the database and encodes the result set into a string. This string is copied into the space that has been reserved for responses and can be parsed by the result set functions in APS.
Here are my questions:
How big is this reserved space? What will happen if the string is bigger than the reserved space? In the other direction, is there a size limit for strings I wish to store in the DB?

Thank you. I'm installing MySQL right now Wink
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Fri Jan 07, 2005 23:00    Post subject: Reply with quote

Hopefully I can answer this question for you Daneel. The MySQL table are comprised of rows and columns. When you set a table colum you have the ability to chose various types. The longest string I ever right personally to a column is player location, and I allow a Varchar of 255, even though, I think it probably only is 120, it doesn't matter Smile. I would defy anyone to show me a string longer than that they need to store for NWN... or am I missing something ? Smile
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Asmodae



Joined: 07 Jan 2005
Posts: 55

PostPosted: Fri Jan 07, 2005 23:06    Post subject: Reply with quote

Actually it sounds like he's asking how big allowable result sets can be, as returned from NWNX into APS. The code I'm looking at creates a 4k buffer in memory, so you should be safe as long as any queries you have return results that are under 4k in size total.

Keep an eye out though for truncated results, that'll tell you you've gone to far.
_________________
Nepenthe - An NWN2 Persistant World, coming to a planet near you. http://www.nepentheonline.com
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Makzimia De Graf



Joined: 31 Dec 2004
Posts: 55
Location: San Diego CA.

PostPosted: Fri Jan 07, 2005 23:15    Post subject: Reply with quote

We got truncation initially with locations, that's what brought this to mind for me Smile then I upped my varchar column. NWNX handle that size fine.
_________________
Makzimia De Graf

DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jan 07, 2005 23:39    Post subject: Reply with quote

The space aps_include reserves for rows is 8*128 = 1024 bytes by default. This is per row ! You can have as many rows as you want, but the data in each row may not exceed 1KByte.

If you need bigger rows, you can always reserve 16,32,... * 128 bytes (up to 64KByte). NWNX will adapt accordingly.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Daneel



Joined: 07 Jan 2005
Posts: 4
Location: Paris (France)

PostPosted: Sat Jan 08, 2005 19:10    Post subject: Reply with quote

Thank you, I have my response now. Smile

In fact, I asked this because I want to code a letter/parchment system. They will be writeable in-game (you just have an invisible creature listening to what the PC says, and storing this in a "letters" table of the DB). Using the letter item (right-clic/use) would make display it contents (SendMessageToPC()). A randomly generated Tag for the letter item (secured to be unique) will be used to SELECT the right row in the "letters" table.

So, it will not be rare that a letter written by a PC is longer 1 kb. I will have to split my letters' texts into <1kb length strings.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Database related 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