Grumalg
Joined: 04 Nov 2005 Posts: 70
|
Posted: Fri Nov 04, 2005 2:43 Post subject: Questions about persistant object storage |
|
|
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.
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... |
|
Gryphyn
Joined: 20 Jan 2005 Posts: 431
|
Posted: Fri Nov 04, 2005 8:14 Post subject: |
|
|
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 |
|