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 
 
Questions about persistant object storage

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



Joined: 04 Nov 2005
Posts: 70

PostPosted: Fri Nov 04, 2005 2:43    Post subject: Questions about persistant object storage Reply with quote

I am a longtime database programmer and neither SQL nor NWScript are mysterious to me. I have been useing NWNX2/MySQL for a while now useing only SQLExecDirect(), SQLFetch(), and SQLGetData() with a variety of custom tables and useing multipart indexes, joins, casts, etc. Everything has worked flawlessly.

I am now turning my attention to persistant object storage, and naturally I wanted to use my own custom tables. I have examined the code in aps_include, read the docs, read most of the forum posts. I even examined the source in visual studio, but the last time I worked with C was before it became C++ thus I did not find enlightenment. Sad

Is it possible to use custom tables for object storage? Or are you limited to the same table design as pwobjdata? If it is possible to use custom tables, how do the SCO/RCO hooks know which field to place the object in? Do they find the field by name or data type or assume it's the last field in the table?

Can one of you guru's please enlighten me, preferable with some small code samples?

Thanks in advance... Smile
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Fri Nov 04, 2005 8:14    Post subject: Reply with quote

Well you can't do anything really fancy with the tables, but it's a simple substitution that takes place in the code line.

"%s" is replaced with the Object (GFF) data - as a BLOB datatype.

You can have multi-columns in the table, but only the one "Object" column.
And when retrieving the Object - ONLY select the BLOB column - even if you use complex joins and/or conditionals

Cheers
Gryphyn
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