rliq
December 8th, 2002, 08:04 PM
I want to Serialise my polymorphic objects to a database. I am creating an XML string, which is passed as a parameter to a Stored Procedure. This all works fine.
Unfortunately, one of the fields in the XML is <TYPE>. Each polymorphic object has on const m_nType member with a unique value.
I retrieve the data through a RecordSet. As I traverse the RecordSet I check the <TYPE> field and switch(nType) to create the correct class. This means that if I add new types I have to change the switch(nType) statment, which is bad...
Has anyone managed to save the RTTI to a database?
If so how?
What was the type of the column?
Is the RTTI information valid for another instance of the program (ie I write, somebody else reads)?
Is there a better way to do it?
Also, this would help, as from the documentation, I just cannot work out how to... Get the RTTI of an object and create another object of the same class. If anyone could provide a short snippet of code it would help, I just cannot find an example.
Thank you
Rob.
Unfortunately, one of the fields in the XML is <TYPE>. Each polymorphic object has on const m_nType member with a unique value.
I retrieve the data through a RecordSet. As I traverse the RecordSet I check the <TYPE> field and switch(nType) to create the correct class. This means that if I add new types I have to change the switch(nType) statment, which is bad...
Has anyone managed to save the RTTI to a database?
If so how?
What was the type of the column?
Is the RTTI information valid for another instance of the program (ie I write, somebody else reads)?
Is there a better way to do it?
Also, this would help, as from the documentation, I just cannot work out how to... Get the RTTI of an object and create another object of the same class. If anyone could provide a short snippet of code it would help, I just cannot find an example.
Thank you
Rob.