Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Static Public Member Functions | Data Fields
Zend_Db Class Reference

Static Public Member Functions

static factory ($adapter, $config=array())
 

Data Fields

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

Detailed Description

Definition at line 32 of file Db.php.

Member Function Documentation

◆ factory()

static factory (   $adapter,
  $config = array() 
)
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
mixed$adapterString name of base adapter class, or Zend_Config object.
mixed$configOPTIONAL; an array or Zend_Config object with adapter parameters.
Returns
Zend_Db_Adapter_Abstract
Exceptions
Zend_Db_Exception
See also
Zend_Db_Exception
Zend_Db_Exception
Zend_Db_Exception

Definition at line 199 of file Db.php.

200  {
201  if ($config instanceof Zend_Config) {
202  $config = $config->toArray();
203  }
204 
205  /*
206  * Convert Zend_Config argument to plain string
207  * adapter name and separate config object.
208  */
209  if ($adapter instanceof Zend_Config) {
210  if (isset($adapter->params)) {
211  $config = $adapter->params->toArray();
212  }
213  if (isset($adapter->adapter)) {
214  $adapter = (string) $adapter->adapter;
215  } else {
216  $adapter = null;
217  }
218  }
219 
220  /*
221  * Verify that adapter parameters are in an array.
222  */
223  if (!is_array($config)) {
227  #require_once 'Zend/Db/Exception.php';
228  throw new Zend_Db_Exception('Adapter parameters must be in an array or a Zend_Config object');
229  }
230 
231  /*
232  * Verify that an adapter name has been specified.
233  */
234  if (!is_string($adapter) || empty($adapter)) {
238  #require_once 'Zend/Db/Exception.php';
239  throw new Zend_Db_Exception('Adapter name must be specified in a string');
240  }
241 
242  /*
243  * Form full adapter class name
244  */
245  $adapterNamespace = 'Zend_Db_Adapter';
246  if (isset($config['adapterNamespace'])) {
247  if ($config['adapterNamespace'] != '') {
248  $adapterNamespace = $config['adapterNamespace'];
249  }
250  unset($config['adapterNamespace']);
251  }
252 
253  // Adapter no longer normalized- see http://framework.zend.com/issues/browse/ZF-5606
254  $adapterName = $adapterNamespace . '_';
255  $adapterName .= str_replace(' ', '_', ucwords(str_replace('_', ' ', strtolower($adapter))));
256 
257  /*
258  * Load the adapter class. This throws an exception
259  * if the specified class cannot be loaded.
260  */
261  if (!class_exists($adapterName)) {
262  #require_once 'Zend/Loader.php';
263  Zend_Loader::loadClass($adapterName);
264  }
265 
266  /*
267  * Create an instance of the adapter class.
268  * Pass the config to the adapter class constructor.
269  */
270  $dbAdapter = new $adapterName($config);
271 
272  /*
273  * Verify that the object created is a descendent of the abstract adapter type.
274  */
275  if (! $dbAdapter instanceof Zend_Db_Adapter_Abstract) {
279  #require_once 'Zend/Db/Exception.php';
280  throw new Zend_Db_Exception("Adapter class '$adapterName' does not extend Zend_Db_Adapter_Abstract");
281  }
282 
283  return $dbAdapter;
284  }
static loadClass($class, $dirs=null)
Definition: Loader.php:52
$config
Definition: fraud_order.php:17
$adapter
Definition: webapi_user.php:16

Field Documentation

◆ ALLOW_SERIALIZATION

const ALLOW_SERIALIZATION = 'allowSerialization'

Use the ALLOW_SERIALIZATION constant in the config of a Zend_Db_Adapter.

Definition at line 58 of file Db.php.

◆ ATTR_AUTOCOMMIT

const 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);

Definition at line 104 of file Db.php.

◆ ATTR_CASE

const ATTR_CASE = 8

Definition at line 105 of file Db.php.

◆ ATTR_CLIENT_VERSION

const ATTR_CLIENT_VERSION = 5

Definition at line 106 of file Db.php.

◆ ATTR_CONNECTION_STATUS

const ATTR_CONNECTION_STATUS = 7

Definition at line 107 of file Db.php.

◆ ATTR_CURSOR

const ATTR_CURSOR = 10

Definition at line 108 of file Db.php.

◆ ATTR_CURSOR_NAME

const ATTR_CURSOR_NAME = 9

Definition at line 109 of file Db.php.

◆ ATTR_DRIVER_NAME

const ATTR_DRIVER_NAME = 16

Definition at line 110 of file Db.php.

◆ ATTR_ERRMODE

const ATTR_ERRMODE = 3

Definition at line 111 of file Db.php.

◆ ATTR_FETCH_CATALOG_NAMES

const ATTR_FETCH_CATALOG_NAMES = 15

Definition at line 112 of file Db.php.

◆ ATTR_FETCH_TABLE_NAMES

const ATTR_FETCH_TABLE_NAMES = 14

Definition at line 113 of file Db.php.

◆ ATTR_MAX_COLUMN_LEN

const ATTR_MAX_COLUMN_LEN = 18

Definition at line 114 of file Db.php.

◆ ATTR_ORACLE_NULLS

const ATTR_ORACLE_NULLS = 11

Definition at line 115 of file Db.php.

◆ ATTR_PERSISTENT

const ATTR_PERSISTENT = 12

Definition at line 116 of file Db.php.

◆ ATTR_PREFETCH

const ATTR_PREFETCH = 1

Definition at line 117 of file Db.php.

◆ ATTR_SERVER_INFO

const ATTR_SERVER_INFO = 6

Definition at line 118 of file Db.php.

◆ ATTR_SERVER_VERSION

const ATTR_SERVER_VERSION = 4

Definition at line 119 of file Db.php.

◆ ATTR_STATEMENT_CLASS

const ATTR_STATEMENT_CLASS = 13

Definition at line 120 of file Db.php.

◆ ATTR_STRINGIFY_FETCHES

const ATTR_STRINGIFY_FETCHES = 17

Definition at line 121 of file Db.php.

◆ ATTR_TIMEOUT

const ATTR_TIMEOUT = 2

Definition at line 122 of file Db.php.

◆ AUTO_QUOTE_IDENTIFIERS

const AUTO_QUOTE_IDENTIFIERS = 'autoQuoteIdentifiers'

Use the AUTO_QUOTE_IDENTIFIERS constant in the config of a Zend_Db_Adapter.

Definition at line 53 of file Db.php.

◆ AUTO_RECONNECT_ON_UNSERIALIZE

const AUTO_RECONNECT_ON_UNSERIALIZE = 'autoReconnectOnUnserialize'

Use the AUTO_RECONNECT_ON_UNSERIALIZE constant in the config of a Zend_Db_Adapter.

Definition at line 63 of file Db.php.

◆ BIGINT_TYPE

const BIGINT_TYPE = 1

Definition at line 69 of file Db.php.

◆ CASE_FOLDING

const CASE_FOLDING = 'caseFolding'

Use the CASE_FOLDING constant in the config of a Zend_Db_Adapter.

Definition at line 43 of file Db.php.

◆ CASE_LOWER

const CASE_LOWER = 2

Definition at line 123 of file Db.php.

◆ CASE_NATURAL

const CASE_NATURAL = 0

Definition at line 124 of file Db.php.

◆ CASE_UPPER

const CASE_UPPER = 1

Definition at line 125 of file Db.php.

◆ CURSOR_FWDONLY

const CURSOR_FWDONLY = 0

Definition at line 126 of file Db.php.

◆ CURSOR_SCROLL

const CURSOR_SCROLL = 1

Definition at line 127 of file Db.php.

◆ ERR_ALREADY_EXISTS

const ERR_ALREADY_EXISTS = NULL

Definition at line 128 of file Db.php.

◆ ERR_CANT_MAP

const ERR_CANT_MAP = NULL

Definition at line 129 of file Db.php.

◆ ERR_CONSTRAINT

const ERR_CONSTRAINT = NULL

Definition at line 130 of file Db.php.

◆ ERR_DISCONNECTED

const ERR_DISCONNECTED = NULL

Definition at line 131 of file Db.php.

◆ ERR_MISMATCH

const ERR_MISMATCH = NULL

Definition at line 132 of file Db.php.

◆ ERR_NO_PERM

const ERR_NO_PERM = NULL

Definition at line 133 of file Db.php.

◆ ERR_NONE

const ERR_NONE = '00000'

Definition at line 134 of file Db.php.

◆ ERR_NOT_FOUND

const ERR_NOT_FOUND = NULL

Definition at line 135 of file Db.php.

◆ ERR_NOT_IMPLEMENTED

const ERR_NOT_IMPLEMENTED = NULL

Definition at line 136 of file Db.php.

◆ ERR_SYNTAX

const ERR_SYNTAX = NULL

Definition at line 137 of file Db.php.

◆ ERR_TRUNCATED

const ERR_TRUNCATED = NULL

Definition at line 138 of file Db.php.

◆ ERRMODE_EXCEPTION

const ERRMODE_EXCEPTION = 2

Definition at line 139 of file Db.php.

◆ ERRMODE_SILENT

const ERRMODE_SILENT = 0

Definition at line 140 of file Db.php.

◆ ERRMODE_WARNING

const ERRMODE_WARNING = 1

Definition at line 141 of file Db.php.

◆ FETCH_ASSOC

const FETCH_ASSOC = 2

Definition at line 142 of file Db.php.

◆ FETCH_BOTH

const FETCH_BOTH = 4

Definition at line 143 of file Db.php.

◆ FETCH_BOUND

const FETCH_BOUND = 6

Definition at line 144 of file Db.php.

◆ FETCH_CLASS

const FETCH_CLASS = 8

Definition at line 145 of file Db.php.

◆ FETCH_CLASSTYPE

const FETCH_CLASSTYPE = 262144

Definition at line 146 of file Db.php.

◆ FETCH_COLUMN

const FETCH_COLUMN = 7

Definition at line 147 of file Db.php.

◆ FETCH_FUNC

const FETCH_FUNC = 10

Definition at line 148 of file Db.php.

◆ FETCH_GROUP

const FETCH_GROUP = 65536

Definition at line 149 of file Db.php.

◆ FETCH_INTO

const FETCH_INTO = 9

Definition at line 150 of file Db.php.

◆ FETCH_LAZY

const FETCH_LAZY = 1

Definition at line 151 of file Db.php.

◆ FETCH_MODE

const FETCH_MODE = 'fetchMode'

Use the FETCH_MODE constant in the config of a Zend_Db_Adapter.

Definition at line 48 of file Db.php.

◆ FETCH_NAMED

const FETCH_NAMED = 11

Definition at line 152 of file Db.php.

◆ FETCH_NUM

const FETCH_NUM = 3

Definition at line 153 of file Db.php.

◆ FETCH_OBJ

const FETCH_OBJ = 5

Definition at line 154 of file Db.php.

◆ FETCH_ORI_ABS

const FETCH_ORI_ABS = 4

Definition at line 155 of file Db.php.

◆ FETCH_ORI_FIRST

const FETCH_ORI_FIRST = 2

Definition at line 156 of file Db.php.

◆ FETCH_ORI_LAST

const FETCH_ORI_LAST = 3

Definition at line 157 of file Db.php.

◆ FETCH_ORI_NEXT

const FETCH_ORI_NEXT = 0

Definition at line 158 of file Db.php.

◆ FETCH_ORI_PRIOR

const FETCH_ORI_PRIOR = 1

Definition at line 159 of file Db.php.

◆ FETCH_ORI_REL

const FETCH_ORI_REL = 5

Definition at line 160 of file Db.php.

◆ FETCH_SERIALIZE

const FETCH_SERIALIZE = 524288

Definition at line 161 of file Db.php.

◆ FETCH_UNIQUE

const FETCH_UNIQUE = 196608

Definition at line 162 of file Db.php.

◆ FLOAT_TYPE

const FLOAT_TYPE = 2

Definition at line 70 of file Db.php.

◆ INT_TYPE

const INT_TYPE = 0

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

Definition at line 68 of file Db.php.

◆ NULL_EMPTY_STRING

const NULL_EMPTY_STRING = 1

Definition at line 163 of file Db.php.

◆ NULL_NATURAL

const NULL_NATURAL = 0

Definition at line 164 of file Db.php.

◆ NULL_TO_STRING

const NULL_TO_STRING = NULL

Definition at line 165 of file Db.php.

◆ PARAM_BOOL

const PARAM_BOOL = 5

Definition at line 166 of file Db.php.

◆ PARAM_INPUT_OUTPUT

const PARAM_INPUT_OUTPUT = -2147483648

Definition at line 167 of file Db.php.

◆ PARAM_INT

const PARAM_INT = 1

Definition at line 168 of file Db.php.

◆ PARAM_LOB

const PARAM_LOB = 3

Definition at line 169 of file Db.php.

◆ PARAM_NULL

const PARAM_NULL = 0

Definition at line 170 of file Db.php.

◆ PARAM_STMT

const PARAM_STMT = 4

Definition at line 171 of file Db.php.

◆ PARAM_STR

const PARAM_STR = 2

Definition at line 172 of file Db.php.

◆ PROFILER

const PROFILER = 'profiler'

Use the PROFILER constant in the config of a Zend_Db_Adapter.

Definition at line 38 of file Db.php.


The documentation for this class was generated from the following file: