Abstract
One of the most ubiquitous elements of modern computing is the relational database. Very few modern applications are created without some sort of database backend. Unfortunately, relational database concepts are fundamentally very different from those used in general-purpose programming languages. This creates an impedance mismatch between the the application and the database layers. One solution to this problem which has been gaining traction in the .NET family of languages is Language-Integrated Queries (LINQ). That is, the embedding of database queries within application code in a way that is statically checked and type safe. Unfortunately, certain language changes or core design elements were necessary to make this embedding possible. We present a framework which implements this concept of type safe embedded queries in Scala without any modifications to the language itself. The entire framework is implemented by leveraging existing language features (particularly for-comprehensions).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Cook, W.R., Rai, S.: Safe Query Objects: Statically typed objects as remotely executable queries. In: Proceedings of the International Conference on Software Engineering (ICSE), pp. 97–106 (2005)
Defunkt, C.: Ruby’s Ambition (2008), http://ambition.rubyforge.org/
Elliott, C., Finne, S., De Moor, O.: Compiling Embedded Languages. Journal of Functional Programming 13(03), 455–481 (2003)
Fowler, M.: Domain Specific Language (2007), http://www.martinfowler.com/bliki/DomainSpecificLanguage.html
Gil, J.Y., Lenz, K.: Simple and safe SQL queries with C++ templates. In: GPCE 2007: Proceedings of the 6th international conference on Generative programming and component engineering, pp. 13–24 (2007)
Leijen, D., Meijer, E.: Domain specific embedded compilers. In: Proceedings of the 2nd Conference on Domain-Specific Languages, pp. 109–122 (1999)
Maier, D.: Representing database programs as objects. In: Advances in database programming languages, pp. 377–386. ACM, New York (1990)
Meijer, E., Beckman, B., Bierman, G.M.: LINQ: Reconciling object, relations and XML in the .NET framework. In: Proceedings of the ACM Symposium on Principles Database Systems (2006)
Melton, J., Eisenberg, A.: Understanding SQL and Java together: a guide to SQLJ, JDBC, and related technologies. Morgan Kaufmann, San Francisco (2000)
Steele Jr., G.L.: Common LISP: the language. Digital Press (1984)
Van Wyk, E., Krishnan, L., Bodin, D., Johnson, E.: Adding domain-specific and general purpose language features to java with the java language extender. In: Companion to the 21st ACM SIGPLAN symposium on Object-oriented programming systems, languages, and applications, pp. 728–729 (2006)
Welsh, N., Solsona, F., Glover, I.: SchemeUnit and SchemeQL: Two little languages. In: Third Workshop on Scheme and Functional Programming (2002)
Zeiger, S.: A Type-Safe Database Query DSL for Scala (2008), http://szeiger.de/blog/2008/12/21/a-type-safe-database-query-dsl-for-scala/
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2010 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Spiewak, D., Zhao, T. (2010). ScalaQL: Language-Integrated Database Queries for Scala. In: van den Brand, M., Gašević, D., Gray, J. (eds) Software Language Engineering. SLE 2009. Lecture Notes in Computer Science, vol 5969. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-12107-4_12
Download citation
DOI: https://doi.org/10.1007/978-3-642-12107-4_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-12106-7
Online ISBN: 978-3-642-12107-4
eBook Packages: Computer ScienceComputer Science (R0)