It should be safe to use RawBytes from *Conn or *Tx, the transaction won't
be re-used. We will look into it further.
On Friday, July 22, 2022 at 4:40:16 AM UTC-5 Michal Hruby wrote:
> That's right, atm there's no safe way to use sql.RawBytes, it should
> either be documented that you need to
That's right, atm there's no safe way to use sql.RawBytes, it should either
be documented that you need to manually control the context, or the
standard library shouldn't be closing the driver.Rows unless the user calls
Scan or Close.
On Fri, 22 Jul 2022, 00:45 Steven Hartland, wrote:
> I'm
I'm guessing that Michal is flagging is there no way to write safe code if
your using stmt.QueryContext(ctx) and rows.Scan into a sql.RawBytes
as QueryContext kicks off a go routine that monitors the ctx, closing rows
if cancelled and that ctx can be cancelled at any time.
The only thing that
On Thu, Jul 21, 2022 at 11:02 AM Michal Hruby wrote:
>
> Hello, I have a code snippet equivalent to this one:
>
> rows, err := stmt.QueryContext(ctx)
> if err != nil {
> return info, nil, err
> }
> defer rows.Close()
>
> var data sql.RawBytes
> for rows.Next() {
> err = rows.Scan()
>
Hello, I have a code snippet equivalent to this one:
rows, err := stmt.QueryContext(ctx)
if err != nil {
return info, nil, err
}
defer rows.Close()
var data sql.RawBytes
for rows.Next() {
err = rows.Scan()
if err != nil {
return nil, err
}
// if ctx is canceled around