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