API Documentation

Zend/Db.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_Db  
Version
$Id: Db.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Db

Package: Zend\Db

Class for connecting to SQL databases and performing common operations.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  PROFILER = 'profiler'

Use the PROFILER constant in the config of a Zend_Db_Adapter.

Constant  CASE_FOLDING = 'caseFolding'

Use the CASE_FOLDING constant in the config of a Zend_Db_Adapter.

Constant  FETCH_MODE = 'fetchMode'

Use the FETCH_MODE constant in the config of a Zend_Db_Adapter.

Constant  AUTO_QUOTE_IDENTIFIERS = 'autoQuoteIdentifiers'

Use the AUTO_QUOTE_IDENTIFIERS constant in the config of a Zend_Db_Adapter.

Constant  ALLOW_SERIALIZATION = 'allowSerialization'

Use the ALLOW_SERIALIZATION constant in the config of a Zend_Db_Adapter.

Constant  AUTO_RECONNECT_ON_UNSERIALIZE = 'autoReconnectOnUnserialize'

Use the AUTO_RECONNECT_ON_UNSERIALIZE constant in the config of a Zend_Db_Adapter.

Constant  INT_TYPE = 0

Use the INT_TYPE, BIGINT_TYPE, and FLOAT_TYPE with the quote() method.

Constant  BIGINT_TYPE = 1
Constant  FLOAT_TYPE = 2
Constant  ATTR_AUTOCOMMIT = 0

PDO constant values discovered by this script result:

$list = array( 'PARAM_BOOL', 'PARAM_NULL', 'PARAM_INT', 'PARAM_STR', 'PARAM_LOB', 'PARAM_STMT', 'PARAM_INPUT_OUTPUT', 'FETCH_LAZY', 'FETCH_ASSOC', 'FETCH_NUM', 'FETCH_BOTH', 'FETCH_OBJ', 'FETCH_BOUND', 'FETCH_COLUMN', 'FETCH_CLASS', 'FETCH_INTO', 'FETCH_FUNC', 'FETCH_GROUP', 'FETCH_UNIQUE', 'FETCH_CLASSTYPE', 'FETCH_SERIALIZE', 'FETCH_NAMED', 'ATTR_AUTOCOMMIT', 'ATTR_PREFETCH', 'ATTR_TIMEOUT', 'ATTR_ERRMODE', 'ATTR_SERVER_VERSION', 'ATTR_CLIENT_VERSION', 'ATTR_SERVER_INFO', 'ATTR_CONNECTION_STATUS', 'ATTR_CASE', 'ATTR_CURSOR_NAME', 'ATTR_CURSOR', 'ATTR_ORACLE_NULLS', 'ATTR_PERSISTENT', 'ATTR_STATEMENT_CLASS', 'ATTR_FETCH_TABLE_NAMES', 'ATTR_FETCH_CATALOG_NAMES', 'ATTR_DRIVER_NAME', 'ATTR_STRINGIFY_FETCHES', 'ATTR_MAX_COLUMN_LEN', 'ERRMODE_SILENT', 'ERRMODE_WARNING', 'ERRMODE_EXCEPTION', 'CASE_NATURAL', 'CASE_LOWER', 'CASE_UPPER', 'NULL_NATURAL', 'NULL_EMPTY_STRING', 'NULL_TO_STRING', 'ERR_NONE', 'FETCH_ORI_NEXT', 'FETCH_ORI_PRIOR', 'FETCH_ORI_FIRST', 'FETCH_ORI_LAST', 'FETCH_ORI_ABS', 'FETCH_ORI_REL', 'CURSOR_FWDONLY', 'CURSOR_SCROLL', 'ERR_CANT_MAP', 'ERR_SYNTAX', 'ERR_CONSTRAINT', 'ERR_NOT_FOUND', 'ERR_ALREADY_EXISTS', 'ERR_NOT_IMPLEMENTED', 'ERR_MISMATCH', 'ERR_TRUNCATED', 'ERR_DISCONNECTED', 'ERR_NO_PERM', );

$const = array(); foreach ($list as $name) { $const[$name] = constant("PDO::$name"); } var_export($const);

Constant  ATTR_CASE = 8
Constant  ATTR_CLIENT_VERSION = 5
Constant  ATTR_CONNECTION_STATUS = 7
Constant  ATTR_CURSOR = 10
Constant  ATTR_CURSOR_NAME = 9
Constant  ATTR_DRIVER_NAME = 16
Constant  ATTR_ERRMODE = 3
Constant  ATTR_FETCH_CATALOG_NAMES = 15
Constant  ATTR_FETCH_TABLE_NAMES = 14
Constant  ATTR_MAX_COLUMN_LEN = 18
Constant  ATTR_ORACLE_NULLS = 11
Constant  ATTR_PERSISTENT = 12
Constant  ATTR_PREFETCH = 1
Constant  ATTR_SERVER_INFO = 6
Constant  ATTR_SERVER_VERSION = 4
Constant  ATTR_STATEMENT_CLASS = 13
Constant  ATTR_STRINGIFY_FETCHES = 17
Constant  ATTR_TIMEOUT = 2
Constant  CASE_LOWER = 2
Constant  CASE_NATURAL = 0
Constant  CASE_UPPER = 1
Constant  CURSOR_FWDONLY = 0
Constant  CURSOR_SCROLL = 1
Constant  ERR_ALREADY_EXISTS = NULL
Constant  ERR_CANT_MAP = NULL
Constant  ERR_CONSTRAINT = NULL
Constant  ERR_DISCONNECTED = NULL
Constant  ERR_MISMATCH = NULL
Constant  ERR_NO_PERM = NULL
Constant  ERR_NONE = '00000'
Constant  ERR_NOT_FOUND = NULL
Constant  ERR_NOT_IMPLEMENTED = NULL
Constant  ERR_SYNTAX = NULL
Constant  ERR_TRUNCATED = NULL
Constant  ERRMODE_EXCEPTION = 2
Constant  ERRMODE_SILENT = 0
Constant  ERRMODE_WARNING = 1
Constant  FETCH_ASSOC = 2
Constant  FETCH_BOTH = 4
Constant  FETCH_BOUND = 6
Constant  FETCH_CLASS = 8
Constant  FETCH_CLASSTYPE = 262144
Constant  FETCH_COLUMN = 7
Constant  FETCH_FUNC = 10
Constant  FETCH_GROUP = 65536
Constant  FETCH_INTO = 9
Constant  FETCH_LAZY = 1
Constant  FETCH_NAMED = 11
Constant  FETCH_NUM = 3
Constant  FETCH_OBJ = 5
Constant  FETCH_ORI_ABS = 4
Constant  FETCH_ORI_FIRST = 2
Constant  FETCH_ORI_LAST = 3
Constant  FETCH_ORI_NEXT = 0
Constant  FETCH_ORI_PRIOR = 1
Constant  FETCH_ORI_REL = 5
Constant  FETCH_SERIALIZE = 524288
Constant  FETCH_UNIQUE = 196608
Constant  NULL_EMPTY_STRING = 1
Constant  NULL_NATURAL = 0
Constant  NULL_TO_STRING = NULL
Constant  PARAM_BOOL = 5
Constant  PARAM_INPUT_OUTPUT = -2147483648
Constant  PARAM_INT = 1
Constant  PARAM_LOB = 3
Constant  PARAM_NULL = 0
Constant  PARAM_STMT = 4
Constant  PARAM_STR = 2

Methods

methodpublicfactory( mixed $adapter, mixed $config = array() ) : \Zend_Db_Adapter_Abstract
static

Factory for Zend_Db_Adapter_Abstract classes.

First argument may be a string containing the base of the adapter class name, e.g. 'Mysqli' corresponds to class Zend_Db_Adapter_Mysqli. This name is currently case-insensitive, but is not ideal to rely on this behavior. If your class is named 'My_Company_Pdo_Mysql', where 'My_Company' is the namespace and 'Pdo_Mysql' is the adapter name, it is best to use the name exactly as it is defined in the class. This will ensure proper use of the factory API.

First argument may alternatively be an object of type Zend_Config. The adapter class base name is read from the 'adapter' property. The adapter config parameters are read from the 'params' property.

Second argument is optional and may be an associative array of key-value pairs. This is used as the argument to the adapter constructor.

If the first argument is of type Zend_Config, it is assumed to contain all parameters, and the second argument is ignored.

Parameters
Name Type Description
$adapter mixed

String name of base adapter class, or Zend_Config object.

$config mixed

OPTIONAL; an array or Zend_Config object with adapter parameters.

Returns
Type Description
\Zend_Db_Adapter_Abstract
Throws
Exception Description
\Zend_Db_Exception
Documentation was generated by DocBlox 0.15.1.