Delete using inner join with composite primary key

All we need is a simple explanation of the problem, which is provided below. I am trying to delete some records from my database, I have succeeded and it works when testing in "DB Browser for SQLite" software but when I try to copy it to my Android Studio project I get this error in … Read more

How to write a SQLite query for android room database

All we need is a simple explanation of the problem, which is provided below. What my User class looks like @Parcelize @Entity(tableName = "user_table") data class User( @PrimaryKey(autoGenerate = true) val id: Int, var name: String, var highScore: String?, var activeUser: Boolean, ): Parcelable What my UserDao looks like @Dao interface UserDao { @Insert(onConflict = … Read more

How to get row cursor with primary key android

All we need is a simple explanation of the problem, which is provided below. I have a table with the following @Override public void onCreate(SQLiteDatabase database) { database.execSQL( "CREATE TABLE " + TABLE_NAME + " (" + "ID" + " INTEGER PRIMARY KEY," + COLUMN_TOPIC + " TEXT," + COLUMN_LOCATION + " TEXT)"); } I … Read more

Can not update the data of SQLite database in Android

All we need is a simple explanation of the problem, which is provided below. I try to update my data in the SQLite database but when I do db.update the ide through an error and convince me to create a local var for it public void updateEmployee(int sno, String name, double increment){ SQLiteDatabase db = … Read more

Android and SQLite: "nested" getReadableDatabase

All we need is a simple explanation of the problem, which is provided below. In my Android app I use the following code to access db: public class DbHelper extends SQLiteOpenHelper { /* … */ } public class DbManager { private DbHelper helper = null; public DbManager(Context context) { helper = new DbHelper(context); } public … Read more

How to remove ALL data from the database

All we need is a simple explanation of the problem, which is provided below. I would like to remove ALL data from the database (with auto-increment values). I use Room. I have read in the documentation there is something like clearAllTables() but according to the documentation: This does NOT reset the auto-increment value So this … Read more

'.', <column alias name>, <compound operator>, AS, BETWEEN, FROM, GROUP, IN, LIMIT, ORDER, WHERE, comma or semicolon expected, got 'SELECT'

All we need is a simple explanation of the problem, which is provided below. Please I need help fixing the error above _ in the title _ appeared in the first SELECT after FROM of this query, all suggestions are welcome so thank you very much. public ArrayList<HashMap<String, String>> getAll_Datas() { ArrayList<HashMap<String, String>> arrayListAllData = … Read more

Foreign Key constraint failed using Room

All we need is a simple explanation of the problem, which is provided below. I’ve looked at this code every which way. Searched here for a solution. I discovered that autogenerated primary key field can’t be used as a parent column Stack question here. However I have used it in java, but it doesn’t seem … Read more