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
|
|
|
|
|
|
|
# ----------------------------------- |
34
|
|
|
|
|
|
|
# Dochazka-REST |
35
|
|
|
|
|
|
|
# ----------------------------------- |
36
|
|
|
|
|
|
|
# employee_Config.pm |
37
|
|
|
|
|
|
|
# |
38
|
|
|
|
|
|
|
# configuration parameters related to employees |
39
|
|
|
|
|
|
|
# ----------------------------------- |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_BY_EID', q/ |
43
|
|
|
|
|
|
|
SELECT eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
44
|
|
|
|
|
|
|
FROM employees WHERE eid=?/ ); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# |
47
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_BY_SEC_ID', q/ |
48
|
|
|
|
|
|
|
SELECT eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
49
|
|
|
|
|
|
|
FROM employees WHERE sec_id=?/ ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_BY_NICK', q/ |
53
|
|
|
|
|
|
|
SELECT eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
54
|
|
|
|
|
|
|
FROM employees WHERE nick=?/ ); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_PRIV_AT_TIMESTAMP', q/ |
58
|
|
|
|
|
|
|
SELECT priv_at_timestamp($1, $2) |
59
|
|
|
|
|
|
|
/ ); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# |
62
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SCHEDULE_AT_TIMESTAMP', q/ |
63
|
|
|
|
|
|
|
SELECT sid_at_timestamp($1, $2) |
64
|
|
|
|
|
|
|
/ ); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# |
67
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_MULTIPLE_BY_NICK', q/ |
68
|
|
|
|
|
|
|
SELECT eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
69
|
|
|
|
|
|
|
FROM employees WHERE nick LIKE ?/ ); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# |
72
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_MULTIPLE_BY_SYNC', q/ |
73
|
|
|
|
|
|
|
SELECT eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
74
|
|
|
|
|
|
|
FROM employees WHERE sync = ?/ ); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# |
77
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_CURRENT_PRIV', q/ |
78
|
|
|
|
|
|
|
SELECT current_priv(?)/ ); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# |
81
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_CURRENT_SCHEDULE', q/ |
82
|
|
|
|
|
|
|
SELECT current_schedule(?)/ ); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# |
85
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_INSERT', q/ |
86
|
|
|
|
|
|
|
INSERT INTO employees |
87
|
|
|
|
|
|
|
(sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark) |
88
|
|
|
|
|
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) |
89
|
|
|
|
|
|
|
RETURNING eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
90
|
|
|
|
|
|
|
/ ); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_UPDATE_BY_EID', q/ |
94
|
|
|
|
|
|
|
UPDATE employees SET sec_id = ?, nick = ?, fullname = ?, email = ?, |
95
|
|
|
|
|
|
|
passhash = ?, salt = ?, sync = ?, supervisor =?, remark = ? |
96
|
|
|
|
|
|
|
WHERE eid = ? |
97
|
|
|
|
|
|
|
RETURNING eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
98
|
|
|
|
|
|
|
/ ); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# |
101
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_DELETE', q/ |
102
|
|
|
|
|
|
|
DELETE FROM employees WHERE eid = ? |
103
|
|
|
|
|
|
|
RETURNING eid, sec_id, nick, fullname, email, passhash, salt, sync, supervisor, remark |
104
|
|
|
|
|
|
|
/ ); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
# |
107
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_COUNT_BY_PRIV_LEVEL', q/ |
108
|
|
|
|
|
|
|
WITH emps_with_privs AS ( |
109
|
|
|
|
|
|
|
SELECT eid, current_priv(eid) AS priv FROM employees |
110
|
|
|
|
|
|
|
) SELECT count(*) FROM emps_with_privs WHERE priv=? |
111
|
|
|
|
|
|
|
/ ); |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# |
114
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_NICKS_ALL', q/ |
115
|
|
|
|
|
|
|
SELECT nick FROM employees ORDER BY nick |
116
|
|
|
|
|
|
|
/ ); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# |
119
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_NICKS_BY_PRIV_LEVEL', q/ |
120
|
|
|
|
|
|
|
WITH emps_with_privs AS ( |
121
|
|
|
|
|
|
|
SELECT eid, nick, current_priv(eid) AS priv FROM employees |
122
|
|
|
|
|
|
|
) SELECT nick FROM emps_with_privs WHERE priv=? ORDER BY nick |
123
|
|
|
|
|
|
|
/ ); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
# |
126
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SELECT_TEAM', q/ |
127
|
|
|
|
|
|
|
SELECT nick FROM employees WHERE supervisor = ? ORDER BY nick |
128
|
|
|
|
|
|
|
/ ); |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
# |
131
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_HAS_REPORTS', q/ |
132
|
|
|
|
|
|
|
SELECT has_reports(?) |
133
|
|
|
|
|
|
|
/ ); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
# |
136
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_PRIV_CHANGE_DURING_RANGE', q/ |
137
|
|
|
|
|
|
|
SELECT priv_change_during_range( ?, ? ) |
138
|
|
|
|
|
|
|
/ ); |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
# |
141
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_PRIVHISTORY_AT_TIMESTAMP', q/ |
142
|
|
|
|
|
|
|
SELECT phid, eid, priv, effective, remark FROM privhistory_at_timestamp( ?, ? ) |
143
|
|
|
|
|
|
|
/ ); |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# |
146
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_PRIVHISTORY_AT_TSRANGE', q/ |
147
|
|
|
|
|
|
|
SELECT phid, eid, priv, effective, remark FROM privhistory_at_tsrange( ?, ? ) |
148
|
|
|
|
|
|
|
/ ); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# |
151
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SCHEDULE_CHANGE_DURING_RANGE', q/ |
152
|
|
|
|
|
|
|
SELECT schedule_change_during_range( ?, ? ) |
153
|
|
|
|
|
|
|
/ ); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# |
156
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SCHEDHISTORY_AT_TIMESTAMP', q/ |
157
|
|
|
|
|
|
|
SELECT shid, eid, sid, effective, remark FROM schedhistory_at_timestamp( ?, ? ) |
158
|
|
|
|
|
|
|
/ ); |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# |
161
|
|
|
|
|
|
|
set( 'SQL_EMPLOYEE_SCHEDHISTORY_AT_TSRANGE', q/ |
162
|
|
|
|
|
|
|
SELECT shid, eid, sid, effective, remark FROM schedhistory_at_tsrange( ?, ? ) |
163
|
|
|
|
|
|
|
/ ); |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
# ----------------------------------- |
166
|
|
|
|
|
|
|
# DO NOT EDIT ANYTHING BELOW THIS LINE |
167
|
|
|
|
|
|
|
# ----------------------------------- |
168
|
41
|
|
|
41
|
|
37195
|
use strict; |
|
41
|
|
|
|
|
155
|
|
|
41
|
|
|
|
|
1277
|
|
169
|
41
|
|
|
41
|
|
265
|
use warnings; |
|
41
|
|
|
|
|
104
|
|
|
41
|
|
|
|
|
1726
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
1; |