r10383: 06 Apr 2005 Kevin Rosenberg <kevin@rosenberg.net>
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 6 Apr 2005 15:58:09 +0000 (15:58 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 6 Apr 2005 15:58:09 +0000 (15:58 +0000)
        * Version 3.1.9
        * db-mysql/mysql-sql.lisp: Add port to connection specification
        based on patch from Dave Watson
        * doc/appendix.xml: Document MySQL port parameter to connection spec

ChangeLog
db-mysql/mysql-sql.lisp
debian/changelog
doc/appendix.xml

index a53f07de7708d5003a718f650cf198bdb26ad9c0..b92bd38884a553224974a4c0f42adbfa61d451a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
+06 Apr 2005 Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 3.1.9
+       * db-mysql/mysql-sql.lisp: Add port to connection specification
+       based on patch from Dave Watson
+       * doc/appendix.xml: Document MySQL port parameter to connection spec
+
 03 Apr 2005 Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 3.1.8
        * sql/time.lisp: Patch from Keith James for parsing ISO-8601 timestamps
        
 18 Mar 2005 Kevin Rosenberg <kevin@rosenberg.net>
index 2945258de5f292f1f668a278a7f446e038d78d91..5468ac5075c914ca53ec45c7ec639eb7ea288363 100644 (file)
   :mysql)
 
 (defmethod database-name-from-spec (connection-spec (database-type (eql :mysql)))
-  (check-connection-spec connection-spec database-type (host db user password))
-  (destructuring-bind (host db user password) connection-spec
+  (check-connection-spec connection-spec database-type
+                        (host db user password &optional port))
+  (destructuring-bind (host db user password &optional port) connection-spec
     (declare (ignore password))
     (concatenate 'string 
-                (if host host "localhost")
+                (etypecase host
+                  (null "localhost")
+                  (pathname (namestring host))
+                  (string host))
+                (if port 
+                    (concatenate 'string
+                                 ":"
+                                 (etypecase port
+                                   (integer (write-to-string port))
+                                   (string port)))
+                    "")
                 "/" db "/" user)))
 
 (defmethod database-connect (connection-spec (database-type (eql :mysql)))
-  (check-connection-spec connection-spec database-type (host db user password))
-  (destructuring-bind (host db user password) connection-spec
+  (check-connection-spec connection-spec database-type
+                        (host db user password &optional port))
+  (destructuring-bind (host db user password &optional port) connection-spec
     (let ((mysql-ptr (mysql-init (uffi:make-null-pointer 'mysql-mysql)))
          (socket nil))
       (if (uffi:null-pointer-p mysql-ptr)
                (if (uffi:null-pointer-p 
                     (mysql-real-connect 
                      mysql-ptr host-native user-native password-native
-                     db-native 0 socket-native 0))
+                     db-native
+                     (etypecase port
+                       (null 0)
+                       (integer port)
+                       (string (parse-integer port)))
+                     socket-native 0))
                    (progn
                      (setq error-occurred t)
                      (error 'sql-connection-error
           database :auto nil))))
 
 (defmethod database-create (connection-spec (type (eql :mysql)))
-  (destructuring-bind (host name user password) connection-spec
+  (destructuring-bind (host name user password &optional port) connection-spec
     (multiple-value-bind (output status)
-       (clsql-sys:command-output "mysqladmin create -u~A -p~A -h~A ~A"
+       (clsql-sys:command-output "mysqladmin create -u~A -p~A -h~A~@[ -P~A~] ~A"
                                       user password 
                                       (if host host "localhost")
+                                      port name
                                       name)
       (if (or (not (eql 0 status))
              (and (search "failed" output) (search "error" output)))
        t))))
 
 (defmethod database-destroy (connection-spec (type (eql :mysql)))
-  (destructuring-bind (host name user password) connection-spec
+  (destructuring-bind (host name user password &optional port) connection-spec
     (multiple-value-bind (output status)
-       (clsql-sys:command-output "mysqladmin drop -f -u~A -p~A -h~A ~A"
+       (clsql-sys:command-output "mysqladmin drop -f -u~A -p~A -h~A~@[ -P~A~] ~A"
                                       user password 
                                       (if host host "localhost")
-                                      name)
+                                      port name)
       (if (or (not (eql 0 status))
              (and (search "failed" output) (search "error" output)))
          (error 'sql-database-error
     t))
 
 (defmethod database-list (connection-spec (type (eql :mysql)))
-  (destructuring-bind (host name user password) connection-spec
+  (destructuring-bind (host name user password &optional port) connection-spec
     (declare (ignore name))
-    (let ((database (database-connect (list host "mysql" user password) type)))
+    (let ((database (database-connect (list host "mysql" user password port) type)))
       (unwind-protect
           (progn
             (setf (slot-value database 'clsql-sys::state) :open)
index fe22a3d42e43331159203333d2fb977c7d01f328..6fb9fd8d8089470ab0399a24f216a0f4ea40a4ab 100644 (file)
@@ -1,3 +1,9 @@
+cl-sql (3.1.9-1) unstable; urgency=low
+
+  * New upstream
+
+ -- Kevin M. Rosenberg <kmr@debian.org>  Wed,  6 Apr 2005 09:30:51 -0600
+
 cl-sql (3.1.8-1) unstable; urgency=low
 
   * New upstream
index a37c582a9459f1f2e012c45df0ac0f2d07a39f0f..c8ce4bb3e0b85ca44a4ee444dcc8baac741a0bd0 100644 (file)
        <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>