如何在 FMDB 中的两个表之间创建或稳定关系? [英] How To Create or Stabiles relationship between two tables in FMDB?

查看:22
本文介绍了如何在 FMDB 中的两个表之间创建或稳定关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 iOS 开发的新手,我也是 SQLITE 数据库的新手.我在我的项目中使用 FMDB 作为包装器,我有两个表 1) ParticepentsTable 和 2) ExerciseTable.

I'm new with iOS Development and i'm also new with SQLITE database. I used FMDB as a wrapper in my project and i have two tables 1) ParticepentsTable and 2) ExerciseTable.

ParticepentsTable 包含 4 行,如 Id、Name、Gender 和 Exercise_IdExerciseTable 包含 2 行,即 Id 和 运动名称.

ParticepentsTable contains 4-Rows like Id, Name, Gender and Exercise_Id and the ExerciseTable contains 2-Rows i.e. Id and exercise_Name.

我的问题如下:-

1) 我想在 Table-1 & 之间建立外键关系2 使用FMDB,以便我可以根据参与者的选择存储练习.

1) I want to make a Foreign-key Relation between Table-1 & 2 using FMDB, so that i can store the exercise according to Participants choice.

2) 或者有什么其他方式可以根据参与者选择或插入练习?

2) Or any other way to select or insert exercises according to the participants?

3) 我可以使用 Join 根据参与者 ID 从两个表中获取数据吗?

3) Can I use Join to fetch data from both the tables according to the Participants id?

任何人都可以帮忙!

教程链接更值得赞赏!谢谢!

推荐答案

通过查看您的其他问题,我猜您已经解决了这个问题.无论如何,这是我的答案.在 iOS 开发中,直接使用 SQLite 并不常见,我们使用 CoreData,这是一个将数据序列化为 SQLite 的 API(或者您也可以将其配置为将其序列化为二进制或 XML).

By looking at your other question I guess you already sorted this out. Here's my answer anyway. In iOS development it's uncommon to use SQLite directly, instead we use CoreData, which is an API that serializes data to SQLite (or you can configure it to serialize it to binary or XML too).

这里有一些链接供您参考:

Here are some links for you:

SQLite

CoreData

希望这会有所帮助!

这篇关于如何在 FMDB 中的两个表之间创建或稳定关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆