官网原型:
int sqlite3_prepare_v2( sqlite3 *db, /* Database handle */ const char *zSql, /* SQL statement, UTF-8 encoded */ int nByte, /* Maximum length of zSql in bytes. */ sqlite3_stmt **ppStmt, /* OUT: Statement handle */ const char **pzTail /* OUT: Pointer to unused portion of zSql */ );
最后一个参数pzTail,表示从zSql截取未使用的一部分
具体实践sql,以及pzTail
char * tmp = (char *)malloc(sizeof(char) *(strlen(sql)+1));//分配空间
1\sql = "insert into B values (6 ,6);"
tmp = "",len = 0;
2\sql = "insert into B values (6 ,6); "
tmp = " ",len = 1;
3\sql = "insert into B values (6 ,6);update B set sizes = 7 where gid = 6;"
tmp = "update B set sizes = 7 where gid = 6;",len = 37
这里看出来,sql语句以;分割,返回的串是;之后内容,至于后续sql又怎么处理,看实际的业务逻辑了
good luck!