switch_mprintf -> sqlite3_mprintf and check for null before dereferencing
switch_mprintf -> asprintf and check for null before dereferencing and format code so it doesn't give me eye cancer