2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % myents SYSTEM "entities.inc">
8 <chapter id="introduction">
9 <title>Introduction</title>
12 <title>Purpose</title>
13 <para>&clsql; is a Common Lisp interface to <glossterm
14 linkend="gloss-sql">SQL</glossterm> databases. A number of Common
15 Lisp implementations and SQL databases are supported. The general
16 structure of &clsql; is based on the
17 <application>CommonSQL</application>
23 <title>History</title>
25 &clsql; is written by Kevin M. Rosenberg and based substantially
26 on Pierre R. Mai's excellent &maisql; package. The main changes
30 <para>port from the &cmucl; FFI to &uffi;.</para>
33 <para>Optimized loading of integer and floating-point fields.</para>
36 <para>new &acl; ODBC interface back-end.</para>
39 <para>compatibility layer for &cmucl; specific code.</para>
42 <para>much improved robustness for the &mysql; back-end
43 along with version 4 client library support.</para>
46 <para>improved system loading.</para>
49 <para>improved packages and symbol export.</para>
52 <para>transaction support.</para>
58 <sect1 id="prerequisites">
59 <title>Prerequisites</title>
64 &clsql; uses &asdf; to compile and load its components.
65 &asdf; is included in the <ulink
66 url="http://cclan.sourceforge.net"><citetitle>&cclan;</citetitle></ulink>
75 url="http://uffi.b9.com/"><citetitle>&uffi;</citetitle></ulink>
76 as a <emphasis>Foreign Function Interface</emphasis>
77 (<glossterm linkend="gloss-ffi">FFI</glossterm>) to support
78 multiple &cl; implementations.
84 <para>&clsql;'s postgresql-socket interface uses Pierre Mai's
85 <ulink url="ftp://clsql.b9.com/">md5</ulink>
90 <title>Supported Common Lisp Implementation</title>
92 The implementations that support &clsql; is governed by the supported
93 implementations of &uffi;. The following implementations are supported:
95 <itemizedlist mark="opencircle">
96 <listitem><para>&acl; v6.2 on Debian Linux, FreeBSD 4.5, and Microsoft Windows XP.</para></listitem>
97 <listitem><para>&lw; v4.3 on Debian Linux and Microsoft Windows XP.</para></listitem>
98 <listitem><para>&cmucl; 18e on Debian Linux, FreeBSD 4.5, and Solaris 2.8.</para></listitem>
99 <listitem><para>&sbcl; 0.8.5 on Debian Linux.</para></listitem>
100 <listitem><para>&scl; 1.1.1 on Debian Linux.</para></listitem>
101 <listitem><para>&openmcl; 0.14 on Debian Linux PowerPC.</para></listitem>
106 <title>Supported &sql; Implementation</title>
108 Currently, &clsql; supports the following databases:
110 <itemizedlist mark="opencircle">
111 <listitem><para>&mysql; v3.23.51 and v4.0.15.</para></listitem>
112 <listitem><para>&postgresql; v7.2 with both direct API and TCP
113 socket connections.</para></listitem>
114 <listitem><para>Allegro's ODBC interface (&aodbc;) using iODBC
115 ODBC manager.</para></listitem>
121 <sect1 id="installation">
122 <title>Installation</title>
125 <title>Ensure &asdf; is loaded</title>
127 Simply load the file <filename>asdf.lisp</filename>.
135 <title>Build &c; helper libraries</title>
136 <para>&clsql; uses functions that require 64-bit integer
137 parameters and return values. The &ffi; in most &clsql;
138 implementations do not support 64-bit integers. Thus, C helper
139 libraries are required to break these 64-bit integers into two compatible
140 32-bit integers. The helper libraries reside in the directories
141 <filename>uffi</filename> and <filename>db-mysql</filename>.
145 <title>&mswindows;</title>
147 Files named <filename>Makefile.msvc</filename> are supplied
148 for building the libraries under Microsoft Windows. Since
149 &mswindows; does not come with that compiler, compiled
150 <type>DLL</type> and <type>LIB</type> library files are
151 supplied with &clsql;.
156 <title>&unix;</title>
158 Files named <filename>Makefile</filename> are supplied for
159 building the libraries under &unix;. Loading the
160 <filename>.asd</filename> files automatically invokes
161 <application>make</application> when necessary. So, manual
162 building of the helper libraries is not necessary on most
163 &unix; systems. However, the location of the &mysql; library
164 files and include files may need to adjusted in
165 <filename>db-mysql/Makefile</filename> on non-Debian
173 <title>Load &uffi;</title>
175 Unzip or untar the &uffi; distribution which creates a directory
176 for the &uffi; files. Add that directory to &asdf;'s <varname>asdf:*central-registry*</varname>.
177 You can do that by pushing the pathname of the directory onto this variable.
178 The following example code assumes the &uffi; files reside in the
179 <filename>/usr/share/lisp/uffi/</filename>
182 (push #P"/usr/share/lisp/uffi/" asdf:*central-registry*)
183 (asdf:operate 'asdf:load-op :uffi)
188 <title>Load &md5; module</title>
190 If you plan to use the clsql-postgresql-socket interface, you
191 must load the md5 module. Unzip or untar the cl-md5
192 distribution, which creates a directory for the cl-md5 files.
193 Add that directory to &asdf;'s
194 <varname>asdf:*central-registry*</varname>. You can do that by
195 pushing the pathname of the directory onto this variable. The
196 following example code assumes the cl-md5 files reside in the
197 <filename>/usr/share/lisp/cl-md5/</filename> directory.
199 (push #P"/usr/share/lisp/cl-md5/" asdf:*central-registry*)
200 (asdf:operate 'asdf:load-op :md5)
206 <title>Load &clsql; modules</title>
208 Unzip or untar the &clsql; distribution which creates a
209 directory for the &clsql; files. Add that directory to &asdf;'s
210 <varname>asdf:*central-registry*</varname>. You can do that by
211 pushing the pathname of the directory onto this variable. The
212 following example code assumes the &clsql; files reside in the
213 <filename>/usr/share/lisp/clsql/</filename> directory. You need
214 to load, at a minimum, the main <symbol>clsql</symbol> system
215 and at least one interface system. The below example show loading
219 (push #P"/usr/share/lisp/clsql/" asdf:*central-repository*)
220 (asdf:operate 'asdf:load-op 'clsql-base) ; base CLSQL package
221 (asdf:operate 'asdf:load-op 'clsql-mysql) ; MySQL interface
222 (asdf:operate 'asdf:load-op 'clsql-postgresql) ; PostgreSQL interface
223 (asdf:operate 'asdf:load-op 'clsql-postgresql-socket) ; Socket PGSQL interface
224 (asdf:operate 'asdf:load-op 'clsql-aodbc) ; Allegro ODBC interface
225 (asdf:operate 'asdf:load-op 'clsql) ; main CLSQL package
231 <title>Run test suite</title>
233 After loading &clsql;, you can execute the test suite. A
234 configuration file named
235 <filename>.clsql-test.config</filename> must be created in
236 your home directory. There are instructures on the format of
237 that file in the <filename>tests/tests.lisp</filename> file in
238 the &clsql; source directory. After creating that file, you
239 can run the test suite with &asdf;:
241 (asdf:operate 'asdf:test-op 'clsql)