gotev / db-framework Goto Github PK
View Code? Open in Web Editor NEWReactive framework to work with SQLite databases, based on Rx, SQLBrite, SQLDelight and AutoValue
License: Apache License 2.0
Reactive framework to work with SQLite databases, based on Rx, SQLBrite, SQLDelight and AutoValue
License: Apache License 2.0
android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: team_member.team_id, team_member.member_id (code 2067)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:782)
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1474)
at com.squareup.sqlbrite.BriteDatabase.insert(BriteDatabase.java:434)
at com.squareup.sqlbrite.BriteDatabase.insert(BriteDatabase.java:417)
at net.gotev.dbframework.DatabaseManager$2.onStatement(DatabaseManager.java:183)
at net.gotev.dbframework.DatabaseManager$3.onStatement(DatabaseManager.java:257)
at net.gotev.dbframework.TransactionBuilder.execute(TransactionBuilder.java:44)
This happens on the following table:
CREATE TABLE team_member (
_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
team_id INTEGER NOT NULL,
member_id INTEGER NOT NULL,
invitation_id INTEGER AS Long,
role INTEGER,
FOREIGN KEY (team_id) REFERENCES team(_id) ON DELETE CASCADE,
FOREIGN KEY (member_id) REFERENCES member(_id) ON DELETE CASCADE,
UNIQUE(team_id, member_id)
);
get_all_ids_by_team_id:
SELECT _id
FROM team_member
WHERE team_id = ?;
When performing:
DatabaseManager.getInstance().syncTableWithList(
"team_member", "_id", contentValues,
FACTORY.get_all_ids_by_team_id(teamId), true);
Precisely at this point and the error is because the insert fails because of the UNIQUE constraint. In this case an update should be tried before launching the exception.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.