简体   繁体   English

SQLite的动态选择语句

[英]Dynamic select statement for SQLite

I'm building an API, for this API i want to have my database handler as dynamically as possible. 我正在建立一个API,为此API我想让我的数据库处理程序尽可能地动态。

I do have the update and insert query's dynamic by using the SQLiteDatabase class .insert and .update functions, but there is no such a thing for select. 通过使用SQLiteDatabase类.insert和.update函数,我确实具有更新和插入查询的动态功能,但是没有这样的选择。

Would i have to build my own method to do this (just like the insert or update methods) or is there something I'm missing which will make this problem cost me a lot less trouble? 我是否需要构建自己的方法来执行此操作(就像插入或更新方法一样),或者我缺少某些东西,这将使此问题花费的麻烦少得多?

The language I'm using is JAVA. 我使用的语言是JAVA。

Allright, so I went on looking and came to the following conclusion: 好吧,所以我继续寻找并得出以下结论:

SQLiteDatabase has a method called .query('lots of Args') which is basically a select statement, I will use this and it will work the way I intended to do it. SQLiteDatabase有一个称为.query('lots of Args') ,该方法基本上是一条select语句,我将使用此方法,并且它将按照我打算的方式工作。

There are functions like rawQuery in which you can use the select clause and infact many more such functions. 有诸如rawQuery之类的函数,您可以在其中使用select子句并实现更多此类函数。 Go through the SQLiteDatabase class documentation properly. 正确浏览SQLiteDatabase类文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM