Full-fledged query buffers

Store query buffers per query the same way it's done for channels.

This allows clients to implement persistent query buffers. Queries
remain open across clients and sessions until a client explicitly
sends a command to clear a (closed) query buffer.

A new config option AutoClearQueryBuffer that default to false
ensures behavioral backwards compatibility.
I'm not sure whether it's obvious what is <buffer> here (and below)...