Returning an error message is one of the tasks that may become
common when working with MySQL
Proxy.
Let's say that you want to prevent users from querying your
database at a given time. The most sensible answer that you would
send to the client that is requesting a query in the forbidden
period is an error message. Not only that, the client must
receive an error code and SQL state, as if the error were issued
by the database server.
With MySQL Proxy, an error set is a legitimate packet to be sent
back to the client, and thus you can return a customized error in
answer to any query.
function error_result (msg, code,state)
proxy.response = {
type = proxy.MYSQLD_PACKET_ERR,
errmsg = msg,
errcode = code,
sqlstate = state,
}
return proxy.PROXY_SEND_RESULT
end …[Read more]