API Documentation

Application/Resource/Multidb.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Application
subpackage
Resource
version
$Id$
Classes
Zend_Application_Resource_Multidb

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Application_Resource_Multidb

Extends from
Zend_Application_Resource_ResourceAbstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Application
subpackage
Resource
Properties
$_dbs
$_defaultDb
Methods
init
isDefault
getDb
getDefaultDb
_setDefault

Description

Cache Manager resource

Example configuration:

  resources.multidb.db1.adapter = "pdo_mysql"
  resources.multidb.db1.host = "localhost"
  resources.multidb.db1.username = "webuser"
  resources.multidb.db1.password = "XXXX"
  resources.multidb.db1.dbname = "db1"
  resources.multidb.db1.default = true

  resources.multidb.db2.adapter = "pdo_pgsql"
  resources.multidb.db2.host = "example.com"
  resources.multidb.db2.username = "dba"
  resources.multidb.db2.password = "notthatpublic"
  resources.multidb.db2.dbname = "db2"

Properties

$_dbs

array $_dbs = 'array'

Associative array containing all configured db's

Details

$_dbs
array
visibility
protected
default
array
final
false
static
false

$_defaultDb

null|Zend_Db_Adapter_Abstract $_defaultDb = ''

An instance of the default db, if set

Details

$_defaultDb
null|Zend_Db_Adapter_Abstract
visibility
protected
default
final
false
static
false

Methods

_setDefault

_setDefault(  $adapter ) :

Set the default db adapter

Arguments
$adapter
Details
visibility
protected
final
false
static
false
$adapter
Zend_Db_Adapter_Abstract
Adapter to set as default

getDb

getDb( null|string|Zend_Db_Adapter_Abstract $db = null ) : Zend_Db_Adapter_Abstract

Retrieve the specified database connection

Arguments
$db
nullstringZend_Db_Adapter_Abstract
The adapter to retrieve. Null to retrieve the default connection
Details
visibility
public
final
false
static
false
throws
if the given parameter could not be found

getDefaultDb

getDefaultDb( boolean $justPickOne = true ) : null|Zend_Db_Adapter_Abstract

Get the default db connection

Arguments
$justPickOne
boolean
If true, a random (the first one in the stack) connection is returned if no default was set. If false, null is returned if no default was set.
Details
visibility
public
final
false
static
false

init

init( ) : Zend_Application_Resource_Multidb

Initialize the Database Connections (instances of Zend_Db_Table_Abstract)

Details
visibility
public
final
false
static
false

isDefault

isDefault( string|Zend_Db_Adapter_Abstract $db ) : boolean

Determine if the given db(identifier) is the default db.

Arguments
$db
stringZend_Db_Adapter_Abstract
The db to determine whether it's set as default
Output
boolean
True if the given parameter is configured as default. False otherwise
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.