Update of /cvsroot/monetdb/sql/src/test/sql_xml/Tests
In directory
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19211/src/test/sql_xml/Tests
Added Files:
funcs.sql load.sql xml.sql
Log Message:
propagated changes of Friday Sep 28 2007 - Wednesday Oct 03 2007
from the SQL_2-20 branch to the development trunk
--- NEW FILE: xml.sql ---
select c.CustId, c.Name as CustName
from customers c;
select xmlelement(name "Customer",
xmlelement(name "CustId", c.CustId),
xmlelement(name "CustName", c.Name),
xmlelement(name "City", c.City))
from customers c;
select xmlelement(name "Customer",
xmlforest(c.CustId, c.Name AS CustName, c.City))
from customers c;
select *
from Customers c, Projects p
where c.CustId = p.CustId
order by c.CustId, p.ProjId;
select xmlelement(name "CustomerProj",
xmlforest(c.CustId, c.Name AS CustName, p.ProjId, p.Name AS ProjName))
from Customers c, Projects p
where c.CustId = p.CustId
order by c.CustId;
select xmlelement(name project,
xmlattributes(p.ProjId as "id"),
xmlforest(c.CustId, c.Name AS CustName, p.ProjId, p.Name AS ProjName))
from Customers c, Projects p
where c.CustId = p.CustId
order by c.CustId;
select
xmlelement(name "Customer",
xmlattributes(c.CustId as "id"),
xmlforest(c.Name as "name", c.City as city),
xmlelement(name projects,
(select xmlagg(xmlelement(name project,
xmlattributes(p.ProjId as "id"),
xmlforest(p.Name as name)))
from Projects p
where p.CustId = c.CustId) )) as "customer_projects"
from Customers c;
select
xmlelement(name "Customer",
xmlattributes(c.CustId as "id"),
xmlcomment('simple comment test'))
from Customers c;
--- NEW FILE: funcs.sql ---
CREATE TYPE xml EXTERNAL NAME xml;
CREATE FUNCTION xml (s STRING) RETURNS xml external name xml.xml;
CREATE FUNCTION str (s XML) RETURNS STRING external name xml.str;
CREATE FUNCTION "comment" (s STRING) RETURNS xml external name xml.comment;
CREATE FUNCTION parse (val STRING, "option" STRING) RETURNS xml external name
xml.parse;
CREATE FUNCTION pi (nme STRING, val STRING) RETURNS xml external name xml.pi;
CREATE FUNCTION root (val STRING, version STRING, standalone STRING) RETURNS
xml external name xml.root;
CREATE FUNCTION attribute (nme STRING, val STRING) RETURNS xml external name
xml.attribute;
CREATE FUNCTION "element" (nme STRING, ns STRING, attr xml, s xml) RETURNS xml
external name xml.element;
CREATE FUNCTION concat (val1 xml, val2 xml) RETURNS xml external name
xml.concat;
CREATE FUNCTION forest (val1 xml, val2 xml) RETURNS xml external name
xml.forest;
CREATE FUNCTION isdocument (val STRING) RETURNS xml external name
xml.isdocument;
CREATE AGGREGATE "xmlagg"( x xml ) RETURNS xml external name xml.agg;
--- NEW FILE: load.sql ---
create table Customers (
CustId integer,
Name varchar(32),
City varchar(32)
);
insert into Customers values(1, 'WoodWorks', 'Baltimore');
insert into Customers values(2, 'Software Solutions', 'Boston');
insert into Customers values(3, 'Food Supplies', 'New York');
insert into Customers values(4, 'Hardware Shop', 'Washington');
insert into Customers values(5, 'Books Inc', 'New Orleans');
create table Projects (
ProjId integer,
Name varchar(32),
CustId integer
);
insert into Projects values(1, 'Medusa', 1);
insert into Projects values(2, 'Pegasus', 4);
insert into Projects values(8, 'Typhon', 4);
insert into Projects values(10, 'Sphinx', 5);
select *
from Customers c, Projects p
where c.CustId = p.CustId
order by c.CustId, p.ProjId;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins