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 
 
SQL ODBC Queries - Buffer limit?

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



Joined: 17 Aug 2010
Posts: 41

PostPosted: Sat Aug 11, 2012 7:57    Post subject: SQL ODBC Queries - Buffer limit? Reply with quote

What is the buffer limit for entering and retrieving data from an SQL database? Could that be what I'm hitting?

I have some code that successfully puts data into the data base, in this case:
Code:
test|10,0,0,100,0|10,0,1,144,0|10,0,2,144,0|10,0,3,144,0|10,1,0,102,0|
10,1,1,417,0|10,1,2,321,0|10,1,3,456,0|10,1,4,50,0|10,1,5,66,0|10,1,6,10,0|10,1,7,86,0|10,2,0,192,0|
10,2,1,542,0|10,2,2,192,0|10,2,3,569,0|10,2,4,569,0|10,2,5,542,0|10,2,6,2216,0|10,2,7,2216,0|
10,3,0,58,0|10,3,1,58,0|10,3,2,171,0|10,3,3,58,0|10,3,4,58,0|10,3,5,58,0|10,3,6,58,0|10,3,7,58,0|
10,4,0,52,0|10,4,1,52,0|10,4,2,375,0|10,4,3,375,0|10,4,4,52,0|10,4,5,119,0|10,4,6,47,0|10,4,7,52,0|
10,5,0,369,0|10,5,1,524,0|10,5,2,440,0|10,5,3,440,0|10,5,4,440,0|10,5,5,440,0|10,5,6,440,0|
10,5,7,440,0|10,6,0,375,1|10,6,1,375,1|10,6,2,121,0|10,6,3,376,0|10,6,4,184,0|10,6,5,2051,0|
10,6,6,2051,0|10,6,7,2051,0|10,6,8,2051,0|10,7,0,56,0|10,7,1,56,0|10,7,2,56,0|10,7,3,56,0|
10,7,4,56,0|10,7,5,56,0|10,7,6,56,0|10,7,7,56,0|10,7,8,56,0|10,7,9,160,0|10,7,10,160,0|
10,7,11,515,0|10,7,12,515,0|10,8,0,2307,0|10,8,1,2307,0|10,8,2,427,0|10,8,3,427,0|10,8,4,427,0|
10,8,5,448,1|10,8,6,448,1|10,8,7,448,1|10,8,8,448,1|10,8,9,443,0|10,8,10,443,0|10,8,11,117,0|
10,8,12,134,0|10,9,0,533,0|10,9,4,190,0|10,9,5,190,0|10,9,6,190,0|10,9,7,193,0|10,9,8,193,0|
10,9,9,193,0|10,9,10,185,0|10,9,11,122,0|10,9,12,73,0
and it's in the database, but attempting to retrieve it is unsuccessful.

It very well could be the code, so I'll post that too, though I hope it it isn't.

Code:
else if (GetStringLeft(sCmd, 5) == "save ") {
                    ///////////// IN PROGRESS ////////////////
                    int nBook = FindSubString("0 1 2 3 4 5 6 7 8 9 ", GetSubString(sCmd, 5, 2)), nPos;

                    string sName = GetStringRight(sCmd, GetStringLength(sCmd) - 7);
                    SendMessageToPC(oCPC, sName + " " + IntToString(nBook));
                    if (nBook < 0 || sName == "") {
                        FloatingTextStringOnCreature(COLOR_RED + "You must specify a book number and a name to save!" + COLOR_END, oCPC, FALSE);
                        return;
                    }

           // These report back correctly
                    sCmd = sName;
                    nBook /= 2;
                    SendMessageToPC(oCPC, sCmd + " " + IntToString(nBook));
                    //DO WORK
                    //This part fills the string with the data, and builds the above posted string of information, to later be parsed
                                    sCmd += "|" + IntToString(nClass) + "," + IntToString(j) + "," + IntToString(k) + "," + IntToString(mss.id) + "," + IntToString(mss.meta);

                    SetLocalString(oCPC, "SpellBook_" + IntToString(nBook), sCmd);
                    SetPersistentString(oCPC, "SpellBook_" + IntToString(nBook), sCmd);

                    SendMessageToPC(oCPC, sCmd);

                    FloatingTextStringOnCreature(COLOR_GREEN + "Spell Book saved!" + COLOR_END, oCPC, FALSE);
                } else if (GetStringLeft(sCmd, 5) == "load ") {
                    ////////////// IN PROGRESS ////////////////
                    int nBook;
                    string ss;

                    if ((nBook = StringToInt(GetStringRight(sCmd, 1))) < 1 || nBook > 9) {
                        if (GetStringRight(sCmd, 1) != "0") {
                            FloatingTextStringOnCreature(COLOR_RED + "You must specify a saved spellbook (0-9) to restore a spellbook!" + COLOR_END, oCPC, FALSE);
                            return;
                        }
                    }
                    SendMessageToPC(oCPC, IntToString(nBook));
                    ss = GetPersistentString(oCPC, "SpellBook_" + IntToString(nBook));

// This code fires and the script returns...
                    if (ss == "") {
                        FloatingTextStringOnCreature(COLOR_RED + "You have not saved that spellbook!" + COLOR_END, oCPC, FALSE);
                        return;
                    }
                    SendMessageToPC(oCPC, ss);

                    ////LOAD BOOK CODE/////
                    FloatingTextStringOnCreature(COLOR_GREEN + "Spell Book loaded!" + COLOR_END, oCPC, FALSE);
                } else if (sCmd == "list") {
                    int nPos, i;
                    DeleteLocalString(oCPC, "FKY_CHAT_LOCAL_CTEXT");
                    string sMessage = COLOR_WHITE + "You have the following spellbooks:\n";

                    for (i = 0; i < 10; i++) {
                        string sBook = GetPersistentString(oCPC, "SpellBook_" + IntToString(i));
//None of the saved books are being read.
                        if ((nPos = FindSubString(sBook, "|")) >= 0)
                            sMessage += "    " + COLOR_WHITE + "#" + IntToString(i) + " " +
                                COLOR_LT_PURPLE + GetStringLeft(sBook, nPos) + "\n";
                    }

                    SendChatLogMessage(oCPC, sMessage + COLOR_END + "\n", oCPC, 5);
                }
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
werehound



Joined: 17 Aug 2010
Posts: 41

PostPosted: Sat Aug 11, 2012 20:35    Post subject: Reply with quote

I think I was hitting a buffer limit. The original string was being retrieved as "". I broke the string into smaller parts and it solved my problem.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
eeriegeek



Joined: 07 Jan 2008
Posts: 59

PostPosted: Sun Aug 12, 2012 23:50    Post subject: Reply with quote

Hey, I don't have time to look at the code right now, but if my memory is correct, there is a test for buffer size in some versions. The size checked was the strlen of the string you passed in to the call. I think if you make a really big NWN string and pass it in you may be able to get more convince it to pass back more.
Back to top
View user's profile Send private message
Lokey



Joined: 02 Jan 2005
Posts: 158

PostPosted: Mon Aug 13, 2012 3:31    Post subject: Reply with quote

I thought you didn't need to buffer now? I know we love to string CONCATs and pass piles of stuff at a time on lin or win.
_________________
Neversummer PW NWNx powered mayhem Wink
Back to top
View user's profile Send private message
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