Re: XmlQuery and GOB



On Wed, Oct 11, 2000 at 11:56:30AM +0200, Gerhard Dieringer wrote:
> >
> > 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.

Ok, then we need to be able to tell the library which provider is concerned,
and if the provider offers the service to convert into his own SQL like language,
then use it.

> 
> 
> > >... 
> > > 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).

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?

Vivien




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