as3-spod icon indicating copy to clipboard operation
as3-spod copied to clipboard

Error when inserting record that uses uint as primary key.

Open peterjoel opened this issue 12 years ago • 3 comments

The error is "Error #3131: Abort due to constraint violation", which originates from a SQL error: "Primary key must be unique".

Using an int instead of uint fixes the problem. But uint should work.

peterjoel avatar Aug 28 '13 10:08 peterjoel

So either there is a bug when creating the table and defining the row as an int instead of a uint or it seems to be a problem with the underlying sqlite library.

SimonRichardson avatar Aug 28 '13 12:08 SimonRichardson

From memory (more than 2 years ago!) - I think it's this line - https://github.com/stickupkid/as3-spod/blob/master/src/org/osflash/spod/types/SpodTypeUInt.as#L9, so we're casting a uint to a sqlite INTEGER.

The obvious issue here is that sqlite doesn't have an understanding of unsigned as far as I'm aware[1] - so it's a limitation with the database that's actually causing this.

You could possibly try and use UNSIGNED BIG INT instead of INTEGER and see if that actually resolves this.

Let me know if you make any progress.

[1] http://www.sqlite.org/datatype3.html

SimonRichardson avatar Aug 28 '13 12:08 SimonRichardson

For now, I'm using int because I just need to get it working.

peterjoel avatar Aug 28 '13 15:08 peterjoel