0
android.database.sqlite.SQLiteException: unrecognized token: "'HRH™": , while compiling: INSERT INTO `w` VALUES (310346,-42,13,3,5399,'mightyhakizimi',2978,'mightyhakizimi',130,'HRH™

我正在从 sqlite 转储文件向我的数据库插入值,该文件可能包含像此异常中的错误字符,如何在每个插入查询中检查所有可能的错误字符?我的插入代码在那里。

Reader reader = new InputStreamReader(new FileInputStream(filePath),"utf-8");
BufferedReader br = new BufferedReader(reader);

db.beginTransaction();


while (br.ready()) {
    String insertStmt = br.readLine();

    db.execSQL(insertStmt);

}
br.close();
db.setTransactionSuccessful();
db.endTransaction();
4

0 回答 0