probe-database tries to connect to database
Richard Lewis <[email protected]> Tue, 28 Feb 2012 18:43:02 +0000
| Newsgroups | gmane.lisp.clsql.general |
|---|---|
| Message-ID | <871upepznt.wl%[email protected]> |
Hi there,
In my application I need to test if a MySQL database exists, and
create it if not. I tried using probe-database for this:
(clsql:probe-database '("localhost" "mydb" "root" "password"))
however, I get the following:
While trying to connect to database localhost/mydb/root
using database-type MYSQL:
Error 1049 / Unknown database 'mydb'
has occurred.
[Condition of type CLSQL-SYS:SQL-CONNECTION-ERROR]
0: ((SB-PCL::FAST-METHOD CLSQL-SYS:DATABASE-CONNECT (T (EQL :MYSQL))) #<unavailable argument> #<unavailable argument> ("localhost" "mydb" "root" "password" NIL) :MYSQL)
1: ((SB-PCL::FAST-METHOD CLSQL-SYS:DATABASE-LIST (T (EQL :MYSQL))) #<unavailable argument> #<unavailable argument> ("localhost" "mydb" "root" "password") :MYSQL)
2: ((SB-PCL::FAST-METHOD CLSQL-SYS:DATABASE-PROBE (T (EQL :MYSQL))) #<unavailable argument> #<unavailable argument> ("localhost" "mydb" "root" "password") :MYSQL)
3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CLSQL-SYS:PROBE-DATABASE '("localhost" "mydb" "root" "password")) #<NULL-LEXENV>)
4: (EVAL (CLSQL-SYS:PROBE-DATABASE '("localhost" "mydb" "root" "password")))
So it seems that probe-database actually tries to connect to the
database to be probed.
For now, I'm using:
(member "mydb" (clsql:list-databases '("localhost" "mysql" "root" "password")) :test #'string=)
Cheers,
Richard
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard Lewis
ISMS, Computing
Goldsmiths, University of London
http://www.richardlewis.me.uk/
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-