Re: [gnome-db] XML Query proposal
- From: Gerhard Dieringer <Gerhard Dieringer nexgo de>
- To: Rodrigo Moya <rodrigo gnome-db org>
- Cc: Laurent Marzullo <laurent marzullo brussels sema slb com>, Gnome DB <gnome-db-list gnome org>
- Subject: Re: [gnome-db] XML Query proposal
- Date: Thu, 27 Sep 2001 23:23:15 +0200
Am 2001.09.27 11:06 schrieb(en) Rodrigo Moya:
> On Thu, 2001-09-27 at 09:43, Laurent Marzullo wrote:
> > Hello,
> >
...
> > And the second if for the description of the Query. That follows your
> > XML Query proposal. So I want to write the query:
> >
> > SELECT owner,
> > object_name,
> > object_type
> > FROM ALL_OBJECTS
> > WHERE object_name = :p_owner -- p_owner is a C
> variable
> > ORDER BY OWNER, TABLE_NAME
> >
> > And use the following XML:
> >
> > <?xml version="1.0"?>
> >
> > <query op="FETCH" >
> > <param source="ALL_OBJECTS" >OWNER</param>
> > <sources>
> > <table id="ALL_OBJECTS">ALL_OBJECTS</table>
> > </sources>
> > <values>
> > <field source="ALL_OBJECTS" name="OWNER" />
> > <field source="ALL_OBJECTS" name="OBJECT_NAME" />
> > <field source="ALL_OBJECTS" name="OBJECT_TYPE" />
> > </values>
> > <qualification>
> > <equal>
> > <field source="ALL_OBJECTS" name="OWNER" />
> > <param name="OWNER" />
> > </equal>
> > </qualification>
> > </query>
> >
> >
> > First question is: HOW TO WRITE THE ORDER BY (following your XML
>
> > format)?
> >
> > The second is: May I add some tag and attribute value ?
> > query.op = "FETCH"
> > <param> (parameter of the query, as the query will be
> > transform to PRO*C/C++)
> >
> > Thank you very much
> >
> I can't answer in detail those questions since I don't know in detail
> the XML query stuff (that's Gerhard who could answer those).
>
> Anyway, if you use the XML queries specification, you shouldn't bother
> at all about the XML format yourself, but you should use the gda_xql_*
> classes to create the GdaXqlQuery object which will build the XML for
> you.
>
> Another thing is that XML queries are right now not understood yet by
> any providers, so before you start using this for your program, support
> should be added to providers so that they understand the XML queries.
>
According to the last gda-xml-query.dtd in libgda-0.2.91/lib/gda-common,
the query should look like:
<?xml version="1.0"?>
<!DOCTYPE query SYSTEM "./xmlquery.dtd">
<query>
<select>
<targetlist>
<target name="all_objects" id="t"/>
</targetlist>
<valuelist>
<value id="v01">
<field source="t" name="owner"/>
</value>
<value id="v02">
<field source="t" name="object_name"/>
</value>
<value id="v03">
<field source="t" name="object_type"/>
</value>
</valuelist>
<where>
<eq>
<field source="t" name="p_owner"/>
<const value="xyz" type="VARCHAR"/>
</eq>
</where>
<order>
<valueref source="v01"/>
<valueref source="v02">
</order>
</select>
</query>
The value attribute of the const tag ('xyz') has to be set by your
application.
As you can easily verify, the gda-xml-query.xsl tranformation reproduces
your SQL statement:
select t.owner as v01, t.object_name as v02, t.object_type as v03
from all_objects as t
where (t.p_owner = xyz) order by t.owner, t.object_name
------------
Gerhard
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]