import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @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 17702 2009-08-20 23:54:16Z yoshida@zend.co.jp $
|
||||
* @version $Id: Abstract.php 19115 2009-11-20 17:41:25Z matthew $
|
||||
*/
|
||||
|
||||
|
||||
@ -173,10 +173,10 @@ abstract class Zend_Db_Adapter_Abstract
|
||||
$config = $config->toArray();
|
||||
} else {
|
||||
/**
|
||||
* @see Zend_Db_Exception
|
||||
* @see Zend_Db_Adapter_Exception
|
||||
*/
|
||||
require_once 'Zend/Db/Exception.php';
|
||||
throw new Zend_Db_Exception('Adapter parameters must be in an array or a Zend_Config object');
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -902,7 +902,7 @@ abstract class Zend_Db_Adapter_Abstract
|
||||
return str_replace('?', $this->quote($value, $type), $text);
|
||||
} else {
|
||||
while ($count > 0) {
|
||||
if (strpos($text, '?') != false) {
|
||||
if (strpos($text, '?') !== false) {
|
||||
$text = substr_replace($text, $this->quote($value, $type), strpos($text, '?'), 1);
|
||||
}
|
||||
--$count;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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: Db2.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Db2.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -373,7 +373,7 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
|
||||
if ($schemaName === null && $this->_config['schema'] != null) {
|
||||
$schemaName = $this->_config['schema'];
|
||||
}
|
||||
|
||||
|
||||
if (!$this->_isI5) {
|
||||
|
||||
$sql = "SELECT DISTINCT c.tabschema, c.tabname, c.colname, c.colno,
|
||||
@ -402,14 +402,14 @@ class Zend_Db_Adapter_Db2 extends Zend_Db_Adapter_Abstract
|
||||
$sql = "SELECT DISTINCT C.TABLE_SCHEMA, C.TABLE_NAME, C.COLUMN_NAME, C.ORDINAL_POSITION,
|
||||
C.DATA_TYPE, C.COLUMN_DEFAULT, C.NULLS ,C.LENGTH, C.SCALE, LEFT(C.IDENTITY,1),
|
||||
LEFT(tc.TYPE, 1) AS tabconsttype, k.COLSEQ
|
||||
FROM QSYS2.SYSCOLUMNS C
|
||||
FROM QSYS2.SYSCOLUMNS C
|
||||
LEFT JOIN (QSYS2.syskeycst k JOIN QSYS2.SYSCST tc
|
||||
ON (k.TABLE_SCHEMA = tc.TABLE_SCHEMA
|
||||
AND k.TABLE_NAME = tc.TABLE_NAME
|
||||
AND LEFT(tc.type,1) = 'P'))
|
||||
AND LEFT(tc.type,1) = 'P'))
|
||||
ON (C.TABLE_SCHEMA = k.TABLE_SCHEMA
|
||||
AND C.TABLE_NAME = k.TABLE_NAME
|
||||
AND C.COLUMN_NAME = k.COLUMN_NAME)
|
||||
AND C.COLUMN_NAME = k.COLUMN_NAME)
|
||||
WHERE "
|
||||
. $this->quoteInto('UPPER(C.TABLE_NAME) = UPPER(?)', $tableName);
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Exception.php 17860 2009-08-27 22:48:48Z beberlei $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -45,6 +45,11 @@ class Zend_Db_Adapter_Exception extends Zend_Db_Exception
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
public function hasChainedException()
|
||||
{
|
||||
return ($this->_chainedException!==null);
|
||||
}
|
||||
|
||||
public function getChainedException()
|
||||
{
|
||||
return $this->_chainedException;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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: Oracle.php 16920 2009-07-21 13:32:28Z ralph $
|
||||
* @version $Id: Oracle.php 19048 2009-11-19 18:15:05Z mikaelkael $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -81,7 +81,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $_execute_mode = OCI_COMMIT_ON_SUCCESS;
|
||||
protected $_execute_mode = null;
|
||||
|
||||
/**
|
||||
* Default class name for a DB statement.
|
||||
@ -119,8 +119,10 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
|
||||
throw new Zend_Db_Adapter_Oracle_Exception('The OCI8 extension is required for this adapter but the extension is not loaded');
|
||||
}
|
||||
|
||||
$this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS);
|
||||
|
||||
$connectionFuncName = ($this->_config['persistent'] == true) ? 'oci_pconnect' : 'oci_connect';
|
||||
|
||||
|
||||
$this->_connection = @$connectionFuncName(
|
||||
$this->_config['username'],
|
||||
$this->_config['password'],
|
||||
@ -358,7 +360,7 @@ class Zend_Db_Adapter_Oracle extends Zend_Db_Adapter_Abstract
|
||||
TC.DATA_SCALE, TC.DATA_PRECISION, C.CONSTRAINT_TYPE, CC.POSITION
|
||||
FROM ALL_TAB_COLUMNS TC
|
||||
LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C
|
||||
ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND C.CONSTRAINT_TYPE = 'P'))
|
||||
ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P'))
|
||||
ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME
|
||||
WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME)";
|
||||
$bind[':TBNAME'] = $tableName;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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 16920 2009-07-21 13:32:28Z ralph $
|
||||
* @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
|
||||
if (isset($this->_config['persistent']) && ($this->_config['persistent'] == true)) {
|
||||
$this->_config['driver_options'][PDO::ATTR_PERSISTENT] = true;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$this->_connection = new PDO(
|
||||
$dsn,
|
||||
@ -141,7 +141,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
|
||||
* @see Zend_Db_Adapter_Exception
|
||||
*/
|
||||
require_once 'Zend/Db/Adapter/Exception.php';
|
||||
throw new Zend_Db_Adapter_Exception($e->getMessage());
|
||||
throw new Zend_Db_Adapter_Exception($e->getMessage(), $e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -241,7 +241,7 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
|
||||
* @see Zend_Db_Statement_Exception
|
||||
*/
|
||||
require_once 'Zend/Db/Statement/Exception.php';
|
||||
throw new Zend_Db_Statement_Exception($e->getMessage());
|
||||
throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,10 +258,10 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
|
||||
if ($sql instanceof Zend_Db_Select) {
|
||||
$sql = $sql->assemble();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$affected = $this->getConnection()->exec($sql);
|
||||
|
||||
|
||||
if ($affected === false) {
|
||||
$errorInfo = $this->getConnection()->errorInfo();
|
||||
/**
|
||||
@ -270,14 +270,14 @@ abstract class Zend_Db_Adapter_Pdo_Abstract extends Zend_Db_Adapter_Abstract
|
||||
require_once 'Zend/Db/Adapter/Exception.php';
|
||||
throw new Zend_Db_Adapter_Exception($errorInfo[2]);
|
||||
}
|
||||
|
||||
|
||||
return $affected;
|
||||
} catch (PDOException $e) {
|
||||
/**
|
||||
* @see Zend_Db_Adapter_Exception
|
||||
*/
|
||||
require_once 'Zend/Db/Adapter/Exception.php';
|
||||
throw new Zend_Db_Adapter_Exception($e->getMessage());
|
||||
throw new Zend_Db_Adapter_Exception($e->getMessage(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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: Mssql.php 17792 2009-08-24 16:18:02Z ralph $
|
||||
* @version $Id: Mssql.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -254,7 +254,7 @@ class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
|
||||
if ($schemaName != null) {
|
||||
$sql .= ", @table_owner = " . $this->quoteIdentifier($schemaName, true);
|
||||
}
|
||||
|
||||
|
||||
$stmt = $this->query($sql);
|
||||
$primaryKeysResult = $stmt->fetchAll(Zend_Db::FETCH_NUM);
|
||||
$primaryKeyColumn = array();
|
||||
@ -335,46 +335,46 @@ class Zend_Db_Adapter_Pdo_Mssql extends Zend_Db_Adapter_Pdo_Abstract
|
||||
'SELECT $1TOP ' . ($count+$offset) . ' ',
|
||||
$sql
|
||||
);
|
||||
|
||||
|
||||
if ($offset > 0) {
|
||||
$orderby = stristr($sql, 'ORDER BY');
|
||||
|
||||
if ($orderby !== false) {
|
||||
$orderParts = explode(',', substr($orderby, 8));
|
||||
$pregReplaceCount = null;
|
||||
$orderbyInverseParts = array();
|
||||
foreach ($orderParts as $orderPart) {
|
||||
$orderPart = rtrim($orderPart);
|
||||
$inv = preg_replace('/\s+desc$/i', ' ASC', $orderPart, 1, $pregReplaceCount);
|
||||
if ($pregReplaceCount) {
|
||||
$orderbyInverseParts[] = $inv;
|
||||
continue;
|
||||
}
|
||||
$inv = preg_replace('/\s+asc$/i', ' DESC', $orderPart, 1, $pregReplaceCount);
|
||||
if ($pregReplaceCount) {
|
||||
$orderbyInverseParts[] = $inv;
|
||||
continue;
|
||||
} else {
|
||||
$orderbyInverseParts[] = $orderPart . ' DESC';
|
||||
}
|
||||
}
|
||||
|
||||
$orderbyInverse = 'ORDER BY ' . implode(', ', $orderbyInverseParts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl';
|
||||
if ($orderby !== false) {
|
||||
$sql .= ' ' . $orderbyInverse . ' ';
|
||||
}
|
||||
$sql .= ') AS outer_tbl';
|
||||
if ($orderby !== false) {
|
||||
$sql .= ' ' . $orderby;
|
||||
}
|
||||
$orderby = stristr($sql, 'ORDER BY');
|
||||
|
||||
if ($orderby !== false) {
|
||||
$orderParts = explode(',', substr($orderby, 8));
|
||||
$pregReplaceCount = null;
|
||||
$orderbyInverseParts = array();
|
||||
foreach ($orderParts as $orderPart) {
|
||||
$orderPart = rtrim($orderPart);
|
||||
$inv = preg_replace('/\s+desc$/i', ' ASC', $orderPart, 1, $pregReplaceCount);
|
||||
if ($pregReplaceCount) {
|
||||
$orderbyInverseParts[] = $inv;
|
||||
continue;
|
||||
}
|
||||
$inv = preg_replace('/\s+asc$/i', ' DESC', $orderPart, 1, $pregReplaceCount);
|
||||
if ($pregReplaceCount) {
|
||||
$orderbyInverseParts[] = $inv;
|
||||
continue;
|
||||
} else {
|
||||
$orderbyInverseParts[] = $orderPart . ' DESC';
|
||||
}
|
||||
}
|
||||
|
||||
$orderbyInverse = 'ORDER BY ' . implode(', ', $orderbyInverseParts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$sql = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $sql . ') AS inner_tbl';
|
||||
if ($orderby !== false) {
|
||||
$sql .= ' ' . $orderbyInverse . ' ';
|
||||
}
|
||||
$sql .= ') AS outer_tbl';
|
||||
if ($orderby !== false) {
|
||||
$sql .= ' ' . $orderby;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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: Oci.php 16203 2009-06-21 18:56:17Z thomas $
|
||||
* @version $Id: Oci.php 19048 2009-11-19 18:15:05Z mikaelkael $
|
||||
*/
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ class Zend_Db_Adapter_Pdo_Oci extends Zend_Db_Adapter_Pdo_Abstract
|
||||
TC.DATA_SCALE, TC.DATA_PRECISION, C.CONSTRAINT_TYPE, CC.POSITION
|
||||
FROM ALL_TAB_COLUMNS TC
|
||||
LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C
|
||||
ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND C.CONSTRAINT_TYPE = 'P'))
|
||||
ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND CC.OWNER = C.OWNER AND C.CONSTRAINT_TYPE = 'P'))
|
||||
ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME
|
||||
WHERE UPPER(TC.TABLE_NAME) = UPPER(:TBNAME)";
|
||||
$bind[':TBNAME'] = $tableName;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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: Pgsql.php 16732 2009-07-15 12:44:36Z yoshida@zend.co.jp $
|
||||
* @version $Id: Pgsql.php 19051 2009-11-19 18:27:53Z mikaelkael $
|
||||
*/
|
||||
|
||||
|
||||
@ -99,19 +99,14 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
|
||||
*/
|
||||
public function listTables()
|
||||
{
|
||||
// @todo use a better query with joins instead of subqueries
|
||||
$sql = "SELECT c.relname AS table_name "
|
||||
. "FROM pg_class c, pg_user u "
|
||||
. "WHERE c.relowner = u.usesysid AND c.relkind = 'r' "
|
||||
. "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) "
|
||||
. "AND c.relname !~ '^(pg_|sql_)' "
|
||||
. "UNION "
|
||||
. "SELECT c.relname AS table_name "
|
||||
. "FROM pg_class c "
|
||||
. "WHERE c.relkind = 'r' "
|
||||
. "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) "
|
||||
. "AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) "
|
||||
. "AND c.relname !~ '^pg_'";
|
||||
$sql = "SELECT c.relname AS table_name "
|
||||
. "FROM pg_catalog.pg_class c "
|
||||
. "JOIN pg_catalog.pg_roles r ON r.oid = c.relowner "
|
||||
. "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace "
|
||||
. "WHERE n.nspname <> 'pg_catalog' "
|
||||
. "AND n.nspname !~ '^pg_toast' "
|
||||
. "AND pg_catalog.pg_table_is_visible(c.oid) "
|
||||
. "AND c.relkind = 'r' ";
|
||||
|
||||
return $this->fetchCol($sql);
|
||||
}
|
||||
@ -194,6 +189,7 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
|
||||
|
||||
$desc = array();
|
||||
foreach ($result as $key => $row) {
|
||||
$defaultValue = $row[$default_value];
|
||||
if ($row[$type] == 'varchar') {
|
||||
if (preg_match('/character varying(?:\((\d+)\))?/', $row[$complete_type], $matches)) {
|
||||
if (isset($matches[1])) {
|
||||
@ -202,6 +198,9 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
|
||||
$row[$length] = null; // unlimited
|
||||
}
|
||||
}
|
||||
if (preg_match("/^'(.*?)'::character varying$/", $defaultValue, $matches)) {
|
||||
$defaultValue = $matches[1];
|
||||
}
|
||||
}
|
||||
list($primary, $primaryPosition, $identity) = array(false, null, false);
|
||||
if ($row[$contype] == 'p') {
|
||||
@ -215,7 +214,7 @@ class Zend_Db_Adapter_Pdo_Pgsql extends Zend_Db_Adapter_Pdo_Abstract
|
||||
'COLUMN_NAME' => $this->foldCase($row[$colname]),
|
||||
'COLUMN_POSITION' => $row[$attnum],
|
||||
'DATA_TYPE' => $row[$type],
|
||||
'DEFAULT' => $row[$default_value],
|
||||
'DEFAULT' => $defaultValue,
|
||||
'NULLABLE' => (bool) ($row[$notnull] != 't'),
|
||||
'LENGTH' => $row[$length],
|
||||
'SCALE' => null, // @todo
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @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: Sqlite.php 16203 2009-06-21 18:56:17Z thomas $
|
||||
* @version $Id: Sqlite.php 18951 2009-11-12 16:26:19Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -197,12 +197,14 @@ class Zend_Db_Adapter_Pdo_Sqlite extends Zend_Db_Adapter_Pdo_Abstract
|
||||
*/
|
||||
public function describeTable($tableName, $schemaName = null)
|
||||
{
|
||||
$sql = 'PRAGMA ';
|
||||
|
||||
if ($schemaName) {
|
||||
$sql = "PRAGMA $schemaName.table_info($tableName)";
|
||||
} else {
|
||||
$sql = "PRAGMA table_info($tableName)";
|
||||
$sql .= $this->quoteIdentifier($schemaName) . '.';
|
||||
}
|
||||
|
||||
$sql .= 'table_info('.$this->quoteIdentifier($tableName).')';
|
||||
|
||||
$stmt = $this->query($sql);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user