go-sqlite3
go-sqlite3 copied to clipboard
Add line number to error message when executing blob of sql
I'm running a blob of sql line this:
if _, err := db.ExecContext(ctx, statement); err != nil {
return err
}
and I'm getting FOREIGN KEY constraint failed; but it's a giant blob of sql with many insert statements, so I sorta have to do trial and error to figure out which constraint is failing. Is it possible to add a line number to this error message?
The sqlite3_error_offset function added in 3.38.0 seems like it would suit your needs.