首先说明这个问题困扰了我很长时间了,严格地说应该有两天,不过终于通过sqlite的官方文档解决了。
For example,assume the string variable zText contains text as follows:
char *zText = "It's a happy day!";
One can use this text in an sql statement as follows:
原文链接:https://www.f2er.com/sqlite/202396.htmlchar *zsql = sqlite3_mprintf("INSERT INTO table VALUES('%q')",zText); sqlite3_exec(db,zsql,0); sqlite3_free(zsql);