2
query() can always be used for SELECT statements (i.e. SQL statements that begin with SELECT without any whitespaces, breaks or other characters before the SELECT)
query() can only be used for non-SELECT statements if the HTTP request method is POST (i.e. if the request was made through a form using the method=POST)
This is because what is instantiated is NOT a MySQLDatabase, but a MySQLDatabaseProxy or MySQLDatabaseSafe. This is done in include/common.php where the request method and the HTTP referer is checked. If either the request method is not POST or the HTTP Referer is not disclosed, a MySQLDatabaseProxy object is instantiated - which does not allow non-SELECT statements in query() - otherwise a MySQLDatabaseSafe is instantiated, which allows non-SELECT statements in query()
Hope this helps