TT#19710 Do not use implicit newlines

Use HERE-docs instead.

Change-Id: I46ae8007b3bf6eb8766cee6afc2d685638fc292a
changes/53/16653/1
Guillem Jover 8 years ago
parent 676acdf115
commit a4fdeb08ce

@ -54,18 +54,20 @@ sub TO_JSON {
__PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(" __PACKAGE__->result_source_instance->view_definition(<<SQL);
select bm.contract_id,max(bm.id) as actual_bm_id from billing.billing_mappings bm SELECT bm.contract_id,max(bm.id) AS actual_bm_id FROM billing.billing_mappings bm
inner join INNER JOIN (
(select bmm.contract_id, max(bmm.start_date) max_start_date SELECT bmm.contract_id, MAX(bmm.start_date) max_start_date
from billing.billing_mappings bmm FROM billing.billing_mappings bmm
where ( bmm.`end_date` >= ? OR bmm.`end_date` IS NULL ) WHERE ( bmm.`end_date` >= ? OR bmm.`end_date` IS NULL )
AND ( bmm.`start_date` <= ? OR bmm.`start_date` IS NULL ) AND ( bmm.`start_date` <= ? OR bmm.`start_date` IS NULL )
AND ( ? is null OR bmm.`contract_id` = ? ) AND ( ? IS NULL OR bmm.`contract_id` = ? )
group by bmm.contract_id GROUP BY bmm.contract_id
) bmm on bm.contract_id=bmm.contract_id and (bm.start_date=bmm.max_start_date or (bmm.max_start_date is null and bm.start_date is null)) ) bmm ON bm.contract_id=bmm.contract_id
group by bm.contract_id AND (bm.start_date=bmm.max_start_date
"); OR (bmm.max_start_date IS NULL AND bm.start_date is null))
GROUP BY bm.contract_id
SQL
#__PACKAGE__->result_source_instance->view_definition("select bma.contract_id, bma.id as actual_bm_id #__PACKAGE__->result_source_instance->view_definition("select bma.contract_id, bma.id as actual_bm_id
#from billing.billing_mappings bma #from billing.billing_mappings bma

@ -83,7 +83,7 @@ sub TO_JSON {
__PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(" __PACKAGE__->result_source_instance->view_definition(<<SQL);
SELECT bpinfo.id, bpinfo.reseller_id, bpinfo.interval, bpinfo.type, SELECT bpinfo.id, bpinfo.reseller_id, bpinfo.interval, bpinfo.type,
IF (bpinfo.fraud_use_reseller_rates > 0, SUM(cdr.source_reseller_cost), IF (bpinfo.fraud_use_reseller_rates > 0, SUM(cdr.source_reseller_cost),
SUM(cdr.source_customer_cost)) as interval_cost, SUM(cdr.source_customer_cost)) as interval_cost,
@ -144,6 +144,6 @@ WHERE CASE WHEN bpinfo.interval = 'month'
END END
GROUP BY bpinfo.id GROUP BY bpinfo.id
HAVING interval_cost >= interval_limit HAVING interval_cost >= interval_limit
"); SQL
1; 1;

@ -62,17 +62,19 @@ __PACKAGE__->result_source_instance->is_virtual(1);
# and (n.end is null or n.end >= now()) # and (n.end is null or n.end >= now())
#order by length(n.number) desc limit 1 #order by length(n.number) desc limit 1
__PACKAGE__->result_source_instance->view_definition(" __PACKAGE__->result_source_instance->view_definition(<<SQL);
select ln.number,max(ln.id) as actual_ln_id from billing.lnp_numbers ln SELECT ln.number,MAX(ln.id) AS actual_ln_id FROM billing.lnp_numbers ln
inner join INNER JOIN (
(select lnn.number, max(lnn.start) max_start SELECT lnn.number, MAX(lnn.start) max_start
from billing.lnp_numbers lnn FROM billing.lnp_numbers lnn
where ( lnn.`end` >= ? OR lnn.`end` IS NULL ) WHERE ( lnn.`end` >= ? OR lnn.`end` IS NULL )
AND ( lnn.`start` <= ? OR lnn.`start` IS NULL ) AND ( lnn.`start` <= ? OR lnn.`start` IS NULL )
AND ( ? is null OR lnn.`number` LIKE ? ) AND ( ? is null OR lnn.`number` LIKE ? )
group by lnn.number GROUP BY lnn.number
) lnn on ln.number=lnn.number and (ln.start=lnn.max_start or (lnn.max_start is null and ln.start is null)) ) lnn ON ln.number=lnn.number
group by ln.number AND (ln.start=lnn.max_start
"); OR (lnn.max_start IS NULL AND ln.start IS NULL))
GROUP BY ln.number
SQL
1; 1;

@ -80,20 +80,21 @@ sub TO_JSON {
__PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(" __PACKAGE__->result_source_instance->view_definition(<<SQL);
SELECT min(m.timestamp) as min_timestamp, m.* FROM SELECT MIN(m.timestamp) AS min_timestamp, m.* FROM
( (
( (
SELECT DISTINCT ( call_id ) SELECT DISTINCT ( call_id )
FROM sipstats.messages FROM sipstats.messages
WHERE caller_uuid LIKE ? COLLATE utf8_bin OR callee_uuid LIKE ? COLLATE utf8_bin OR call_id LIKE ? COLLATE utf8_bin WHERE caller_uuid LIKE ? COLLATE utf8_bin
ORDER BY timestamp DESC OR callee_uuid LIKE ? COLLATE utf8_bin
LIMIT ?, ? OR call_id LIKE ? COLLATE utf8_bin
ORDER BY timestamp DESC
LIMIT ?, ?
) )
) q JOIN sipstats.messages m ON q.call_id = m.call_id ) q JOIN sipstats.messages m ON q.call_id = m.call_id
GROUP BY call_id GROUP BY call_id
"); SQL
1; 1;

Loading…
Cancel
Save