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