Create and deliver personalized experiences across digital properties at scale
Build engaging websites with intuitive web content management
Leverage a complete UI toolbox for web, mobile and desktop development
Build, protect and deploy apps across any platform and mobile device
Build mobile apps for iOS, Android and Windows Phone
Rapidly develop, manage and deploy business apps, delivered as SaaS in the cloud
Automate UI, load and performance testing for web, desktop and mobile
Host, deploy and scale Node.js, Java and .NET Core apps on premise or in the cloud
Optimize data integration with high-performance connectivity
Automate decision processes with a no-code business rules engine
Transform your businesses in order to survive in a completely digitized and connected world driven by software innovation.
Globally scale websites with innovative content management and infrastructure approaches
Content-focused web and mobile solution for empowering marketers
Faster, tailored mobile experiences for any device and data source
UX and app modernization to powerfully navigate today's digital landscape
Fuel agility with ever-ready applications, built in the cloud
We recently noticed some questions on a newsgroup that attracted our attention. The question was something similar to this:
How to create an XQuery which generates SQL like
[cc lang="sql" theme="xquery"]
SELECT t1.columnName1 FROM Table t1 WHERE t1.columnName2 IN('as','fa','pr')[/cc]
My immediate reaction was: why is he worrying about that? You should't need to think about how to write an XQuery to obtain a specific SQL; it is the XQuery processor's goal to digest your XQuery and make the "best" SQL out of it...
The obvious XQuery that comes to my mind would be...
for $ts in fn:collection("Table")/Table
where $t1/columnName2 = ('as','fa','pr')
Strangely enough, experts on that newsgroup suggested to instead write the query like:
[cc lang="xquery"]for $t in Table() where $t/columnName2 = 'as' or
$t/columnName2 = 'fa' or $t/columnName2 = 'pr'
...or, assuming a sequence of values on which to filter:
[cc lang="xquery"]for $v in $values for $t in Table()
where $t/columnName2 = $v
Why would they suggest such an unnatural way to solve that problem in XQuery? The reality is that I'm thinking in terms of what DataDirect XQuery would do; while they are thinking about different XQuery processors. DataDirect XQuery has been designed to re-write XQuery expressions in SQL without forcing the user to code XQuery in a specific way. In XQuery it's possible to express the same logic in many different ways; but it shouldn't be the XQuery author's responsibility to guess about how the underlying XQuery engine optimizes what he writes; it should be the XQuery engine that is able to take the "right decisions" no matter how the user codes the solution in XQuery (at least in reasonably equivalent scenarios, like the one described above).
For the record, the XQueries described above all end up generating the same execution plan in DataDirect XQuery:
digg_skin = 'compact';
View all posts from Minollo on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.