mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Improve MySQL encoding errors handling.
When it's not possible to decode a MySQL value in the proper given encoding, automatically replace the value with nil and be quite verbose about it by logging an error.
This commit is contained in:
parent
b033aed88b
commit
1461cda1c0
@ -72,9 +72,17 @@
|
||||
(funcall process-row-fn row))))
|
||||
(handler-bind
|
||||
((babel-encodings:character-decoding-error
|
||||
#'(lambda (e)
|
||||
#'(lambda (c)
|
||||
(pgstate-incf *state* (target mysql) :errs 1)
|
||||
(log-message :error "~a" e))))
|
||||
(let ((encoding (babel-encodings:character-coding-error-encoding c))
|
||||
(position (babel-encodings:character-coding-error-position c))
|
||||
(character
|
||||
(aref (babel-encodings:character-decoding-error-octets c)
|
||||
(babel-encodings:character-coding-error-position c))))
|
||||
(log-message :error
|
||||
"~a: Illegal ~a character starting at position ~a: ~a."
|
||||
table-name encoding position character))
|
||||
(invoke-restart 'qmynd-impl::use-nil))))
|
||||
(mysql-query sql :row-fn row-fn :result-type 'vector))))))
|
||||
|
||||
;;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user