Oracle 5.0 Reference Manual page 1444

Table of Contents

Advertisement

mysql> show querycounter
is split into
command = "show"
option
= "querycounter"
spaces are ignored, the case has to be as is.
mysql> show myerror
returns a error-packet
--]]
The script works in combination with a main proxy script, reporter.lua:
--[[
Copyright 2008, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
--]]
-- reporter.lua
--[[
See http://www.chriscalender.com/?p=41
(Thanks to Chris Calender)
See http://datacharmer.blogspot.com/2009/01/mysql-proxy-is-back.html
(Thanks Giuseppe Maxia)
--]]
proxy.global.query_counter = proxy.global.query_counter or 0
function proxy.global.initialize_process_table()
if proxy.global.process == nil then
proxy.global.process = {}
end
if proxy.global.process[proxy.connection.server.thread_id] == nil then
proxy.global.process[proxy.connection.server.thread_id] = {}
end
end
function read_auth_result( auth )
local state = auth.packet:byte()
if state == proxy.MYSQLD_PACKET_OK then
proxy.global.initialize_process_table()
table.insert( proxy.global.process[proxy.connection.server.thread_id],
{ ip = proxy.connection.client.src.name, ts = os.time() } )
end
end
function disconnect_client()
local connection_id = proxy.connection.server.thread_id
if connection_id then
-- client has disconnected, set this to nil
proxy.global.process[connection_id] = nil
end
Using MySQL Proxy
1424
See the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents