summaryrefslogtreecommitdiff
path: root/doc/intro.xml
blob: 936cf59e9acd8d5c14cf7d91f690b32d0ee7996b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<?xml version='1.0' ?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
               "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % myents SYSTEM "entities.inc">
%myents;
]>

<chapter id="introduction">
  <title>Introduction</title>

  <sect1 id="purpose">
    <title>Purpose</title>
    <para>&clsql; is a Common Lisp interface to <glossterm
    linkend="gloss-sql">SQL</glossterm> databases.  A number of Common
    Lisp implementations and SQL databases are supported. The general
    structure of &clsql; is based on the &commonsql; package by
    LispWorks Ltd.
    </para>
  </sect1>
  
  <sect1 id="history">
    <title>History</title>
    <para>
      The &clsql; project was started by Kevin M. Rosenberg in 2001 to
      support SQL access on multiple Common Lisp implementations using
      the &uffi; library. The initial code was based substantially on
      Pierre R. Mai's excellent &maisql; package. In late 2003, the
      &usql; library was orphaned by its author, onShore Development,
      Inc. In April 2004, Marcus Pearce ported the &usql; library to
      &clsql;.  The &usql; library provides a &commonsql;-compatible
      API for &clsql;.
    </para>

    <para>The main changes from &maisql; and &usql; are:
      <itemizedlist>
	<listitem>
	  <para>Port from the &cmucl; FFI to &uffi; which provide
	  compatibility with the major Common Lisp
	  implementations.</para>
	</listitem>
	<listitem>
	  <para>Optimized loading of integer and floating-point fields.</para>
	</listitem>
	<listitem>
	  <para>Additional database backends: &odbc;, &aodbc;, &sqlite;
	  and &sqlite3;.</para>
	</listitem>
	<listitem>
	  <para>A compatibility layer for &cmucl; specific code.</para>
	</listitem>
	<listitem>
	  <para>Much improved robustness for the &mysql; back-end
	  along with version 4 client library support.</para>
	</listitem>
	<listitem>
	  <para>Improved library loading and installation documentation.</para>
	</listitem>
	<listitem>
	  <para>Improved packages and symbol export.</para>
	</listitem>
	<listitem>
	  <para>Pooled connections.</para>
	</listitem>
	<listitem>
	  <para>Integrated transaction support for the classic
	  &maisql; iteration macros.</para>
	</listitem>
      </itemizedlist>
    </para>
  </sect1>
  
  <sect1 id="prerequisites">
    <title>Prerequisites</title>
    
    <sect2>
      <title>&asdf;</title>
      <para>
	&clsql; uses &asdf; to compile and load its components.
	&asdf; is included in the <ulink
	url="http://cclan.sourceforge.net"><citetitle>&cclan;</citetitle></ulink>
	collection.
      </para>
    </sect2>
    
    <sect2>
      <title>&uffi;</title>
      <para>
	&clsql; uses <ulink
	url="http://uffi.kpe.io/"><citetitle>&uffi;</citetitle></ulink>
	as a <emphasis>Foreign Function Interface</emphasis>
	(<glossterm linkend="gloss-ffi">FFI</glossterm>) to support
	multiple &cl; implementations.
      </para> 
    </sect2>
    
    <sect2>
      <title>&md5;</title>
      <para>&clsql;'s postgresql-socket interface uses Pierre Mai's 
	<ulink url="http://files.kpe.io/md5/">md5</ulink>
	module.
      </para>       
    </sect2>
    <sect2>
      <title>Supported Common Lisp Implementation</title>
      <para>
	The implementations that support &clsql; is governed by the supported
	implementations of &uffi;. The following implementations are supported:
      </para>
      <itemizedlist mark="opencircle">
	<listitem><para>&acl; v6.2 through 8.0 on Debian Linux x86 &amp;
	x86_64 &amp; PowerPC, FreeBSD 4.5, and Microsoft Windows
	XP.</para></listitem>
	<listitem><para>&lw; v4.3 and v4.4 on Debian Linux and Microsoft
	Windows XP.</para></listitem>
	<listitem><para>&cmucl; 18e on Debian Linux, FreeBSD 4.5, and
	Solaris 2.8. 19c on Debian Linux.</para></listitem>
	<listitem><para>&sbcl; 0.8.4 through 0.9.16 on Debian
	Linux.</para></listitem>
	<listitem><para>&scl; 1.1.1 on Debian Linux.</para></listitem>
	<listitem><para>&openmcl; 0.14 PowerPC and 1.0pre AMD64 on Debian Linux .</para></listitem>
      </itemizedlist>
    </sect2>
    
    <sect2>
      <title>Supported &sql; Implementation</title>
      <para>
	&clsql; supports the following databases:
      </para>
      <itemizedlist mark="opencircle">
	<listitem><para>&mysql; (tested v3.23.51, v4.0.18, 5.0.24).</para></listitem>
	<listitem><para>&postgresql; (tested with v7.4 and 8.0 with both direct API and TCP
	socket connections.</para></listitem>
	<listitem><para>&sqlite;.</para></listitem>
	<listitem><para>&sqlite3;.</para></listitem>
	<listitem><para>Direct &odbc; interface.</para></listitem>
        <listitem><para>&oracle; OCI.</para></listitem>
	<listitem><para>Allegro's DB interface (&aodbc;).</para></listitem>
      </itemizedlist>
    </sect2>
    
  </sect1>
  
  <sect1 id="installation">
    <title>Installation</title>
    
    <sect2>
      <title>Ensure &asdf; is loaded</title>
      <para>
	Simply load the file <filename>asdf.lisp</filename>.
	<screen>
(load "asdf.lisp")
	</screen>
      </para>
    </sect2>
    
    <sect2>
      <title>Build &c; helper libraries</title>
      <para>&clsql; uses functions that require 64-bit integer
	parameters and return values. The &ffi; in most &clsql;
	implementations do not support 64-bit integers. Thus, C helper
	libraries are required to break these 64-bit integers into two compatible
	32-bit integers. The helper libraries reside in the directories
	<filename>uffi</filename> and <filename>db-mysql</filename>.
      </para>
      
      <sect3>
	<title>&mswindows;</title>
	<para>
	  Files named <filename>Makefile.msvc</filename> are supplied
	  for building the libraries under Microsoft Windows.  Since
	  &mswindows; does not come with that compiler, compiled
	  <type>DLL</type> and <type>LIB</type> library files are
	  supplied with &clsql;.
	</para>
      </sect3>

      <sect3>
	<title>&unix;</title>
	<para>
	  Files named <filename>Makefile</filename> are supplied for
	  building the libraries under &unix;. Loading the
	  <filename>.asd</filename> files automatically invokes
	  <application>make</application> when necessary. So, manual
	  building of the helper libraries is not necessary on most
	  &unix; systems. However, the location of the &mysql; library
	  files and include files may need to adjusted in
	  <filename>db-mysql/Makefile</filename> on non-Debian
	  systems.
	</para>
      </sect3>
      
    </sect2>
    
    <sect2>
      <title>Add &uffi; path</title>
      <para>
	Unzip or untar the &uffi; distribution which creates a directory
	for the &uffi; files. Add that directory to &asdf;'s <varname>asdf:*central-registry*</varname>.
	You can do that by pushing the pathname of the directory onto this variable.
	The following example code assumes the &uffi; files reside in the
	<filename>/usr/share/lisp/uffi/</filename> 
	directory.
	<screen>
(push #P"/usr/share/lisp/uffi/" asdf:*central-registry*)
	</screen>
      </para>
    </sect2>
   <sect2>
     <title>Add &md5; path</title>
     <para>
       If you plan to use the clsql-postgresql-socket interface, you
       must load the md5 module.  Unzip or untar the cl-md5
       distribution, which creates a directory for the cl-md5 files.
       Add that directory to &asdf;'s
       <varname>asdf:*central-registry*</varname>.  You can do that by
       pushing the pathname of the directory onto this variable.  The
       following example code assumes the cl-md5 files reside in the
       <filename>/usr/share/lisp/cl-md5/</filename> directory.
       <screen>
(push #P"/usr/share/lisp/cl-md5/" asdf:*central-registry*)
       </screen>
     </para>
   </sect2>
   
   <sect2>
     <title>Add &clsql; path and load module</title>
     <para>
       Unzip or untar the &clsql; distribution which creates a
       directory for the &clsql; files. Add that directory to &asdf;'s
       <varname>asdf:*central-registry*</varname>.  You can do that by
       pushing the pathname of the directory onto this variable.  The
       following example code assumes the &clsql; files reside in the
       <filename>/usr/share/lisp/clsql/</filename> directory. You need
       to load the <symbol>clsql</symbol> system.

	<screen>
(push #P"/usr/share/lisp/clsql/" asdf:*central-registry*)
(asdf:operate 'asdf:load-op 'clsql)                   ; main CLSQL package
	</screen>
      </para>
    </sect2>
    
    <sect2>
      <title>Run test suite (optional)</title>
      <para>
	The test suite can be executed using the &asdf;
	<symbol>test-op</symbol> operator. If &clsql; has not been
	loaded with <symbol>asdf:load-op</symbol>, the
	<symbol>asdf:test-op</symbol> operator will automatically load
	&clsql;. A configuration file named
	<filename>.clsql-test.config</filename> must be created in
	your home directory. There are instructures on the format of
	that file in the <filename>tests/README</filename>. After
	creating <filename>.clsql-test.config</filename>, you can run
	the test suite with &asdf;:
	<screen>
	  (asdf:operate 'asdf:test-op 'clsql)
        </screen>
      </para>
    </sect2>
    
  </sect1>

</chapter>