Gameframe.SQLite
SQLite integration for Unity projects. Provides easy-to-use database connectivity through Mono.Data.SqliteClient, enabling developers to create, query, and manage SQLite databases directly within their games. Includes straightforward API for table creation, data insertion, and reading operations with persistent storage in the application's data directory.
com.gameframe.sqlite Unity Compatibility
Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/sqlite.git README Markdown
Copy this to your project's README.md
## Installation
Add **Gameframe.SQLite** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/sqlite.git
```
[](https://www.pkglnk.dev/pkg/sqlite)README
Gameframe.SQLite š
SQLite Package
Quick Package Install
Using UnityPackageManager (for Unity 2019.3 or later)
Open the package manager window (menu: Window > Package Manager)
Select "Add package from git URL...", fill in the pop-up with the following link:
https://github.com/coryleach/UnitySQLite.git#1.0.2
Using UnityPackageManager (for Unity 2019.1 or later)
Find the manifest.json file in the Packages folder of your project and edit it to look like this:
{
"dependencies": {
"com.gameframe.sqlite": "https://github.com/coryleach/UnitySQLite.git#1.0.2",
...
},
}
Usage
using Mono.Data.SqliteClient;
// Create database
string path = Application.persistentDataPath + "/" + "My_Test_Database";
string connection = "URI=file:" + path;
// Open connection
IDbConnection dbcon = new SqliteConnection(connection);
dbcon.Open();
// Create table
IDbCommand dbcmd;
dbcmd = dbcon.CreateCommand();
string q_createTable = "CREATE TABLE IF NOT EXISTS my_table (id INTEGER PRIMARY KEY, val INTEGER )";
dbcmd.CommandText = q_createTable;
dbcmd.ExecuteReader();
// Insert values in table
IDbCommand cmnd = dbcon.CreateCommand();
cmnd.CommandText = "INSERT INTO my_table (id, val) VALUES (0, 5)";
cmnd.ExecuteNonQuery();
// Read and print all values in table
IDbCommand cmnd_read = dbcon.CreateCommand();
IDataReader reader;
string query ="SELECT * FROM my_table";
cmnd_read.CommandText = query;
reader = cmnd_read.ExecuteReader();
while (reader.Read())
{
Debug.Log("id: " + reader[0].ToString());
Debug.Log("val: " + reader[1].ToString());
}
// Close connection
dbcon.Close();
Author
š¤ Cory Leach
- Twitter: @coryleach
- Github: @coryleach
Show your support
Give a āļø if this project helped you!
This README was generated with ā¤ļø by Gameframe.Packages
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In