16
|
1 #!/usr/bin/env python |
|
2 |
|
3 """ supplys the data needed to comunicate with the roundup-server, |
|
4 and the sqlite database. Represents the types of errors used in roundup. |
|
5 |
|
6 author: Sascha L. Teichmann <sascha.teichmann@intevation.de> |
|
7 author: Bernhard Reiter <bernhard@intevation.de> |
|
8 author: Sean Engelhardt <sean.engelhardt@intevation.de> |
|
9 |
|
10 (c) 2010,2015 by Intevation GmbH |
|
11 |
|
12 This is Free Software unter the terms of the |
|
13 GNU GENERAL PUBLIC LICENSE Version 3 or later. |
|
14 See http://www.gnu.org/licenses/gpl-3.0.txt for details |
|
15 """ |
|
16 |
|
17 import os |
|
18 |
|
19 #Add desired sqlite databases here |
|
20 DATABASE_REFERENCCE = os.path.dirname(os.path.realpath(__file__)) + "/test_reference.db" |
|
21 DATABASE_DEMO = os.path.dirname(os.path.realpath(__file__)) + "/demo.db" |
|
22 DATABASE_ERRORDB = os.path.dirname(os.path.realpath(__file__)) + "/errordatabase.db" |
|
23 DATABASE_TECH_INTERN = os.path.dirname(os.path.realpath(__file__)) + "/tech_intern.db" |
|
24 DATABASE_INT_TEST = os.path.dirname(os.path.realpath(__file__)) + "/int_test.db" |
|
25 |
|
26 COLUMNS= [ |
|
27 "critical", "urgent", "bug", "feature", "wish", |
|
28 ] |
|
29 |
|
30 data_dict = { |
|
31 "date": [], |
|
32 "critical": [], |
|
33 "urgent": [], |
|
34 "bug": [], |
|
35 "feature": [], |
|
36 "wish": [] |
|
37 } |
|
38 |
|
39 #SQL |
|
40 |
|
41 #DEMO System |
|
42 SELECT_ALL = """ |
|
43 SELECT strftime("%Y-%m-%dT%H:%M:%S", timestamp), |
|
44 critical, |
|
45 urgent, |
|
46 bug, |
|
47 feature, |
|
48 wish |
|
49 FROM issues |
|
50 ORDER BY timestamp |
|
51 """ |
|
52 |
|
53 |
|
54 CREATE_DB = """ |
|
55 CREATE TABLE issues ( |
|
56 timestamp TIMESTAMP NOT NULL UNIQUE DEFAULT current_timestamp, |
|
57 critical INTEGER NOT NULL DEFAULT 0, |
|
58 urgent INTEGER NOT NULL DEFAULT 0, |
|
59 bug INTEGER NOT NULL DEFAULT 0, |
|
60 feature INTEGER NOT NULL DEFAULT 0, |
|
61 wish INTEGER NOT NULL DEFAULT 0 |
|
62 ) |
|
63 """ |
|
64 |
|
65 |
|
66 INSERT_NEW = """ |
|
67 INSERT INTO issues (critical, urgent, bug, feature, wish) |
|
68 VALUES (?, ?, ?, ?, ?) |
|
69 """ |
|
70 |
|
71 #Referecen DB: |
|
72 SELECT_ALL_REFERENCE = """ |
|
73 SELECT strftime("%Y-%m-%dT%H:%M:%S", sample_time), |
|
74 critical, |
|
75 major, |
|
76 crash, |
|
77 normal, |
|
78 minor, |
|
79 wishlist |
|
80 FROM issues |
|
81 ORDER BY sample_time |
|
82 """ |