>> YANA 4 PHP Framework >> Docs For Class DbServer

Class DbServer

Description

Connection to a database server

This class provides methods to establish or test connections with database servers.

  • name: DbServer
  • access: public

Located in /includes/class_dbserver.php

Object
   |
   --DbServer
Method Summary
  • DbServer DbServer ([array $dsn = null])
  • mixed &get ()
  • bool test (string $dsn)

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

  • name: DbServer::get()
  • access: public
test if a connection is available
bool test (
string $dsn
)
List of parameters:
Name Type Description
$dsn string array
Description:

returns (boolean) true if a connection to a db-server could be established via the provided parameters. See the constructor method for details on the $dsn parameter

  • name: DbServer::test()
  • access: public
inherited from base classes

Inherited From Object

Documentation generated on Sun, 11 Mar 2007 15:02:27 +0100 by phpDocumentor 1.3.1

yana author: Thomas MeyerHomepage: www.yanaframework.net