AlexDenisov / iActiveRecord

ActiveRecord for iOS without CoreData, only SQLite
http://alexdenisov.github.com/iActiveRecord/
MIT License
354 stars 50 forks source link

Fixed bug where [Record save] would fail silently from constraint violation #79

Closed neilabdev closed 10 years ago

neilabdev commented 10 years ago

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
}