Skip to content

Commit 10731f1

Browse files
committed
Initial commit
0 parents  commit 10731f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+17190
-0
lines changed

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/.buildpath
2+
/.cache
3+
/.metadata
4+
/.project
5+
/.settings
6+
/.vscode
7+
/.idea
8+
/.gitattributes
9+
.DS_Store

LICENSE.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2005-2015, Zend Technologies USA, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of Zend Technologies USA, Inc. nor the names of its
15+
contributors may be used to endorse or promote products derived from this
16+
software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
22+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
INFORMATION
2+
===================
3+
4+
This is a fork from Zend Framework 1.12.16 Release.
5+
6+
PURPOSE
7+
---------------------------
8+
This package is a part of the Zend Framework 1. Component was separated and put into its own composer package.
9+
10+
LICENSE
11+
=======
12+
13+
The files in this archive are released under the Zend Framework license.
14+
You can find a copy of this license in [LICENSE.txt](LICENSE.txt).

composer.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "magento/zend-db",
3+
"description": "Magento Zend Framework 1",
4+
"type": "library",
5+
"keywords": [
6+
"framework",
7+
"zf1"
8+
],
9+
"homepage": "http://framework.zend.com/",
10+
"license": "BSD-3-Clause",
11+
"require": {
12+
"php": ">=7.0.0",
13+
"magento/zend-exception": "^1.16",
14+
"magento/zend-loader": "^1.16"
15+
},
16+
"autoload": {
17+
"psr-0": {
18+
"Zend_Db": "library/"
19+
}
20+
},
21+
"extra": {
22+
"branch-alias": {
23+
"dev-main": "1.16.x-dev"
24+
}
25+
}
26+
}

library/Zend/Db.php

+286
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,286 @@
1+
<?php
2+
3+
/**
4+
* Zend Framework
5+
*
6+
* LICENSE
7+
*
8+
* This source file is subject to the new BSD license that is bundled
9+
* with this package in the file LICENSE.txt.
10+
* It is also available through the world-wide-web at this URL:
11+
* http://framework.zend.com/license/new-bsd
12+
* If you did not receive a copy of the license and are unable to
13+
* obtain it through the world-wide-web, please send an email
14+
* to [email protected] so we can send you a copy immediately.
15+
*
16+
* @category Zend
17+
* @package Zend_Db
18+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
19+
* @license http://framework.zend.com/license/new-bsd New BSD License
20+
* @version $Id$
21+
*/
22+
23+
24+
/**
25+
* Class for connecting to SQL databases and performing common operations.
26+
*
27+
* @category Zend
28+
* @package Zend_Db
29+
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
30+
* @license http://framework.zend.com/license/new-bsd New BSD License
31+
*/
32+
class Zend_Db
33+
{
34+
35+
/**
36+
* Use the PROFILER constant in the config of a Zend_Db_Adapter.
37+
*/
38+
const PROFILER = 'profiler';
39+
40+
/**
41+
* Use the CASE_FOLDING constant in the config of a Zend_Db_Adapter.
42+
*/
43+
const CASE_FOLDING = 'caseFolding';
44+
45+
/**
46+
* Use the FETCH_MODE constant in the config of a Zend_Db_Adapter.
47+
*/
48+
const FETCH_MODE = 'fetchMode';
49+
50+
/**
51+
* Use the AUTO_QUOTE_IDENTIFIERS constant in the config of a Zend_Db_Adapter.
52+
*/
53+
const AUTO_QUOTE_IDENTIFIERS = 'autoQuoteIdentifiers';
54+
55+
/**
56+
* Use the ALLOW_SERIALIZATION constant in the config of a Zend_Db_Adapter.
57+
*/
58+
const ALLOW_SERIALIZATION = 'allowSerialization';
59+
60+
/**
61+
* Use the AUTO_RECONNECT_ON_UNSERIALIZE constant in the config of a Zend_Db_Adapter.
62+
*/
63+
const AUTO_RECONNECT_ON_UNSERIALIZE = 'autoReconnectOnUnserialize';
64+
65+
/**
66+
* Use the INT_TYPE, BIGINT_TYPE, and FLOAT_TYPE with the quote() method.
67+
*/
68+
const INT_TYPE = 0;
69+
const BIGINT_TYPE = 1;
70+
const FLOAT_TYPE = 2;
71+
72+
/**
73+
* PDO constant values discovered by this script result:
74+
*
75+
* $list = array(
76+
* 'PARAM_BOOL', 'PARAM_NULL', 'PARAM_INT', 'PARAM_STR', 'PARAM_LOB',
77+
* 'PARAM_STMT', 'PARAM_INPUT_OUTPUT', 'FETCH_LAZY', 'FETCH_ASSOC',
78+
* 'FETCH_NUM', 'FETCH_BOTH', 'FETCH_OBJ', 'FETCH_BOUND',
79+
* 'FETCH_COLUMN', 'FETCH_CLASS', 'FETCH_INTO', 'FETCH_FUNC',
80+
* 'FETCH_GROUP', 'FETCH_UNIQUE', 'FETCH_CLASSTYPE', 'FETCH_SERIALIZE',
81+
* 'FETCH_NAMED', 'ATTR_AUTOCOMMIT', 'ATTR_PREFETCH', 'ATTR_TIMEOUT',
82+
* 'ATTR_ERRMODE', 'ATTR_SERVER_VERSION', 'ATTR_CLIENT_VERSION',
83+
* 'ATTR_SERVER_INFO', 'ATTR_CONNECTION_STATUS', 'ATTR_CASE',
84+
* 'ATTR_CURSOR_NAME', 'ATTR_CURSOR', 'ATTR_ORACLE_NULLS',
85+
* 'ATTR_PERSISTENT', 'ATTR_STATEMENT_CLASS', 'ATTR_FETCH_TABLE_NAMES',
86+
* 'ATTR_FETCH_CATALOG_NAMES', 'ATTR_DRIVER_NAME',
87+
* 'ATTR_STRINGIFY_FETCHES', 'ATTR_MAX_COLUMN_LEN', 'ERRMODE_SILENT',
88+
* 'ERRMODE_WARNING', 'ERRMODE_EXCEPTION', 'CASE_NATURAL',
89+
* 'CASE_LOWER', 'CASE_UPPER', 'NULL_NATURAL', 'NULL_EMPTY_STRING',
90+
* 'NULL_TO_STRING', 'ERR_NONE', 'FETCH_ORI_NEXT',
91+
* 'FETCH_ORI_PRIOR', 'FETCH_ORI_FIRST', 'FETCH_ORI_LAST',
92+
* 'FETCH_ORI_ABS', 'FETCH_ORI_REL', 'CURSOR_FWDONLY', 'CURSOR_SCROLL',
93+
* 'ERR_CANT_MAP', 'ERR_SYNTAX', 'ERR_CONSTRAINT', 'ERR_NOT_FOUND',
94+
* 'ERR_ALREADY_EXISTS', 'ERR_NOT_IMPLEMENTED', 'ERR_MISMATCH',
95+
* 'ERR_TRUNCATED', 'ERR_DISCONNECTED', 'ERR_NO_PERM',
96+
* );
97+
*
98+
* $const = array();
99+
* foreach ($list as $name) {
100+
* $const[$name] = constant("PDO::$name");
101+
* }
102+
* var_export($const);
103+
*/
104+
const ATTR_AUTOCOMMIT = 0;
105+
const ATTR_CASE = 8;
106+
const ATTR_CLIENT_VERSION = 5;
107+
const ATTR_CONNECTION_STATUS = 7;
108+
const ATTR_CURSOR = 10;
109+
const ATTR_CURSOR_NAME = 9;
110+
const ATTR_DRIVER_NAME = 16;
111+
const ATTR_ERRMODE = 3;
112+
const ATTR_FETCH_CATALOG_NAMES = 15;
113+
const ATTR_FETCH_TABLE_NAMES = 14;
114+
const ATTR_MAX_COLUMN_LEN = 18;
115+
const ATTR_ORACLE_NULLS = 11;
116+
const ATTR_PERSISTENT = 12;
117+
const ATTR_PREFETCH = 1;
118+
const ATTR_SERVER_INFO = 6;
119+
const ATTR_SERVER_VERSION = 4;
120+
const ATTR_STATEMENT_CLASS = 13;
121+
const ATTR_STRINGIFY_FETCHES = 17;
122+
const ATTR_TIMEOUT = 2;
123+
const CASE_LOWER = 2;
124+
const CASE_NATURAL = 0;
125+
const CASE_UPPER = 1;
126+
const CURSOR_FWDONLY = 0;
127+
const CURSOR_SCROLL = 1;
128+
const ERR_ALREADY_EXISTS = NULL;
129+
const ERR_CANT_MAP = NULL;
130+
const ERR_CONSTRAINT = NULL;
131+
const ERR_DISCONNECTED = NULL;
132+
const ERR_MISMATCH = NULL;
133+
const ERR_NO_PERM = NULL;
134+
const ERR_NONE = '00000';
135+
const ERR_NOT_FOUND = NULL;
136+
const ERR_NOT_IMPLEMENTED = NULL;
137+
const ERR_SYNTAX = NULL;
138+
const ERR_TRUNCATED = NULL;
139+
const ERRMODE_EXCEPTION = 2;
140+
const ERRMODE_SILENT = 0;
141+
const ERRMODE_WARNING = 1;
142+
const FETCH_ASSOC = 2;
143+
const FETCH_BOTH = 4;
144+
const FETCH_BOUND = 6;
145+
const FETCH_CLASS = 8;
146+
const FETCH_CLASSTYPE = 262144;
147+
const FETCH_COLUMN = 7;
148+
const FETCH_FUNC = 10;
149+
const FETCH_GROUP = 65536;
150+
const FETCH_INTO = 9;
151+
const FETCH_LAZY = 1;
152+
const FETCH_NAMED = 11;
153+
const FETCH_NUM = 3;
154+
const FETCH_OBJ = 5;
155+
const FETCH_ORI_ABS = 4;
156+
const FETCH_ORI_FIRST = 2;
157+
const FETCH_ORI_LAST = 3;
158+
const FETCH_ORI_NEXT = 0;
159+
const FETCH_ORI_PRIOR = 1;
160+
const FETCH_ORI_REL = 5;
161+
const FETCH_SERIALIZE = 524288;
162+
const FETCH_UNIQUE = 196608;
163+
const NULL_EMPTY_STRING = 1;
164+
const NULL_NATURAL = 0;
165+
const NULL_TO_STRING = NULL;
166+
const PARAM_BOOL = 5;
167+
const PARAM_INPUT_OUTPUT = -2147483648;
168+
const PARAM_INT = 1;
169+
const PARAM_LOB = 3;
170+
const PARAM_NULL = 0;
171+
const PARAM_STMT = 4;
172+
const PARAM_STR = 2;
173+
174+
/**
175+
* Factory for Zend_Db_Adapter_Abstract classes.
176+
*
177+
* First argument may be a string containing the base of the adapter class
178+
* name, e.g. 'Mysqli' corresponds to class Zend_Db_Adapter_Mysqli. This
179+
* name is currently case-insensitive, but is not ideal to rely on this behavior.
180+
* If your class is named 'My_Company_Pdo_Mysql', where 'My_Company' is the namespace
181+
* and 'Pdo_Mysql' is the adapter name, it is best to use the name exactly as it
182+
* is defined in the class. This will ensure proper use of the factory API.
183+
*
184+
* First argument may alternatively be an object of type Zend_Config.
185+
* The adapter class base name is read from the 'adapter' property.
186+
* The adapter config parameters are read from the 'params' property.
187+
*
188+
* Second argument is optional and may be an associative array of key-value
189+
* pairs. This is used as the argument to the adapter constructor.
190+
*
191+
* If the first argument is of type Zend_Config, it is assumed to contain
192+
* all parameters, and the second argument is ignored.
193+
*
194+
* @param mixed $adapter String name of base adapter class, or Zend_Config object.
195+
* @param mixed $config OPTIONAL; an array or Zend_Config object with adapter parameters.
196+
* @return Zend_Db_Adapter_Abstract
197+
* @throws Zend_Db_Exception
198+
*/
199+
public static function factory($adapter, $config = array())
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)) {
224+
/**
225+
* @see Zend_Db_Exception
226+
*/
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)) {
235+
/**
236+
* @see Zend_Db_Exception
237+
*/
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) {
276+
/**
277+
* @see Zend_Db_Exception
278+
*/
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+
}
285+
286+
}

0 commit comments

Comments
 (0)