mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding fix for Ticket #1088, additional refactorings, and code formatting fixes
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3253 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
bc745b234a
commit
82ebd41fa6
9 changed files with 26 additions and 136 deletions
|
@ -117,19 +117,17 @@ class DboAdodb extends DboSource{
|
|||
function _execute($sql) {
|
||||
return $this->_adodb->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow() {
|
||||
if ($this->_result->EOF) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_result->FetchRow();
|
||||
}
|
||||
function fetchRow() {
|
||||
if ($this->_result->EOF) {
|
||||
return null;
|
||||
}
|
||||
return $this->_result->FetchRow();
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin a transaction
|
||||
|
@ -317,7 +315,7 @@ class DboAdodb extends DboSource{
|
|||
return 'NULL';
|
||||
}
|
||||
|
||||
if ($data == '') {
|
||||
if ($data === '') {
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
|
|
@ -126,12 +126,14 @@ class DboMssql extends DboSource {
|
|||
$this->connected = false;
|
||||
|
||||
if (is_numeric($config['port'])) {
|
||||
$port = ':' . $config['port']; // Port number
|
||||
$port = ':' . $config['port']; // Port number
|
||||
} elseif ($config['port'] === null) {
|
||||
$port = ''; // No port - SQL Server 2005
|
||||
} else {
|
||||
$port = '\\' . $config['port']; // Named pipe
|
||||
$port = '\\' . $config['port']; // Named pipe
|
||||
}
|
||||
|
||||
$this->connection=$connect($config['host'] . $port, $config['login'], $config['password']);
|
||||
$this->connection = $connect($config['host'] . $port, $config['login'], $config['password']);
|
||||
|
||||
if (mssql_select_db($config['database'], $this->connection)) {
|
||||
$this->connected = true;
|
||||
|
@ -146,7 +148,6 @@ class DboMssql extends DboSource {
|
|||
function disconnect() {
|
||||
return @mssql_close($this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes given SQL statement.
|
||||
*
|
||||
|
@ -157,23 +158,6 @@ class DboMssql extends DboSource {
|
|||
function _execute($sql) {
|
||||
return mssql_query($sql, $this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @param bool $assoc Associative array only, or both?
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow($assoc = false) {
|
||||
if (is_resource($this->_result)) {
|
||||
$this->resultSet($this->_result);
|
||||
$resultRow = $this->fetchResult();
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of sources (tables) in the database.
|
||||
*
|
||||
|
@ -267,7 +251,7 @@ class DboMssql extends DboSource {
|
|||
if ($data === null) {
|
||||
return 'NULL';
|
||||
}
|
||||
if ($data == '') {
|
||||
if ($data === '') {
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
|
|
@ -132,21 +132,6 @@ class DboMysql extends DboSource {
|
|||
function _execute($sql) {
|
||||
return mysql_query($sql, $this->connection);
|
||||
}
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @param bool $assoc Associative array only, or both?
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow($assoc = false) {
|
||||
if(is_resource($this->_result)) {
|
||||
$this->resultSet($this->_result);
|
||||
$resultRow = $this->fetchResult();
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns an array of sources (tables) in the database.
|
||||
*
|
||||
|
@ -241,7 +226,7 @@ class DboMysql extends DboSource {
|
|||
return 'NULL';
|
||||
}
|
||||
|
||||
if($data == '') {
|
||||
if($data === '') {
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
|
|
@ -125,21 +125,6 @@ class DboMysqli extends DboSource {
|
|||
function _execute($sql) {
|
||||
return mysqli_query($this->connection, $sql);
|
||||
}
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @param bool $assoc Associative array only, or both?
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow($assoc = false) {
|
||||
if(is_resource($this->_result)) {
|
||||
$this->resultSet($this->_result);
|
||||
$resultRow = $this->fetchResult();
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns an array of sources (tables) in the database.
|
||||
*
|
||||
|
@ -229,7 +214,7 @@ class DboMysqli extends DboSource {
|
|||
return 'NULL';
|
||||
}
|
||||
|
||||
if($data == '') {
|
||||
if($data === '') {
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
|
|
@ -121,9 +121,8 @@ class DboOdbc extends DboSource{
|
|||
* @return boolean True if the database could be disconnected, else false
|
||||
*/
|
||||
function disconnect() {
|
||||
return@odbc_close($this->connection);
|
||||
return @odbc_close($this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes given SQL statement.
|
||||
*
|
||||
|
@ -134,22 +133,6 @@ class DboOdbc extends DboSource{
|
|||
function _execute($sql) {
|
||||
return odbc_exec($this->connection, $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @param bool $assoc Associative array only, or both?
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow($assoc = false) {
|
||||
if (is_resource($this->_result)) {
|
||||
$this->resultSet($this->_result);
|
||||
$resultRow = $this->fetchResult();
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns an array of sources (tables) in the database.
|
||||
*
|
||||
|
|
|
@ -96,9 +96,9 @@ class DBO_Pear extends DboSource{
|
|||
*
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow() {
|
||||
return $this->_result->fetchRow(DB_FETCHMODE_ASSOC);
|
||||
}
|
||||
function fetchRow() {
|
||||
return $this->_result->fetchRow(DB_FETCHMODE_ASSOC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
|
||||
|
|
|
@ -83,7 +83,7 @@ class DboPostgres extends DboSource {
|
|||
|
||||
$config = $this->config;
|
||||
$connect = $config['connect'];
|
||||
$this->connection = $connect("host={$config['host']} port={$config['port']} dbname={$config['database']} user={$config['login']} password={$config['password']}");
|
||||
$this->connection = $connect("host='{$config['host']}' port='{$config['port']}' dbname='{$config['database']}' user='{$config['login']}' password='{$config['password']}'");
|
||||
|
||||
if ($this->connection) {
|
||||
$this->connected = true;
|
||||
|
@ -104,7 +104,7 @@ class DboPostgres extends DboSource {
|
|||
* @return boolean True if the database could be disconnected, else false
|
||||
*/
|
||||
function disconnect() {
|
||||
$this->connected=!@pg_close($this->connection);
|
||||
$this->connected = !@pg_close($this->connection);
|
||||
return !$this->connected;
|
||||
}
|
||||
|
||||
|
@ -117,29 +117,13 @@ class DboPostgres extends DboSource {
|
|||
function _execute($sql) {
|
||||
return pg_query($this->connection, $sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow($assoc = false) {
|
||||
if (is_resource($this->_result)) {
|
||||
$this->resultSet($this->_result);
|
||||
$resultRow=$this->fetchResult();
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
|
||||
*
|
||||
* @return array Array of tablenames in the database
|
||||
*/
|
||||
function listSources() {
|
||||
$cache=parent::listSources();
|
||||
$cache = parent::listSources();
|
||||
|
||||
if ($cache != null) {
|
||||
return $cache;
|
||||
|
@ -241,7 +225,7 @@ class DboPostgres extends DboSource {
|
|||
|
||||
switch($column) {
|
||||
case 'integer':
|
||||
if ($data == '') {
|
||||
if ($data === '') {
|
||||
return 'DEFAULT';
|
||||
} else {
|
||||
$data = pg_escape_string($data);
|
||||
|
@ -252,7 +236,7 @@ class DboPostgres extends DboSource {
|
|||
|
||||
break;
|
||||
case 'boolean':
|
||||
$data=$this->boolean((bool)$data);
|
||||
$data = $this->boolean((bool)$data);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -119,20 +119,6 @@ class DboSqlite extends DboSource {
|
|||
function _execute($sql) {
|
||||
return sqlite_query($this->connection, $sql);
|
||||
}
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow ($assoc = false) {
|
||||
if(is_resource($this->_result)) {
|
||||
$this->resultSet($this->_result);
|
||||
$resultRow = $this->fetchResult();
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns an array of tables in the database. If there are no tables, an error is raised and the application exits.
|
||||
*
|
||||
|
@ -224,7 +210,7 @@ class DboSqlite extends DboSource {
|
|||
return 'NULL';
|
||||
}
|
||||
|
||||
if($data == '') {
|
||||
if($data === '') {
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
|
|
@ -125,21 +125,6 @@ class DboSybase extends DboSource {
|
|||
function _execute($sql) {
|
||||
return sybase_query($sql, $this->connection);
|
||||
}
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
* @param bool $assoc Associative array only, or both?
|
||||
* @return array The fetched row as an array
|
||||
*/
|
||||
function fetchRow($assoc = false) {
|
||||
if(is_resource($this->_result)) {
|
||||
$this->resultSet($this->_result);
|
||||
$resultRow = $this->fetchResult();
|
||||
return $resultRow;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns an array of sources (tables) in the database.
|
||||
*
|
||||
|
@ -229,7 +214,7 @@ class DboSybase extends DboSource {
|
|||
return 'NULL';
|
||||
}
|
||||
|
||||
if($data == '') {
|
||||
if($data === '') {
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue