投身于Android的使用SQLite表的最佳方法 [英] Best way to join tables using sqlite in android

查看:92
本文介绍了投身于Android的使用SQLite表的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出做一个简单的表连接在一个Android应用程序中使用SQLite数据库我的两个表的最佳途径。就是用CursorJoiner最简单的方法或者是还有什么更简单的方法?

I am trying to find out the best way to do a simple table join on my two tables using a sqlite database in an android application. Is the simplest way to use CursorJoiner or is there any easier way?

推荐答案

在<一实施href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/database/sqlite/SQLiteDatabase.java;h=d4f9b2008b83f0131a57800eddf636391c88d492;hb=HEAD">SQLiteDatabase和<一href="http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/database/sqlite/SQLiteQueryBuilder.java;h=610bf7013e099f303e9ab67d6b4ef899a2bc03c2;hb=HEAD">SQLiteQueryBuilder你会看到,它有可能通过你想加入到表中的<一个参数表href="http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#query%28java.lang.String,%20java.lang.String%5b%5d,%20java.lang.String,%20java.lang.String%5b%5d,%20java.lang.String,%20java.lang.String,%20java.lang.String%29"><$c$c>query即使文档意味着将只需要一台单一的名字。该文档<一个href="http://developer.android.com/reference/android/database/sqlite/SQLiteQueryBuilder.html">SQLiteQueryBuilder为更清晰,甚至建议像 FOO,酒吧富LEFT OUTER JOIN栏上(foo.id = bar.foo_id)

In the implementation of SQLiteDatabase and SQLiteQueryBuilder you will see that it is possible to pass the tables you want to join to the table argument of query even though the documentation implies it will only take a single name of a table. The documentation for SQLiteQueryBuilder is more clear and even suggests things like foo, bar or foo LEFT OUTER JOIN bar ON (foo.id = bar.foo_id).

这篇关于投身于Android的使用SQLite表的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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