Office Hours — Today, August 17

Tuesday, August 15

Aug 17
3:55 PM
Mark M.
has entered the room
Mark M.
turned on guest access
4:05 PM
Steve S.
has entered the room
Steve S.
Hi, Mark!
Mark M.
hello, Steve!
how can I help you today?
Steve S.
I wanted to follow up our chat a couple of days ago
I've looked at the database code in EmPubLite and noticed you use raw SQL
Are there good use cases for SQLQueryBuilder and ContentValues, or should I generally prefer raw SQL?
4:10 PM
Mark M.
well, ContentValues is dictated more by the operation -- you use that for INSERT and UPDATE
Steve S.
ok
Mark M.
whereas you don't use that for SELECT or other queries, simply because SQLiteDatabase doesn't
Steve S.
right, i get that
Mark M.
with respect to SQLiteQueryBuilder, I'm not a huge fan, outside of perhaps a ContentProvider implementation, but you're welcome to use it
or, use an ORM or ORM-esque layer, like Room from the Architecture Components
Steve S.
ok
Mark M.
(though Room is still an alpha)
Steve S.
i thought maybe SQLiteQueryBuilder would have security advantages over raw SQL (for instance, preventing SQL injection)
Mark M.
no more than positional parameters (the ? stuff) do
Steve S.
ok
Mark M.
SQL injection isn't really a thing for local UIs
Steve S.
ok
Mark M.
if the user wishes to execute a Little Bobby Tables attack against her own copy of the app, that user is slightly deranged, but it's her choice
SQL injection is a much bigger deal when the data is coming from semi-arbitrary outside parties
SQLite's positional parameters aren't designed to deal with SQL injection, but they do a pretty good job of addressing it anyway
4:15 PM
Steve S.
ok. it's certainly simpler to go with raw SQL, so I'll look into taking that route
no more questions today. i appreciate your help. thank you!
Mark M.
you're welcome!
Steve S.
have a good rest of the day!
Mark M.
I wish you luck in surviving the zombie apocalypse that Monday's eclipse will surely bring!
Steve S.
thanks for bringing that to me attention! i'll try to get all my Android questions answered before then!
Steve S.
has left the room
4:55 PM
Mark M.
turned off guest access

Tuesday, August 15

 

Office Hours

People in this transcript

  • Mark Murphy
  • Steve S