gpsfold: Remove $Id$ at EOF.
[gpstools.git] / branches / gpst.gpxfix / postgres / Patch / wheretype.patch
blobe7f480f8d5708a80e9853070e04437cfe4f23f92
1 Index: create_funcs.sql
2 ===================================================================
3 --- create_funcs.sql (revisjon 2216)
4 +++ create_funcs.sql (arbeidskopi)
5 @@ -110,6 +110,44 @@
6 END;
7 $$ LANGUAGE plpgsql;
9 +DROP TYPE wheretype;
10 +CREATE TYPE wheretype AS (
11 + date timestamptz,
12 + lat numeric(8, 5),
13 + lon numeric(8, 5),
14 + sted text,
15 + dist numeric
16 +);
18 +DROP FUNCTION wherepos(timestamptz);
19 +CREATE OR REPLACE FUNCTION wherepos(currtime timestamptz) RETURNS wheretype AS $$
20 +DECLARE
21 + currpos point;
22 + currsted text;
23 + currdist numeric;
24 + currlat numeric(8, 5);
25 + currlon numeric(8, 5);
26 +BEGIN
27 + currpos = findpos(currtime);
28 + currlat = currpos[1];
29 + currlon = currpos[0];
30 + currsted = clname(currpos);
31 + currdist = cldist(currpos);
32 + RETURN(currtime, currlat, currlon, currsted, currdist);
33 + -- RETURN(currtime || currlat || currlon || currplace || currdist);
34 +END;
35 +$$ LANGUAGE plpgsql;
37 +-- Backup
38 +-- begin-base64 644 -
39 +-- H4sIABd7IEgCA11Q0WrCMBR971fch8JacLA9CGLxIatZEUocsX0SH0qNLpCm
40 +-- WRvZGH78kupMm0DC5Zx77jm5KcWowLClQPFHjlIM7yVJi82WwPcn65hq+6i+
41 +-- dJ3mDQP79LpqlP6NTX9RUrIDzX40oB2EYbDGaY4oDsAcKzJiUC2XOnGQqGo2
42 +-- aBx25L0GeWlYx2uHiuoBRosZzOMR1UqfesPZhkyMV3Di8jjOH0+Hr/5b96+H
43 +-- 6WzHvBz86IYTsmpYdG+JvX9Y3hYef9uWW+X1Ck/wbK4p7oGWy2GVA+PwVo7x
44 +-- keIWx0ettbHEZJ0EYQg5IlmJMgxKqHP/JZLgD2CFKF3xAQAA
45 +-- ====
47 -- Returnerer antall sekunder sia midnatt for en dato.
48 DROP FUNCTION secmidnight(timestamptz);
49 CREATE OR REPLACE FUNCTION secmidnight(timestamptz) RETURNS double precision