Oracle 5.0 Reference Manual page 1439

Table of Contents

Advertisement

• Unless your client is designed to cope with more result sets than queries, you should ensure that the
number of queries from the client match the number of results sets returned to the client. Using the
unique ID and removing result sets you inserted will help.
Normally, the
with each other to inject additional queries and remove the additional result sets. However,
read_query_result()
15.7.4.8. Manipulating Results with
The
read_query_result()
manually injected queries into the query queue. If you have not manipulated the query queue, this
function is not called. The function supports a single argument, the result packet, which provides a
number of properties:
• id: The ID of the result set, which corresponds to the ID that was set when the query packet was
submitted to the server when using
resultset_is_needed
See
proxy.queries
• query: The text of the original query.
• query_time: The number of microseconds required to receive the first row of a result set since the
query was sent to the server.
• response_time: The number of microseconds required to receive the last row of the result set
since the query was sent to the server.
• resultset: The content of the result set data.
By accessing the result information from the MySQL server, you can extract the results that match the
queries that you injected, return different result sets (for example, from a modified query), and even
create your own result sets.
The following Lua script, for example, will output the query, followed by the query time and response
time (that is, the time to execute the query and the time to return the data for the query) for each query
sent to the server:
function read_query( packet )
if packet:byte() == proxy.COM_QUERY then
end
end
function read_query_result(inj)
print("query-time: " .. (inj.query_time / 1000) .. "ms")
print("response-time: " .. (inj.response_time / 1000) .. "ms")
end
You can access the rows of returned results from the result set by accessing the
resultset
can iterate over the results showing the first column from each row using this Lua fragment:
for row in inj.resultset.rows do
print("injected query returned: " .. row[1])
end
Just like read_query(),
according to the result returned. If you have injected additional queries into the query queue, for
example, remove the results returned from those additional queries and return only the results from the
query originally submitted by the client.
MySQL Proxy Scripting
and
read_query()
read_query_result()
is only called if you populate the query queue within read_query().
read_query_result()
is called for each result set returned by the server only if you have
flag to
append
[1411].
print("we got a normal query: " .. packet:sub(2))
proxy.queries:append(1, packet )
return proxy.PROXY_SEND_QUERY
property of the result that is exposed through read_query_result(). For example, you
read_query_result()
on the query queue. You must have set the
append(id)
to intercept the result set before it is returned to the client.
can return different values for each result
1419
function are used in conjunction
rows
property of the

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents