Edinburgh Research Explorer A Practical Theory of Language-integrated Query

Language-integrated query is receiving renewed attention, in part because of its support through Microsoft's LINQ framework. We present a practical theory of language-integrated query based on quotation and normalisation of quoted terms. Our technique supports join queries, abstraction over values and predicates, composition of queries, dynamic generation of queries, and queries with nested intermediate data. Higher-order features prove useful even for constructing first-order queries. We prove a theorem characterising when a host query is guaranteed to generate a single SQL query. We present experimental results confirming our technique works, even in situations where Microsoft's LINQ framework either fails to produce an SQL query or, in one case, produces an avalanche of SQL queries.

[1]  Gavin M. Bierman,et al.  Lost in translation: formalizing proposed extensions to c# , 2007, OOPSLA.

[2]  Martin Odersky,et al.  Lightweight modular staging: a pragmatic approach to runtime code generation and compiled DSLs , 2010, GPCE '10.

[3]  Brian Beckman Why LINQ matters: cloud composability guaranteed , 2012, CACM.

[4]  Geoffrey Mainland,et al.  Explicitly heterogeneous metaprogramming with MetaHaskell , 2012, ICFP.

[5]  David Maier,et al.  Making smalltalk a database system , 1984, SIGMOD '84.

[6]  Emil Axelsson,et al.  Combining Deep and Shallow Embedding for EDSL , 2012, Trends in Functional Programming.

[7]  James Cheney,et al.  Row-based effect types for database integration , 2012, TLDI '12.

[8]  Torsten Grust,et al.  Accelerating XPath evaluation in any RDBMS , 2004, TODS.

[9]  Mihai Budiu,et al.  The Compiler Forest , 2013, ESOP.

[10]  Torsten Grust,et al.  FERRY: database-supported program execution , 2009, SIGMOD Conference.

[11]  Walid Taha,et al.  MetaML and multi-stage programming with explicit annotations , 2000, Theor. Comput. Sci..

[12]  Morten Rhiger,et al.  Staged Computation with Staged Lexical Scope , 2012, ESOP.

[13]  Gottfried Vossen,et al.  Towards practical meta-querying , 2002, Inf. Syst..

[14]  Philip Wadler,et al.  Improving list comprehension database queries , 1989, Fourth IEEE Region 10 International Conference TENCON.

[15]  James Cheney,et al.  First-Class Phantom Types , 2003 .

[16]  Ken Friis Larsen,et al.  Generic multiset programming with discrimination-based joins and symbolic Cartesian products , 2010, High. Order Symb. Comput..

[17]  Ezra Cooper,et al.  The Script-Writer's Dream: How to Write Great SQL in Your Own Language, and Be Sure It Will Succeed , 2009, DBPL.

[18]  Dan Suciu,et al.  Comprehension syntax , 1994, SGMD.

[19]  D. Prawitz Natural Deduction: A Proof-Theoretical Study , 1965 .

[20]  Torsten Grust,et al.  Haskell Boards the Ferry - Database-Supported Program Execution for Haskell , 2010, IFL.

[21]  Erik Meijer The World According to LINQ , 2011, ACM Queue.

[22]  Torsten Grust,et al.  Avalanche-safe LINQ compilation , 2010, Proc. VLDB Endow..

[23]  Eberhard Karls,et al.  A Ferry-Based Query Backend for the Links Programming Language , 2011 .

[24]  Ralf H. Reussner,et al.  A case study evaluation of maintainability and performance of persistency techniques , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[25]  Oren Eini The pain of implementing LINQ providers , 2011, CACM.

[26]  Mihai Budiu,et al.  Programming Languages and Systems , 2003, Lecture Notes in Computer Science.

[27]  Joseph Sventek,et al.  Computer and Information Science , 2015, Computer and Information Science.

[28]  Geoffrey Mainland,et al.  Nikola: embedding compiled GPU functions in Haskell , 2010 .

[29]  Don Syme,et al.  Leveraging .NET meta-programming components from F#: integrated queries and interoperable heterogeneous execution , 2006, ML '06.

[30]  Mary Sheeran,et al.  The Design and Implementation of Feldspar - An Embedded Language for Digital Signal Processing , 2010, IFL.

[31]  Philip Wadler,et al.  Well-Typed Programs Can't Be Blamed , 2009, ESOP.

[32]  Peter Buneman,et al.  Types and persistence in database programming languages , 1987, CSUR.

[33]  Adam Chlipala,et al.  Ur: statically-typed metaprogramming with type-level record computation , 2010, PLDI '10.

[34]  Philip W. Trinder,et al.  Comprehensions, a Query Notation for DBPLs , 1992, DBPL.

[35]  Makoto Tatsuta,et al.  Static analysis of multi-staged programs via unstaging translation , 2011, POPL '11.

[36]  Atsushi Ohori,et al.  Making standard ML a practical database programming language , 2011, ICFP '11.

[37]  Limsoon Wong,et al.  Normal Forms and Conservative Extension Properties for Query Languages over Collection Types , 1996, J. Comput. Syst. Sci..

[38]  Brian Beckman,et al.  LINQ: reconciling object, relations and XML in the .NET framework , 2006, SIGMOD Conference.

[39]  Philip Wadler,et al.  Links: Web Programming Without Tiers , 2006, FMCO.