diff --git a/.gitignore b/.gitignore index 5f325fc..c26db6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,11 @@ *.iml .gradle /local.properties -/.idea/caches/build_file_checksums.ser -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml +/.idea/ .DS_Store /build +/app/build +/app/release /captures *.externalNativeBuild -*.apk \ No newline at end of file +*.apk diff --git a/.idea/misc.xml b/.idea/misc.xml index 3963879..75dac50 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -24,7 +24,7 @@ - + diff --git a/README.md b/README.md index 8df3d58..2d4ca86 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ allprojects { Add the dependency ``` dependencies { - implementation 'com.github.p32929:AndroidEasySQL-Library:1.3.11' + implementation 'com.github.p32929:AndroidEasySQL-Library:1.3.12' } ``` @@ -220,6 +220,14 @@ To delete a row data, call ```deleteRow(rowId)``` like this: ```boolean deleted = easyDB.deleteRow(rowId);``` +or + +```boolean deleted = easyDB.deleteRow(columnNumber, valueToMatch)``` + +or + +```boolean deleted = easyDB.deleteRow(columnName, valueToMatch)``` + Thus, it will return a boolean value. So, you can know if your data is updated or not... ### Delete all data from the Table: diff --git a/androideasysql-library/src/main/java/p32929/androideasysql_library/EasyDB.java b/androideasysql-library/src/main/java/p32929/androideasysql_library/EasyDB.java index d1cc986..05246d0 100644 --- a/androideasysql-library/src/main/java/p32929/androideasysql_library/EasyDB.java +++ b/androideasysql-library/src/main/java/p32929/androideasysql_library/EasyDB.java @@ -257,6 +257,16 @@ public boolean deleteRow(int id) { return db.delete(TABLE_NAME, "id = ?", new String[]{String.valueOf(id)}) == 1; } + public boolean deleteRow(int columnNumber, int valueToMatch) { + SQLiteDatabase db = this.getWritableDatabase(); + return db.delete(TABLE_NAME, columns.get(columnNumber - 1).columnName + " = ?", new String[]{String.valueOf(valueToMatch)}) == 1; + } + + public boolean deleteRow(String columnName, int valueToMatch) { + SQLiteDatabase db = this.getWritableDatabase(); + return db.delete(TABLE_NAME, columnName + " = ?", new String[]{String.valueOf(valueToMatch)}) == 1; + } + public void deleteAllDataFromTable() { SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("delete from " + TABLE_NAME);