Merge lp:~hartmut-php/eventum/no-mysql-functions into lp:eventum

Proposed by Elan Ruusamäe on 2014-09-27
Status: Merged
Merge reported by: Elan Ruusamäe
Merged at revision: not available
Proposed branch: lp:~hartmut-php/eventum/no-mysql-functions
Merge into: lp:eventum
Diff against target: 214 lines (+26/-20) (has conflicts)
11 files modified
lib/eventum/class.custom_field.php (+1/-1)
lib/eventum/class.draft.php (+1/-1)
lib/eventum/class.email_account.php (+1/-1)
lib/eventum/class.mail_queue.php (+6/-0)
lib/eventum/class.news.php (+1/-1)
lib/eventum/class.note.php (+1/-1)
lib/eventum/class.notification.php (+1/-1)
lib/eventum/class.report.php (+1/-1)
lib/eventum/class.search.php (+2/-2)
lib/eventum/class.stats.php (+9/-9)
lib/eventum/class.support.php (+2/-2)
Text conflict in lib/eventum/class.mail_queue.php
To merge this branch: bzr merge lp:~hartmut-php/eventum/no-mysql-functions
Reviewer Review Type Date Requested Status
Elan Ruusamäe Pending
Review via email: mp+236236@code.launchpad.net

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/eventum/class.custom_field.php'
2--- lib/eventum/class.custom_field.php 2014-09-04 21:31:57 +0000
3+++ lib/eventum/class.custom_field.php 2014-09-27 20:11:45 +0000
4@@ -1747,7 +1747,7 @@
5
6 public function getDBValueFieldSQL()
7 {
8- return "(IF(fld_type = 'date', icf_value_date, IF(fld_type = 'integer', icf_value_integer, icf_value)))";
9+ return "(CASE WHEN fld_type = 'date' THEN icf_value_date ELSE WHEN fld_type = 'integer' THEN icf_value_integer ELSE icf_value END)";
10 }
11
12 /**
13
14=== modified file 'lib/eventum/class.draft.php'
15--- lib/eventum/class.draft.php 2014-09-04 21:31:57 +0000
16+++ lib/eventum/class.draft.php 2014-09-27 20:11:45 +0000
17@@ -397,7 +397,7 @@
18 emd_status = 'pending'
19 ORDER BY
20 emd_id ASC
21- LIMIT " . ($sequence - 1) . ", 1";
22+ LIMIT 1 OFFSET " . ($sequence - 1);
23 $res = DB_Helper::getInstance()->getOne($stmt);
24 if (PEAR::isError($res)) {
25 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
26
27=== modified file 'lib/eventum/class.email_account.php'
28--- lib/eventum/class.email_account.php 2014-09-04 21:31:57 +0000
29+++ lib/eventum/class.email_account.php 2014-09-27 20:11:45 +0000
30@@ -428,7 +428,7 @@
31 WHERE
32 ema_prj_id=" . Misc::escapeInteger($prj_id) . "
33 LIMIT
34- 0, 1";
35+ 1 OFFSET 0";
36 $res = DB_Helper::getInstance()->getOne($stmt);
37 if (PEAR::isError($res)) {
38 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
39
40=== modified file 'lib/eventum/class.mail_queue.php'
41--- lib/eventum/class.mail_queue.php 2014-09-04 21:31:57 +0000
42+++ lib/eventum/class.mail_queue.php 2014-09-27 20:11:45 +0000
43@@ -307,12 +307,18 @@
44 WHERE
45 maq_status='$status'
46 ORDER BY
47+<<<<<<< TREE
48 maq_id ASC";
49
50 if ($limit !== false) {
51 $sql .= " LIMIT 0, $limit";
52 }
53
54+=======
55+ maq_id ASC
56+ LIMIT
57+ $limit OFFSET 0";
58+>>>>>>> MERGE-SOURCE
59 $res = DB_Helper::getInstance()->getCol($sql);
60 if (PEAR::isError($res)) {
61 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
62
63=== modified file 'lib/eventum/class.news.php'
64--- lib/eventum/class.news.php 2014-09-04 20:32:55 +0000
65+++ lib/eventum/class.news.php 2014-09-27 20:11:45 +0000
66@@ -51,7 +51,7 @@
67 ORDER BY
68 nws_created_date DESC
69 LIMIT
70- 0, 3";
71+ 3 OFFSET 0";
72 $res = DB_Helper::getInstance()->getAll($stmt, DB_FETCHMODE_ASSOC);
73 if (PEAR::isError($res)) {
74 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
75
76=== modified file 'lib/eventum/class.note.php'
77--- lib/eventum/class.note.php 2014-09-04 21:31:57 +0000
78+++ lib/eventum/class.note.php 2014-09-27 20:11:45 +0000
79@@ -244,7 +244,7 @@
80 not_removed = 0
81 ORDER BY
82 not_created_date ASC
83- LIMIT " . ($sequence - 1) . ", 1";
84+ LIMIT 1 OFFSET " . ($sequence - 1);
85 $res = DB_Helper::getInstance()->getOne($stmt);
86 if (PEAR::isError($res)) {
87 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
88
89=== modified file 'lib/eventum/class.notification.php'
90--- lib/eventum/class.notification.php 2014-09-04 21:31:57 +0000
91+++ lib/eventum/class.notification.php 2014-09-27 20:11:45 +0000
92@@ -72,7 +72,7 @@
93 public static function getSubscribedEmails($issue_id, $type = false)
94 {
95 $stmt = "SELECT
96- IF(usr_id <> 0, usr_email, sub_email) AS email
97+ CASE usr_id <> 0 THEN usr_email ELSE sub_email END AS email
98 FROM
99 (
100 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "subscription";
101
102=== modified file 'lib/eventum/class.report.php'
103--- lib/eventum/class.report.php 2014-09-04 20:59:49 +0000
104+++ lib/eventum/class.report.php 2014-09-27 20:11:45 +0000
105@@ -890,7 +890,7 @@
106 break;
107 case "dow":
108 $format = '%W';
109- $order_by = "IF(DATE_FORMAT(%1\$s, '%%w') = 0, 7, DATE_FORMAT(%1\$s, '%%w'))";
110+ $order_by = "CASE WHEN DATE_FORMAT(%1\$s, '%%w') = 0 THEN 7 ELSE DATE_FORMAT(%1\$s, '%%w') END";
111 break;
112 case "week":
113 if ($type == "aggregate") {
114
115=== modified file 'lib/eventum/class.search.php'
116--- lib/eventum/class.search.php 2014-09-04 17:37:16 +0000
117+++ lib/eventum/class.search.php 2014-09-27 20:11:45 +0000
118@@ -265,7 +265,7 @@
119 iss_last_internal_action_date,
120 iss_last_internal_action_type,
121 " . Issue::getLastActionFields() . ",
122- IF(iss_last_internal_action_date > iss_last_public_action_date, 'internal', 'public') AS action_type,
123+ CASE WHEN iss_last_internal_action_date > iss_last_public_action_date THEN 'internal' ELSE 'public' END AS action_type,
124 iss_private,
125 usr_full_name,
126 iss_percent_complete,
127@@ -397,7 +397,7 @@
128 $total_rows = Pager::getTotalRows($stmt);
129 $stmt .= "
130 LIMIT
131- " . Misc::escapeInteger($start) . ", " . Misc::escapeInteger($max);
132+ " . Misc::escapeInteger($max) . " OFFSET " . Misc::escapeInteger($start);
133 $res = DB_Helper::getInstance()->getAll($stmt, DB_FETCHMODE_ASSOC);
134 if (PEAR::isError($res)) {
135 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
136
137=== modified file 'lib/eventum/class.stats.php'
138--- lib/eventum/class.stats.php 2014-09-04 20:32:55 +0000
139+++ lib/eventum/class.stats.php 2014-09-27 20:11:45 +0000
140@@ -230,8 +230,8 @@
141 $stmt = "SELECT
142 DISTINCT iss_prc_id,
143 prc_title,
144- SUM(IF(sta_is_closed=0, 1, 0)) AS total_open_items,
145- SUM(IF(sta_is_closed=1, 1, 0)) AS total_closed_items
146+ SUM(CASE WHEN sta_is_closed=0 THEN 1 ELSE 0 END) AS total_open_items,
147+ SUM(CASE WHEN sta_is_closed=1 THEN 1 ELSE 0 END) AS total_closed_items
148 FROM
149 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,
150 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_category,
151@@ -272,8 +272,8 @@
152 $stmt = "SELECT
153 DISTINCT iss_pre_id,
154 pre_title,
155- SUM(IF(sta_is_closed=0, 1, 0)) AS total_open_items,
156- SUM(IF(sta_is_closed=1, 1, 0)) AS total_closed_items
157+ SUM(CASE WHEN sta_is_closed=0 THEN 1 ELSE 0 END) AS total_open_items,
158+ SUM(CASE WHEN sta_is_closed=1 THEN 1 ELSE 0 END) AS total_closed_items
159 FROM
160 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,
161 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_release,
162@@ -350,8 +350,8 @@
163 $stmt = "SELECT
164 DISTINCT iss_pri_id,
165 pri_title,
166- SUM(IF(sta_is_closed=0, 1, 0)) AS total_open_items,
167- SUM(IF(sta_is_closed=1, 1, 0)) AS total_closed_items
168+ SUM(CASE WHEN sta_is_closed=0 THEN 1 ELSE 0 END) AS total_open_items,
169+ SUM(CASE WHEN sta_is_closed=1 THEN 1 ELSE 0 END) AS total_closed_items
170 FROM
171 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,
172 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "project_priority,
173@@ -430,8 +430,8 @@
174 $stmt = "SELECT
175 DISTINCT isu_usr_id,
176 usr_full_name,
177- SUM(IF(sta_is_closed=0, 1, 0)) AS total_open_items,
178- SUM(IF(sta_is_closed=1, 1, 0)) AS total_closed_items
179+ SUM(CASE WHEN sta_is_closed=0 THEN 1 ELSE 0 END) AS total_open_items,
180+ SUM(CASE WHEN sta_is_closed=1 THEN 1 ELSE 0 END) AS total_closed_items
181 FROM
182 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue,
183 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "issue_user,
184@@ -471,7 +471,7 @@
185 {
186 $prj_id = Auth::getCurrentProject();
187 $stmt = "SELECT
188- IF(sup_iss_id > 0, 'associated', 'unassociated') type,
189+ CASE WHEN sup_iss_id > 0 THEN 'associated' ELSE 'unassociated' END AS type,
190 COUNT(*) AS total_items
191 FROM
192 " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "support_email,
193
194=== modified file 'lib/eventum/class.support.php'
195--- lib/eventum/class.support.php 2014-09-04 21:31:57 +0000
196+++ lib/eventum/class.support.php 2014-09-27 20:11:45 +0000
197@@ -1308,7 +1308,7 @@
198 $total_rows = Pager::getTotalRows($stmt);
199 $stmt .= "
200 LIMIT
201- " . Misc::escapeInteger($start) . ", " . Misc::escapeInteger($max);
202+ " . Misc::escapeInteger($max) . " OFFSET " . Misc::escapeInteger($start);
203 $res = DB_Helper::getInstance()->getAll($stmt, DB_FETCHMODE_ASSOC);
204 if (PEAR::isError($res)) {
205 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
206@@ -1658,7 +1658,7 @@
207 sup_iss_id = " . Misc::escapeInteger($issue_id) . "
208 ORDER BY
209 sup_id
210- LIMIT " . (Misc::escapeInteger($sequence) - 1) . ", 1";
211+ LIMIT 1 OFFSET " . (Misc::escapeInteger($sequence) - 1);
212 $res = DB_Helper::getInstance()->getRow($stmt);
213 if (PEAR::isError($res)) {
214 Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);

Subscribers

People subscribed via source and target branches