From: Kevin M. Rosenberg Date: Wed, 6 Apr 2005 15:58:09 +0000 (+0000) Subject: r10383: 06 Apr 2005 Kevin Rosenberg X-Git-Tag: v3.8.6~169 X-Git-Url: http://git.kpe.io/?p=clsql.git;a=commitdiff_plain;h=55f590bf6f5298e59aae30f02c958388f483da02 r10383: 06 Apr 2005 Kevin Rosenberg * 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 --- diff --git a/ChangeLog b/ChangeLog index a53f07d..b92bd38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ +06 Apr 2005 Kevin Rosenberg + * 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 + * Version 3.1.8 * sql/time.lisp: Patch from Keith James for parsing ISO-8601 timestamps 18 Mar 2005 Kevin Rosenberg diff --git a/db-mysql/mysql-sql.lisp b/db-mysql/mysql-sql.lisp index 2945258..5468ac5 100644 --- a/db-mysql/mysql-sql.lisp +++ b/db-mysql/mysql-sql.lisp @@ -95,16 +95,28 @@ :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) @@ -123,7 +135,12 @@ (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 @@ -403,11 +420,12 @@ 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))) @@ -418,12 +436,12 @@ 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 @@ -438,9 +456,9 @@ 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) diff --git a/debian/changelog b/debian/changelog index fe22a3d..6fb9fd8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-sql (3.1.9-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Wed, 6 Apr 2005 09:30:51 -0600 + cl-sql (3.1.8-1) unstable; urgency=low * New upstream diff --git a/doc/appendix.xml b/doc/appendix.xml index a37c582..c8ce4bb 100644 --- a/doc/appendix.xml +++ b/doc/appendix.xml @@ -240,7 +240,7 @@ Connection Specification Syntax of connection-spec - (host db user password) + (host db user password &optional port) Description of connection-spec @@ -277,6 +277,13 @@ field. + + port + + String representing the port to use for + communication with the MySQL server. + +