Easiest way to convert CArchive to use SQL database for serialization?


Easiest way to convert CArchive to use SQL database for serialization?



I have an existing application that uses CArchive to serialize a object structure to a file. I am wondering if can replace the usage of CArchive with some custom class to write to a database the same way that things are serialized. Before I go about figuring if this is doable I was wondering if other people have done the same- what is the best approach to this problem? I would like to be able to create a drop in replacement for the usage of CArchive so that the existing object structure would simply read/write to/from a database rather than a serialized file. Is it as simple as overwriting the Serialize method for each class?




SQL delete from related tables

1:



Select a dummy column with a dummy value in SQL?
Short answer: forget it..
SQL select join: is it possible to prefix all columns as 'prefix.*'?
Longer answer:.
How to fetch unmatching records from two SQL tables?
CArchive doesn't have a single virtual member.


How to use the LIKE keyword in SQL?
Even it's destructor isn't virtual, which means you're not supposed to derive from that class (C# programmers say sealed)..
A DB2 Trigger to calculate an average in another table
There's only one possibility that I can think of to customize CArchive's work (and without rewriting the whole serialization code in CDocument): Construct your CArchive object by passing it a pointer to CFile derived class that would handle the data connection for you..
LIKE in dynamic queries
From there on, how you control your database by simply overriding CFile's Read() and Write() is beyond my imagination :-(.
SQL: Optimization problem, has rows?



75 out of 100 based on 55 user ratings 1305 reviews

@