Re: [gnome-db] XML Query proposal



On Thu, 2001-09-27 at 09:43, Laurent Marzullo wrote:
> Hello,
> 
> I'm currently working on a project where I must write C++
> class to access Oracle DB with PRO*C/C++.
> 
> For this, I use two XML file. One is for the description
> of all the tables of the data base like this:
> 
> <?xml version="1.0"?>
> 
> <db name="INTRACRA" >
>     <owner  name="SYS" >
>         <object  name="ALL_OBJECTS"  type="VIEW" >
>             <clmn name="OWNER"            type="VARCHAR" length="30"              null="N" comment="Username of the owner of the object"   />
>             <clmn name="OBJECT_NAME"      type="VARCHAR" length="30"              null="N" comment="Name of the object"                    />
>             <clmn name="SUBOBJECT_NAME"   type="VARCHAR" length="30"              null="Y" comment="Name of the subobject (for example, partition)" />
>             <clmn name="OBJECT_ID"        type="NUMBER"  length="22"              null="N" comment="Object number of the object" />
>             <clmn name="DATA_OBJECT_ID"   type="NUMBER"  length="22"              null="Y" comment="Object number of the segment which contains the object" />
>             <clmn name="OBJECT_TYPE"      type="VARCHAR" length="18"              null="Y" comment="Type of the object" />
>             <clmn name="CREATED"          type="DATE"                             null="N" comment="timestamp for the creation of the object" />
>             <clmn name="LAST_DDL_TIME"    type="DATE"                             null="N" comment="Timestamp for the last ddl change (including GRANT and revoke) to the object" />
>             <clmn name="TIMESTAMP"        type="VARCHAR" length="19"              null="Y" comment="Timestamp for the specification of the object" />
>             <clmn name="STATUS"           type="VARCHAR" length="7"               null="Y" comment="status of the object" />
>             <clmn name="TEMPORARY"        type="VARCHAR" length="1"               null="Y" comment="Can the current session only see data that it placed in this object itself" />
>             <clmn name="GENERATED"        type="VARCHAR" length="1"               null="Y" comment="Was the name of this object system generated" />
>             <clmn name="SECONDARY"        type="VARCHAR" length="1"               null="Y" comment="Is this a secondary object created as part of icreate for domain indexes" />
>         </object>
>     </owner>
> </db>
> 
> 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.

cheers
-- 
Rodrigo Moya <rodrigo gnome-db org> - <rodrigo ximian com>
http://www.gnome-db.org/ - http://www.ximian.com/




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