Fix db_insert_*() functions

db_insert_* functions were comparing againts wrong return value, fix
that. Also limit error propagation of those functions.
Merge remote-tracking branch 'github/master'