YMMV with this as I'm not an sqlite guru...
 
You may need to prefix the printf  with a sqlite3_ . Elsewhere for mprintf example gives:

char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
sqlite3_exec(db, zSQL, 0, 0, 0);
sqlite3_free(zSQL);

HTH,

Mark