View previous topic :: View next topic |
Author |
Message |
Daneel
Joined: 07 Jan 2005 Posts: 4 Location: Paris (France)
|
Posted: Fri Jan 07, 2005 19:50 Post subject: A size limit for strings ? |
|
|
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 |
|
Back to top |
|
|
Makzimia De Graf
Joined: 31 Dec 2004 Posts: 55 Location: San Diego CA.
|
Posted: Fri Jan 07, 2005 23:00 Post subject: |
|
|
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 . I would defy anyone to show me a string longer than that they need to store for NWN... or am I missing something ? _________________ Makzimia De Graf
DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums |
|
Back to top |
|
|
Asmodae
Joined: 07 Jan 2005 Posts: 55
|
Posted: Fri Jan 07, 2005 23:06 Post subject: |
|
|
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 |
|
|
Makzimia De Graf
Joined: 31 Dec 2004 Posts: 55 Location: San Diego CA.
|
Posted: Fri Jan 07, 2005 23:15 Post subject: |
|
|
We got truncation initially with locations, that's what brought this to mind for me 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 |
|
|
Papillon x-man
Joined: 28 Dec 2004 Posts: 1060 Location: Germany
|
Posted: Fri Jan 07, 2005 23:39 Post subject: |
|
|
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 |
|
|
Daneel
Joined: 07 Jan 2005 Posts: 4 Location: Paris (France)
|
Posted: Sat Jan 08, 2005 19:10 Post subject: |
|
|
Thank you, I have my response now.
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 |
|
|
|