Comments (9)
Right now, it is a wrapper over query method in SQLiteDatabase http://bit.ly/p4uv2V
You could follow the same syntax.
Yes, I'm in the process of writing a Query Builder for Sugar ORM. Should be in fairly soon. Something in the following lines:
Select.fromTable(Note.class).where("title").eq("Satya").list();
Select.fromTable(Note.class)
.where("tag").eq(tag.getId())
.orderBy("title ASC")
.list();
Please suggest if you have any preferences.. thanks.
from sugar.
Hey @homer123 I've included Select in this checkin in a very alpha condition.. Do try it out and let me know what you think.
There is a test file SelectTest.java. Would show you different operations possible with Select query.
Typical usage would be as follows:
Select.from(TestRecord.class)
.where(Condition.prop("test").eq("satya"),
Condition.prop("prop").eq(2))
.list();
Property names are not converted currently, it'd be the table column names (conversion eg: testUnderscore => test_underscore)
Its still work in progress..
from sugar.
The syntax looks good. It would be good to have AND/OR/NOT operations for the where clause.
Would you have any beta code that I can try out ? I will be happy to provide feedback
Also did you graduate from CEG, Anna Univ ?
from sugar.
Its in progress. Will let you know once its ready to try out.
I'm from St. Joseph's college of Engg, Chennai. How about yourself?
from sugar.
Thank you. I graduated from annamalai univ, chidambaram
from sugar.
To me, that query builder looks much worse than using a raw SQL query - so I don't see the point. Why not use ActiveRecord-style query building for simple queries? For example:
Book.findBy("title or author", title, author);
from sugar.
Hmm.. I guess that can be already done with existing finders. Instead of Array input, we can make it a varargs argument.
Thanks for the input. We'll see if we can make QueryBuilder add more value than what it does currently.
from sugar.
I think all the functionality being requested here has been implemented. QueryBuilder is mostly complete and findWithQuery
has a varargs version.
from sugar.
does sugar ORM support query like this
elect PRODUCT from PRODUCT_TAGS where TAGS = 1 intersect Select PRODUCT from PRODUCT_TAGS where TAGS = 5; how do i pass this using sugar orm . @satyan @whoshuu @homer123 @tobykurien @allieus please can some one help me .
from sugar.
Related Issues (20)
- Support for user specified ID's being used in the database instead of having them generated automatically.
- Android Studio 3.2.1 DB is no longer created HOT 3
- Is Sugar ORM library affected by the newly found SQLite vulnerability?
- update bug HOT 1
- [QUESTION] Where I can find the CI service?
- OneToMany Annotation
- Missing saveAll() for nested Table
- How read existing DB from assets folder? HOT 1
- Como deletar todos os dados de uma tabela e depois verificar se a tabela está vazia? HOT 1
- No such table with migration HOT 2
- ava.lang.NoSuchMethodException: <init> []
- SugarRecord Read / write separation
- bulk data not inserted completely
- Caused by: android.database.sqlite.SQLiteException: no such table: HOT 5
- *.db file is empty, but in application all the lines are shown.
- RuntimeException on start
- 我使用save来保存数据但是数据当中设置了不可重复字段会对其进行覆盖
- build failed when sync graddle HOT 1
- no such column when select
- Could not resolve project :sugar
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sugar.