as3-spod
as3-spod copied to clipboard
Error when inserting record that uses uint as primary key.
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.
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.
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
For now, I'm using int because I just need to get it working.