Skip to content

MuZiLee/SQLdb

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

SQLdb

A new Flutter application. sqflite based packaging

Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

数据库表名
final String table;

【more】true 此模式的数据表会自动创建一个自增字段"_id"作为数据插入索引。此模式创建的表,当调用【insert】时,旧数据不会被替换

【more】false 默认模式。被创建的表会按表传入的json原样进入字段以及类型复制,每一次调用【insert】时,新数据会替换旧数据。

final bool more;


var data = {
  "id": 14,
  "level": "A,B,C,E",
  "mobile": "13800138000",
  "uid": "admin",
  "name": "kkk",
  "step": 2
};

初始化

//TODO:初始化自动创建db文件。
SQLdb.init("member_check_login", json: data);

//TODO: 增加数据
SQLdb.init("member_check_login", json: data).insert(data);

//TODO: 更新数据
SQLdb.init("member_check_login").update(json, where: "id = 3",onChanged: (count){
  print("更新数据库:${count}");
});

//TODO: 查询数据
SQLdb.init("member_check_login").getList((list){
  print("查询数据:${list}");
});

//TODO:删除数据
SQLdb.init("member_check_login").deleteList(onChanged: (count){
  print("删除数据:${count}");
});

查询所有表

SQLdb.init("member_check_login").getTableAll(onChanged: (map){
    print("查询所有表:${map}");
});

查询某表是否存在

SQLdb.init("member_check_login").queryTable(onChanged: (map){
    print("查询所有表:${map}");
});

About

SQLdb library based on sqflite package. Very simple to use 【Flutter】or【Dart】

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published