I knew it was bound to happen eventually. I'm getting the deadly
SQLite error 19 "constraint failure" when trying to do an
insertOrThrow. Here's the string that creates the table:
protected static final String dbColUid = "UID";
protected static final String dbColParentName = "parentName";
protected static final String dbColParentId = "parentId";
protected static final String dbColObjectName = "objectName";
protected static final String dbColObjectId = "objectId";
protected static final String dbColChosen = "chosen";
protected static final String dbColSyncStatus = "syncStatus";
private static final String databaseCreate =
"create table if not exists " + tableName + " ( " +
dbColUid + " TEXT PRIMARY KEY, " +
dbColParentName + " TEXT, " +
dbColParentId + " TEXT," +
dbColObjectName + " TEXT, " +
dbColObjectId + " TEXT," +
dbColChosen + " INTEGER," +
dbColSyncStatus + " INTEGER" +
" );";
Here's the insert code:
ContentValues insertContent = new ContentValues();
insertContent.put(dbColUid, uid );
insertContent.put(dbColParentName, parentName );
insertContent.put(dbColParentId, parentId );
insertContent.put(dbColObjectName, objectName );
insertContent.put(dbColObjectId, objectId );
insertContent.put(dbColChosen, chosen );
insertContent.put(dbColSyncStatus, syncStatus );
return myDatabase.insertOrThrow(tableName, NONE ,
insertContent );
uid, parentName, parentId, objectName, and objectId are all strings.
chosen and syncStatus are ints.
Any ideas?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en