Merge pull request #2649 from tperalta82/master
Fix INSERTS with Selects inside
This commit is contained in:
commit
2dfe1751f3
@ -61,7 +61,7 @@ class mysqlims extends mysqli
|
||||
*/
|
||||
public function prepare($query)
|
||||
{
|
||||
if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) {
|
||||
if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && stripos($query, "INSERT") === false && $this->slave !== false) {
|
||||
$this->lastused = $this->mysqliR;
|
||||
return $this->mysqliR->prepare($query);
|
||||
} else {
|
||||
@ -80,7 +80,7 @@ class mysqlims extends mysqli
|
||||
*/
|
||||
public function query($query, $resultmode = MYSQLI_STORE_RESULT)
|
||||
{
|
||||
if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && $this->slave !== false) {/* Use readonly server */
|
||||
if (stripos($query, "SELECT") && stripos($query, "FOR UPDATE") === false && stripos($query, "INSERT") === false && $this->slave !== false) {/* Use readonly server */
|
||||
$this->lastused = $this->mysqliR;
|
||||
return $this->mysqliR->query($query, $resultmode);
|
||||
} else {
|
||||
@ -88,4 +88,4 @@ class mysqlims extends mysqli
|
||||
return $this->mysqliW->query($query, $resultmode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user