-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Parsing time enabled silently ignores invalid dates and stops any subsequent rows reads #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
When I use a string variable
or
|
reproducible code, schema and data? |
Schema, data: Code: var userRows *sql.Rows
var userID int
var birthday *time.Time
userRows, err = txn.Query(`
SELECT user_id, birthday
FROM users
`)
for userRows.Next() {
err = userRows.Scan(&userID, &birthday)
if err !=nil {
// There's no error fired...
}
} |
I'm sorry, I was wrong. I've deleted previous message. @datio You just missed checking for rows.Next() {
var userID int
var birthday *time.Time
if err := rows.Err(); err != nil {
panic(err)
}
err = rows.Scan(&userID, &birthday)
fmt.Printf("err=%v, userid=%v, birthday=%v\n", err, userID, birthday)
}
fmt.Printf("Last: %v\n", rows.Err()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue description
The time parse errors (out of range / cannot parse) are silently ignored.
Any subsequent results with rows.Next() are not returned.
Example code
Configuration
Driver version (or git SHA): Can't say for sure, the FETCH_HEAD contents include:
Go version: go1.9.1 linux/amd64
Server version: mysql Ver 15.1 Distrib 10.2.8-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Server OS: Linux 3937cad50f1a 4.4.0-96-generic
#
119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64 GNU/LinuxThe server runs inside a docker container BTW.
The text was updated successfully, but these errors were encountered: