r8124: convert to xml
[clsql.git] / doc / intro.sgml
1 <?xml version='1.0' ?>   <!-- -*- DocBook -*- -->
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.xml">
5 %myents;
6 ]>
7
8 <chapter id="introduction">
9   <title>Introduction</title>
10
11   <sect1>
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> package by Xanalys.</para>
18   </sect1>
19
20   <sect1>
21     <title>History</title>
22     <para>
23       &clsql; is written by Kevin M. Rosenberg and based substantially
24 on Pierre R. Mai's excellent &maisql; package. The main changes from &maisql;
25 are:
26 <itemizedlist>
27 <listitem>
28 <para>port from the &cmucl; FFI to &uffi;.</para>
29 </listitem>
30 <listitem>
31 <para>new &acl; ODBC interface back-end.</para>
32 </listitem>
33 <listitem>
34 <para>compatibility layer for &cmucl; specific code.</para>
35 </listitem>
36 <listitem>
37 <para>much improved robustness for the &mysql; back-end.</para>
38 </listitem>
39 <listitem>
40 <para>improved system loading.</para>
41 </listitem>
42 <listitem>
43 <para>improved packages and symbol export.</para>
44 </listitem>
45 <listitem>
46 <para>transaction support.</para>
47 </listitem>
48 </itemizedlist>
49     </para>
50   </sect1>
51
52   <sect1>
53     <title>Prerequisites</title>
54
55     <sect2>
56       <title>&defsystem;</title>
57       <para> &clsql; uses &asdf; to compile and load its
58 components.  &asdf; is included in the <ulink
59 url="http://cclan.sourceforge.net"><citetitle>&cclan;</citetitle></ulink> collection.
60       </para>
61     </sect2>
62
63     <sect2>
64       <title>&uffi;</title>
65       <para>&clsql; uses <ulink
66 url="http://uffi.med-info.com/"><citetitle>&uffi;</citetitle></ulink>
67 as a <emphasis>Foreign Function Interface</emphasis> (<glossterm
68 linkend="gloss-ffi">FFI</glossterm>) to support multiple &cl;
69 implementations.</para> 
70
71 <para>You can download &uffi; from its FTP <ulink
72 url="ftp://ftp.med-info.com/pub/uffi/"><citetitle>site</citetitle></ulink>. There
73 are zip files for Microsoft Windows systems and gzipped tar files for
74 other systems.</para>
75     </sect2>
76
77     <sect2>
78       <title>&md5;</title>
79       <para>&clsql;'s postgresql-socket interface uses Pierre Mai's 
80        <ulink url="ftp://clsql.b9.com/">md5</ulink> module. If you plan to use
81        this interface please download the md5 module from ftp://clsql.b9.com </para>       
82     <sect2>
83       <title>Supported Common Lisp Implementation</title>
84       <para>
85 The implementations that support &clsql; is governed by the supported
86 implementations of &uffi;. The following implementations are supported:
87       </para>
88       <itemizedlist mark="opencircle">
89         <listitem><para>&acl; v6.2 on Debian Linux, FreeBSD 4.5, and Microsoft Windows XP.</para></listitem>
90         <listitem><para>&lw; v4.2 on Debian Linux and Microsoft Windows XP.</para></listitem>
91         <listitem><para>&cmucl; 18d on Debian Linux, FreeBSD 4.5, and Solaris 2.8.</para></listitem>
92         <listitem><para>&sbcl; 0.7.14 on Debian Linux.</para></listitem>
93         <listitem><para>&scl; 1.1 on Debian Linux.</para></listitem>
94         <listitem><para>&openmcl; 0.13 on Debian Linux PowerPC.</para></listitem>
95       </itemizedlist>
96     </sect2>
97
98     <sect2>
99       <title>Supported &sql; Implementation</title>
100       <para>
101         Currently, &clsql; supports the following databases:
102       </para>
103       <itemizedlist mark="opencircle">
104         <listitem><para>&mysql; v3.23.51.</para></listitem>
105         <listitem><para>&postgresql; v7.2 with both direct API and TCP socket connections.</para></listitem>
106         <listitem><para>Allegro's ODBC interface (&aodbc;) using iODBC ODBC manager.</para></listitem>
107       </itemizedlist>
108     </sect2>
109
110   </sect1>
111
112   <sect1>
113     <title>Installation</title>
114
115     <sect2>
116       <title>Ensure &defsystem; is loaded</title>
117       <para>
118         Simply load the file <filename>defsystem.lisp</filename>.
119         <programlisting>
120 (load "defsystem.lisp")
121         </programlisting>
122       </para>
123     </sect2>
124
125     <sect2>
126       <title>Build &c; helper libraries</title>
127       <para>&clsql; uses functions that require 64-bit integer
128 parameters and return values. The &ffi; in most &clsql;
129 implementations do not support 64-bit integers. Thus, C helper
130 libraries are required to break these 64-bit integers into two compatible
131 32-bit integers.</para>
132
133 <para>Makefiles for Microsoft Windows and GNU/Solaris systems
134 are supplied to build the libraries. Since many Microsoft Windows
135 users don't have access to a compiler, the <type>DLL</type> and <type>LIB</type>
136 files for Microsoft Windows are supplied with the distribution.</para>
137
138 <para>To build the libraries on a GNU or Solaris, use the shell and
139 change to the root directory of &clsql;. You may need to edit the file
140 <filename>interfaces/mysql/Makefile</filename> to specify the location of your
141 MySQL installation. The default Makefiles are setup for shared library
142 linking on Linux. If you are using FreeBSD or Solaris, you will need
143 to change the linker setting as instructed in the Makefile. 
144 Then, you can give the command
145 <programlisting>
146 make libs
147 </programlisting>
148 in the root directory of &clsql; to build the libraries 
149 <filename>interfaces/mysql/clsql-mysql.so</filename> and
150 <filename>interfaces/clsql-uffi/clsql-uffi.so</filename>.
151 </para>
152       </sect2>
153
154     <sect2>
155       <title>Load &uffi;</title>
156       <para>
157         Unzip or untar the &uffi; distribution which creates a directory
158 for the &uffi; files. Add that directory to Defsystem's <varname>asdf:*central-registry*</varname>.
159 You can do that by pushing the pathname of the directory onto this variable.
160  The following example code assumes the &uffi; files reside in the
161 <filename>/usr/share/lisp/uffi/</filename> directory.
162         <programlisting>
163 (push #P"/usr/share/lisp/uffi/" asdf:*central-registry*)
164 (asdf:oos 'asdf:load-op :uffi)
165         </programlisting>
166       </para>
167     </sect2>
168    <sect2>
169       <title>Load &md5; module</title>
170       <para>
171         If you plan to use the  clsql-postgresql-socket interface, you must load the md5 module.
172         Unzip or untar the cl-md5 distribution, which creates a directory for the cl-md5 files.
173         Add that directory to Defsystem's <varname>asdf:*central-registry*</varname>. 
174         You can do that by pushing the pathname of the directory onto this variable.
175         The following example code assumes the cl-md5 files reside in the
176         <filename>/usr/share/lisp/cl-md5/</filename> directory.
177         <programlisting>
178 (push #P"/usr/share/lisp/cl-md5/" asdf:*central-registry*)
179 (asdf:oos 'asdf:load-op :md5)
180         </programlisting>
181       </para>
182     </sect2>
183
184     <sect2>
185       <title>Load &clsql; modules</title>
186       <para>
187         Unzip or untar the &clsql; distribution which creates a directory
188 for the &clsql; files. Add that directory to Defsystem's <varname>asdf:*central-registry*</varname>.
189 You can do that by pushing the pathname of the directory onto this variable.
190  The following example code assumes the &clsql; files reside in the
191 <filename>/usr/share/lisp/clsql/</filename> directory. You need to load, at a minimum,
192 the main <symbol>:clsql</symbol> system and at least one interface system.
193         <programlisting>
194 (push #P"/usr/share/lisp/clsql/" asdf:*central-repository*)
195 (asdf:oos 'asdf:load-op :clsql-base)        ; base clsql package
196 (asdf:oos 'asdf:load-op :clsql-mysql)       ; MySQL interface
197 (asdf:oos 'asdf:load-op :clsql-postgresql)  ; PostgreSQL interface
198 (asdf:oos 'asdf:load-op :clsql-postgresql-socket) ; Socket PGSQL interface
199 (asdf:oos 'asdf:load-op :clsql-aodbc)       ; Allegro ODBC interface
200 (asdf:oos 'asdf:load-op :clsql)             ; main clsql package
201         </programlisting>
202       </para>
203     </sect2>
204
205     <sect2>
206       <title>Run test suite</title>
207       <para>
208         After loading &clsql;, you can execute the test program in
209 the directory <filename>./test-suite</filename>. The test file,
210 <filename>tester-clsql</filename>
211 has instructions for creating a <filename>test.config</filename>.
212 After creating that file, simple load the test file with Lisp
213 and the tests should automatically execute.
214       </para>
215     </sect2>
216
217   </sect1>
218
219 </chapter>