我使用下面的代碼片段插入到sqlite數據庫的html字符串,我的代碼工作正常,但是當我檢索相同的html字符串並在web視圖中顯示它不呈現,一些數據正在修改,任何人都可以請幫助如何將長的html字符串插入數據庫。插入html字符串到sqlite數據庫使用目標c
爲const char * SQL = 「插入到文章 (art_id,sub_cat_id,art_title,art_details)VALUES(?,?,??)」;
if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK) NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database)); sqlite3_bind_text(addStmt, 1, [[tuser objectForKey:@"art_id"] UTF8String], -1, SQLITE_TRANSIENT); sqlite3_bind_text(addStmt, 2, [[tuser objectForKey:@"sub_cat_id"] UTF8String], -1, SQLITE_TRANSIENT); sqlite3_bind_text(addStmt, 3, [[tuser objectForKey:@"art_title"] UTF8String], -1, SQLITE_TRANSIENT); sqlite3_bind_text(addStmt, 4, [[tuser objectForKey:@"art_details"] UTF8String], -1, SQLITE_TRANSIENT); if(SQLITE_DONE != sqlite3_step(addStmt)) NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database)); else //SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid //coffeeID = sqlite3_last_insert_rowid(database); //Reset the add statement. sqlite3_reset(addStmt);
可否請你具體談談「一些數據「及其」修改「? – dasblinkenlight
嗨一些雙引號和單引號越來越截斷,謝謝deepesh – Max
這很可能是問題與保存/從sqlite中檢索數據無關。您可能想要提供更多關於如何在數據庫中處理HTML的信息。 – dasblinkenlight