android - User downloads all events, then favourites a few -
this theoretical question. i'm creating app downloads list of events around city mysql db
, displays them in recyclerview
.
users should able select event , add own list of events interested in. at point, i'm not sure best practices.
so when user selects event item recyclerview
, what's best solution, can think of that:
method 1: add chosen event list<event>
saved in sharedpreferences
json
string. upload list online mysql
db @ later point.
any other suggestions?
about query:
also, give me pointer on how complex query
database.
i have these tables events,accounts, guestlist
. so, guestlist holds id of event , of account keep track of events specific user wants attend. i'm guessing i'd have use kind of join?
you can see if want data display (the event information user requesting it) i'd need first query guestlist
table list of events. query events
table information events ids grabbed moment ago. example sql statement anyone?
when user select event recyclerview wants attend, should pass query database storing event user’s private event list. optimal way doing asynchronously… seems have many many relationship between models. events, account , middle table guestlist stores relations between models. best practice name events_account , convension means connection table. examples show on ms sql pretty same , concept same too. basing on models description relations should looking that.
you can select data using basic query this
when user wants grab info particular event can add clause this
you can pass parameters in method , pure query. let's pretend these variables @currentuserid , @particular event. can pass values method , use them select item
this worst practice – use pure query. php other languages giving prerequisites shoot in leg. using pure db query in code , relaying user use application totally wrong. way user can send sql injection , dump database. here comes orm /object relational mapping/ entityframework .net. php equivalent propelorm. maps database , makes access object easy fluent syntax.
the query , orm simpler use , saves sql injection both transpiled sql language. query execute in sql close 1 on pictures bit uglier human. don't worry query fact because operations executed on database level , fast.
i hope useful , enough , solves theoretical problem
Comments
Post a Comment