skip to main content
research-article

Making standard ML a practical database programming language

Published:19 September 2011Publication History
Skip Abstract Section

Abstract

Integrating a database query language into a programming language is becoming increasingly important in recently emerging high-level cloud computing and other applications, where efficient and sophisticated data manipulation is required during computation. This paper reports on seamless integration of SQL into SML# - an extension of Standard ML. In the integrated language, the type system always infers a principal type for any type consistent SQL expression. This makes SQL queries first-class citizens, which can be freely combined with any other language constructs definable in Standard ML. For a program involving SQL queries, the compiler separates SQL queries and delegates their evaluation to a database server, e.g. PostgreSQL or MySQL in the currently implemented version.

The type system of our language is largely based on Machiavelli, which demonstrates that ML with record polymorphism can represent type structure of SQL. In order to develop a practical language, however, a number of technical challenges have to be overcome, including static enforcement of server connection consistency, proper treatment of overloaded SQL primitives, query compilation, and runtime connection management. This paper describes the necessary extensions to the type system and compilation, and reports on the details of its implementation.

Skip Supplemental Material Section

Supplemental Material

_talk4.mp4

References

  1. M. Abadi, L. Cardelli, B. Pierce, and G. Plotkin. Dynamic typing in a statically-typed language. ACM Trans. Program. Lang. Syst., 13(2):207--268, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Albano, G. Ghelli, and R. Orsini. Fibonacci: a programming language for object databases. The VLDB Journal, 4(3):403--444, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. J. Annevelink. Database programming languages: a functional approach. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 318--327, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M.P. Atkinson and O.P. Buneman. Types and persistence in database programming languages. ACM Computing Surveys, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Blanas, J. M. Patel, V. Ercegovac, J. Rao, E. J. Shekita, and Y. Tian. A comparison of join algorithms for log processing in mapreduce. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 975--986, 2010. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. P. Buneman, S. Naqvi, V. Tannen, and L. Wong. Principles of programming with complex objects and collection types. Theor. Comput. Sci., 149(1):3--48, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. A. Chlipala. Ur: statically-typed metaprogramming with type-level record computation. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 122--133, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. E. F. Codd. A relational model for large shared databank. Communications of the ACM, 13(6):377--387, 1970. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. E. Cooper. The script-writer's dream: How to write great SQL in your own language, and be sure it will succeed. In Proceedings of the International Symposium on Database Programming Languages, pages 36--51, Springer-Verlag, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. E. Cooper, S. Lindley, P. Wadler, and J. Yallop. Links: web programming without tiers. In Proceedings of the International Conference on Formal Methods for Components and Objects, pages 266--296, Springer-Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. G. Copeland and D. Maier. Making smalltalk a database system. In Proceedings of the ACM SIGMOD International Conferenceon Management of Data, pages 316--325, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. J. Dean and S. Ghemawat. Mapreduce: simplified data processing on large clusters. Commun. ACM, 51(1):107--113, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. A. Eisenberg and J. Melton. SQLJ part 0, now known as SQL/OLB (object-language bindings). SIGMOD Rec., 27(4):94--100, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Gil and K. Lenz. Simple and safe SQL queries with C++ templates. Science of Computer Programming, 75(7):573--595, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Giorgidze, T. Grust, T. Schreiber, and J. Weijers. Haskell boards the Ferry: Database-supported program execution for Haskell. In Proceedings of the 22nd international symposium on Implementation and Application of Functional Languages, to appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. T. Grust, M. Mayr, J. Rittinger, and T. Schreiber. FERRY: database-supported program execution. In Proceedings of the SIGMOD International Conference on Management of Data, pages 1063--1066, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. C. V. Hall, K. Hammond, S. L. Peyton Jones, and P. L. Wadler. Type classes in haskell. ACM Trans. Program. Lang. Syst., 18(2):109--138, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. P. Hudak. Building domain-specific embedded languages. ACM Comput. Surv., page 196, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. D. Leijen and E. Meijer. Domain specific embedded compilers. In Proceedings of the 2nd USENIX Conference on Domain Specific Languages, pages 109--122, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Y. Leontiev, M. T. Özsu, and D. Szafron. On type systems for object-oriented database programming languages. ACM Comput. Surv., 34(4):409--449, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Maier. Why database languages are a bad idea. In F. Bancilhon and P. Buneman, editors, Proceedings of the International Workshop on Database Programming Languages, Addison-Wesley, 1989.Google ScholarGoogle Scholar
  22. E. Meijer, B. Beckman, and G. Bierman. LINQ: Reconciling object, relations and XML in the .NET framework. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 706--706, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML. The MIT Press, revised edition, 1997. Google ScholarGoogle ScholarCross RefCross Ref
  24. J.C. Mitchell and G.D. Plotkin. Abstract types have existential type. ACM Trans. Program. Lang. Syst., 10(3):470--502, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. R. Morrison, F. Brown, R. Connor, Q. Cutts, A. Dearle, G. Kirby, and D. Munro. Napier88 reference manual. Technical report, University of St. Andrews, 1996.Google ScholarGoogle Scholar
  26. H-D. Nguyen and A. Ohori. Compiling ml polymporphism with explicit layout bitmap. In Proceedings of the ACM Conference on Principles andPractice of Declarative Programming, pages 237--248, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. A. Ohori. A polymorphic record calculus and its compilation. ACM Trans. Program. Lang. Syst., 17(6):844--895, 1995. A preliminary summary appeared at ACM POPL, 1992 under the title "A compilation method for ML-style polymorphic record calculi". Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. A. Ohori and P. Buneman. Type inference in a database programming language. In Proceedings of the ACM Conference on LISP and Functional Programming, pages 174--183, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. A. Ohori, P. Buneman, and V. Breazu-Tannen. Database programming in Machiavelli - a polymorphic language with static type inference. In Proceedings of the ACM SIGMOD International Conference on Management of Data, pages 46--57, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. D. Remy. Typechecking records and variants in a natural extension of ML. In Proceedings of the ACM Symposium on Principles of Programming Languages, pages 242--249, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. SML#. http://www.riec.tohoku.ac.jp/smlsharp/.Google ScholarGoogle Scholar
  32. J. Bussche, D. Van Gucht, and S. Vansummeren. A crash course on database queries. In Proceedings of the ACM SIGMOD-SIGACT-SIGART Symposiumon Principles of Database Systems, pages 143--154, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Limsoon Wong. Kleisli, a functional query system. J. Funct. Program., 10(1):19--56, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. C. Lécluse and P. Richard. The O2 database programming language. In Proceedings of the International Conference on Very Large Data Bases, pages 423--432, Morgan Kaufmann Publishers Inc, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Making standard ML a practical database programming language

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 46, Issue 9
        ICFP '11
        September 2011
        456 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2034574
        Issue’s Table of Contents
        • cover image ACM Conferences
          ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
          September 2011
          470 pages
          ISBN:9781450308656
          DOI:10.1145/2034773

        Copyright © 2011 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 19 September 2011

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!