Re: Antw: Re: XmlQuery and GOB



On Wed, Oct 11, 2000 at 03:02:22PM +0200, Gerhard Dieringer wrote:
> >>> Vivien Malerba <malerba gears linuxave net> 11.10.2000  13.39 Uhr >>>
> 
> > Wouldn't that be a bit complex for the user of the library (I mean having to record
> > which id was affected to which element,...) Maybe we could create a document head
> > (for any kind of query) which references database elements such as tables, views,
> > sequences,... used in the query.
> 
> > These elements would have IDs assigned in any way (yours or mine),
> > and then when in the query we need to talk about a table, we just need to have its
> > id (and nothing more because the table information is already in the document head).
> 
> > The user would, to build a query:
> > use the same functions you thought about, using only element names. The library
> > would know if an element is already declared, and otherwise declare it. This
> > processus is transparent to the user.
> > 
> > This also has the advantage that it is easy to scan that head to know which
> > elements appear in the query.
> > 
> >
> > Here is an example of document head:
> > <head>
> >   <table id="001" name="tab_a"/>
> >   <table id="002" name="tab_b"/>
> >   <sequence id="003" name="a_sequence"/>
> > </head>
> >
> > What do you think?
> >
> 
> To benefit of the XML id/idref mechanism, we need to use the id attribute to identify 
> the table (or view, sequence, ...). To make things easy for the user this means, we should
> use the name as the id. This in consequence makes the name attribute unnecessary.

I just wondered if there was any case when one can have, within the same DB, two
elements with the same name. I don't see any now, so yes you are right.

> 
> But what do you think of the following change of the API:
> 
> example:
> {
>     XmlQueryItem *insert, *target, *dest;
> 
>     insert = xml_query_insert_new();
>     target = xml_query_query_add_target_from_text(XML_QUERY_QUERY(insert),
>                                          XML_QUERY_TYPE_TABLE,
>                                          "tab_a");
>     
>     dest = xml_query_insert_add_dest_from_text(XML_QUERY_INSERT(insert), 
>                                         target,                        
>                                         "a");
>     
>     xml_query_query_add_const_from_text(XML_QUERY_QUERY(insert),
>                                          dest,
>                                          "1", 
>                                          "int",
>                                          FALSE);
>     
>     dest = xml_query_insert_add_dest_from_text(XML_QUERY_INSERT(insert), 
>                                         target,
>                                         "b");
>     
>     xml_query_query_add_const_from_text(XML_QUERY_QUERY(insert),
>                                          dest, 
>                                          "abc", 
>                                          "char",
>                                          FALSE);
> }    
> 
> This also has the advantage to explcitely connect the values to the target variables,
> which is not necessary for SQL but may be usefull for other situations.
> 
> When we render it into XML, we can use whatever id we want, because it's transparent 
> to the user.
> 

Ok!

Cheers,

Vivien




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