r8851: more integration
[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     Xanalys.
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 with the cessation of further development. In April 2004,
30       Marcus Pearce ported the &usql; library to &clsql;.  The &usql;
31       library provides a &commonsql;-compatible 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: &acl; ODBC and &sqlite;.</para>
46         </listitem>
47         <listitem>
48           <para>A compatibility layer for &cmucl; specific code.</para>
49         </listitem>
50         <listitem>
51           <para>Much improved robustness for the &mysql; back-end
52           along with version 4 client library support.</para>
53         </listitem>
54         <listitem>
55           <para>Improved library loading and installation documentation.</para>
56         </listitem>
57         <listitem>
58           <para>Improved packages and symbol export.</para>
59         </listitem>
60         <listitem>
61           <para>Pooled connections.</para>
62         </listitem>
63         <listitem>
64           <para>Integrated transaction support for the classic
65           &maisql; iteration macros.</para>
66         </listitem>
67       </itemizedlist>
68     </para>
69   </sect1>
70   
71   <sect1 id="prerequisites">
72     <title>Prerequisites</title>
73     
74     <sect2>
75       <title>&asdf;</title>
76       <para>
77         &clsql; uses &asdf; to compile and load its components.
78         &asdf; is included in the <ulink
79         url="http://cclan.sourceforge.net"><citetitle>&cclan;</citetitle></ulink>
80         collection.
81       </para>
82     </sect2>
83     
84     <sect2>
85       <title>&uffi;</title>
86       <para>
87         &clsql; uses <ulink
88         url="http://uffi.b9.com/"><citetitle>&uffi;</citetitle></ulink>
89         as a <emphasis>Foreign Function Interface</emphasis>
90         (<glossterm linkend="gloss-ffi">FFI</glossterm>) to support
91         multiple &cl; implementations.
92       </para> 
93     </sect2>
94     
95     <sect2>
96       <title>&md5;</title>
97       <para>&clsql;'s postgresql-socket interface uses Pierre Mai's 
98         <ulink url="ftp://clsql.b9.com/">md5</ulink>
99         module.
100       </para>       
101     </sect2>
102     <sect2>
103       <title>Supported Common Lisp Implementation</title>
104       <para>
105         The implementations that support &clsql; is governed by the supported
106         implementations of &uffi;. The following implementations are supported:
107       </para>
108       <itemizedlist mark="opencircle">
109         <listitem><para>&acl; v6.2 on Debian Linux, FreeBSD 4.5, and Microsoft Windows XP.</para></listitem>
110         <listitem><para>&lw; v4.3 on Debian Linux and Microsoft Windows XP.</para></listitem>
111         <listitem><para>&cmucl; 18e on Debian Linux, FreeBSD 4.5, and Solaris 2.8.</para></listitem>
112         <listitem><para>&sbcl; 0.8.5 on Debian Linux.</para></listitem>
113         <listitem><para>&scl; 1.1.1 on Debian Linux.</para></listitem>
114         <listitem><para>&openmcl; 0.14 on Debian Linux PowerPC.</para></listitem>
115       </itemizedlist>
116     </sect2>
117     
118     <sect2>
119       <title>Supported &sql; Implementation</title>
120       <para>
121         Currently, &clsql; supports the following databases:
122       </para>
123       <itemizedlist mark="opencircle">
124         <listitem><para>&mysql; v3.23.51 and v4.0.15.</para></listitem>
125         <listitem><para>&postgresql; v7.2 with both direct API and TCP
126         socket connections.</para></listitem>
127         <listitem><para>&sqlite;.</para></listitem>
128         <listitem><para>Allegro's ODBC interface (&aodbc;) using iODBC
129         ODBC manager.</para></listitem>
130       </itemizedlist>
131     </sect2>
132     
133   </sect1>
134   
135   <sect1 id="installation">
136     <title>Installation</title>
137     
138     <sect2>
139       <title>Ensure &asdf; is loaded</title>
140       <para>
141         Simply load the file <filename>asdf.lisp</filename>.
142         <screen>
143 (load "asdf.lisp")
144         </screen>
145       </para>
146     </sect2>
147     
148     <sect2>
149       <title>Build &c; helper libraries</title>
150       <para>&clsql; uses functions that require 64-bit integer
151         parameters and return values. The &ffi; in most &clsql;
152         implementations do not support 64-bit integers. Thus, C helper
153         libraries are required to break these 64-bit integers into two compatible
154         32-bit integers. The helper libraries reside in the directories
155         <filename>uffi</filename> and <filename>db-mysql</filename>.
156       </para>
157       
158       <sect3>
159         <title>&mswindows;</title>
160         <para>
161           Files named <filename>Makefile.msvc</filename> are supplied
162           for building the libraries under Microsoft Windows.  Since
163           &mswindows; does not come with that compiler, compiled
164           <type>DLL</type> and <type>LIB</type> library files are
165           supplied with &clsql;.
166         </para>
167       </sect3>
168
169       <sect3>
170         <title>&unix;</title>
171         <para>
172           Files named <filename>Makefile</filename> are supplied for
173           building the libraries under &unix;. Loading the
174           <filename>.asd</filename> files automatically invokes
175           <application>make</application> when necessary. So, manual
176           building of the helper libraries is not necessary on most
177           &unix; systems. However, the location of the &mysql; library
178           files and include files may need to adjusted in
179           <filename>db-mysql/Makefile</filename> on non-Debian
180           systems.
181         </para>
182       </sect3>
183       
184     </sect2>
185     
186     <sect2>
187       <title>Load &uffi;</title>
188       <para>
189         Unzip or untar the &uffi; distribution which creates a directory
190         for the &uffi; files. Add that directory to &asdf;'s <varname>asdf:*central-registry*</varname>.
191         You can do that by pushing the pathname of the directory onto this variable.
192         The following example code assumes the &uffi; files reside in the
193         <filename>/usr/share/lisp/uffi/</filename> 
194         directory.
195         <screen>
196 (push #P"/usr/share/lisp/uffi/" asdf:*central-registry*)
197 (asdf:operate 'asdf:load-op :uffi)
198         </screen>
199       </para>
200     </sect2>
201    <sect2>
202      <title>Load &md5; module</title>
203      <para>
204        If you plan to use the clsql-postgresql-socket interface, you
205        must load the md5 module.  Unzip or untar the cl-md5
206        distribution, which creates a directory for the cl-md5 files.
207        Add that directory to &asdf;'s
208        <varname>asdf:*central-registry*</varname>.  You can do that by
209        pushing the pathname of the directory onto this variable.  The
210        following example code assumes the cl-md5 files reside in the
211        <filename>/usr/share/lisp/cl-md5/</filename> directory.
212        <screen>
213 (push #P"/usr/share/lisp/cl-md5/" asdf:*central-registry*)
214 (asdf:operate 'asdf:load-op :md5)
215        </screen>
216      </para>
217    </sect2>
218    
219    <sect2>
220      <title>Load &clsql; modules</title>
221      <para>
222        Unzip or untar the &clsql; distribution which creates a
223        directory for the &clsql; files. Add that directory to &asdf;'s
224        <varname>asdf:*central-registry*</varname>.  You can do that by
225        pushing the pathname of the directory onto this variable.  The
226        following example code assumes the &clsql; files reside in the
227        <filename>/usr/share/lisp/clsql/</filename> directory. You need
228        to load, at a minimum, the main <symbol>clsql</symbol> system
229        and at least one interface system. The below example show loading
230        all &clsql; systems.
231
232         <screen>
233 (push #P"/usr/share/lisp/clsql/" asdf:*central-registry*)
234 (asdf:operate 'asdf:load-op 'clsql-base)              ; base CLSQL package
235 (asdf:operate 'asdf:load-op 'clsql-mysql)             ; MySQL interface
236 (asdf:operate 'asdf:load-op 'clsql-postgresql)        ; PostgreSQL interface
237 (asdf:operate 'asdf:load-op 'clsql-postgresql-socket) ; Socket PGSQL interface
238 (asdf:operate 'asdf:load-op 'clsql-aodbc)             ; Allegro ODBC interface
239 (asdf:operate 'asdf:load-op 'clsql)                   ; main CLSQL package
240         </screen>
241       </para>
242     </sect2>
243     
244     <sect2>
245       <title>Run test suite</title>
246       <para>
247         After loading &clsql;, you can execute the test suite. A
248         configuration file named
249         <filename>.clsql-test.config</filename> must be created in
250         your home directory. There are instructures on the format of
251         that file in the <filename>tests/tests.lisp</filename> file in
252         the &clsql; source directory. After creating that file, you
253         can run the test suite with &asdf;:
254         <screen>
255           (asdf:operate 'asdf:test-op 'clsql)
256         </screen>
257       </para>
258     </sect2>
259     
260   </sect1>
261
262 </chapter>
263