From 8fba19ca5d472f5745f387ab7512c053f19391b0 Mon Sep 17 00:00:00 2001 From: p32929 Date: Tue, 28 Apr 2020 18:20:50 +0600 Subject: [PATCH 1/2] updated readme a little bit --- README.md | 2 +- .../easiestsqlandroidapp/MainActivity.java | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 27d69ed..a2a7fb3 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ if (cursor != null) { ###### easiestDB.getOneRowData(String tableName, int rowNumber) ``` -Cursor cursor = easiestDB.getOneRowData(0, 0); +Cursor cursor = easiestDB.getOneRowData(0, 1); // rowNumber starts from 1 but tableIndex starts from 0 if (cursor != null) { cursor.moveToFirst(); int value1 = cursor.getInt(columnIndex); diff --git a/app/src/main/java/org/richit/easiestsqlandroidapp/MainActivity.java b/app/src/main/java/org/richit/easiestsqlandroidapp/MainActivity.java index 70f4983..34b8bde 100644 --- a/app/src/main/java/org/richit/easiestsqlandroidapp/MainActivity.java +++ b/app/src/main/java/org/richit/easiestsqlandroidapp/MainActivity.java @@ -2,6 +2,7 @@ import android.database.Cursor; import android.os.Bundle; +import android.util.Log; import androidx.appcompat.app.AppCompatActivity; @@ -38,6 +39,12 @@ protected void onCreate(Bundle savedInstanceState) { new Datum(2, "Value2") ); + getAllData(); + getOneData(); + + } + + private void getAllData() { // Get all Cursor cursor = easiestDB.getAllDataFrom(0); if (cursor != null) { @@ -47,11 +54,27 @@ protected void onCreate(Bundle savedInstanceState) { // double value3 = cursor.getDouble(columnNumber); String id = cursor.getString(0); - + Log.d(TAG, "getAllData: " + id); } } boolean deleted = easiestDB.deleteDatabase(); + } + + private void getOneData() { + // Get one + Cursor cursor = easiestDB.getOneRowData(0, 1); + if (cursor != null) { + Log.d(TAG, "onCreate: Got one data"); + cursor.moveToFirst(); + Log.d(TAG, String.format("%s - %s - %s", + cursor.getString(0), + cursor.getString(1), + cursor.getString(2) + )); + } else { + Log.d(TAG, "onCreate: Not found"); + } } } From 7da8382d2716d28c860071a7f7c77ab133c2ef46 Mon Sep 17 00:00:00 2001 From: Fayaz Bin Salam Date: Sat, 2 May 2020 09:06:42 +0600 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a2a7fb3..a96865e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # EasiestSqlLibrary -The Easiest and Laziest approach to Android SQL Database. +The Easiest and the Laziest approach to Android SQL Database. If you like Flutter, the flutter version of this library can be found here -> [Github](https://github.com/p32929/EasiestSqlFlutter) or [pub.dev](https://pub.dev/packages/easiestdb) ## Installation Add it in your root build.gradle at the end of repositories: @@ -199,4 +199,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -``` \ No newline at end of file +```