{"id":19404154,"url":"https://github.com/p32929/androideasysql-library","last_synced_at":"2025-04-24T08:32:48.962Z","repository":{"id":105972116,"uuid":"140182409","full_name":"p32929/AndroidEasySQL-Library","owner":"p32929","description":"An Easier \u0026 Lazier approach to SQL database for Android","archived":false,"fork":false,"pushed_at":"2020-07-17T14:03:07.000Z","size":2870,"stargazers_count":31,"open_issues_count":0,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-07T15:35:59.738Z","etag":null,"topics":["android","android-app","android-application","android-development","android-library","cursor","database","database-management","easydb","lazier","library","p32929","sql","sql-database","sql-query","sqlite","sqlite-an","sqlite-android","sqlite-database","sqliteopenhelper"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/p32929.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-07-08T16:01:43.000Z","updated_at":"2024-02-03T11:53:19.000Z","dependencies_parsed_at":"2024-03-06T02:00:31.797Z","dependency_job_id":null,"html_url":"https://github.com/p32929/AndroidEasySQL-Library","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2FAndroidEasySQL-Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2FAndroidEasySQL-Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2FAndroidEasySQL-Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p32929%2FAndroidEasySQL-Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p32929","download_url":"https://codeload.github.com/p32929/AndroidEasySQL-Library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223947819,"owners_count":17230100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-app","android-application","android-development","android-library","cursor","database","database-management","easydb","lazier","library","p32929","sql","sql-database","sql-query","sqlite","sqlite-an","sqlite-android","sqlite-database","sqliteopenhelper"],"created_at":"2024-11-10T11:33:22.554Z","updated_at":"2024-11-10T11:33:23.146Z","avatar_url":"https://github.com/p32929.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UPDATE!!!\nA newer, easier and better version of this library (V2) can be found here:\n\u003cbr\u003e\nhttps://github.com/p32929/EasiestSqlLibrary\n\nBut if you want, you can still use this library. If you like Flutter, the flutter version of this library can be found here -\u003e [Github](https://github.com/p32929/EasiestSqlFlutter) or [pub.dev](https://pub.dev/packages/easiestdb) . Thanks...\n\n# AndroidEasySQL-Library\nAn Easier \u0026amp; Lazier approach to SQL database for Android\n\n[![](https://badgen.net/github/release/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/release/p32929/AndroidEasySQL-Library/stable)]() [![](https://badgen.net/github/tag/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/watchers/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/checks/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/status/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/stars/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/forks/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/issues/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/open-issues/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/closed-issues/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/label-issues/p32929/AndroidEasySQL-Library/help-wanted/open)]() [![](https://badgen.net/github/prs/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/open-prs/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/closed-prs/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/merged-prs/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/commits/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/last-commit/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/branches/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/releases/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/tags/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/license/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/contributors/p32929/AndroidEasySQL-Library)]() [![](https://badgen.net/github/dependents-pkg/p32929/AndroidEasySQL-Library)]() \n\n## Share\nSharing with your friends is just one click away from here\n\n[![facebook](https://image.flaticon.com/icons/png/32/124/124010.png)](https://www.facebook.com/sharer/sharer.php?u=https://github.com/p32929/AndroidEasySQL-Library)\n[![twitter](https://image.flaticon.com/icons/png/32/124/124021.png)](https://twitter.com/intent/tweet?source=https://github.com/p32929/AndroidEasySQL-Library)\n[![tumblr](https://image.flaticon.com/icons/png/32/124/124012.png)](https://www.tumblr.com/share?v=3\u0026u=https://github.com/p32929/AndroidEasySQL-Library)\n[![pocket](https://image.flaticon.com/icons/png/32/732/732238.png)](https://getpocket.com/save?url=https://github.com/p32929/AndroidEasySQL-Library)\n[![pinterest](https://image.flaticon.com/icons/png/32/124/124039.png)](https://pinterest.com/pin/create/button/?url=https://github.com/p32929/AndroidEasySQL-Library)\n[![reddit](https://image.flaticon.com/icons/png/32/2111/2111589.png)](https://www.reddit.com/submit?url=https://github.com/p32929/AndroidEasySQL-Library)\n[![linkedin](https://image.flaticon.com/icons/png/32/1409/1409945.png)](https://www.linkedin.com/shareArticle?mini=true\u0026url=https://github.com/p32929/AndroidEasySQL-Library)\n[![whatsapp](https://image.flaticon.com/icons/png/32/733/733585.png)](https://api.whatsapp.com/send?text=https://github.com/p32929/AndroidEasySQL-Library)\n\n## Support\nIf you like my works and want to support me/my works, feel free to support or donate. My payment details can be found here: https://p32929.github.io/SendMoney2Me/\n\n## Installation\nAdd it in your root build.gradle at the end of repositories:\n```\nallprojects {\n  repositories {\n    maven { url 'https://jitpack.io' }\n  }\n}\n```\n\nAdd the dependency\n```\ndependencies {\n     implementation 'com.github.p32929:AndroidEasySQL-Library:1.4.1'\n}\n```\n\n## Basic Usage\nSteps to follow:\n* Initialize\n* Set Table Name (Not mandatory)\n* Add columns\n* Call done method\n\nAfter that you can do:\n* Add data\n* Read data\n* Edit data\n* Delete data\n* \u0026 so much more\n\n## Code example\n### Initialization, Set Table Name, Add columns, altogether:\n\n```\nEasyDB easyDB = EasyDB.init(this, \"TEST\") // TEST is the name of the DATABASE\n                       .setTableName(\"DEMO TABLE\")  // You can ignore this line if you want\n                       .addColumn(\"C1\", \"text\") // Contrains like \"text\", \"unique\", \"not null\" are not case sensitive\n                       .addColumn(\"C2\", \"text\", \"unique\")\n                       .addColumn(\"C3\", \"text\", \"unique\", \"not null\")\n                       .doneTableColumn();\n```\n\nor\n\n```\nEasyDB easyDB = EasyDB.init(this, \"TEST\") // \"TEST\" is the name of the DATABASE\n                .setTableName(\"DEMO TABLE\")  // You can ignore this line if you want\n                .addColumn(new Column(\"C1\", \"text\", \"unique\")) // Contrains like \"text\", \"unique\", \"not null\" are not case sensitive\n                .addColumn(new Column(\"C2\", \"text\", \"not null\"))\n                .addColumn(new Column(\"C3\", \"text\"))\n                .doneTableColumn();\n```\n\n** Saving the ```easyDB``` object into a variable will make easier to work with the database later. **\n\n** You don't have to add any primary key. The library does it by default (as ```ID``` column) **\n\n### Adding data:\nYou can call the ```addData()``` in two ways:\n\n\u003e addData(columnNumber, data) // ```columnNumber``` is an integer\n\n\u003e addData(columnName, data) // ```columnName``` is a String\n\n```data``` parameter in ```addData()``` can be either integer or string. After adding all the data, call ```doneDataAdding()``` method.\n\nExample:\n```\nboolean done = easyDB.addData(1, \"Data1\")\n                .addData(2, \"Data2\")\n                .addData(3, \"Data3\")\n                .doneDataAdding();\n```\n\nor\n\n```\nboolean done = easyDB.addData(\"C1\", \"Data1\")\n                .addData(\"C2\", \"Data2\")\n                .addData(\"C3\", \"Data3\")\n                .doneDataAdding();\n```\n\nThus, it will return a boolean value.\n```True``` means data added successfully,\n```False``` means data isn't added successfully.\n\n### Get/Read All Data:\nTo get all data as a ```Cursor``` object, call ```getAllData()``` or ```getAllDataOrderedBy()``` like this:\n\n```Cursor res = easyDB.getAllData();```\n\nor\n\n```Cursor res = easyDB.getAllDataOrderedBy(columnNumber, ascendingOrDescending);```\n\n```ascendingOrDescending``` parameter in ```getAllDataOrderedBy()``` is a boolean value. To get all data in ascending order pass ```true```, or to get all data in descending order pass ```false``` as the parameter.\n\nLater use a while loop like this:\n\n```\nwhile (res.moveToNext()) {\n\t// Your code here\n}\n```\n\nTo get an integer from ```res``` call ```getInt(columnIndex)``` and to get a String call ```getString(columnIndex)``` like this:\n```\nint anIntegerVariable = res.getInt(columnIndex);\nString aStringVariable = res.getString(columnIndex);\n```\n\nhere ```columnIndex``` is an integer, starts from 0.\n\nExample:\n\n```\nCursor res = easyDB.getAllData();\nwhile (res.moveToNext()) {\n    int anIntegerVariable = res.getInt(columnIndex);\n    String aStringVariable = res.getString(columnIndex);\n}\n```\n\nor\n\n```\nCursor res = easyDB.getAllDataOrderedBy(columnNumber, false);\nwhile (res.moveToNext()) {\n    int anIntegerVariable = res.getInt(columnIndex);\n    String aStringVariable = res.getString(columnIndex);\n}\n```\n\n\n### Get/Read one row data:\nTo get data from a row, call ```getOneRowData(rowID)```. It will return the data as a Cursor object. You can then retrieve each column data from the cursor.\nExample:\n```\nCursor res = easyDB.getOneRowData(1);\nif (res != null) {\n    res.moveToFirst(); // Because here's only one row data\n    String ID = res.getString(0); // Column 0 is the ID column\n    String c1 = res.getString(1);\n    String c2 = res.getString(2);\n}\n```\n\n### Get/Read/Search one/multiple row data by matching a column data:\nTo get data from one/multiple rows by matching data with a column, call ```searchInColumn(columnNumber, valueToSearch, limit)``` or ```searchInColumn(columnName, valueToSearch, limit)```\nexample:\n```\nCursor res = easyDB.searchInColumn(1, \"data\", 1); // Here we passed limit = 1. Thus it will return only one row data with the matched column value\nif (res != null) {\n    res.moveToFirst(); // Because here's only one row data\n    String ID = res.getString(0); // Column 0 is the ID column\n    String c1 = res.getString(1);\n    String c2 = res.getString(2);\n}\n```\n\nor\n\n```\nCursor res = easyDB.searchInColumn(\"ID\", \"data\", -1); // Here we passed limit = -1. Thus it will return all the rows with the matched column values\nif (res != null) {\n    while (res.moveToNext()) {\n            String ID = res.getString(0); // Column 0 is the ID column\n            String c1 = res.getString(1);\n            String c2 = res.getString(2);\n    }\n}\n```\n\n\u003e Please DO NOT pass ```limit = 0``` as the parameter\n\n### Match data from multiple columns:\nTo check if some values exist or not in the database, first call ```getAllColumns()``` to get all the column names like this:\n\n```String columns[] = easyDB.getAllColumns();```\n\nNow, You may create an array of ```String``` defining which columns you want to match with some values, like this:\n\n```\nString columnsToMatch[] = new String[]{columns[1], columns[2]};\n```\nAnd an array of values(String) you want to match, like this:\n\n```\nString valuesToMatch[] = new String[]{valueToSearchInColumn1, valueToSearchInColumn2};\n```\n\nNow call ```matchColumns()``` like this:\n\n```boolean matched = easyDB.matchColumns(columnsToMatch, valuesToMatch);```\n\nThus, it will return a boolean value. So, you can know if your given values are matched or not.\n\n** Creating these two array variables(```columnsToMatch``` \u0026 ```valuesToMatch```) will make it easier to pass them into ```matchColumns()``` method. **\n\n### Update / Edit data:\nTo update / Edit, call ```updateData(columnNumber, data)``` method.\nExample:\n```\nboolean updated = easyDB.updateData(1, \"UpdatedData1\")\n                .updateData(2, \"UpdatedData2\")\n                .updateData(3, \"UpdatedData3\")\n                .rowID(id);\n```\n\nUpdatedData can be either integer or String.\nThus, it will return a boolean value. So, you can know if your data is updated or not...\n\n### Delete data:\nTo delete a row data, call ```deleteRow(rowId)``` like this:\n\n```boolean deleted = easyDB.deleteRow(rowId);```\n\nor\n\n```boolean deleted = easyDB.deleteRow(columnNumber, valueToMatch)```\n\nor\n\n```boolean deleted = easyDB.deleteRow(columnName, valueToMatch)```\n\nThus, it will return a boolean value. So, you can know if your data is updated or not...\n\n### Delete all data from the Table:\nTo delete the table and its all data, call ```deleteAllDataFromTable``` like this:\n\n```easyDB.deleteAllDataFromTable();```\n\nHope you'll enjoy using the library :)\n\n\u003e Thanks\n\n## License:\n```\nMIT License\n\nCopyright (c) 2018 Fayaz Bin Salam\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp32929%2Fandroideasysql-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp32929%2Fandroideasysql-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp32929%2Fandroideasysql-library/lists"}