| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ************************************************************************* |
|
2
|
|
|
|
|
|
|
# Copyright (c) 2014-2017, SUSE LLC |
|
3
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
# All rights reserved. |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Redistribution and use in source and binary forms, with or without |
|
7
|
|
|
|
|
|
|
# modification, are permitted provided that the following conditions are met: |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# 1. Redistributions of source code must retain the above copyright notice, |
|
10
|
|
|
|
|
|
|
# this list of conditions and the following disclaimer. |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright |
|
13
|
|
|
|
|
|
|
# notice, this list of conditions and the following disclaimer in the |
|
14
|
|
|
|
|
|
|
# documentation and/or other materials provided with the distribution. |
|
15
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
# 3. Neither the name of SUSE LLC nor the names of its contributors may be |
|
17
|
|
|
|
|
|
|
# used to endorse or promote products derived from this software without |
|
18
|
|
|
|
|
|
|
# specific prior written permission. |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
21
|
|
|
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
22
|
|
|
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
23
|
|
|
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
|
24
|
|
|
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
25
|
|
|
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
26
|
|
|
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
27
|
|
|
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
28
|
|
|
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
29
|
|
|
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
30
|
|
|
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE. |
|
31
|
|
|
|
|
|
|
# ************************************************************************* |
|
32
|
|
|
|
|
|
|
# |
|
33
|
|
|
|
|
|
|
# sql/schedhistory_Config.pm |
|
34
|
|
|
|
|
|
|
# |
|
35
|
|
|
|
|
|
|
# SQL statements related to schedhistory |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_INSERT |
|
39
|
|
|
|
|
|
|
# SQL query to insert a schedhistory row |
|
40
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_INSERT', q/ |
|
41
|
|
|
|
|
|
|
INSERT INTO schedhistory (eid, sid, effective, remark) |
|
42
|
|
|
|
|
|
|
VALUES (?, ?, ?, ?) |
|
43
|
|
|
|
|
|
|
RETURNING shid, eid, sid, effective, remark |
|
44
|
|
|
|
|
|
|
/ ); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_UPDATE |
|
47
|
|
|
|
|
|
|
# SQL to update a single row from schedhistory table |
|
48
|
|
|
|
|
|
|
# |
|
49
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_UPDATE', q/ |
|
50
|
|
|
|
|
|
|
UPDATE schedhistory |
|
51
|
|
|
|
|
|
|
SET sid = ?, effective = ?, remark = ? |
|
52
|
|
|
|
|
|
|
WHERE shid = ? |
|
53
|
|
|
|
|
|
|
RETURNING shid, eid, sid, effective, remark |
|
54
|
|
|
|
|
|
|
/ ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_DELETE |
|
57
|
|
|
|
|
|
|
# SQL query to delete a schedhistory row |
|
58
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_DELETE', q/ |
|
59
|
|
|
|
|
|
|
DELETE FROM schedhistory |
|
60
|
|
|
|
|
|
|
WHERE shid = ? |
|
61
|
|
|
|
|
|
|
RETURNING shid, eid, sid, effective, remark |
|
62
|
|
|
|
|
|
|
/ ); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_SELECT_ARBITRARY |
|
65
|
|
|
|
|
|
|
# SQL to select from schedhistory based on EID and arbitrary timestamp |
|
66
|
|
|
|
|
|
|
# |
|
67
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_SELECT_ARBITRARY', q/ |
|
68
|
|
|
|
|
|
|
SELECT his.shid, his.eid, his.sid, sch.scode, his.effective, his.remark |
|
69
|
|
|
|
|
|
|
FROM schedhistory his, schedules sch |
|
70
|
|
|
|
|
|
|
WHERE his.sid = sch.sid and his.eid = ? and his.effective <= ? |
|
71
|
|
|
|
|
|
|
ORDER BY his.effective DESC |
|
72
|
|
|
|
|
|
|
FETCH FIRST ROW ONLY |
|
73
|
|
|
|
|
|
|
/ ); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_SELECT_CURRENT |
|
76
|
|
|
|
|
|
|
# SQL to select from schedhistory based on EID and current timestamp |
|
77
|
|
|
|
|
|
|
# |
|
78
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_SELECT_CURRENT', q/ |
|
79
|
|
|
|
|
|
|
SELECT his.shid AS shid, his.eid AS eid, his.sid AS sid, |
|
80
|
|
|
|
|
|
|
sch.scode AS scode, his.effective AS effective, his.remark AS remark |
|
81
|
|
|
|
|
|
|
FROM schedhistory his, schedules sch |
|
82
|
|
|
|
|
|
|
WHERE his.sid = sch.sid and his.eid = ? and his.effective <= current_timestamp |
|
83
|
|
|
|
|
|
|
ORDER BY his.effective DESC |
|
84
|
|
|
|
|
|
|
FETCH FIRST ROW ONLY |
|
85
|
|
|
|
|
|
|
/ ); |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_SELECT_BY_SHID |
|
88
|
|
|
|
|
|
|
# SQL to select a schedhistory record by its shid |
|
89
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_SELECT_BY_SHID', q/ |
|
90
|
|
|
|
|
|
|
SELECT his.shid AS shid, his.eid AS eid, his.sid AS sid, |
|
91
|
|
|
|
|
|
|
sch.scode AS scode, his.effective AS effective, his.remark AS remark |
|
92
|
|
|
|
|
|
|
FROM schedhistory his, schedules sch |
|
93
|
|
|
|
|
|
|
WHERE his.sid = sch.sid and his.shid = ? |
|
94
|
|
|
|
|
|
|
/ ); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_SELECT_RANGE_BY_EID |
|
97
|
|
|
|
|
|
|
# SQL to select a range of SCHEDHISTORY records |
|
98
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_SELECT_RANGE_BY_EID', q/ |
|
99
|
|
|
|
|
|
|
SELECT his.shid AS shid, his.eid AS eid, his.sid AS sid, |
|
100
|
|
|
|
|
|
|
sch.scode AS scode, his.effective AS effective, his.remark AS remark |
|
101
|
|
|
|
|
|
|
FROM schedhistory his, schedules sch |
|
102
|
|
|
|
|
|
|
WHERE his.sid = sch.sid and his.eid = ? and his.effective <@ CAST( ? AS tstzrange ) |
|
103
|
|
|
|
|
|
|
ORDER BY his.effective |
|
104
|
|
|
|
|
|
|
/ ); |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# SQL_SCHEDHISTORY_SELECT_RANGE_BY_NICK |
|
107
|
|
|
|
|
|
|
# SQL to select a range of SCHEDHISTORY records |
|
108
|
|
|
|
|
|
|
set( 'SQL_SCHEDHISTORY_SELECT_RANGE_BY_NICK', q/ |
|
109
|
|
|
|
|
|
|
SELECT sh.shid AS shid, sh.eid AS eid, sh.sid AS sid, sch.scode AS scode, |
|
110
|
|
|
|
|
|
|
sh.effective AS effective, sh.remark AS remark |
|
111
|
|
|
|
|
|
|
FROM schedhistory sh, employees em, schedules sch |
|
112
|
|
|
|
|
|
|
WHERE sh.sid = sch.sid AND sh.eid = em.eid AND em.nick = ? AND sh.effective <@ CAST( ? AS tstzrange ) |
|
113
|
|
|
|
|
|
|
ORDER BY sh.effective |
|
114
|
|
|
|
|
|
|
/ ); |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# ----------------------------------- |
|
117
|
|
|
|
|
|
|
# DO NOT EDIT ANYTHING BELOW THIS LINE |
|
118
|
|
|
|
|
|
|
# ----------------------------------- |
|
119
|
41
|
|
|
41
|
|
28158
|
use strict; |
|
|
41
|
|
|
|
|
100
|
|
|
|
41
|
|
|
|
|
1136
|
|
|
120
|
41
|
|
|
41
|
|
228
|
use warnings; |
|
|
41
|
|
|
|
|
92
|
|
|
|
41
|
|
|
|
|
1412
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |