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