Giter VIP home page Giter VIP logo

com.pixelwizards.sqlite's Introduction

com.pixelwizards.sqlite

openupm

Unity Package Manager compatible wrapper for SQLite databases.

This package is a fork of the source repo (https://github.com/rizasif/sqlite-unity-plugin), reorganized into Package Manager structure and published to OpenUPM.

This plugin can be used to access SQLite database for Unity projects. Supports desktop, Android and iOS devices.

Usage

Install via OpenUPM

The package is available on the openupm registry. It's recommended to install it via openupm-cli.

openupm add com.pixelwizards.sqlite

Install via git url

Add this to your project manifest.json

"com.pixelwizards.sqlite": "https://github.com/PixelWizards/com.pixelwizards.sqlite.git",

OpenUPM Support

This package is also available via the OpenUPM scoped registry: https://openupm.com/packages/com.pixelwizards.sqlite

Prerequistes

  • This has been tested for >= 2018.3

Quick Start

Check out https://github.com/sqlitebrowser/sqlitebrowser for an SQLite desktop client / database browser for creating / managing databases

Getting Started

  1. Import the correct namespaces.
using UnityEngine;
using System.Data;
using Mono.Data.Sqlite;
using System.IO;
  1. Open your database connection; if the database name (My_Database) does not exist it will be created.
string connection = "URI=file:" + Application.persistentDataPath + "/" + "My_Database";
IDbConnection dbcon = new SqliteConnection(connection);
dbcon.Open();
  1. Finally create a query to access your database.
IDbCommand dbcmd;
IDataReader reader;

dbcmd = dbcon.CreateCommand();
string q_createTable = 
  "CREATE TABLE IF NOT EXISTS " + "my_table" + " (" +
  "id" + " INTEGER PRIMARY KEY, " +
  "val" + " INTEGER )";
  
dbcmd.CommandText = q_createTable;
reader = dbcmd.ExecuteReader();

Sample Project

There is a sample project that uses this package available here: https://github.com/PixelWizards/com.pixelwizards.sqlite-example

Tutorial

Read this article on medium for more details on using SQLite with Unity.

com.pixelwizards.sqlite's People

Contributors

gekidoslair avatar rizasif avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.