{"id":18643622,"url":"https://github.com/lemberg/android-database","last_synced_at":"2025-10-26T02:09:33.286Z","repository":{"id":70144908,"uuid":"39074977","full_name":"lemberg/android-database","owner":"lemberg","description":"Sample of a project that deals with database","archived":false,"fork":false,"pushed_at":"2016-01-12T18:46:21.000Z","size":161,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-11T17:47:08.310Z","etag":null,"topics":[],"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/lemberg.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}},"created_at":"2015-07-14T12:59:41.000Z","updated_at":"2022-07-04T07:05:28.000Z","dependencies_parsed_at":"2023-03-17T18:51:35.859Z","dependency_job_id":null,"html_url":"https://github.com/lemberg/android-database","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lemberg/android-database","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemberg%2Fandroid-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemberg%2Fandroid-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemberg%2Fandroid-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemberg%2Fandroid-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lemberg","download_url":"https://codeload.github.com/lemberg/android-database/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lemberg%2Fandroid-database/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261330122,"owners_count":23142482,"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":[],"created_at":"2024-11-07T06:07:35.716Z","updated_at":"2025-10-26T02:09:28.253Z","avatar_url":"https://github.com/lemberg.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"**SQLite database sample**\n\nThis sample will show you an easy way to:\n\n 1. create and register one or several databases;\n 2. manage operations with database and its tables;\n 3. handle database migration tasks;\n 4. save/load data in one line.\n\n**Implementation guide**\n\nTo implement the following database structure in your app, you need pay your attention on 3 main classes: `BaseSQLiteOpenHelper`, `DatabaseRegister`, `BaseDAO`.\n\n\n 1. Make your `DatabaseHelper` extends `BaseSQLiteOpenHelper` and override all the methods to configure your database.\n `MigratableSQLiteOpenHelper` helps to manage data migration while database upgrading or downgrading.\n\n 2. In your `DatabaseManager` create a global instance of `DatabaseRegister\n    class` and `registerDatabase(BaseSQLiteOpenHelper sqLiteOpenHelper)` method.\n\n 3. In Application class you will now be able to init your\n    `DatabaseManager` and `registerDatabase(new DatabaseHelper())`\n\n 4. The next step is implementation of functionality to access data of\n    database. To make it work just `extend BaseDAO\u003cKey, Entity\u003e` which\n    adds ability to access data of database table. Using DAO object you can save, update, delete, select data of database table. Feel free, you can also add additional functionality into DAO.\n\n**Usage guide**\n\nUsing this database model, makes your calls to database easy and simple, here how it would looks like:\n\n```java\n    private void saveContacts() {\n        List\u003cContact\u003e contacts = generateContactList();\n        DatabaseManager.getInstance().addContacts(contacts);\n    }\n\n    private  List\u003cContact\u003e loadContacts() {\n        return DatabaseManager.getInstance().loadContacts();\n    }\n```\n\n**More Info**\n\nIf you want to see full code, check out sample app.\n\nAlso please check unit tests [section](https://github.com/lemberg/android-database/wiki/unit-tests).\n\n**License**\n```\nThe MIT License (MIT)\n\nCopyright (c) 2016 Lemberg Solutions Ltd\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%2Flemberg%2Fandroid-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemberg%2Fandroid-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemberg%2Fandroid-database/lists"}