← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: Dealing with resultsets

 

Hi!

On Jan 15, 2009, at 6:58 PM, Giuseppe Maxia wrote:

What is the recommended way of dealing with result sets in
read_query_result?
Previously, I used things like

 local res = assert(inj.resultset)
 local num_cols = string.byte(res.raw, 1)

 if num_cols > 0 and num_cols < 255 then -- there is a resultset
 -- some work
 end

Running this code, I now get warnings and different results than before.

Is there any change in the way we deal with resultsets?


Indeed there is.
This is a consequence of proxy no longer buffering resultsets by default to avoid overhead and memory size problems with large results.

In read_query you can tell it for which injections to buffer the result packets like:

proxy.queries:append(1, string.char(proxy.COM_QUERY) .. "SELECT value FROM table WHERE a > 5", { resultset_is_needed = true })

or do this for the original query:

proxy.queries:append(1, packet, { resultset_is_needed = true })

then the rest is as usual.

hth,
-k
--
Kay Roepke
Software Engineer, MySQL Enterprise Tools

Sun Microsystems GmbH    Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering                    HRB MUC 161028




Follow ups

References