Oracle 5.0 Reference Manual page 1442

Table of Contents

Advertisement

end
local query = packet:sub(2)
local rows = { }
local fields = { }
-- try to match the string up to the first non-alphanum
local f_s, f_e, command = string.find(packet, "^%s*(%w+)", 2)
local option
if f_e then
-- if that match, take the next sub-string as option
f_s, f_e, option = string.find(packet, "^%s+(%w+)", f_e + 1)
end
-- we got our commands, execute it
if command == "show" and option == "querycounter" then
---
-- proxy.PROXY_SEND_RESULT requires
--
-- proxy.response.type to be either
-- * proxy.MYSQLD_PACKET_OK or
-- * proxy.MYSQLD_PACKET_ERR
--
-- for proxy.MYSQLD_PACKET_OK you need a resultset
-- * fields
-- * rows
--
-- for proxy.MYSQLD_PACKET_ERR
-- * errmsg
proxy.response.type = proxy.MYSQLD_PACKET_OK
proxy.response.resultset = {
fields = {
},
rows = {
}
}
-- we have our result, send it back
return proxy.PROXY_SEND_RESULT
elseif command == "show" and option == "myerror" then
proxy.response.type = proxy.MYSQLD_PACKET_ERR
proxy.response.errmsg = "my first error"
return proxy.PROXY_SEND_RESULT
elseif string.sub(packet, 2):lower() == 'select help' then
return show_process_help()
elseif string.sub(packet, 2):lower() == 'show proxy processlist' then
return show_process_table()
elseif query == "SELECT * FROM backends" then
fields = {
{ name = "backend_ndx",
type = proxy.MYSQL_TYPE_LONG },
{ name = "address",
type = proxy.MYSQL_TYPE_STRING },
{ name = "state",
type = proxy.MYSQL_TYPE_STRING },
{ name = "type",
type = proxy.MYSQL_TYPE_STRING },
}
for i = 1, #proxy.global.backends do
local b = proxy.global.backends[i]
rows[#rows + 1] = {
i, b.dst.name, b.state, b.type
Using MySQL Proxy
{ type = proxy.MYSQL_TYPE_LONG, name = "query_counter", },
{ proxy.global.query_counter }
1422

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents