{"size": 2641, "ext": "scrbl", "max_stars_repo_path": "db-doc/db/scribblings/db.scrbl", "max_stars_repo_name": "Bogdanp/racket-db", "max_stars_repo_stars_event_min_datetime": "2015-01-23T01:06:46.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-28T09:51:50.000Z", "max_issues_repo_path": "db-doc/db/scribblings/db.scrbl", "max_issues_repo_name": "Bogdanp/racket-db", "max_issues_repo_issues_event_min_datetime": "2015-02-23T01:59:45.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-16T05:40:36.000Z", "max_forks_repo_path": "db-doc/db/scribblings/db.scrbl", "max_forks_repo_name": "Bogdanp/racket-db", "max_forks_repo_forks_event_min_datetime": "2015-02-20T03:02:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-09T05:03:24.000Z"}
{"max_stars_count": 18, "max_issues_count": 24, "max_forks_count": 16, "avg_line_length": 40.0151515152, "max_line_length": 81, "alphanum_fraction": 0.7625899281}
#lang scribble/doc
@(require scribble/manual
          scribble/struct
          scribble/eval
          "config.rkt")

@title{DB: Database Connectivity}
@author[@author+email["Ryan Culpepper" "ryanc@racket-lang.org"]]

@section-index["database"]

@centered{@bold{@italic{A database interface for functional programmers.}}}

@defmodule[db]

This library provides a high-level interface to several database
systems. The following database systems are currently supported:
@itemlist[

@item{@bold{@as-index{@hyperlink["http://www.postgresql.org"]{PostgreSQL}}
versions 7.4 and later.} This library implements the PostgreSQL wire
protocol, so no native client library is required.}

@item{@bold{@as-index{@hyperlink["http://www.mysql.com"]{MySQL}} versions 5 and
later.} This library implements the MySQL wire protocol, so no
native client library is required.}

@item{@bold{@as-index{@hyperlink["http://www.sqlite.org"]{SQLite}} version
3.} The SQLite native client library is required; see
@secref["sqlite3-requirements"].}

@item{@bold{@as-index{@hyperlink["http://cassandra.apache.org"]{Cassandra}}
versions 2.1.0 and later.} This library implements the Cassandra wire
protocol (v3), so no native client is required.}

@item{@bold{@as-index{ODBC}.} An ODBC Driver Manager and appropriate
ODBC drivers are required; see @secref["odbc-requirements"]. The
following database systems are known to work with this library via
ODBC (see @secref["odbc-status"] for details):
@bold{@as-index{@hyperlink["http://www.ibm.com/software/data/db2/"]{DB2}}},
@bold{@as-index{@hyperlink["http://www.oracle.com"]{Oracle}}}, and
@bold{@as-index{@hyperlink["http://www.microsoft.com/sqlserver/"]{SQL Server}}}.}
]

The query operations are functional in spirit: queries return results
or raise exceptions rather than stashing their state into a cursor
object for later navigation and retrieval. Query parameters and result
fields are automatically translated to and from appropriate Racket
values. Resources are managed automatically by the garbage collector
and via custodians. Connections are internally synchronized, so
multiple threads can use a connection simultaneously.

@bold{Acknowledgments} Thanks to Dave Gurnell, Noel Welsh, Mike Burns,
and Doug Orleans for contributions to @tt{spgsql}, the PostgreSQL-only
predecessor of this library. The SQLite support is based in part on
code from Jay McCarthy's @tt{sqlite} package.

@include-section["using-db.scrbl"]
@include-section["connect.scrbl"]
@include-section["query.scrbl"]
@include-section["sql-types.scrbl"]
@include-section["util.scrbl"]
@include-section["notes.scrbl"]

@(close-eval fake-eval)
