更新时间:2022-06-02 17:49:29
您不能在一个简单的表中.我了解您的意思,例如,您想存储以下内容:
You can´t in a simple table. I understand your point, you want to store, for example, something like this:
citizen = {
"name":"",
"id":"",
"childrens":{
children1:{
"name":"",
"id":"",
}
children2:{
"name":"",
"id":"",
}
}
}
这是因为sqflite是使用设备sqlite的工具,并且该数据库在apache软件下工作.这意味着Sqflite会存储数据,而sql DB会存储数据,而您不能在sql表中存储对象.
This is because sqflite is a tool to use the device sqlite and this DB works under apache software. That means, Sqflite stores data as well sql DB stores data and you can't store objects in a sql table.
您应根据需要为每个复杂数据创建其他表.像这样的东西(作为伪代码):
You should create other table for each complex data as you need. Something like this (as pseudocode):
'CREATE TABLE Citizen ('
' id INTEGER PRIMARY KEY,'
' name TEXT,'
' children1Id INTEGER,'
' children2Id INTEGER,'
'); '
'CREATE TABLE Children ('
' id INTEGER PRIMARY KEY,'
' name TEXT'
')'
我希望这会对您有所帮助.
I hope this will help you.