Giter Club home page Giter Club logo

Comments (9)

satyan avatar satyan commented on July 21, 2024 1

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.

satyan avatar satyan commented on July 21, 2024 1

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.

homer123 avatar homer123 commented on July 21, 2024

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.

satyan avatar satyan commented on July 21, 2024

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.

homer123 avatar homer123 commented on July 21, 2024

Thank you. I graduated from annamalai univ, chidambaram

from sugar.

tobykurien avatar tobykurien commented on July 21, 2024

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.

satyan avatar satyan commented on July 21, 2024

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.

whoshuu avatar whoshuu commented on July 21, 2024

I think all the functionality being requested here has been implemented. QueryBuilder is mostly complete and findWithQuery has a varargs version.

from sugar.

emashara avatar emashara commented on July 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.