When a save happens but fails as a result of a constraint violation, the result returned which should be the new last_insert_id, instead assigned the error code from the sqlite function, causing the return function to believe the save succeeded, because it expects failures to be zero '0'. Thus:
if([model save]) {
// Always returns true in case of constraint violation does not return '0' but the error code as the last_insert_id
}
When a save happens but fails as a result of a constraint violation, the result returned which should be the new last_insert_id, instead assigned the error code from the sqlite function, causing the return function to believe the save succeeded, because it expects failures to be zero '0'. Thus: