API Documentation

Zend/Application/Resource/Multidb.php

Show: inherited
Table of Contents

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.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Application  
Subpackage
Resource  
Version
$Id: Multidb.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Application_Resource_Multidb

Package: Zend\Application\Resource

Cache Manager resource

Example configuration:

  resources.multidb.defaultMetadataCache = "database"

  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"
Parent(s)
\Zend_Application_Resource_ResourceAbstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

Propertyprotectedarray  $_dbs= 'array()'

Associative array containing all configured db's

Default valuearray()Details
Type
array
Propertyprotectednull|\Zend_Db_Adapter_Abstract  $_defaultDb= ''

An instance of the default db, if set

Details
Type
null\Zend_Db_Adapter_Abstract

Methods

methodprotected_setDefault(  $adapter ) : void

Set the default db adapter

Parameters
Name Type Description
$adapter
Details
\Zend_Db_Adapter_Abstract
Adapter to set as default
methodprotected_setDefaultMetadataCache( string|\Zend_Cache_Core $cache ) : \Zend_Application_Resource_Multidb

Set the default metadata cache

Parameters
Name Type Description
$cache string|\Zend_Cache_Core
Returns
Type Description
\Zend_Application_Resource_Multidb
methodpublicgetDb( null|string|\Zend_Db_Adapter_Abstract $db = null ) : \Zend_Db_Adapter_Abstract

Retrieve the specified database connection

Parameters
Name Type Description
$db null|string|\Zend_Db_Adapter_Abstract

The adapter to retrieve. Null to retrieve the default connection

Returns
Type Description
\Zend_Db_Adapter_Abstract
Throws
Exception Description
\Zend_Application_Resource_Exception if the given parameter could not be found
methodpublicgetDefaultDb( boolean $justPickOne = true ) : null|\Zend_Db_Adapter_Abstract

Get the default db connection

Parameters
Name Type Description
$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.

Returns
Type Description
null|\Zend_Db_Adapter_Abstract
methodpublicinit( ) : \Zend_Application_Resource_Multidb

Initialize the Database Connections (instances of Zend_Db_Table_Abstract)

Returns
Type Description
\Zend_Application_Resource_Multidb
methodpublicisDefault( string|\Zend_Db_Adapter_Abstract $db ) : boolean

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

Parameters
Name Type Description
$db string|\Zend_Db_Adapter_Abstract

The db to determine whether it's set as default

Returns
Type Description
boolean True if the given parameter is configured as default. False otherwise
Documentation was generated by DocBlox 0.15.1.