- (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~@[ -P~A~] ~A"
- user password
- (if host host "localhost")
- port name)
- (if (or (not (eql 0 status))
- (and (search "failed" output) (search "error" output)))
- (error 'sql-database-error
- :message
- (format nil "mysql database deletion failed with connection-spec ~A."
- connection-spec))
- t))))
+ (destructuring-bind (host name user password) connection-spec
+ (let ((database (database-connect (list host "" user password)
+ type)))
+ (setf (slot-value database 'clsql-sys::state) :open)
+ (unwind-protect
+ (database-execute-command (format nil "drop database ~A" name) database)
+ (database-disconnect database)))))