r10612: 05 Jul 2005 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / doc / intro.xml
1 <?xml version='1.0' ?>
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">
5 %myents;
6 ]>
7
8 <chapter id="introduction">
9   <title>Introduction</title>
10
11   <sect1 id="purpose">
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 &commonsql; package by
17     LispWorks Ltd.
18     </para>
19   </sect1>
20   
21   <sect1 id="history">
22     <title>History</title>
23     <para>
24       The &clsql; project was started by Kevin M. Rosenberg in 2001 to
25       support SQL access on multiple Common Lisp implementations using
26       the &uffi; library. The initial code was based substantially on
27       Pierre R. Mai's excellent &maisql; package. In late 2003, the
28       &usql; library was orphaned by its author, onShore Development,
29       Inc. In April 2004, Marcus Pearce ported the &usql; library to
30       &clsql;.  The &usql; library provides a &commonsql;-compatible
31       API for &clsql;.
32     </para>
33
34     <para>The main changes from &maisql; and &usql; are:
35       <itemizedlist>
36         <listitem>
37           <para>Port from the &cmucl; FFI to &uffi; which provide
38           compatibility with the major Common Lisp
39           implementations.</para>
40         </listitem>
41         <listitem>
42           <para>Optimized loading of integer and floating-point fields.</para>
43         </listitem>
44         <listitem>
45           <para>Additional database backends: &odbc;, &aodbc;, &sqlite;
46           and &sqlite3;.</para>
47         </listitem>
48         <listitem>
49           <para>A compatibility layer for &cmucl; specific code.</para>
50         </listitem>
51         <listitem>
52           <para>Much improved robustness for the &mysql; back-end
53           along with version 4 client library support.</para>
54         </listitem>
55         <listitem>
56           <para>Improved library loading and installation documentation.</para>
57         </listitem>
58         <listitem>
59           <para>Improved packages and symbol export.</para>
60         </listitem>
61         <listitem>
62           <para>Pooled connections.</para>
63         </listitem>
64         <listitem>
65           <para>Integrated transaction support for the classic
66           &maisql; iteration macros.</para>
67         </listitem>
68       </itemizedlist>
69     </para>
70   </sect1>
71   
72   <sect1 id="prerequisites">
73     <title>Prerequisites</title>
74     
75     <sect2>
76       <title>&asdf;</title>
77       <para>
78         &clsql; uses &asdf; to compile and load its components.
79         &asdf; is included in the <ulink
80         url="http://cclan.sourceforge.net"><citetitle>&cclan;</citetitle></ulink>
81         collection.
82       </para>
83     </sect2>
84     
85     <sect2>
86       <title>&uffi;</title>
87       <para>
88         &clsql; uses <ulink
89         url="http://uffi.b9.com/"><citetitle>&uffi;</citetitle></ulink>
90         as a <emphasis>Foreign Function Interface</emphasis>
91         (<glossterm linkend="gloss-ffi">FFI</glossterm>) to support
92         multiple &cl; implementations.
93       </para> 
94     </sect2>
95     
96     <sect2>
97       <title>&md5;</title>
98       <para>&clsql;'s postgresql-socket interface uses Pierre Mai's 
99         <ulink url="ftp://files.b9.com/md5/">md5</ulink>
100         module.
101       </para>       
102     </sect2>
103     <sect2>
104       <title>Supported Common Lisp Implementation</title>
105       <para>
106         The implementations that support &clsql; is governed by the supported
107         implementations of &uffi;. The following implementations are supported:
108       </para>
109       <itemizedlist mark="opencircle">
110         <listitem><para>&acl; v6.2 and 7.0b on Debian Linux x86 &amp;
111         x86_64 &amp; PowerPC, FreeBSD 4.5, and Microsoft Windows
112         XP.</para></listitem>
113         <listitem><para>&lw; v4.3 on Debian Linux and Microsoft
114         Windows XP.</para></listitem>
115         <listitem><para>&cmucl; 18e on Debian Linux, FreeBSD 4.5, and
116         Solaris 2.8.</para></listitem>
117         <listitem><para>&sbcl; 0.8.5 on Debian
118         Linux.</para></listitem>
119         <listitem><para>&scl; 1.1.1 on Debian Linux.</para></listitem>
120         <listitem><para>&openmcl; 0.14 on Debian Linux
121         PowerPC.</para></listitem>
122       </itemizedlist>
123     </sect2>
124     
125     <sect2>
126       <title>Supported &sql; Implementation</title>
127       <para>
128         Currently, &clsql; supports the following databases:
129       </para>
130       <itemizedlist mark="opencircle">
131         <listitem><para>&mysql; v3.23.51 and v4.0.18.</para></listitem>
132         <listitem><para>&postgresql; v7.4 with both direct API and TCP
133         socket connections.</para></listitem>
134         <listitem><para>&sqlite;.</para></listitem>
135         <listitem><para>&sqlite3;.</para></listitem>
136         <listitem><para>Direct &odbc; interface.</para></listitem>
137         <listitem><para>&oracle; OCI.</para></listitem>
138         <listitem><para>Allegro's DB interface (&aodbc;).</para></listitem>
139       </itemizedlist>
140     </sect2>
141     
142   </sect1>
143   
144   <sect1 id="installation">
145     <title>Installation</title>
146     
147     <sect2>
148       <title>Ensure &asdf; is loaded</title>
149       <para>
150         Simply load the file <filename>asdf.lisp</filename>.
151         <screen>
152 (load "asdf.lisp")
153         </screen>
154       </para>
155     </sect2>
156     
157     <sect2>
158       <title>Build &c; helper libraries</title>
159       <para>&clsql; uses functions that require 64-bit integer
160         parameters and return values. The &ffi; in most &clsql;
161         implementations do not support 64-bit integers. Thus, C helper
162         libraries are required to break these 64-bit integers into two compatible
163         32-bit integers. The helper libraries reside in the directories
164         <filename>uffi</filename> and <filename>db-mysql</filename>.
165       </para>
166       
167       <sect3>
168         <title>&mswindows;</title>
169         <para>
170           Files named <filename>Makefile.msvc</filename> are supplied
171           for building the libraries under Microsoft Windows.  Since
172           &mswindows; does not come with that compiler, compiled
173           <type>DLL</type> and <type>LIB</type> library files are
174           supplied with &clsql;.
175         </para>
176       </sect3>
177
178       <sect3>
179         <title>&unix;</title>
180         <para>
181           Files named <filename>Makefile</filename> are supplied for
182           building the libraries under &unix;. Loading the
183           <filename>.asd</filename> files automatically invokes
184           <application>make</application> when necessary. So, manual
185           building of the helper libraries is not necessary on most
186           &unix; systems. However, the location of the &mysql; library
187           files and include files may need to adjusted in
188           <filename>db-mysql/Makefile</filename> on non-Debian
189           systems.
190         </para>
191       </sect3>
192       
193     </sect2>
194     
195     <sect2>
196       <title>Add &uffi; path</title>
197       <para>
198         Unzip or untar the &uffi; distribution which creates a directory
199         for the &uffi; files. Add that directory to &asdf;'s <varname>asdf:*central-registry*</varname>.
200         You can do that by pushing the pathname of the directory onto this variable.
201         The following example code assumes the &uffi; files reside in the
202         <filename>/usr/share/lisp/uffi/</filename> 
203         directory.
204         <screen>
205 (push #P"/usr/share/lisp/uffi/" asdf:*central-registry*)
206         </screen>
207       </para>
208     </sect2>
209    <sect2>
210      <title>Add &md5; path</title>
211      <para>
212        If you plan to use the clsql-postgresql-socket interface, you
213        must load the md5 module.  Unzip or untar the cl-md5
214        distribution, which creates a directory for the cl-md5 files.
215        Add that directory to &asdf;'s
216        <varname>asdf:*central-registry*</varname>.  You can do that by
217        pushing the pathname of the directory onto this variable.  The
218        following example code assumes the cl-md5 files reside in the
219        <filename>/usr/share/lisp/cl-md5/</filename> directory.
220        <screen>
221 (push #P"/usr/share/lisp/cl-md5/" asdf:*central-registry*)
222        </screen>
223      </para>
224    </sect2>
225    
226    <sect2>
227      <title>Add &clsql; path and load module</title>
228      <para>
229        Unzip or untar the &clsql; distribution which creates a
230        directory for the &clsql; files. Add that directory to &asdf;'s
231        <varname>asdf:*central-registry*</varname>.  You can do that by
232        pushing the pathname of the directory onto this variable.  The
233        following example code assumes the &clsql; files reside in the
234        <filename>/usr/share/lisp/clsql/</filename> directory. You need
235        to load the <symbol>clsql</symbol> system.
236
237         <screen>
238 (push #P"/usr/share/lisp/clsql/" asdf:*central-registry*)
239 (asdf:operate 'asdf:load-op 'clsql)                   ; main CLSQL package
240         </screen>
241       </para>
242     </sect2>
243     
244     <sect2>
245       <title>Run test suite (optional)</title>
246       <para>
247         The test suite can be executed using the &asdf;
248         <symbol>test-op</symbol> operator. If &clsql; has not been
249         loaded with <symbol>asdf:load-op</symbol>, the
250         <symbol>asdf:test-op</symbol> operator will automatically load
251         &clsql;. A configuration file named
252         <filename>.clsql-test.config</filename> must be created in
253         your home directory. There are instructures on the format of
254         that file in the <filename>tests/README</filename>. After
255         creating <filename>.clsql-test.config</filename>, you can run
256         the test suite with &asdf;:
257         <screen>
258           (asdf:operate 'asdf:test-op 'clsql)
259         </screen>
260       </para>
261     </sect2>
262     
263   </sect1>
264
265 </chapter>
266