Opasnet Base UI: Difference between revisions

From Opasnet
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 6: Line 6:
=== Basic object data ===
=== Basic object data ===
<code>
<code>
SELECT * FROM obj WHERE ident="<object identifier>";
SELECT * FROM obj WHERE ident = "<object identifier>";
</code>
</code>


=== Newest act ===
=== Newest act (upload) ===
<code>
<code>
SELECT series_id FROM actobj WHERE obj_id=<object id> ORDER BY series_id DESC LIMIT 0,1;
SELECT series_id FROM actobj WHERE obj_id = <object id> ORDER BY series_id DESC LIMIT 0,1;
</code>
 
=== Object cell data ===
<code>
SELECT n, mean FROM cell JOIN actobj ON cell.actobj_id = actobj.id WHERE actobj.series_id = <act series id>;
</code>
 
=== Wiki data ===
<code>
SELECT * FROM wiki WHERE id = <wiki id>;
</code>
 
=== Upload history ===
<code>
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;
</code>
 
=== Specific upload info ===
<code>
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;
</code>
</code>


[[category:extension]]
[[category:extension]]

Revision as of 13:36, 1 March 2010

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 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;