On 4 Feb 2004, at 03:39 pm, kynan wrote:
The idea of having XML in the DB is sound though, if you do it thoughtfully.

So long as you're not planning on searching on it or indexing it or ...


I once used XML to store information about a webpage as a PostGreSQL field ... but later down the track I wanted to search on some of that data and had to retrieve all records that contained 'bob' and then parse the XML and check that 'bob' was in the byline rather than just having his name in the content.


<dream>


I'd love to see an XML parser embedded into SQL so that I can have:
CREATE TABLE aTable (id serial, data XML);

Then I can:
SELECT id FROM aTable WHERE data:story:byline = 'Bob';

Which would return the id of any record whose data field looked something like:
<XML><story id=1><byline>Bob</byline><content>Content</content></story><story id=2><byline>Bob</byline><content>Content of another story</content></story></XML>


But wouldn't return the id where the data looked like:
<XML><story id=1><byline>Nora</byline><content>Bob is a dude</content></story><story id=2><byline>Bill</byline><content>Content of another story</content></story></XML>


even though 'bob' is in the text.

Basically the SQL engine would recognise that 'data' is an XML field and could search it according to requirements.

</dream>

Rick Measham
Senior Designer and Developer

Printaform Pty Ltd
Tel: (03) 9850 3255
Fax: (03) 9850 3277
http://www.printaform.com.au
http://www.printsupply.com.au
vcard: http://www.printaform.com.au/staff/rickm.vcf



Reply via email to