sql2txt bug fixes

- fix tab escaping where input size is not zero but we read past it
  in the buffer, write right number of bytes out
- in sql_escape pay attention to (just) the size of input buf when
  it's provided, not reading past it
- skip leading blanks before tuples
- make tab_escape and sql_escape take -1 size rather than 0
  (which can be a legit size) in order to ignore that param
- deal properly with escaped chars split across buffers
- if we run out of data parsing a tuple, get a new buffer

Change-Id: I959ad9138394ee66a59487916be72620d9918447