1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

Fixes issues with secondary database connections.

This commit is contained in:
Cameron
2019-01-05 14:37:12 -08:00
parent e49c53492e
commit e44fc0c13a

View File

@@ -939,7 +939,7 @@ class e_db_mysql
if($REPLACE === false) if($REPLACE === false)
{ {
$query = "INSERT".$IGNORE." INTO `".$this->mySQLPrefix."{$table}` ({$keyList}) VALUES ({$valList})"; $query = "INSERT".$IGNORE." INTO ".$this->mySQLPrefix."{$table} ({$keyList}) VALUES ({$valList})";
if($DUPEKEY_UPDATE === true) if($DUPEKEY_UPDATE === true)
{ {
@@ -950,7 +950,7 @@ class e_db_mysql
} }
else else
{ {
$query = "REPLACE INTO `".$this->mySQLPrefix."{$table}` ({$keyList}) VALUES ({$valList})"; $query = "REPLACE INTO ".$this->mySQLPrefix."{$table} ({$keyList}) VALUES ({$valList})";
} }
@@ -1479,14 +1479,14 @@ class e_db_mysql
*/ */
function truncate($table=null) function truncate($table=null)
{ {
if($table == null){ return; } if($table == null){ return null; }
return $this->gen("TRUNCATE TABLE `#".$table."` "); return $this->gen("TRUNCATE TABLE ".$this->mySQLPrefix.$table);
} }
/** /**
* @param string $type assoc|num|both * @param string $type assoc|num|both
* @return array MySQL row * @return array|bool MySQL row
* @desc Fetch an array containing row data (see PHP's mysql_fetch_array() docs)<br /> * @desc Fetch an array containing row data (see PHP's mysql_fetch_array() docs)<br />
* @example * @example
* Example :<br /> * Example :<br />
@@ -1596,7 +1596,7 @@ class e_db_mysql
{ {
$rows = $this->mySQLrows = ($this->pdo) ? $this->mySQLresult->fetch(PDO::FETCH_ASSOC) : @mysql_fetch_array($this->mySQLresult); $rows = $this->mySQLrows = ($this->pdo) ? $this->mySQLresult->fetch(PDO::FETCH_ASSOC) : @mysql_fetch_array($this->mySQLresult);
$this->dbError('db_Count'); $this->dbError('db_Count');
return $rows['COUNT(*)']; return (int) $rows['COUNT(*)'];
} }
else else
{ {
@@ -1616,7 +1616,7 @@ class e_db_mysql
{ {
$rows = $this->mySQLrows = ($this->pdo) ? $this->mySQLresult->fetch(PDO::FETCH_NUM) : @mysql_fetch_array($this->mySQLresult); $rows = $this->mySQLrows = ($this->pdo) ? $this->mySQLresult->fetch(PDO::FETCH_NUM) : @mysql_fetch_array($this->mySQLresult);
$this->dbError('db_Count'); $this->dbError('db_Count');
return $rows[0]; return (int) $rows[0];
} }
else else
{ {
@@ -2484,7 +2484,7 @@ class e_db_mysql
return false; return false;
} }
$result = $this->gen("SELECT NULL FROM `#".$table."` LIMIT 1"); $result = $this->gen("SELECT NULL FROM ".$this->mySQLPrefix.$table." LIMIT 1");
if($result === 0) if($result === 0)
{ {
@@ -2641,7 +2641,7 @@ class e_db_mysql
$fieldList = $fields; $fieldList = $fields;
} }
$id = $this->gen("INSERT INTO #".$table."(".$fieldList.") SELECT ".$fieldList." FROM #".$table." WHERE ".$args); $id = $this->gen("INSERT INTO ".$this->mySQLPrefix.$table."(".$fieldList.") SELECT ".$fieldList." FROM ".$this->mySQLPrefix.$table." WHERE ".$args);
$lastInsertId = $this->lastInsertId(); $lastInsertId = $this->lastInsertId();
return ($id && $lastInsertId) ? $lastInsertId : false; return ($id && $lastInsertId) ? $lastInsertId : false;