database/sql.DB is a pool. If you don't want to close it, SetMaxIdleConns(1), or better, use a db.Conn().
stephan...@gmail.com a következőt írta (2020. szeptember 11., péntek, 21:02:26 UTC+2): > On Friday, 11 September 2020 at 21:04:11 UTC+3 mar...@gmail.com wrote: > >> Which sqlite driver are you using? That sounds like a bug. >> > > "github.com/mattn/go-sqlite3" > > >> >> On Fri, Sep 11, 2020 at 10:56 AM Stephan Lukits wrote: >> >>> I passed a string-type pointer (as last destination) to a sql.DB.Query >>> call which had a NULL value as field value. No error was returned >> >> > Here I was wrong. The error is returned by the Scan(...)-call (which I > didn't catch, these are my first steps with go ...) > The reason why I was fixated on the Query-call was the way I tracked the > cause: > I printed the functioning and not functioning DB-connection and saw that > they differ > &{0 {:memory: 0xc00000e0e0} 0 {0 0} [0xc000126a20] ... > &{0 {:memory: 0xc00000e0e0} 0 {0 0} [] ... > at the slice. Pinging the non-functioning DB-connection put a new addres > into the empty slice, so I assumed that this slice holds the open > connections. > Then I narroed the two lines until I found the line where the switch to > the empty slice happand which was oddly the Query-call. > > The Questions which remain are, dose this connection gets closed allways > when an error appears? Is it a bug? > Can I use the API to figure if this connection was closed? Ping doesn't > work because it just creates a new connection and pretends everything is > fine. > My settings are: > .SetMaxOpenConns(1) > .SetConnMaxLifetime(0) > .SetConnMaxIdleTime(0) > (because I really don't want this connection to close ;) > > Thanks Stephan > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/284619bd-4576-4d73-8696-fbd0e1865a34n%40googlegroups.com.