Hello John- Thanks for your comments. Could you please provide some details on how you have generated XML from custom data-structure and how you propose to do this for SQL schema as well.
Any code examples would really help. Rajan >-----Original Message----- >From: John Stanton [mailto:[EMAIL PROTECTED] >Sent: Monday, October 17, 2005 7:40 AM >To: sqlite-users@sqlite.org >Subject: Re: [sqlite] Question about automatic schema creation from custom >data-strucutre for persistence storage > >I addressed this some time back in a C program which dynamically >generates XML. Generating SQL would be an option. > >By building a table with a keyname for each data element and a pointer >to a data item the output structure can be assembled. As a wise person >once told me "There is no problem in CS which cannot be solved by yet >another level of indirection". > >In my case I also added a function pointer so that callbacks could be >used. With XML the table is actually a transformation of the DTD so >that the result is guaranteed to be "well formed". If the table were >compiled from the data structure then a similar integrity could be assured. > >This method would require a few lines of code, but you would only need >to do it once as opposed to writing code for each data structure. >JS > >Dan Kennedy wrote: >> As far as I know C++ has no introspection capability so the answer >> is probably no. Unless you want to parse your header file yourself, >> or something like that. >> >> With Java or another high-level programming language that supports >> introspection it would be possible I think. >> >> >> "Rajan, Vivek K" <[EMAIL PROTECTED]> wrote: >> Hello- >> >> >> >> Has anyone had experience with automatically creating schema from a >> custom data-structure for persistence storage using SQLite? So, in my >> C/C++ program I have the following type of data-structure: >> >> >> >> struct _trace { >> >> std::string name; >> >> std::string prop; >> >> std:string object; >> >> int a; >> >> double b; >> >> }; >> >> >> >> std::vector _myPath; >> >> >> Now, let's say I want to write and read _myPath data-structure >> (persistence) in SQLite database. >> >> >> >> My questions: >> >> - Is there a mechanism to dynamically create a schema on-the-fly from >> the data-structure? >> >> - Essentially a capability to store any custom data-structure into >> SQLite data-base by automatic creation of schema for the data-structure >> >> >> >> Rajan >> >> >> >> >> >> >> >> --------------------------------- >> Yahoo! Music Unlimited - Access over 1 million songs. Try it free.