©
This document uses PHP Chinese website manual Release
(PHP 5)
mysqli::rpl_query_type -- mysqli_rpl_query_type — Returns RPL query type
面向对象风格
$query
)过程化风格
$link
, string $query
)
Returns MYSQLI_RPL_MASTER
,
MYSQLI_RPL_SLAVE
or
MYSQLI_RPL_ADMIN
depending on a query type.
INSERT, UPDATE and similar are
master queries, SELECT is
slave, and FLUSH,
REPAIR and similar are admin.
本函数还未编写文档,仅有参数列表。
自 PHP 5.3.0 起,已经废弃并移除此函数。
[#1] steohan at gobro dot de [2010-09-22 11:22:44]
Because the sql types could be combined it would be better to use a function like this:
function getMySQLType($str){
$str=trim($str);
return strtoupper(substr($str,0,strpos($str,' ')));
}
$sql="select * from user;";
if (getMySQLType($sql) == 'SELECT'){
//true
}
[#2] technique-glamour at condenast dot fr [2007-07-19 08:28:06]
WARNING : this function (or maybe the "enable_rpl_parse" function) randomly causes a segfault into PHP.
We don't use this function anymore. Instead we check if the query contains the word 'SELECT' :
function query_type($query)
{
if ( stripos($query,'SELECT'))
return true;
return false;
}