yana

phpDocumentor v 1.4.0

Class DbServer

Description

Connection to a database server
This class provides methods to establish or test connections with database servers.
  • access: public
  • name: DbServer
Object
   |
   --DbServer
Method Summary

Methods

create a new instance
DbServer DbServer (
[array $dsn = null]
)
List of parameters:
Name Type Description
$dsn array for a description of the $dsn parameter see the text above
Description:
The $dsn parameter became available in version 2.8 It is an array containing the following information (all entries are optional):
  •  string  ( DBMS )     default =  mysql      name of the php-dbms api to be used
                                                e.g. mysql, mysqli, db2, ...
  •  string  ( HOST )     default =  localhost  adress of the host e.g. localhost,
                                                123.456.789.0,
                                                COMPUTER-NAME\DB-INSTANCE (windows+MS-SQL)
  •  integer ( PORT )     default =  0          port number
  •  string  ( USERNAME ) default =  root
  •  string  ( PASSWORD ) default =  n/a
  •  string  ( DATABASE ) default =  yana       name of the database
The default settings may be changed by editing file config/system.config in key DEFAULT.DATABASE.DSN. The parameter $dsn has the following fall-back behaviour: $dsn -> global user settings -> yana default settings
  • name: DbServer::__consruct()
get a PEAR-DB connection object
mixed &get ()
Description:
This function returns an open database connection via PEAR-DB. The returned values are:
  •  null               = if PEAR-DB was not found
  •  (boolean) false    = if the connection failed
  •  (object) DB_common = if the connection was established successfully
  • access: public
  • name: DbServer::get()
alias of DbServer::get()
array getConnection ()
Description:
See DbServer::get() for details.
  • see: DbServer::get()
  • since: 2.9.8
  • access: public
  • name: DbServer::getConnection()
get the DSN
array getDsn ()
Description:
This function returns an associative array containing information on the current connection:
  • USE_ODBC: true, if ODBC is used to connect to the database
  • DBMS: name of used database system
  • HOST: host name, e.g. localhost
  • PORT: port number of database server (may be empty)
  • USERNAME
  • PASSWORD
  • DATABASE: name of database to connect to
Returns bool(false) on error.
  • since: 2.9.8
  • access: public
  • name: DbServer::getDsn()
test if a connection is available
bool isAvailable (
array $dsn
)
List of parameters:
Name Type Description
$dsn array
Description:
Returns bool(true) if a connection to a db-server could be established via the provided parameters, and bool(false) otherwise. See the constructor method for details on the $dsn parameter
  • see: DbServer::__consruct()
  • access: public
  • name: DbServer::isAvailable()
inherited from base classes

Inherited From Object

Documentation generated on Sat, 03 Jan 2009 22:22:19 +0100 by phpDocumentor 1.4.0

yana author: Thomas MeyerHomepage: www.yanaframework.net