emilsjolander / sprinkles

Sprinkles is a boiler-plate-reduction-library for dealing with databases in android applications
Apache License 2.0
772 stars 84 forks source link

Add two methods to query sql loading from raw text file #75

Closed qq157755587 closed 10 years ago

qq157755587 commented 10 years ago

I really like to write SQL by sprinkles, but I don't like to write SQL like this:

"select Notes.*, " +
              "(select count(*) from NoteTagLinks where NoteTagLinks.note_id = Notes.id) as tag_count " +
              "from Notes order by created_at desc"

So I added two methods to run SQL written in raw text files. Just add text files(such as query_notes.sql) into raw folder, and write SQL directly in files.

I don't know how to write test case with raw files, but I tested it with sample model. It looks good.

emilsjolander commented 10 years ago

Awesome addition! Thanks :+1: