mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
PHP 5.6 fixes for e_db_mysql
- FIX: Don't redefine MYSQL_* constants in e_db_pdo_class.php - FIX: e_db_mysql::rowCount() could try to use mysql_num_rows() to count rows of a non-resource - FIX: e_db_mysql::delete() stores the number of deleted rows in e_db_mysql::$mySQLrows - FIX: e_db_abstractTest::testDb_Query() was fetching in PDO mode but shouldn't have been - FIX: Typos in e_db_abstractTest::testDelete() - MOD: Moved PDO-exclusive testBackup() from e_db_abstractTest to e_db_pdoTest - FIX: e_db_mysqlTest now works in PHP 5.6 if the main e_db instance was in PDO mode but the test class initializes in legacy mode - MOD: e_db_mysqlTest now asserts that PDO mode is not in use - FIX: e_db_mysqlTest::testGetServerInfo() should now actually get a version number - FIX: e_db_mysqlTest::testGetLastErrorNumber() has a different error code compared to PDO - FIX: e_db_mysqlTest::testEscape() should actually get something from mysql_real_escape_string()
This commit is contained in:
@@ -1083,9 +1083,16 @@ class e_db_mysql implements e_db
|
||||
|
||||
/** @var PDOStatement $resource */
|
||||
$resource = $this->mySQLresult;
|
||||
$rows = $this->mySQLrows = ($this->pdo) ? $resource->rowCount() : mysql_num_rows($this->mySQLresult);
|
||||
if ($this->pdo)
|
||||
{
|
||||
$this->mySQLrows = $resource->rowCount();
|
||||
}
|
||||
elseif (is_resource($this->mySQLresult))
|
||||
{
|
||||
$this->mySQLrows = mysql_num_rows($this->mySQLresult);
|
||||
}
|
||||
$this->dbError('db_Rows');
|
||||
return $rows;
|
||||
return $this->mySQLrows;
|
||||
}
|
||||
|
||||
|
||||
@@ -1723,9 +1730,9 @@ class e_db_mysql implements e_db
|
||||
if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.$this->mySQLPrefix.$table, NULL, 'db_Delete', $debug, $log_type, $log_remark))
|
||||
{
|
||||
// return the number of records deleted instead of an object
|
||||
$tmp = ($this->pdo) ? $this->mySQLresult->rowCount() : mysql_affected_rows($this->mySQLaccess);
|
||||
$this->mySQLrows = ($this->pdo) ? $this->mySQLresult->rowCount() : mysql_affected_rows($this->mySQLaccess);
|
||||
$this->dbError('db_Delete');
|
||||
return $tmp;
|
||||
return $this->mySQLrows;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1737,9 +1744,9 @@ class e_db_mysql implements e_db
|
||||
{
|
||||
if ($result = $this->mySQLresult = $this->db_Query('DELETE FROM '.$this->mySQLPrefix.$table.' WHERE '.$arg, NULL, 'db_Delete', $debug, $log_type, $log_remark))
|
||||
{
|
||||
$tmp = ($this->pdo) ? $this->mySQLresult->rowCount() : mysql_affected_rows($this->mySQLaccess);
|
||||
$this->mySQLrows = ($this->pdo) ? $this->mySQLresult->rowCount() : mysql_affected_rows($this->mySQLaccess);
|
||||
$this->dbError('db_Delete');
|
||||
return $tmp;
|
||||
return $this->mySQLrows;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user