switch_mprintf -> sqlite3_mprintf and check for null before deref