mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-19 07:59:54 +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,7 +117,6 @@ class DboAdodb extends DboSource{
|
|||
function _execute($sql) {
|
||||
return $this->_adodb->execute($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a row from given resultset as an array .
|
||||
*
|
||||
|
@ -127,7 +126,6 @@ class DboAdodb extends DboSource{
|
|||
if ($this->_result->EOF) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->_result->FetchRow();
|
||||
}
|
||||
|
||||
|
@ -317,7 +315,7 @@ class DboAdodb extends DboSource{
|
|||
return 'NULL';
|
||||
}
|
||||
|
||||
if ($data == '') {
|
||||
if ($data === '') {
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ class DboMssql extends DboSource {
|
|||
|
||||
if (is_numeric($config['port'])) {
|
||||
$port = ':' . $config['port']; // Port number
|
||||
} elseif ($config['port'] === null) {
|
||||
$port = ''; // No port - SQL Server 2005
|
||||
} else {
|
||||
$port = '\\' . $config['port']; // Named pipe
|
||||
}
|
||||
|
@ -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 "''";
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,6 @@ class DboOdbc extends DboSource{
|
|||
function disconnect() {
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
@ -117,22 +117,6 @@ 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.
|
||||
*
|
||||
|
@ -241,7 +225,7 @@ class DboPostgres extends DboSource {
|
|||
|
||||
switch($column) {
|
||||
case 'integer':
|
||||
if ($data == '') {
|
||||
if ($data === '') {
|
||||
return 'DEFAULT';
|
||||
} else {
|
||||
$data = pg_escape_string($data);
|
||||
|
|
|
@ -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