go-sqlite3 icon indicating copy to clipboard operation
go-sqlite3 copied to clipboard

Return io.EOF for empty Query statements

Open ganigeorgiev opened this issue 1 year ago • 3 comments

This small PR is supposed to fix https://github.com/mattn/go-sqlite3/issues/950.

ganigeorgiev avatar Oct 11 '24 23:10 ganigeorgiev

I don't think we should return io.EOF. An empty query is likely a bug, and doing this would mask it.

rittneje avatar Oct 11 '24 23:10 rittneje

It is an empty statement. I don't see why it would be considered bug.

I have no strong opinion on this but note that https://pkg.go.dev/modernc.org/sqlite also seems to behave this way and doesn't hang.

ganigeorgiev avatar Oct 11 '24 23:10 ganigeorgiev

It is also similar to the behavior of the already merged https://github.com/mattn/go-sqlite3/pull/973 for Exec.

For me it doesn't make sense db.Query("") to fail and db.Exec("") not.

ganigeorgiev avatar Oct 11 '24 23:10 ganigeorgiev