Re: XmlQuery and GOB



>>> Vivien Malerba <malerba gears linuxave net> 11.10.2000  10.59 Uhr >>>
> > 
> > The API has four groups of methods:
> > 1.) create from DOM-tree (DOM-tree is created by libxml from XML doc)
> > 2.) create from text
>
>This one is to create elements with API calls. Tell me if I am wrong!

No, you are right!


> > 3.) render to XML (the reverse of the first)
> > 4.) render to SQL
> > 
>
> The 4th one is a bit different since the rendering should be done by the
> provider itself (otherwise you can't generate SQL-like which is specific to a
> provider, or maybe is it generic SQL92 that you want to generate here?)

Generating generic SQL92 could be the default, if a provider doesn't provide it's own diallect.


> >... 
> > This query is constructed by the following sequence:
> >
> > {
> >     XmlQueryItem *insert;
> >
> >     insert = xml_query_insert_new();
> >     xml_query_query_add_target_from_text(XML_QUERY_QUERY(insert),
> >                                          XML_QUERY_TYPE_TABLE,
> >                                         "t1",
> >                                         "tab_a");
>
> Wouldn't it be better if the id was derived automatically from the table
> name (for example id="TA"+table name) so there is no problem with the ID 
> attribute of the DTD (AFAIK for one doc each ID must be unique), and then 
> all the tables can be referenced by their name and not id. So the previous
> function would be:
>
> xml_query_query_add_target_from_text(XML_QUERY_QUERY(insert),
>                                     XML_QUERY_TYPE_TABLE,
>                                      "tab_a");
> and then:
> xml_query_insert_add_dest_from_text(XML_QUERY_INSERT(insert),
>                                     "tab_a",
>                                    "a");

I think your objection has a contradiction:
If we create the id from the tablename und the id has to be unique in one doc,
we can't use one table twice in one doc!

What about defining a gensym- or sequence-object with (at least) the two methods
currval und nextval, that creates unique strings, for exapmle "id_0001", "id_0002", ....
This can be used to define the id for the table (nextval) and the idrefs for the fields (currval).

--------------------
Gerhard





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