Home

Awesome

USqlite

Build status

关于

支持unity3d对象的Sqlite工具

支持x64 x86,暂不支持Android、IOS

使用案例

  1. 连接数据库
Sqlite3.Open('filepath.db');
  1. 闭关数据库连接
Sqlite3.Close();
  1. 创建表
Sqlite3.CreateTable<Point>();
[TableAttribute("PointMax")]
public class Point
{
    [AutoIncrement]
    [PrimaryKey]
    [Column("ID",DbType.Int64,true)] public Int64 ID;
    [Column("POSITION")] public string POSITION;
    [Column] public Vector3 SCALE;
    [Column] public Vector3 ROTATION;
    [Column("TOWER")] public string tower;
    [Column] public string building;
    [Column] public string room;
}
  1. 删除表
Sqlite3.DropTable<Point>();
  1. 插入
Sqlite3.Table<Point>().Insert("PointMax",points);
  1. 删除
int MIN = 8;
int MAX = 12;
Sqlite3.Table<Point>().Delete("PointMax").Where(point => (point.ID > MIN && point.ID < MAX)).ExecuteNoQuery();
  1. 修改
Sqlite3.Table<Point>().Update("PointMax",
            point => new string[]{point.POSITION,point.building,point.level},
            new object[]{"(200,200,200)","大楼",1})
            .Where(point=>point.ID > 5 && point.ID < 8).ExecuteNoQuery();
  1. 查询
Point testPoint = new Point();
testPoint.ID = 20;
Sqlite3.Open(FilePath.normalPath + TABLENAME);
var points = Sqlite3.Table<Point>().Select("PointMax").Where(point => point.ID < testPoint.ID).Execute2List();

支持接口

SQLStatus
Insert:white_check_mark:
Update:white_check_mark:
Select:white_check_mark:
Delete:white_check_mark:
AND/OR:white_check_mark:
Like:x:
Glob:x:
Limit:x:
Order By:x:
Json:x: