OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] XQuery question - feel free to ignore

[ Lists Home | Date Index | Thread Index ]

> If I have a database that supports XQuery and I construct a 
> query that uses
> the following XPath as part of a flower statement:
> customer[surname = 'smith']
> how would you both want and expect the query to run?
> 1) Return all customers where surname equalled exactly 'smith' or
> 2) Follow the datbase matching and return 'Smith' and 'smith' 
> and other case
> insensitive strings or
> 3) I can choose by setting a parameter before running the 
> query which mode
> to use

The answer is (3). The matching rules depend on the default collation in
use, which can be set in the query prolog.

> On a similar note if I ask for
> customer[age > 20.5]
> but age is stored as an integer would you want/expect the same sort of
> conversion to be made as the database would (probably error 
> as unable to
> implicitly cast) or would you expect the results to be 
> queried as XPath.

The XPath 2.0 semantics are identical to the XQuery 1.0 semantics, so I'm
not sure what distinction you are making. If age is defined as an
xs:integer, this is comparable with the decimal value 20.5 (in fact, all
numeric values are mutually comparable), so the comparison is allowed.
Whether this involves a "conversion" depends on the implementation.

> In essence where does the filter take place, in the database or on some
> imaginary document created by the database containing all customers?

That depends entirely on the architecture of your chosen implementation (and
may not be a meaningful question in many cases, in the sense that the
database *is* an imaginary document containing all customers).

Michael Kay


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS