i implementing restful webservice android application. app need create stops
table in mysql database folowing colmumns id, long, lat, route, name, arrivaltime
app every minute query server retrieve route number table , depend on rider position arrivaltime popup windows appear ask user whether bus arrives stop standing @ moment.
how can integrate the arrivaltime
table since big array?
for server side using jersey.
{ "id": 1 "stops_name": "amersham ", "arrival_time": { "mon-fri": [ "05:38", "06:07","06:37",.....50 entries], "sat": ["05:34","06:01","06:31",...........50 entries], "son": ["06:02","06:34","07:04",...........50 entries] }, "stops_lat": 83.837994, "stops_long": 18.700423 }
your database layout depends on requirements.
option 1: create 3 text columns arrivaltimemonfri
, arrivaltimesat
, arrivaltimeson
store arrival times in format of choice.
option 2: create 2 tables. master table stops
columns (id, long, lat, route, name)
, detail table arrivaltimes
columns (id, stops_id, weekday, arrivaltime)
:
1 | 1 | "mon-fri" | 5:38 2 | 1 | "mon-fri" | 6:07 3 | 1 | "mon-fri" | 6:37 ...
there of course many other options , each of them has advantages , disadvantages in terms of performance, handling, ...
Comments
Post a Comment