Aller au contenu

Photo

Storing objects under MySQL


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Kato -

Kato -
  • Members
  • 392 messages
Hi,

I'm having some problems storing objects(more precisely a store) to a MySQL table using REPLACE INTO. I've had some similar problems in the past when using INSERT...ON DUPLICATE KEY UPDATE, wich were sloved thanks to Virusman who informed me that the latter cannot work with objects(yet it works for any other data type). Does anyone know if it's also the case with REPLACE INTO?

Thank you!


Kato 

Modifié par Kato_Yang, 07 janvier 2012 - 05:31 .


#2
Kato -

Kato -
  • Members
  • 392 messages
Ha, I've just found the answer: StoreCampaignObject() only stores items and creatures, and it does not seem possible to store objects in a more "direct" fashion, StoreCampaignObject() seems to be the only alternative. It explains why most storage systems use an invisible creature as the "container". The NPC's inventory is filled, then the NPC itself is stored in the DB.

So it leaves two solutions: Storing the items as a whole(in a tinyblob type column), or storing the items ref + stack + charges and re-create them at retrieval time. I wonder wich of these two possibilities will create the less lag, though. Any idea?

Thank you!


Kato

Modifié par Kato_Yang, 08 janvier 2012 - 04:17 .


#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
The reasom most people do not store Items by ResRef is that It does not allow for any items that do not comform to the BluePrint.

If someone in your world goes to a crafter and gets a D6 fire damage added to there sonic sword and then gives it a new name, when it comes back out of the storage system, stored by ResRef, it is going to be just a sonic sword again.

#4
Kato -

Kato -
  • Members
  • 392 messages
Oh! I did ignore this, thank you Lightfoot. It certainly answers my last question then, I'll store items as a whole.


Kato