2021-03-23 18:27:53.473 28763-28982/? E/SQLiteLog: (1) near "k1": syntax error
    
    
    --------- beginning of crash
2021-03-23 18:27:53.475 28763-28982/? E/AndroidRuntime: FATAL EXCEPTION: randomShelfUploadTimer
    Process: com.aplus.goodsshelves, PID: 28763
    android.database.sqlite.SQLiteException: near "k1": syntax error (code 1): , while compiling: update scan_record set is_upload = 1 where expressnum in ( 'YT5322921382500
    ','YT5320915492779
    ','YT9507368079604
    ','75427798072177
    ','4311937881630
    ','MMM={'k1':'769WF','k2':'769NA','k3':'001','k4':'T77','k5':'SF1326783694843','k6':'A1','k7':'c7515832'}
    ','SF1326783694843
    ','773078508974207
    ','YT4759286786382
    ','YT4690138831075
    ','YT4717590828219
    ' )
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:905)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:516)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
        at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
        at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1705)
        at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1636)
        at com.aplus.goodsshelves.activity.BatchGoodsPlaceActivity3.selectScanRecordAndUpload(BatchGoodsPlaceActivity3.java:778)
        at com.aplus.goodsshelves.activity.BatchGoodsPlaceActivity3.access$400(BatchGoodsPlaceActivity3.java:67)
        at com.aplus.goodsshelves.activity.BatchGoodsPlaceActivity3$2.run(BatchGoodsPlaceActivity3.java:193)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)

解决方法:

scanResult = scanResult.replaceAll("'", "''");

 

Logo

助力广东及东莞地区开发者,代码托管、在线学习与竞赛、技术交流与分享、资源共享、职业发展,成为松山湖开发者首选的工作与学习平台

更多推荐