r10612: 05 Jul 2005 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / doc / appendix.xml
index d6a50d9cf8aa5b4164e0aef5243564a5ea7899c5..1fdbed0961cc581db0e248cdca7f3a995e1221e3 100644 (file)
@@ -7,14 +7,53 @@
   
 <appendix id="appendix">
   <title>Database Back-ends</title>
-  
-    <sect1 id="postgresql">
-      <title>PostgreSQL</title>
-      <sect2>
-       <title>Libraries</title>
-       <para>The PostgreSQL back-end requires the PostgreSQL C 
-         client library (<filename>libpq.so</filename>).  The
-         location of this library is specified via 
+
+  <sect1 id="foreignlibs">
+    <title>How CLSQL finds and loads foreign  libraries</title>
+    <para>
+      For some database types CLSQL has to load external foreign
+      libaries.  These are usually searched for in the standard
+      locations the operating system uses but you can tell &clsql; to
+      look into other directories as well by using the function
+      <function>CLSQL:PUSH-LIBRARY-PATH</function> or by directly
+      manipulating the special variable
+      <varname>CLSQL:*FOREIGN-LIBRARY-SEARCH-PATHS*</varname>.  If,
+      say, the shared library libpq.so needed for PostgreSQL support
+      is located in the directory <filename>/opt/foo/</filename> on
+      your machine you'd use
+      <screen>
+       (clsql:push-library-path "/opt/foo/")
+      </screen>
+  before loading the CLSQL-POSTGRESQL module.  (Note the trailing
+  slash above!)
+
+  If you want to combine this with fully automatic loading of
+  libraries via ASDF a technique like the following works:
+
+  <screen>
+    (defmethod asdf:perform :after ((o asdf:load-op) 
+                                    (c (eql (asdf:find-system 'clsql))))
+      (funcall (find-symbol (symbol-name '#:push-library-path)
+                            (find-package 'clsql))
+               #p"/opt/foo/"))
+  </screen>
+    </para>
+
+    <para>
+      Additionally, site-specific initialization can be done using an
+initialization file. If the file <filename>/etc/clsql-init.lisp</filename> 
+exists, this file will be read after the &clsql; ASDF system is loaded.
+This file can contain forms to set site-specific paths as well as change
+&clsql; default values.
+    </para>
+  </sect1>
+  <sect1 id="postgresql">
+    <title>PostgreSQL</title>
+    <sect2>
+      <title>Libraries</title>
+      <para>The PostgreSQL back-end requires the PostgreSQL C 
+      client library (<filename>libpq.so</filename>).  The
+      location of this library is specified via 
          <symbol>*postgresql-so-load-path*</symbol>, which defaults
          to <filename>/usr/lib/libpq.so</filename>.  Additional flags 
          to <application>ld</application> needed for linking are
        <title>Connection Specification</title>
        <sect3>
          <title>Syntax of connection-spec</title>
-         <synopsis>(<replaceable>host</replaceable> <replaceable>db</replaceable> <replaceable>user</replaceable> <replaceable>password</replaceable>)</synopsis>
+         <synopsis>(<replaceable>host</replaceable> <replaceable>db</replaceable> <replaceable>user</replaceable> <replaceable>password</replaceable> &amp;optional <replaceable>port</replaceable>)</synopsis>
        </sect3>
        <sect3>
          <title>Description of connection-spec</title>
                  field.</para>
              </listitem>
            </varlistentry>
+           <varlistentry>
+             <term><parameter>port</parameter></term>
+             <listitem>
+               <para>String representing the port to use for
+                 communication with the MySQL server.</para>
+             </listitem>
+           </varlistentry>
          </variablelist>
        </sect3>
       </sect2>
       </sect2>
     </sect1>
 
+    <sect1 id="sqlite3">
+      <title>&sqlite3;</title>
+      <sect2>
+       <title>Libraries</title> <para>The &sqlite3; back-end requires
+       the &sqlite3; shared library file. Its default file name is
+       <filename>/usr/lib/libsqlite3.so</filename>.</para>
+      </sect2>
+      <sect2>
+       <title>Initialization</title>
+       <para>
+         Use 
+         <screen>
+(asdf:operate 'asdf:load-op 'clsql-sqlite3)
+         </screen>
+         to load the &sqlite3; back-end.  The database type for the &sqlite3;
+         back-end is <symbol>:sqlite3</symbol>.
+       </para>
+      </sect2>
+      <sect2>
+       <title>Connection Specification</title>
+       <sect3>
+         <title>Syntax of connection-spec</title>
+         <synopsis>(<replaceable>filename</replaceable> &amp;optional <replaceable>init-function</replaceable>)</synopsis>
+       </sect3>
+       <sect3>
+         <title>Description of connection-spec</title>
+         <variablelist>
+           <varlistentry>
+             <term><parameter>filename</parameter></term>
+             <listitem>
+               <para>String representing the filename of the &sqlite3;
+               database file.</para>
+             </listitem>
+           </varlistentry>
+           <varlistentry>
+             <term><parameter>init-function</parameter></term>
+             <listitem>
+               <para>
+                A function designator.
+                <replaceable>init-function</replaceable> takes a
+                single argument of type
+                <type>sqlite3:sqlite3-db</type>, a foreign pointer to
+                the C descriptor of the newly opened database.
+                <replaceable>init-function</replaceable> is called by
+                the back-end immediately after &sqlite3;
+                <function>sqlite3_open</function> library function,
+                and can be used to perform optional database
+                initializations by calling foreign functions in the
+                &sqlite3; library.
+               </para>
+               <para>
+                An example of an initialization function which
+                defines a new collating sequence for text columns is
+                provided in
+                <filename>./examples/sqlite3/init-func/</filename>.
+               </para>
+             </listitem>
+           </varlistentry>
+         </variablelist>
+       </sect3>
+      </sect2>
+      <sect2><title>Notes</title>
+      <sect3><title>Connection</title> 
+      <itemizedlist mark='opencircle'>
+        <listitem>
+          <para>
+            Passing <parameter>filename</parameter> a value of
+            <filename>:memory:</filename> will create a database in
+            physical memory instead of using a file on disk.
+          </para>
+        </listitem>        
+        <listitem>
+          <para>
+            Some operations will be many times faster if database
+            integrity checking is disabled by setting the SYNCHRONOUS
+            flag to OFF (see the SQLITE manual for details).
+          </para>
+        </listitem>
+      </itemizedlist>
+      </sect3>
+      <sect3><title>FDDL</title> 
+      <itemizedlist mark='opencircle'>
+        <listitem>
+          <para>
+            The <symbol>:owner</symbol> keyword argument to the FDDL functions 
+            for listing and testing for database objects is ignored. 
+          </para>
+        </listitem>        
+        <listitem>
+          <para>
+            The <symbol>:column-list</symbol> keyword argument to
+            <link
+            linkend="create-view"><function>create-view</function></link>
+            is not supported by &sqlite3;. 
+          </para>
+        </listitem>
+      </itemizedlist>
+      </sect3>
+      <sect3><title>Symbolic SQL Syntax</title>
+      <itemizedlist mark='opencircle'>
+        <listitem>
+          <para>
+            &sqlite3; does not support the <function>all</function>,
+            <function>some</function>, <function>any</function> and
+            <function>exists</function> subquery operations. 
+          </para>
+        </listitem>
+      </itemizedlist>
+      </sect3>
+      </sect2>
+    </sect1>
+
   <sect1 id="oracle">
     <title>Oracle</title>
     <sect2>