Name

DATABASE-NAME — Get the name of a database objectGeneric Function

Syntax

database-name database => name

Arguments and Values

database

A database object, either of type database or of type closed-database.

name

A string describing the identity of the database to which this database object is connected to.

Description

This function returns the database name of the given database. The database name is a string which somehow describes the identity of the database to which this database object is or has been connected. The database name of a database object is determined at connect time, when a call to database-name-from-spec derives the database name from the connection specification passed to connect in the connection-spec parameter.

The database name is used via find-database in connect to determine whether database connections to the specified database exist already.

Usually the database name string will include indications of the host, database name, user, or port that where used during the connection attempt. The only important thing is that this string shall try to identify the database at the other end of the connection. Connection specifications parts like passwords and credentials shall not be used as part of the database name.

Examples

(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"
	

Side Effects

None.

Affected By

database-name-from-spec

Exceptional Situations

Will signal an error if the object passed as the database parameter is neither of type database nor of type closed-database.

See Also

connect
find-database
connected-databases
disconnect
status

Notes

None.