AFAIK there is not. However, you could certainly build your function to do so. Create a function that accepts the SQL statement like mysql_query() normally would, but store it in a variable before you pass it to mysql_query within your custom function.
function my_query($sql)
{
$last_query = $sql;
global $last_query;
mysql_query($sql);
}