[icfp] clean up SQL/sql

This commit is contained in:
ben 2016-03-16 08:31:40 -04:00
parent f14387469a
commit bc4753c502
4 changed files with 11 additions and 8 deletions

View File

@ -4,7 +4,7 @@
\mod{fun/domain} & Infer function domain types \\ \mod{fun/domain} & Infer function domain types \\
\mod{num/value} & Evaluate a numeric expression \\ \mod{num/value} & Evaluate a numeric expression \\
\mod{pattern/groups} & Count regexp groups \\ \mod{pattern/groups} & Count regexp groups \\
\mod{query/constr} & Parse \mod{SQL} queries \\ \mod{query/constr} & Parse {\tt sql} queries \\
\mod{schema/spec} & Lift a schema value from syntax \\ \mod{schema/spec} & Lift a schema value from syntax \\
\mod{string/format} & Parse format directives \\ \mod{string/format} & Parse format directives \\
\mod{vector/length} & Infer length from a vector spec. \\ \mod{vector/length} & Infer length from a vector spec. \\

View File

@ -26,7 +26,7 @@ Another 145 lines implement common functionality, putting the grand total
Except for @exact|{\mod{db}}| and @exact|{\mod{regexp}}|, each of the Except for @exact|{\mod{db}}| and @exact|{\mod{regexp}}|, each of the
core modules defines a single interpretation function (in @exact|{$\interp$}|). core modules defines a single interpretation function (in @exact|{$\interp$}|).
In @exact|{\mod{db}}|, the two functions are the schema predicate and @tt{SQL} In @exact|{\mod{db}}|, the two functions are the schema predicate and @tt{sql}
query parser. query parser.
In @exact|{\mod{regexp}}|, we have six group-parsing functions In @exact|{\mod{regexp}}|, we have six group-parsing functions
to match the six string-like input types to match the six string-like input types
@ -423,7 +423,8 @@ By tagging calls to @racket[vector-map] with a syntax property, our system
@centered[ @centered[
@codeblock{ @codeblock{
(vector-length (vector-map f v)) (vector-length (vector-map f v))
== (vector-length v) ==
(vector-length v)
} }
] ]

View File

@ -38,8 +38,10 @@
@include-section{implementation.scrbl} @include-section{implementation.scrbl}
@include-section{conclusion.scrbl} @include-section{conclusion.scrbl}
@;@section[#:style 'unnumbered]{Acknowledgments} @section[#:style 'unnumbered]{Acknowledgments}
@;
To appear
@;We thank @;We thank
@;Sam Tobin-Hochstadt for reminding us that Typed Racket is macro-extensible, @;Sam Tobin-Hochstadt for reminding us that Typed Racket is macro-extensible,
@;Ryan Culpepper for divulging secrets of the Racket macro system, @;Ryan Culpepper for divulging secrets of the Racket macro system,

View File

@ -384,13 +384,13 @@ We do, however, optimize vector references to unsafe primitives and
@; ============================================================================= @; =============================================================================
@section[#:tag "sec:sql"]{Database Schema} @section[#:tag "sec:sql"]{Database Schema}
Racket's @racket[db] library provides a string-based API for executing SQL Racket's @racket[db] library provides a string-based API for executing @tt{sql}
queries.@note{In this section, we use @tt{sql} as an abbreviation for @tt{postgresql}.} queries.@note{In this section, we use @tt{sql} as an abbreviation for @tt{postgresql}.}
After connecting to a database, SQL queries embedded in strings can be run After connecting to a database, @tt{sql} queries embedded in strings can be run
to retrieve row values, represented as Racket vectors. to retrieve row values, represented as Racket vectors.
Queries may optionally contain @emph{query parameters}---natural numbers Queries may optionally contain @emph{query parameters}---natural numbers
prefixed by a dollar sign (@tt{$}). prefixed by a dollar sign (@tt{$}).
Arguments substituted for query parameters are guarded against SQL injection. Arguments substituted for query parameters are guarded against @tt{sql} injection.
@exact|{ @exact|{
\begin{SCodeFlow}\begin{RktBlk}\begin{SingleColumn}\RktSym{{\Stttextmore}}\mbox{\hphantom{\Scribtexttt{x}}}\RktPn{(}\RktSym{define}\mbox{\hphantom{\Scribtexttt{x}}}\RktSym{C}\mbox{\hphantom{\Scribtexttt{x}}}\RktPn{(}\RktSym{sql{-}connect}\mbox{\hphantom{\Scribtexttt{x}}}\RktPn{\#{\hbox{\texttt{:}}}user}\mbox{\hphantom{\Scribtexttt{x}}}\RktVal{"admin"} \begin{SCodeFlow}\begin{RktBlk}\begin{SingleColumn}\RktSym{{\Stttextmore}}\mbox{\hphantom{\Scribtexttt{x}}}\RktPn{(}\RktSym{define}\mbox{\hphantom{\Scribtexttt{x}}}\RktSym{C}\mbox{\hphantom{\Scribtexttt{x}}}\RktPn{(}\RktSym{sql{-}connect}\mbox{\hphantom{\Scribtexttt{x}}}\RktPn{\#{\hbox{\texttt{:}}}user}\mbox{\hphantom{\Scribtexttt{x}}}\RktVal{"admin"}