<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is ...
*
* @category Zend
* @package Zend_Db
* @subpackage Adapter
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 19115 2009-11-20 17:41:25Z matthew $
*/
/**
* @see Zend_Db
*/
require_once 'Zend/Db.php';
/**
* Class for connecting to SQL databases and performing common operations.
*
* @category Zend
* @package Zend_Db
* @subpackage Adapter
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Db_Adapter_Abstract
{
/**
* User-provided configuration
*
* @var array
*/
protected $_config = array();
/**
* Constructor.
*
* $config is an array of key/value pairs or an instance of Zend_Config
* containing configuration options. These options are common to most adapters:
*
* dbname => (string) The name of the database to user
* username => (string) Connect to the database as this username.
* password => (string) Password associated with the username.
* host => (string) What host to connect to, defaults to localhost
*
* Some options are used on a case-by-case basis by adapters:
*
* port => (string) The port of the database
* persistent => (boolean) Whether to use a persistent connection or not, defaults to false
* protocol => (string) The network protocol, defaults to TCPIP
* caseFolding => (int) style of case-alteration used for identifiers
*
* @param array|Zend_Config $config An array or instance of Zend_Config having configuration data
* @throws Zend_Db_Adapter_Exception
*/
public function __construct($config)
{
/*
* Verify that adapter parameters are in an array.
*/
if (!is_array($config)) {
/*
* Convert Zend_Config argument to a plain array.
*/
if ($config instanceof Zend_Config) {
$config = $config->toArray();
} else {
/**
* @see Zend_Db_Adapter_Exception
*/
require_once 'Zend/Db/Adapter/Exception.php';
throw new Zend_Db_Adapter_Exception('Adapter parameters must be in an array or a Zend_Config object');
}
}
//后面略...