[Up] |
Work in progressThis version may be updated without notice. |
Copyright © INRIA
This specification describes an RDBMS optional module for
. This RDBMS module provides tags, attributes, functions, properties, and data types related to applications that have to access to relational database management systems with SQL.The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
Note that for reasons of style, these words are not capitalized in this document.
The following specifications are part of the technologies.
1.1 Performing SQL queries2 RDBMS module reference
1.2 Producing straightly the expected XML structure
2.1 Elements
2.2 Foreign attributes
2.3 Predefined properties
2.4 Extended XPath functions
2.5 Data types
A Glossary
B Related specifications
C Lists
C.1 Examples listD for the RDBMS module
C.2 Figures list
This
module has been designed to provide basic RDBMS support.This module is somewhat very simple to use :
SQL queries accept prepared SQL statements, which parameters are set with entries found in the context after performing the subactions.
An example with Active Update for rows that have been modified.]Unlike any proprietary technique of database vendors,
allows to produce directly any XML structure without the help of XSLT. offers very flexible means for designing arbitrary complex XML structures. allows actually :SQL to XML | |
---|---|
In this example, an SQL result is browsed in order to build an XML document. <rdbms:connect driver="..." name="sql" password="..." url="..." user="..."/> <rdbms:select connection="{ $sql }" name="orders" query="SELECT * FROM orders WHERE id= ? "> <xcl:param value="{ $sys:env/order-id }"/> </rdbms:select> <xcl:document name="xml"> <order id="{ $sys:env/order-id }"> <xcl:for-each name="group" select="{ xcl:group( $orders, currency ) }"> <xcl:element name="{ currency }"> <xcl:for-each select="{ $group }"> <item part-number="{ pn }" quantity="{ qty }"> { price } <xcl:text>{ string( product ) }</xcl:text> </item> </xcl:for-each> </xcl:element> </xcl:for-each> </order> </xcl:document> The snippet code above produces the $xml property, which content might be the following XML document (xml:document) : <order id="1234"> <dollar> <item part-number="321" price="138.95" quantity="1">Lawnmower</item> <item part-number="654" price="29.99" quantity="2">Baby Monitor</item> </dollar> <euro> <item part-number="987" price="11.27" quantity="3">Roquefort Cheese</item> </euro> </order> (notice that for readability, whitespaces has been stripped and replaced by a smart indentation) |
RDBMS namespace URI | : | http://www.inria.fr/xml/active-tags/rdbms |
Usual prefix | : | rdbms |
Elements | Foreign attributes | Predefined properties | Data types |
---|---|---|---|
<rdbms:connect> <rdbms:disconnect> <rdbms:select> <rdbms:update> <rdbms:commit> <rdbms:rollback> | @rdbms:version | $rdbms:null | rdbms:connection rdbms:x-row |
Must be an adt:expression that computes an object of the type expected. | |
Must be a hard-coded value (litteral) | |
Can be either a hard-coded value or an adt:expression | |
This material may be missing | |
Denotes a value to use by default | |
Allows a read operation. | |
Allows a write operation. | |
Allows a rename operation. | |
Allows an update operation. | |
Allows a delete operation. |
Create a connection to a database.
The connection created, a rdbms:connection, is set to a property.
[TODO: content definition]
Attributes runtime | hard-coded | both Name Type Value optional | default value name xs:QName The name of the connection.
scope The scope of the property to create. xs:string local Local. global Global. shared Shared. driver xs:string The driver to use. Implementation dependant.
url xs:string The URL to connect to. Depends on the driver.
user xs:string The user with which making the connection.
password xs:string The password of the user with which making the connection.
Disconnect from a connection.
[TODO: content definition]
Attributes runtime | hard-coded | both Name Type Value optional | default value connection rdbms:connection The connection to disconnect.
Perform a single SQL query. The result of the query is set to a property.
runtime phase
- Opens a context and run the subactions.
- Set the parameters of the context as parameters of the SQL prepared statement.
- Perform the SQL query.
- Set the property to the result set, a adt:list of rdbms:x-row.
[TODO: content definition]
Attributes runtime | hard-coded | both Name Type Value optional | default value name xs:QName The name of the result set property.
scope The scope of the property to create. xs:string local Local. global Global. shared Shared. connection rdbms:connection The connection to submit the query.
query xs:string The query to submit.
Perform a single SQL update query. The numbers of record affected by the query is set to a property.runtime phase
- Opens a context and run the subactions.
- Set the parameters of the context as parameters of the SQL prepared statement.
- Perform the SQL query.
- Set the property to the number of rows affected by the query, a xs:int.
[TODO: content definition]
Attributes runtime | hard-coded | both Name Type Value optional | default value name xs:QName The name of the property that hold the number of rows affected by the query.
scope The scope of the property to create. xs:string local Local. global Global. shared Shared. connection rdbms:connection The connection to submit the query.
query xs:string The query to submit.
Commit pending SQL updates.[TODO: content definition]
Attributes runtime | hard-coded | both Name Type Value optional | default value connection rdbms:connection The connection to commit.
Rollback pending SQL updates.[TODO: content definition]
Attributes runtime | hard-coded | both Name Type Value optional | default value connection rdbms:connection The connection to rollback.
- Priority : 0
The version of the RDBMS module to use. This attribute should be encountered before any RDBMS element, but it takes precedence on the element inside which it is hosted.
$rdbms refers to null values in the database.
No XPath functions are defined by this module.
Represents a connection to the data base.
Represents a row of a result set of a query.
Operation read | write | rename | update | delete Type Value Comment type() xs:QName rdbms:x-row This type child:: adt:list Each item has a name and a value of the type supplied by the underlying implementation.
This list is not exhaustive; it is a list of common modules usable by an engine that implements the
specifications that implementors may use. Additional modules are welcome.<asl:active-schema asl:version="1.0" adt:version="1.0" xs:version="1.0" target="web"
schema-version="1.0" xml:lang="en" xmlns:rdbms="http://www.inria.fr/xml/active-tags/rdbms" xmlns:asl="http://www.inria.fr/xml/active-schema" xmlns:adt="http://www.inria.fr/xml/active-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://www.w3.org/1999/xhtml" xmlns:at="http://www.inria.fr/xml/active-tags/reference"> <asl:element name="rdbms:select" root="never"> <!-- TODO --> </asl:element> <!-- TODO --> </asl:active-schema>