数据类型错误匹配为1459938216056250401717267022在sqlite中

时间:2016-04-06 10:32:08

标签: android sqlite android-sqlite

static final String CREATE_DB_TABLE_LEADS = " CREATE TABLE " + TABLE_LEADS
        + " (leadId INTEGER PRIMARY KEY AUTOINCREMENT,leadName TEXT,leadNumber INTEGER,leadRequirement TEXT,leadCity TEXT,leadTime TEXT,leadSource TEXT,isProcessed INTEGER);";

leadId =data.getString("id");

错误:

04-06 15:53:37.902 1802-5282/com.zip_first.zipfirst E/SQLiteLog: (20) statement aborts at 6: [INSERT INTO LEADS(leadCity,leadName,leadId,leadNumber,leadRequirement,leadTime,leadSource) VALUES (?,?,?,?,?,?,?)] datatype mismatch
04-06 15:53:37.972 1802-5282/com.zip_first.zipfirst E/SQLiteDatabase: Error inserting leadCity=    Nashik   leadName=    Abhishek    leadId=1459938216056250401717267022 leadNumber=8888884678 leadRequirement=    Language Classes For English American leadTime=    Tue 24 Mar 2015 19:50:47    leadSource=justdial
                                                                      android.database.sqlite.SQLiteDatatypeMismatchException: datatype mismatch (code 20)
                                                                          at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
                                                                          at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:906)
                                                                          at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
                                                                          at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
                                                                          at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469)
                                                                          at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339)
                                                                          at com.zip_first.zipfirst.provider.StubProvider.insert(StubProvider.java:165)
                                                                          at android.content.ContentProvider$Transport.insert(ContentProvider.java:201)
                                                                          at android.content.ContentResolver.insert(ContentResolver.java:866)
                                                                          at com.zip_first.zipfirst.gcm.MyGcmListenerService.onMessageReceived(MyGcmListenerService.java:88)
                                                                          at com.google.android.gms.gcm.GcmListenerService.zzq(Unknown Source)
                                                                          at com.google.android.gms.gcm.GcmListenerService.zzp(Unknown Source)
                                                                          at com.google.android.gms.gcm.GcmListenerService.zzo(Unknown Source)
                                                                          at com.google.android.gms.gcm.GcmListenerService.zza(Unknown Source)
                                                                          at com.google.android.gms.gcm.GcmListenerService$1.run(Unknown Source)
                                                                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
                                                                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
                                                                          at java.lang.Thread.run(Thread.java:856)
04-06 15:53:37.972 1802-5282/com.zip_first.zipfirst D/MyGcmListenerService: Record inserted
04-06 15:53:37.982 1802-5282/com.zip_first.zipfirst D/Count: Count1

1 个答案:

答案 0 :(得分:0)

在SQLite中,整数不能超过64位,因此最大可能值为9223372036854775807.

如果您真的想使用1459938216056250401717267022作为ID,则必须更改表格以使用文本列。