====== isReadOnlyQuery ======
~~NOTOC~~
== Applies To ==
[[v5:loadbalancer:index|ADOdb Load Balancer]]
== Syntax ==
bool isReadOnlyQuery(
string $sql
)
===== Description =====
The method ''isReadOnly()'' reads a provided SQL statement for elements that might cause a read-write process to be created. The method is used internally by the load balancer to determine if a statement needs to be executed on the primary server but can also be called manually.
---------------------------
===== Usage ====
/*
* connection to load balancer assumed
*/
$SQL = "SELECT * FROM employees";
print $db->isReadOnlySql($SQL);
/*
* Returns false
*/
SQL = "SELECT * FROM employees FOR UPDATE";
print $db->isReadOnlySql($SQL);
/*
* Returns true
*/