[gnome-db] database xml - database version property



[From thread "database xml"]

Hi,

The change made to line 498 of the file "gda-xml-database.c", in the
function "gda_xml_database_to_string()" solves the problem but render
the function "gda-database-set-version()" useless.

In fact, the user cannot define the version of the database, with this
code, the version is always <database name="name" version="xxxx"> with
xxxx being the libgda version number (0.91.0 f.e.).

Is it not possible to have something like below ?

<database name="name" gdaversion="xxxx" version="yyyy"> with xxxx being
the libgda version number and yyyy the database version defined by the
application.

This way, if the application modifies its way of saving data, by keeping
track of the database version, it will be possible to find out if the
actual version of the application is able to read the xml file or if it
needs a filter to convert the database to the new format.

For example :

application version 0.1
  - database format used : 1
  * trying to load a database version 1 : OK
  * trying to load a database version 2 : unable, upgrade application.

application version 0.2
  - database format used : 2
  * trying to load a database version 2 : OK
  * trying to load a database version 1 : need first to make some filter
stuff to convert the database to version 2.

This should give a code like :

xmlSetProp (root, PROPERTY_NAME, xmldb->priv->name);
xmlSetProp (root, PROPERTY_VERSION, xmldb->priv->version);
xmlSetProp (root, PROPERTY_GDAVERSION, VERSION);

But this, of course, needs other modifications to add the property
"gdaversion" (GdaXmlDatabasePrivate, I suppose ... and may be more), so
I do not know if this is possible. 

Philippe

Le mer 30/07/2003 à 12:54, Rodrigo Moya a écrit :
> On Wed, 2003-07-30 at 11:04, Philippe CHARLIER wrote:
> > Le mar 29/07/2003 à 20:54, Rodrigo Moya a écrit :
> > --<CUT>--
> > > > The database is created with the tables, but with no name (what's the
> > > > utility of "gda_xml_database_set_name" ?).
> > > > I expected something like :
> > > > 
> > > > <?xml version="1.0"?>
> > > > <database name="airports">
> > > > ...
> > > > </database>
> > > > 
> > > hm, what version of libgda are you using?
> > --<CUT>--
> > 
> > Concerning the fact that there is no name recorded for the database, 
> > I dig into the code and it seems that effectively, for version 0.90,
> > it is not yet implemented.
> > By the way I looked to the CVS version of "gda-xml-database.c" and, in the
> > function "gda_xml_database_to_string()", this is implemented but I think
> > that there is a little bug :
> > 
> > 494 rodrigo 1.18 	/* create the top node */
> > 495              	doc = xmlNewDoc ("1.0");
> > 496              	root = xmlNewDocNode (doc, NULL, OBJECT_DATABASE, NULL);
> > 497 rodrigo 1.22 	xmlSetProp (root, PROPERTY_NAME, xmldb->priv->name);
> > 498              	xmlSetProp (root, PROPERTY_VERSION, xmldb->priv->name);
> > 499 rodrigo 1.18 	xmlDocSetRootElement (doc, root);
> > 500              
> > 
> > Line 498, PROPERTY_VERSION "is set" to name.
> > 
> right, fixed also in CVS.
> 
> cheers
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]