Sql: Handle SQLITE_BUSY properly for sqlite3_step and sqlite3_prepare.

Repeat the statements a couple of times and sleep in between.