{"id":14960987,"url":"https://github.com/gilzoide/unity-sqlite-net","last_synced_at":"2025-04-05T22:04:14.681Z","repository":{"id":216886913,"uuid":"742622000","full_name":"gilzoide/unity-sqlite-net","owner":"gilzoide","description":"SQLite-net for Unity, supports Windows, Linux, macOS, iOS, tvOS, visionOS, Android and WebGL","archived":false,"fork":false,"pushed_at":"2025-02-15T13:12:54.000Z","size":80502,"stargazers_count":123,"open_issues_count":5,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T21:02:57.752Z","etag":null,"topics":["sqlite","sqlite-net","sqlite-orm","sqlite3","unity","unity3d","upm","upm-package"],"latest_commit_sha":null,"homepage":"","language":"C","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/gilzoide.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["gilzoide"],"patreon":null,"open_collective":null,"ko_fi":"gilzoide","tidelift":null,"community_bridge":null,"liberapay":"gilzoide","issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2024-01-12T22:20:53.000Z","updated_at":"2025-03-29T04:33:01.000Z","dependencies_parsed_at":"2024-10-10T10:40:33.150Z","dependency_job_id":"47969a0c-e8ac-448e-b3c2-7ff6d2857df1","html_url":"https://github.com/gilzoide/unity-sqlite-net","commit_stats":{"total_commits":107,"total_committers":2,"mean_commits":53.5,"dds":0.01869158878504673,"last_synced_commit":"6e9a7dc4578eff2110eb5745f30159a555c333d5"},"previous_names":["gilzoide/unity-sqlite-net"],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-sqlite-net","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-sqlite-net/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-sqlite-net/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilzoide%2Funity-sqlite-net/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilzoide","download_url":"https://codeload.github.com/gilzoide/unity-sqlite-net/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406085,"owners_count":20933803,"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":["sqlite","sqlite-net","sqlite-orm","sqlite3","unity","unity3d","upm","upm-package"],"created_at":"2024-09-24T13:23:36.208Z","updated_at":"2025-04-05T22:04:14.668Z","avatar_url":"https://github.com/gilzoide.png","language":"C","readme":"# SQLite-net for Unity\n[![openupm](https://img.shields.io/npm/v/com.gilzoide.sqlite-net?label=openupm\u0026registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.gilzoide.sqlite-net/)\n\nThis package provides the excelent [SQLite-net](https://github.com/praeclarum/sqlite-net) library for accessing [SQLite](https://sqlite.org/) databases in Unity.\n\n\n## Features\n- [SQLite-net v1.9.172](https://github.com/praeclarum/sqlite-net/tree/v1.9.172)\n  + Both synchronous and asynchronous APIs are available\n  + `SQLiteConnection.Serialize` extension method for serializing a database to `byte[]` (reference: [SQLite Serialization](https://www.sqlite.org/c3ref/serialize.html)).\n  + `SQLiteConnection.Deserialize` extension method for deserializing memory (`byte[]`, `NativeArray\u003cbyte\u003e` or `ReadOnlySpan\u003cbyte\u003e`) into an open database (reference: [SQLite Deserialization](https://www.sqlite.org/c3ref/deserialize.html)).\n- [SQLite 3.49.0](https://sqlite.org/releaselog/3_49_0.html)\n  + Enabled modules: [R\\*Tree](https://sqlite.org/rtree.html), [Geopoly](https://sqlite.org/geopoly.html), [FTS5](https://sqlite.org/fts5.html), [Built-In Math Functions](https://www.sqlite.org/lang_mathfunc.html)\n  + Supports Windows, Linux, macOS, WebGL, Android, iOS, tvOS and visionOS platforms\n  + Supports persisting data in WebGL builds by using a [custom VFS backed by Indexed DB](https://github.com/gilzoide/idbvfs).\n\n\n## Optional packages\n- [SQLite Asset](https://github.com/gilzoide/unity-sqlite-asset): read-only SQLite database assets for Unity with scripted importer for \".sqlite\", \".sqlite2\" and \".sqlite3\" files\n- [SQLite Asset - CSV](https://github.com/gilzoide/unity-sqlite-asset-csv): easily import \".csv\" files as read-only SQLite database assets\n\n\n## How to install\nEither:\n- Use the [openupm registry](https://openupm.com/) and install this package using the [openupm-cli](https://github.com/openupm/openupm-cli):\n  ```\n  openupm add com.gilzoide.sqlite-net\n  ```\n- Install using the [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui-giturl.html) with the following URL:\n  ```\n  https://github.com/gilzoide/unity-sqlite-net.git#1.2.3\n  ```\n- Clone this repository or download a snapshot of it directly inside your project's `Assets` or `Packages` folder.\n\n\n## Usage example\nThe following code demonstrates some of SQLite-net's core functionality.\nCheck out [SQLite-net's Wiki](https://github.com/praeclarum/sqlite-net/wiki) for more complete documentation on how to use the library.\n```cs\nusing SQLite;\nusing UnityEngine;\n\n// The library contains simple attributes that you can use\n// to control the construction of tables, ORM style\npublic class Player\n{\n    [PrimaryKey, AutoIncrement]\n    public int Id { get; set; }\n    public string Name { get; set; }\n}\n\npublic class TestSQLite : MonoBehaviour\n{\n    void Start()\n    {\n        // 1. Create a connection to the database.\n        // The special \":memory:\" in-memory database and\n        // URIs like \"file:///somefile\" are also supported\n        var db = new SQLiteConnection($\"{Application.persistentDataPath}/MyDb.db\");\n\n        // 2. Once you have defined your entity, you can automatically\n        // generate tables in your database by calling CreateTable\n        db.CreateTable\u003cPlayer\u003e();\n\n        // 3. You can insert rows in the database using Insert\n        // The Insert call fills Id, which is marked with [AutoIncremented]\n        var newPlayer = new Player\n        {\n            Name = \"gilzoide\",\n        };\n        db.Insert(newPlayer);\n        Debug.Log($\"Player new ID: {newPlayer.Id}\");\n        // Similar methods exist for Update and Delete.\n\n        // 4.a The most straightforward way to query for data\n        // is using the Table method. This can take predicates\n        // for constraining via WHERE clauses and/or adding ORDER BY clauses\n        var query = db.Table\u003cPlayer\u003e().Where(p =\u003e p.Name.StartsWith(\"g\"));\n        foreach (Player player in query)\n        {\n            Debug.Log($\"Found player named {player.Name} with ID {player.Id}\");\n        }\n\n        // 4.b You can also make queries at a low-level using the Query method\n        var players = db.Query\u003cPlayer\u003e(\"SELECT * FROM Player WHERE Id = ?\", 1);\n        foreach (Player player in players)\n        {\n            Debug.Log($\"Player with ID 1 is called {player.Name}\");\n        }\n\n        // 5. You can perform low-level updates to the database using the Execute\n        // method, for example for running PRAGMAs or VACUUM\n        db.Execute(\"VACUUM\");\n    }\n}\n```\n\n\n## License\nSQLite-net for Unity first-party code is licensed under the [MIT license](LICENSE.txt).\n\nThird-party code:\n- SQLite-net: [MIT license](Runtime/sqlite-net/LICENSE.txt)\n- SQLite: [public domain](https://sqlite.org/copyright.html)\n\n\n## Modifications made to SQLite-net source code\n- The value of `LibraryPath` was changed from `sqlite3` to `__Internal` in WebGL/iOS/tvOS/visionOS builds and `gilzoide-sqlite-net` for other platforms.\n  This makes sure the prebuilt libraries are used instead of the ones provided by the system.\n- `LibraryPath` is made public.\n  This is useful for libraries that want to bind additional native SQLite functions via P/Invoke.\n- `SQLiteConnection.Quote` is made public.\n  This is useful for libraries making raw queries.\n- `SQLite3.SetDirectory` is only defined in Windows platforms.\n- Makes all column related attributes inherit `PreserveAttribute`, fixing errors on columns when managed code stripping is enabled.\n- Changes the `TaskScheduler` used by the async API on WebGL to one that executes tasks on Unity's main thread.\n- Fix support for struct return types in queries\n","funding_links":["https://github.com/sponsors/gilzoide","https://ko-fi.com/gilzoide","https://liberapay.com/gilzoide"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-sqlite-net","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilzoide%2Funity-sqlite-net","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilzoide%2Funity-sqlite-net/lists"}