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.
/* * 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 */