Are you sure your uid value is unique? That's the only constraint on your table.

On Tue, Sep 28, 2010 at 7:32 PM, Bret Foreman <bret.fore...@gmail.com> wrote:
> 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?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in Atlanta: http://bignerdranch.com/classes/android

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to