View previous topic :: View next topic |
Author |
Message |
Kato
Joined: 05 Mar 2010 Posts: 47
|
Posted: Mon Jun 27, 2011 8:44 Post subject: SCO/RCO: cannot retrieve object |
|
|
Hi there,
I'm having some problems retrieving stored objects from a MySQL table with RCO. SCO seems to store the object in the table though, I can see it while browsing the table with MySQL Query Browser. I'm using a simplified system wich stores/retrieves a npc, looping through it's inventory to retrieve items. I thought about trying FETCHMODE, but I'm under Windows, alas...
The functions:
void SetPersistentObject(string sKey, object oObject)
{
string sSQL = "INSERT INTO bankobj(cdkey, storer) VALUES('" + sKey + "', %s) ON DUPLICATE KEY UPDATE storer=%s";
SetLocalString(GetModule(), "NWNX!ODBC!SETSCORCOSQL", sSQL);
StoreCampaignObject("NWNX", "-", oObject);
}
object GetPersistentObject(object oPC, object oOwner)
{
string sKey = GetPCPublicCDKey(oPC);
string sSQL = "SELECT storer FROM bankobj WHERE cdkey='" + sKey + "'";
SetLocalString(GetModule(), "NWNX!ODBC!SETSCORCOSQL", sSQL);
if(!GetIsObjectValid(oOwner)) oOwner = oPC;
return RetrieveCampaignObject("NWNX", "-", GetLocation(oOwner), oOwner);
}
my odbc log file:
o Got request (scorco): SELECT storer FROM bankobj WHERE cdkey='Q7KUVYJJ'
o Got request (scorco): INSERT INTO bankobj(cdkey, storer) VALUES('Q7KUVYJJ', ~s) ON DUPLICATE KEY UPDATE storer=~s
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '˜«ZàÒi' at line 1
o Got request (scorco): SELECT storer FROM bankobj WHERE cdkey='Q7KUVYJJ'
o Got request (scorco): INSERT INTO bankobj(cdkey, storer) VALUES('Q7KUVYJJ', ~s) ON DUPLICATE KEY UPDATE storer=~s
! SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '˜«ZàÒi' at line 1
I feel like this must be very simple, sorry if it is, and thank you very much for taking the time to read this!
Kato |
|
Back to top |
|
|
Kato
Joined: 05 Mar 2010 Posts: 47
|
Posted: Tue Jul 05, 2011 16:49 Post subject: |
|
|
well, I guess I'll have to find out... I'll report my results when I do.
Kato |
|
Back to top |
|
|
Kato
Joined: 05 Mar 2010 Posts: 47
|
Posted: Sun Jul 17, 2011 22:56 Post subject: |
|
|
Okay, FYI, it simply was the ON DUPLICATE KEY UPDATE part wich caused the problem. Many thanks to Virusman for the info. |
|
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
|