Fix several issues commiting data to db

orm: Fix detection of statement failure
orm: Fix type detection of InstrumentedList::add
mysqli: Set object-level character set