Bug #13417 rpl_query_type returns MASTER for CALL statements, even non-updating ones
Submitted: 23 Sep 2005 3:55 Modified: 24 Sep 2005 4:19
Reporter: Jasper Bryant-Greene Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.12-beta OS:Linux (Gentoo Linux x86)
Assigned to: MySQL Verification Team CPU Architecture:Any

[23 Sep 2005 3:55] Jasper Bryant-Greene
Description:
From the PHP MySQLi API, calling mysqli_rpl_query_type() for a CALL statement should return MYSQLI_RPL_SLAVE for CALL statements where the stored procedure is defined as READS SQL DATA, and MYSQLI_RPL_MASTER for other SPs.

How to repeat:
Where getUser is a stored procedure taking one INT argument and defined as READS SQL DATA:

<?php

$query_type = $myDatabaseConnection->rpl_query_type('CALL getUser(7)');

if($query_type == MYSQLI_RPL_SLAVE) {
print('Execute on slave');
} else {
print('Execute on master');
}

?>

Expected results: "Execute on slave"
Actual results: "Execute on master"

Suggested fix:
Make rpl_query_type return SLAVE for calling stored procedures defined as READS SQL DATA.
[24 Sep 2005 4:19] MySQL Verification Team
Sorry but this is specif PHP's Function Table / Implementation. Not MySQL server.