Re: storing C++ objects in RDBMSs
Posted in 1996
Adel Shrufi wrote: > > Hi Folks, > I am looking for feedback or past experiences on how to store C++ objects > in an RDBMS, e.g. Oracle or Informix. I know the ideal way would be to > use an OODBMSs, which I have personally done and found to be great. > However, RDBMSs still rule the world, and we need to store our objects > in these systems. > > I'd appreciate if people, who have had experiences with this, would > either email me or post to this newsgroup about how best to get around this > problem. We were thinking of writing a tool that sort of automates the > mapping of our business object to the underlying databases. We reviewed > one commercial or-mapping tool, and we found to be too generic for our > purposes. > > Are there any other tools that we missed-- hopefully something > that does not make heavy use of dynamic SQL, and gives lots of flexibility > in terms of tuning knobs etc.? > > Thanks, > --Adel Hello Adel, i had a similar problem putting ASCII-reports files from our mainframe into a structured INFORMIX- RDBMS. It is not be the exact answer to your question, try to take it as a hint in a little different direction. After checking some commerical loader programms (none of them was usable for that specific task) i ended up with the following configuration: Based on CLI 2.0 (=ODBC by INFORMIX) i wrote a C++-Class for every SQL-datatyp that shows up in the ASCII-Files i have to deal with. These classes encapsulate all that inconvinient datastructures of ODBC to me now, and i can add , multiply, concat without bothering about SQL_NULL . Then i wrote a C++-application that automatically creates C++ header and class- sourcefiles encapsulating a single table directly from the table definition sql-file. These classes have all the basic memberfunctions (insert,update,delete,fetch,..) i need to do my job. So know i have a one to one relationship between a table ( or a view, or a stored procedure) and a C++-Class, with function members and data-objects. Working with my database now looks something like this: *customers.fname = "Smith"; status = customer.insert(); .... status = customer.read(); if (*customer.fname == "Smith") { ... } This is a rather special thing till now, that works for me, but perhaps not for anyone else, and there would be a lot of work to do to make it usable in a more general way. May be later on that year i will add form-support to my table-classes. If you are interested in details, please let me know. Regards Peter -- _____________________________________________________________________________ SIEMENS AG Abt.: AUT 2 PKV 1 Peter Buckenleib Frauenauracher Str. 80 91056 Erlangen Tel. : 09131/98-3806 FAX. : 09131/98-1256 email: pbu@f30x.erl.scn.de ______________________________________________________________________________