Skip to main content

ScalaQL: Language-Integrated Database Queries for Scala

  • Conference paper
Software Language Engineering (SLE 2009)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 5969))

Included in the following conference series:

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).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. Defunkt, C.: Ruby’s Ambition (2008), http://ambition.rubyforge.org/

  3. Elliott, C., Finne, S., De Moor, O.: Compiling Embedded Languages. Journal of Functional Programming 13(03), 455–481 (2003)

    Article  MATH  Google Scholar 

  4. Fowler, M.: Domain Specific Language (2007), http://www.martinfowler.com/bliki/DomainSpecificLanguage.html

  5. 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)

    Google Scholar 

  6. Leijen, D., Meijer, E.: Domain specific embedded compilers. In: Proceedings of the 2nd Conference on Domain-Specific Languages, pp. 109–122 (1999)

    Google Scholar 

  7. Maier, D.: Representing database programs as objects. In: Advances in database programming languages, pp. 377–386. ACM, New York (1990)

    Google Scholar 

  8. 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)

    Google Scholar 

  9. Melton, J., Eisenberg, A.: Understanding SQL and Java together: a guide to SQLJ, JDBC, and related technologies. Morgan Kaufmann, San Francisco (2000)

    Google Scholar 

  10. Steele Jr., G.L.: Common LISP: the language. Digital Press (1984)

    Google Scholar 

  11. 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)

    Google Scholar 

  12. Welsh, N., Solsona, F., Glover, I.: SchemeUnit and SchemeQL: Two little languages. In: Third Workshop on Scheme and Functional Programming (2002)

    Google Scholar 

  13. 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/

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics