gpst: %Cmd: Remove it, unused
[gpstools.git] / postgres / Patch / prevpoint.patch
blobeaea52435b4b8c7153a215f906d21ff33407e064
1 Index: create_funcs.sql
2 ===================================================================
3 --- create_funcs.sql (revision 3000)
4 +++ create_funcs.sql (working copy)
5 @@ -31,6 +31,23 @@
6 ) AS s;
7 $$ LANGUAGE SQL; -- }}}
9 +-- prevpoint(): Returner id for forrige punkt i logg-tabellen.
10 +CREATE OR REPLACE FUNCTION prevpoint(currpoint integer) RETURNS integer -- {{{
11 +AS $$
12 +DECLARE
13 + previd integer;
14 +BEGIN
15 + previd = (
16 + SELECT id FROM logg WHERE date < (
17 + SELECT date FROM logg where id = currpoint
18 + ORDER BY date DESC
19 + LIMIT 1
20 + ) LIMIT 1
21 + );
22 + RETURN(previd);
23 +END;
24 +$$ LANGUAGE plpgsql; -- }}}
26 -- findpos(): Beregn koordinater for et tidspunkt som ligger mellom to trackpunkter.
27 CREATE OR REPLACE FUNCTION findpos(currtime timestamptz) RETURNS point AS $$ -- {{{
28 DECLARE