It seems that might be caused by weird non conforming to DB file dates or date formats.
Some files used to throw these type of messages:
Doctrine\DBAL\Exception\DriverException: An exception occurred while executing ‘INSERT INTO oc_opds_metadata (id
, updated
, date
, author
, title
, language
, publisher
, isbn
, copyright
, description
, subjects
, cover
, rescan
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)’ with params [77796, “2019-03-08 20:37:32”, “”, “”, “Bargain ZZZ”, “”, “”, “9781591845505”, “”, “”, “”, null, “2019-03-15T20:37:33+00:00”]: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ‘2019-03-15T20:37:33+00:00’ for column nextcloud
.oc_opds_metadata
.rescan
at row 1
I made these changes in \lib\meta.php:
Change
$meta['date'],
to
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['date']))),
and change
$meta['rescan'],
to
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['rescan']))),
in this block of the code
$sql = "UPDATE *PREFIX*opds_metadata SET `updated`=?, `date`=?, `author`=?, `title`=?, `language`=?, `publisher`=?, `isbn`=?, `copyright`=?, `description`=?, `subjects`=?, `cover`=?, `rescan`=? WHERE id=?";
$args = array(
$meta['updated'],
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['date']))),
$meta['author'],
$meta['title'],
$meta['language'],
$meta['publisher'],
preg_replace('/[^0-9xX]/','',$meta['isbn']),
mb_strimwidth($meta['copyright'],0,252,'...'),
mb_strimwidth($meta['description'],0,2044,'...'),
$meta['subjects'],
$meta['cover'],
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['rescan']))),
$meta['id']
);
} else {
$sql = "INSERT INTO *PREFIX*opds_metadata (`id`, `updated`, `date`, `author`, `title`, `language`, `publisher`, `isbn`, `copyright`, `description`, `subjects`, `cover`, `rescan`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
$args = array(
$meta['id'],
$meta['updated'],
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['date']))),
$meta['author'],
$meta['title'],
$meta['language'],
$meta['publisher'],
preg_replace('/[^0-9xX]/','',$meta['isbn']),
mb_strimwidth($meta['copyright'],0,252,'...'),
mb_strimwidth($meta['description'],0,2044,'...'),
$meta['subjects'],
$meta['cover'],
date('Y-m-d H:i:s', strtotime(str_replace('-', '/', $meta['rescan']))),
);