插入值时Sqlite无法识别的标记

时间:2013-03-17 09:19:32

标签: android sqlite exception

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();

0 个答案:

没有答案