vix.ing · top · new · best · stats · spec

A Typeful Integration of SQL into Curry

2016/12/30 by Michael Hanus, Julia Krone
Computer Science · #Compiler #Curry #Data definition language #Distributed systems and fault tolerance #Extension (predicate logic) #Formal Methods in Verification #Language Integrated Query #Logic, programming, and type systems #Preprocessor #Relational database #SQL #cs.DB #cs.PL

paper · pdf · doi:10.4204/eptcs.234.8

published as EPTCS 234, 2017, pp. 104-119 · In Proceedings WLP'15/'16/WFLP'16, arXiv:1701.00148

openalex publication_date 2016/12/30 · arxiv created 2017/01/03 · arxiv updated 2017/01/04 · openalex created_date 2017/01/06 · openalex updated_date 2026/08/05

Abstract

We present an extension of the declarative programming language Curry to support the access to data stored in relational databases via SQL. Since Curry is statically typed, our emphasis on this SQL integration is on type safety. Our extension respects the type system of Curry so that run-time errors due to ill-typed data are avoided. This is obtained by preprocessing SQL statements at compile time and translating them into type-safe database access operations. As a consequence, the type checker of the Curry system can spot type errors in SQL statements at compile time. To generate appropriately typed access operations, the preprocessor uses an entity-relationship (ER) model describing the structure of the relational data. In addition to standard SQL, SQL statements embedded in Curry can include program expressions and also relationships specified in the ER model. The latter feature is useful to avoid the error-prone use of foreign keys. As a result, our SQL integration supports a high-level and type-safe access to databases in Curry programs.

Citations