View previous topic :: View next topic |
Author |
Message |
Rat Bastard!!!
Joined: 10 Jan 2005 Posts: 11
|
Posted: Mon Jan 10, 2005 4:30 Post subject: Problem with "Name" field in pwdata |
|
|
I read all the posts here (and most at NWN, but the site is slow) and no one seems to have the problem I have. Now, I have used NWNX for a while, got some nice PW going, did some scripts...I am not exactly a n00b but still need to ask a question here and there.
Anyways, here is my problem:
Code: | o Got request: INSERT INTO pwdata (player,name, nMet_Naraluril , expire) VALUES ('Rat-man','Deva Davis','1',0)
! SQL Error: [MySQL][ODBC 3.51 Driver][mysqld-4.0.20a-nt]Unknown column 'nMet_Naraluril' in 'field list' |
This is the log file for when I try to get my test character to SetPersistentInt that its met someone before. I have no clue why its trying to use column nMet_Naraluril. It should be using column name.
Here is my injection script: Code: | SetPersistentInt(oPC, sVarName, 1, 0); |
sVarName is properly declared....its value should be nMet_Naraluril. Instead that is being taken to be the column name.
Help? |
|
Back to top |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Mon Jan 10, 2005 8:16 Post subject: |
|
|
I would think its because you haven't sent the compete sequence needed...
SetPersistentInt(oPC, sVarName, 1, 0);
instead try:
SetPersistentInt(oPC,sVarName,1,0,"MyTable");
You haven't told it what table to put the information in, so its confused...... |
|
Back to top |
|
|
JeroenB
Joined: 31 Dec 2004 Posts: 228 Location: Netherlands
|
Posted: Mon Jan 10, 2005 11:03 Post subject: |
|
|
It uses by default the pwdata table. The wrong part here is the colomn and I can't see how you got that name overthere ..
Can you post the functions code here? (located in the aps_include script). We might find what is wrong then some easier. |
|
Back to top |
|
|
Rat Bastard!!!
Joined: 10 Jan 2005 Posts: 11
|
Posted: Mon Jan 10, 2005 14:36 Post subject: |
|
|
I'm at work right now, but will do so when I get home tonight.
Acrodania,
It assumes pwdata by default, but I thought about that also and tried it, with the same issue. Good thought though. |
|
Back to top |
|
|
Acrodania
Joined: 02 Jan 2005 Posts: 208
|
Posted: Mon Jan 10, 2005 18:54 Post subject: |
|
|
I thought it was supposed to add the timeout and table by default, but its always spazzed out on me if I added one to the connect string without adding the other, regardless of which one, so I have always entered both........ |
|
Back to top |
|
|
Rat Bastard!!!
Joined: 10 Jan 2005 Posts: 11
|
Posted: Tue Jan 11, 2005 4:13 Post subject: |
|
|
I inherited the module from a team member. With it, he had installed ATS/Salandra's Crafting Version 1.00 Public Version, which has its own “aps_include” included and its suppose to be optimized for the system. Well something is not right because I made “aps_include2” which has the original NWNX2 code in it and the system and all my errors went away.
I am hesitant to change the already present code, but I took the time to print both out at work and look at them side by side. Nothing jumps out at me between the two.
Maybe someone can go thru them and fix it, but for right now I have a full plate at work. Maybe this weekend I will look at it and fix the code. I included links to the new and old code if someone wants to look.
http://www.socallanparty.com/files/aps_include_old.txt
http://www.socallanparty.com/files/aps_include_original.txt
Need to say thanks though to everyone though...so thanks. |
|
Back to top |
|
|
Liberty Valance
Joined: 06 Jan 2005 Posts: 21 Location: A Persistent World West2
|
Posted: Tue Jan 11, 2005 4:37 Post subject: |
|
|
Well, I've found the following discrepancies:
aps_include_old.txt::SetPersistentString
Code: | if (SQLFetch() == SQL_SUCCESS)
{
// row exists
sSQL = "UPDATE " + sTable + " SET val='" + sValue +
"',expire=" + IntToString(iExpiration) + " WHERE player='" + sPlayer +
"' AND tag='" + sTag + "' AND name='" + sVarName + "'";
SQLExecDirect(sSQL);
}
else
{
// row doesn't exist
sSQL = "INSERT INTO " + sTable + " (player,tag,name,val,expire) VALUES" +
"('" + sPlayer + "','" + sTag + "','" + sVarName + "','" +
sValue + "'," + IntToString(iExpiration) + ")";
SQLExecDirect(sSQL);
} |
aps_include_original.txt::SetPersistentString
Code: | if (SQLFetch() == SQL_SUCCESS)
{
// row exists
sSQL = "UPDATE " + sTable + " SET " + sVarName + " = '" + sValue +
"',expire=" + IntToString(iExpiration) + " WHERE player='"+ sPlayer +
"' AND name='" + sName + "'";
SQLExecDirect(sSQL);
}
else
{
// row doesn't exist
sSQL = "INSERT INTO " + sTable + " (player,name, " + sVarName +
" , expire) VALUES ('" + sPlayer + "','" + sName + "','" + sValue +
"'," + IntToString(iExpiration) + ")";
SQLExecDirect(sSQL);
} |
________________________________________________
aps_include_old.txt::GetPersistentString
Code: | string sSQL = "SELECT val FROM " + sTable + " WHERE player='" + sPlayer +
"' AND tag='" + sTag + "' AND name='" + sVarName + "'";
SQLExecDirect(sSQL); |
aps_include_original.txt::GetPersistentString
Code: | string sSQL = "SELECT " + sVarName + " FROM " + sTable + " WHERE player='" + sPlayer +
"' AND name='" + sName + "' ; ";
SQLExecDirect(sSQL); |
________________________________________________
aps_include_old.txt::SetPersistentInt
Code: | void SetPersistentInt(object oObject, string sVarName, int iValue, int iExpiration =
0, string sTable = "pwdata")
{
SetPersistentString(oObject, sVarName, IntToString(iValue), iExpiration, sTable);
} |
aps_include_original.txt::SetPersistentInt
Code: | void SetPersistentInt(object oObject, string sVarName, int iValue, int iExpiration=0, string sTable="pwdata")
{
//SetPersistentString(oObject, sVarName, IntToString(iValue), iExpiration, sTable);
string sPlayer;
string sName;
if (GetIsPC(oObject))
{
sPlayer = SQLEncodeSpecialChars(GetPCPlayerName(oObject));
sName = SQLEncodeSpecialChars(GetName(oObject));
}
else
{
sPlayer = "~";
sName = GetTag(oObject);
}
string sSQL = "SELECT player FROM " + sTable + " WHERE player='" + sPlayer +
"' AND name='" + sName + "'";
SQLExecDirect(sSQL);
if (SQLFetch() == SQL_SUCCESS)
{
// row exists
sSQL = "UPDATE " + sTable + " SET " + sVarName + " = " + IntToString(iValue) +
",expire=" + IntToString(iExpiration) + " WHERE player='"+ sPlayer +
"' AND name='" + sName + "'";
SQLExecDirect(sSQL);
}
else
{
// row doesn't exist
sSQL = "INSERT INTO " + sTable + " (player,name, " + sVarName +
" , expire) VALUES ('" + sPlayer + "','" + sName + "','" + IntToString(iValue) +
"'," + IntToString(iExpiration) + ")";
SQLExecDirect(sSQL);
}
} |
________________________________________________
aps_include_old.txt::GetPersistentInt
Code: | string sSQL = "SELECT val FROM " + sTable + " WHERE player='" + sPlayer +
"' AND tag='" + sTag + "' AND name='" + sVarName + "'";
SQLExecDirect(sSQL);
oModule = GetModule();
SetLocalString(oModule, "NWNX!ODBC!FETCH", "-2147483647");
return StringToInt(GetLocalString(oModule, "NWNX!ODBC!FETCH")); |
aps_include_original.txt::GetPersistentInt
Code: | string sSQL = "SELECT " + sVarName + " FROM " + sTable + " WHERE player='" + sPlayer +
"' AND name='" + sName + "' ; ";
SQLExecDirect(sSQL);
if (SQLFetch() == SQL_SUCCESS)
return StringToInt(SQLGetData(1));
else
{
return 0;
// lots of comments here omitted
} |
________________________________________________
And the Set/Get functions pretty much seem to continue on, with similar differences. I'm no code monkey, but there's definitely some differences somewhere in here. Now I just need to figure out what exactly
For starters though, the old script (from ATS?) doesn't use sVarName in it's INSERT/UPDATE/SELECT calls, but instead seems to use a constant of "val". This could quite possibly be a good source of the problem. _________________ A Persistent World West2 | APWW2 Forums
Wirehead Studios |
|
Back to top |
|
|
Rat Bastard!!!
Joined: 10 Jan 2005 Posts: 11
|
Posted: Tue Jan 11, 2005 17:20 Post subject: |
|
|
Yeah...it shows up much easier here on screen then on fanfold printouts. I am not sure what I am going to do. I am going to test using the new "original" aps_include vs the old "customize" one but for now I am going to include the the original aps_include as aps_include2 and just refer to it in my scripts as:
Code: | #include "aps_include2" |
Thanks for all the help guys.
Last edited by Rat Bastard!!! on Tue Jan 11, 2005 17:20; edited 1 time in total |
|
Back to top |
|
|
Makzimia De Graf
Joined: 31 Dec 2004 Posts: 55 Location: San Diego CA.
|
Posted: Tue Jan 11, 2005 17:20 Post subject: |
|
|
I spoke with Salandra about this, and here is the skinny. The reason our aps_include has more in it is simple. If one of you who knows looks you will note, we do not use pwdata and a single table. There are more columns per table also than normal. Pwdata on our mod is just not called at all. The main confusion in all this of course is that the rest of our code elsewhere handles table calls as well I guess. I am not the code monkey at all... so sorry if that doesn't come across making any sense. Sufficient to say, we have a no error perfect running MOD with a lot of SQL code in it. And the tables are very useful and work fast. Last line from Salandra, we use MySQL calls more than the original aps, and a variable number of columns.
Thanks,
Makz. _________________ Makzimia De Graf
DM/Creator Island of Fredian
fredian.game-host.org:5123
Forums at http://castille.us/fredian/Forums |
|
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
|