r1650: *** empty log message ***
[clsql.git] / doc / intro.sgml
1 <!-- -*- DocBook -*- -->
2
3 <chapter>
4   <title>Introduction</title>
5
6   <sect1>
7     <title>Purpose</title>
8     <para>&clsql; is a Common Lisp interface to <glossterm
9 linkend="gloss-sql">SQL</glossterm> databases.  A number of Common
10 Lisp implementations and SQL databases are supported.The general
11 structure of &clsql; is based on the
12 <application>CommonSQL</application> package by Xanalys.</para>
13   </sect1>
14
15   <sect1>
16     <title>History</title>
17     <para>
18       &clsql; is written by Kevin M. Rosenberg and based substantially
19 on Pierre R. Mai's excellent &maisql; package. The main changes from &maisql;
20 are:
21 <itemizedlist>
22 <listitem>
23 <para>port from the &cmucl; FFI to &uffi;.</para>
24 </listitem>
25 <listitem>
26 <para>new &acl; ODBC interface back-end.</para>
27 </listitem>
28 <listitem>
29 <para>compatibility layer for &cmucl; specific code.</para>
30 </listitem>
31 <listitem>
32 <para>much improved robustness for the &mysql; back-end.</para>
33 </listitem>
34 <listitem>
35 <para>improved system loading.</para>
36 </listitem>
37 <listitem>
38 <para>improved packages and symbol export.</para>
39 </listitem>
40 </itemizedlist>
41     </para>
42   </sect1>
43
44   <sect1>
45     <title>Prerequisites</title>
46
47     <sect2>
48       <title>&defsystem;</title>
49       <para> &clsql; uses &defsystem to compile and load its
50 components.  &defsystem; is included in the <ulink
51 url="http://clocc.sourceforge.net"><citetitle>&clocc;</citetitle></ulink> collection. The
52 version in the pre-packaged distribution is rather old and
53 may not function well. The version in CVS tree tree works quite
54 well. For convenience, a copy of the latest &defsystem; at the FTP
55 <ulink
56 url="ftp://ftp.med-info.com/pub/defsystem/"><citetitle>site</citetitle></ulink>
57 of &clsql;.
58       </para>
59     </sect2>
60
61     <sect2>
62       <title>&uffi;</title>
63       <para> &clsql; uses <ulink
64 url="http://uffi.med-info.com/"><citetitle>&uffi;</citetitle></ulink>
65 as a <emphasis>Foreign Function Interface</emphasis> (<glossterm
66 linkend="gloss-ffi">FFI</glossterm>) to support multiple &cl;
67 implementations.</para> 
68
69 <para>You can download &uffi; from its FTP <ulink
70 url="ftp://ftp.med-info.com/pub/uffi/"><citetitle>site</citetitle></ulink>. There
71 are zip files for Microsoft Windows systems and gzipped tar files for
72 other systems.</para>
73     </sect2>
74
75     <sect2>
76       <title>Supported Common Lisp Implementation</title>
77       <para>
78 The implementations that support &clsql; is governed by the supported
79 implementations of &uffi;. At the time of the initial release of &clsql;,
80 the following implementations are supported:
81       </para>
82       <itemizedlist mark="opencircle">
83         <listitem><para>&acl; v6.1 on Redhat Linux 7.2 and Microsoft Windows.</para></listitem>
84         <listitem><para>&lw; v4.2 on Redhat Linux 7.2 and Microsoft Windows.</para></listitem>
85         <listitem><para>&cmucl; 18d on Redhat Linux 7.2.</para></listitem>
86       </itemizedlist>
87     </sect2>
88
89     <sect2>
90       <title>Supported &sql; Implementation</title>
91       <para>
92         Currently, &clsql; supports the following databases:
93       </para>
94       <itemizedlist mark="opencircle">
95         <listitem><para>&mysql; v3.23.49 on Redhat Linux 7.2 and Microsoft Windows.</para></listitem>
96         <listitem><para>&postgresql; v7.1 on Redhat Linux 7.2. Support for both direct API connections and TCP socket connections.</para></listitem>
97         <listitem><para>Allegro's ODBC interface (&aodbc;) on Redhat Linux 7.2 and Microsoft Windows.</para></listitem>
98       </itemizedlist>
99     </sect2>
100
101   </sect1>
102
103   <sect1>
104     <title>Installation</title>
105
106     <sect2>
107       <title>Ensure &defsystem; is loaded</title>
108       <para>
109         Simply load the file <filename>defsystem.lisp</filename>.
110         <programlisting>
111 (load "defsystem.lisp")
112         </programlisting>
113       </para>
114     </sect2>
115
116     <sect2>
117       <title>Build <filename>clsql-mysql</filename> helper library</title>
118       <para>&mysql; uses functions that require 64-bit integer
119 parameters and return values. The &ffi; in most &clsql;
120 implementations do not support 64-bit integers. Thus, a C helper
121 library is required to break these 64-bit integers into two compatible
122 32-bit integers.</para>
123
124 <para><filename>Makefile</filename>'s for Microsoft Windows and GNU/Solaris systems
125 are supplied to build this library. In addition, the <type>DLL</type> and <type>LIB</type>
126 files for Microsoft Windows are supplied with the distribution.</para>
127
128 <para>To build the library, first move to the directory
129 <filename>interfaces/mysql</filename> directory. You may need to
130 edit <filename>Makefile</filename> or <filename>Makefile.msvc</filename> to
131 correctly specify the location of your &mysql; installation. On UNIX systems, use
132 the command:
133      <programlisting>make</programlisting>
134 On a Microsoft Windows system,
135 use the command: 
136      <programlisting>
137 nmake /f
138 Makefile.msvc
139   </programlisting></para>
140       </sect2>
141
142     <sect2>
143       <title>Load &uffi;</title>
144       <para>
145         Unpack the appropriate &uffi; version for your system which creates a directory
146 for the &uffi; files. Add that directory to Defsystem's <varname>mk:*central-registry*</varname>.
147 You can do that by either pushing the pathname of the directory onto this variable, or
148 use the new <function>add-registry-location</function> present in the newest versions of
149 &defsystem;. The following example code assumes the &uffi; files reside in the
150 <filename>/usr/local/src/lisp/uffi</filename> directory.
151         <programlisting>
152 (mk:add-registry-location #P"/usr/local/src/lisp/uffi")
153 (mk:load-system :uffi)
154         </programlisting>
155       </para>
156     </sect2>
157
158   </sect1>
159
160 </chapter>