DATABASE-NAME-FROM-SPEC — Return the database name string corresponding to the given connection specification.Generic Function
connection-spec
A connection specification, whose structure and
interpretation are dependent on the
database-type
.
database-type
A database type specifier, i.e. a keyword.
A string denoting a database name.
This generic function takes a connection specification
and a database type and returns the database name of the
database object that would be created had
connect
been called with the given
connection specification and database types.
This function is useful in determining a database name from the connection specification, since the way the connection specification is converted into a database name is dependent on the database type.
(database-name-from-spec '("dent" "newesim" "dent" "dent") :mysql) => "dent/newesim/dent" (connect '("dent" "newesim" "dent" "dent") :database-type :mysql) => #<CLSQL-MYSQL:MYSQL-DATABASE {48391DCD}> (database-name *default-database*) => "dent/newesim/dent" (database-name-from-spec '(nil "template1" "dent" nil) :postgresql) => "/template1/dent" (connect '(nil "template1" "dent" nil) :database-type :postgresql) => #<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE {48392D2D}> (database-name *default-database*) => "/template1/dent" (database-name-from-spec '("www.pmsf.de" "template1" "dent" nil) :postgresql) => "www.pmsf.de/template1/dent" (find-database "dent/newesim/dent") => #<CLSQL-MYSQL:MYSQL-DATABASE {484E91C5}> (find-database "/template1/dent") => #<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE {48392D2D}> (find-database "www.pmsf.de/template1/dent" nil) => NIL (find-database **) => #<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE {48392D2D}>