小编fil*_*ard的帖子

如何在sqflite中的数据库中创建多个表?

我正在使用SQLite数据库构建和使用扑扑的应用程序。我使用这段代码创建了第一个表:

 void _createDb(Database db, int newVersion) async {
    await db.execute('''CREATE TABLE cards (id_card INTEGER PRIMARY KEY, 
         color TEXT, type TEXT, rarity TEXT, name TEXT UNIQUE, goldCost INTEGER,
         manaCost INTEGER, armor INTEGER, attack INTEGER, health INTEGER, description TEXT)''');
}
Run Code Online (Sandbox Code Playgroud)

表已创建,我可以毫无问题地访问它。

不幸的是,我不能包含刚刚创建的多个表。我尝试在同一方法中添加另一个SQL CREATE TABLE子句,并db.execute在下一行中使用不同的SQL子句重复该方法。

我正在模仿本教程中的代码:https : //www.youtube.com/watch?v= xke5_yGL0uk

如何在同一数据库中添加另一个表?

sqlite android dart flutter sqflite

7
推荐指数
4
解决办法
3380
查看次数

OCaml 模块中的抽象类型

我在 OCaml 中有非常简单的签名和模块:

module type S = sig
  type t 
  val y : t
end;;
Run Code Online (Sandbox Code Playgroud)

module M2 : S = struct
  type t = int
  let x = 1
  let y = x+2
end;;
Run Code Online (Sandbox Code Playgroud)

我不能使用像

M2.y
Run Code Online (Sandbox Code Playgroud)

获得3除非我指定的模块

module M2 : S with type t = int = struct ...
Run Code Online (Sandbox Code Playgroud)

为什么会这样?已经有说法了type t = int

ocaml module signature

2
推荐指数
1
解决办法
869
查看次数

标签 统计

android ×1

dart ×1

flutter ×1

module ×1

ocaml ×1

signature ×1

sqflite ×1

sqlite ×1