Opasnet Base UI

From Opasnet
Jump to navigation Jump to search

This special page implements user interface to fetch data from the Opasnet Base -database.

Queries

This chapter describes the queries that Base UI executes.

Basic object data

SELECT * FROM obj WHERE ident = "<object identifier>";

Newest act (upload)

SELECT series_id FROM actobj WHERE obj_id = <object id> ORDER BY series_id DESC LIMIT 0,1;

Object cell data

SELECT n, mean FROM cell LEFT JOIN actobj ON cell.actobj_id = actobj.id WHERE actobj.series_id = <act series id>;

Wiki data

SELECT * FROM wiki WHERE id = <wiki id>;

Upload history

SELECT act.id AS id, who, time, comments, n, acttype FROM act LEFT JOIN actobj ON act.id = actobj.act_id LEFT JOIN acttype ON acttype.id = act.acttype_id LEFT JOIN cell ON cell.actobj_id = actobj.id WHERE actobj.obj_id = <object id> AND (acttype.id = 4 OR acttype.id = 5) ORDER BY time DESC;

Specific upload info

SELECT act.id AS id, who, time, comments, n, acttype FROM act LEFT JOIN actobj ON act.id = actobj.act_id LEFT JOIN acttype ON acttype.id = act.acttype_id LEFT JOIN cell ON cell.actobj_id = actobj.id WHERE actobj.obj_id = <object id> AND (acttype.id = 4 OR acttype.id = 5) AND actobj.series_id = <act series id> ORDER BY time DESC;