web/modules/rhn/RHN/DB/DataSource/xml/CustomInfo_queries.xml | 5 -
web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml | 2
web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml | 30 +++----
web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml | 42 +++++++---
web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml | 2
web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml | 17 ++--
web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml | 6 -
7 files changed, 65 insertions(+), 39 deletions(-)
New commits:
commit 7695d3f21f2d3900be9237f2742d15a19b061ad8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Aug 10 11:34:51 2011 +0200
replace oracle specific syntax with ANSI one
fixing
ERROR: syntax error at or near "VERSION"
LINE 9: full_list.evr.version VERSION,
as well as (+) and DECODE
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
index 680ae18..e25c819 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
@@ -1446,19 +1446,20 @@ ORDER BY UPPER(PN.name), UPPER(PE.version), UPPER(PE.release), UPPER(PE.epoch)
<mode name="system_upgradable_package_list">
<query params="sid">
-SELECT pn.id || '|' || lookup_evr(full_list.evr.epoch, full_list.evr.version, full_list.evr.release) ID,
- full_list.server_id SERVER_ID,
- pn.id NAME_ID,
- lookup_evr(full_list.evr.epoch, full_list.evr.version, full_list.evr.release) EVR_ID,
- pn.name ||'-'|| full_list.evr.version || '-' || full_list.evr.release || DECODE(full_list.evr.epoch, NULL, '', ':' || full_list.evr.epoch) NVRE,
- full_list.errata_id ERRATA_ID,
- full_list.errata_advisory ERRATA_ADVISORY,
- full_list.evr.epoch EPOCH,
- full_list.evr.version VERSION,
- full_list.evr.release RELEASE,
- E.advisory_type ERRATA_ADVISORY_TYPE,
- E.advisory_name ERRATA_ADVISORY_NAME
- FROM rhnErrata E,
+SELECT pn.id || '|' || lookup_evr(full_list.evr.epoch, full_list.evr.version, full_list.evr.release) as ID,
+ full_list.server_id as SERVER_ID,
+ pn.id as NAME_ID,
+ lookup_evr(full_list.evr.epoch, full_list.evr.version, full_list.evr.release) as EVR_ID,
+ pn.name ||'-'|| full_list.evr.version || '-' || full_list.evr.release ||
+ CASE WHEN full_list.evr.epoch IS NOT NULL THEN ':' || full_list.evr.epoch END as NVRE,
+ full_list.errata_id as ERRATA_ID,
+ full_list.errata_advisory as ERRATA_ADVISORY,
+ full_list.evr.epoch as EPOCH,
+ full_list.evr.version as VERSION,
+ full_list.evr.release as RELEASE,
+ E.advisory_type as ERRATA_ADVISORY_TYPE,
+ E.advisory_name as ERRATA_ADVISORY_NAME
+ FROM
(
SELECT SOP.package_name_id name_id, MAX(pe.evr) evr,
SOP.server_id server_id, SOP.errata_id errata_id,
@@ -1469,8 +1470,9 @@ SELECT pn.id || '|' || lookup_evr(full_list.evr.epoch, full_list.evr.version, f
GROUP BY SOP.package_name_id, SOP.server_id, SOP.errata_id, SOP.errata_advisory
) full_list,
rhnPackageName PN
+ LEFT JOIN rhnErrata E
+ ON full_list.errata_id = E.id
WHERE full_list.name_id = PN.id
- AND full_list.errata_id = E.id (+)
ORDER BY UPPER(NVRE)
</query>
</mode>
commit 60ca30539dd924f4e2ffd2b0e0a8a27bb0e8b174
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Aug 10 12:07:20 2011 +0200
made NVL2 work in both db backends
fixing
ERROR: invalid input syntax for integer: "Y"
LINE 5: ...CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N')
...
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
index 24214c7..8a90e43 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
@@ -140,7 +140,7 @@ ORDER BY SN.modified DESC
FROM rhnServerTokenRegs STR
WHERE STR.token_id = RT.id
) system_count,
- NVL2((SELECT 1 FROM rhnRegTokenOrgDefault RTOD WHERE RTOD.reg_token_id = RT.id), 'Yes', 'No') org_default
+ NVL((SELECT 'Yes' FROM rhnRegTokenOrgDefault RTOD WHERE RTOD.reg_token_id = RT.id), 'No') org_default
FROM rhnActivationKey AK,
rhnRegToken RT
WHERE RT.org_id = :org_id
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
index 2f412cb..c7715b0 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
@@ -6,7 +6,7 @@ SELECT CR.id AS ID,
Csum.checksum md5sum,
CFN.path,
CR.revision,
- NVL2((SELECT 1 FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N') LATEST,
+ NVL((SELECT 'Y' FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'N') LATEST,
TO_CHAR(coalesce(CCon.created, CF.created), 'YYYY-MM-DD HH24:MI:SS') AS CREATED,
CASE CCT.label WHEN 'local_override' THEN '(system override)' ELSE CC.name END AS CONFIG_CHANNEL_NAME,
CC.label AS CONFIG_CHANNEL_LABEL,
commit 689bb530de187fab6f8a98185fe3cba2088fdab9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Aug 10 11:34:51 2011 +0200
replace oracle specific syntax with ANSI one
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml
index c004d7f..e89d3ad 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml
@@ -21,14 +21,14 @@ SELECT P.recid AS ID,
PS.output
FROM rhn_sat_cluster SC,
rhn_command C,
- rhn_probe P,
rhn_check_probe CP,
- rhn_probe_state PS
+ rhn_probe P
+ LEFT JOIN rhn_probe_state PS
+ ON PS.probe_id = P.recid
WHERE CP.host_id = :sid
AND CP.probe_id = P.recid
AND CP.sat_cluster_id = SC.recid
AND P.command_id = C.recid
- AND PS.probe_id(+) = P.recid
ORDER BY UPPER(PS.state)
</query>
</mode>
commit f6d4609327644d01a522465cd33022a052ff664c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Aug 10 11:34:51 2011 +0200
replace oracle specific syntax with ANSI one
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml
index 3f6de21..01244da 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml
@@ -33,12 +33,23 @@ SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA,
GO.GROUP_ID AS ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT,
NOTE_COUNT, GO.MODIFIED, GO.MAX_MEMBERS,
'unknown' AS ALL_ERRATA,
- (SELECT DECODE(
- MAX(DECODE(PS.state, 'OK', 1, 'PENDING', 2, 'UNKNOWN', 3, 'WARNING', 4, 'CRITICAL', 5)),
- 1, 'OK', 2, 'PENDING', 3, 'UNKNOWN', 4, 'WARNING', 5, 'CRITICAL') ST
- FROM rhn_check_probe CP, rhn_probe_state PS, rhnServerGroupMembership SGM
+ (SELECT CASE MAX(CASE PS.state
+ WHEN 'OK' THEN 1
+ WHEN 'PENDING' THEN 2
+ WHEN 'UNKNOWN' THEN 3
+ WHEN 'WARNING' THEN 4
+ WHEN 'CRITICAL' THEN 5
+ END)
+ WHEN 1 THEN 'OK'
+ WHEN 2 THEN 'PENDING'
+ WHEN 3 THEN 'UNKNOWN'
+ WHEN 4 THEN 'WARNING'
+ WHEN 5 THEN 'CRITICAL'
+ END) ST
+ FROM rhn_probe_state PS, rhnServerGroupMembership SGM
+ LEFT JOIN rhn_check_probe CP
+ ON SGM.server_id = CP.host_id
WHERE PS.probe_id = CP.probe_id
- AND SGM.server_id = CP.host_id(+)
AND SGM.group_id = UMSG.server_group_id
GROUP BY SGM.group_id) MONITORING_STATUS
FROM rhnVisServerGroupOverviewLite GO, rhnUserManagedServerGroups UMSG
@@ -69,12 +80,23 @@ ORDER BY UPPER(NAME)
SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA,
GO.GROUP_ID AS ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT,
NOTE_COUNT, GO.MODIFIED, GO.MAX_MEMBERS,
- (SELECT DECODE(
- MAX(DECODE(PS.state, 'OK', 1, 'PENDING', 2, 'UNKNOWN', 3, 'WARNING', 4, 'CRITICAL', 5)),
- 1, 'OK', 2, 'PENDING', 3, 'UNKNOWN', 4, 'WARNING', 5, 'CRITICAL') ST
- FROM rhn_check_probe CP, rhn_probe_state PS, rhnServerGroupMembership SGM
+ (SELECT CASE MAX(CASE PS.state
+ WHEN 'OK' THEN 1
+ WHEN 'PENDING' THEN 2
+ WHEN 'UNKNOWN' THEN 3
+ WHEN 'WARNING' THEN 4
+ WHEN 'CRITICAL' THEN 5
+ END)
+ WHEN 1 THEN 'OK'
+ WHEN 2 THEN 'PENDING'
+ WHEN 3 THEN 'UNKNOWN'
+ WHEN 4 THEN 'WARNING'
+ WHEN 5 THEN 'CRITICAL'
+ END) ST
+ FROM rhn_probe_state PS, rhnServerGroupMembership SGM
+ LEFT JOIN rhn_check_probe CP
+ ON SGM.server_id = CP.host_id
WHERE PS.probe_id = CP.probe_id
- AND SGM.server_id = CP.host_id(+)
AND SGM.group_id = UMSG.server_group_id
GROUP BY SGM.group_id) MONITORING_STATUS
FROM rhnServerGroupOverview GO, rhnUserManagedServerGroups UMSG,
commit ba59e1176c35852e9f38f41a6b8d4b033f815d31
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Aug 10 11:34:51 2011 +0200
replace oracle specific syntax with ANSI one
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/CustomInfo_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/CustomInfo_queries.xml
index 0249296..f75dce3 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/CustomInfo_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/CustomInfo_queries.xml
@@ -27,10 +27,11 @@ SELECT CDK.id,
CDK.description,
COUNT(SCDV.key_id) as system_count,
TO_CHAR(CDK.modified, 'YYYY-MM-DD HH24:MI:SS') AS LAST_MODIFIED
- FROM rhnServerCustomDataValue SCDV,
+ FROM
rhnCustomDataKey CDK
+ LEFT JOIN rhnServerCustomDataValue SCDV
+ ON CDK.id = SCDV.key_id
WHERE CDK.org_id = :org_id
- AND CDK.id = SCDV.key_id (+)
AND NOT EXISTS (
SELECT 1 FROM rhnServerCustomDataValue
WHERE server_id = :sid
commit 1b895e662c3451e23d4751d74273a93b2f1ce35f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Aug 10 11:34:51 2011 +0200
replace oracle specific syntax with ANSI one
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml
index 579f176..64e903b 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/contact_method_queries.xml
@@ -28,15 +28,16 @@ SELECT WC.id contact_id,
WC.login contact_login,
CM.recid method_id,
CM.method_name method_name,
- DECODE( MT.method_type_name,
- 'Email', CM.email_address,
- 'Pager', CM.pager_email) method_target
- FROM rhn_contact_methods CM,
- web_contact WC,
- rhn_method_types MT
+ CASE MT.method_type_name
+ WHEN 'Email' THEN CM.email_address
+ WHEN 'Pager' THEN CM.pager_email END method_target
+ FROM
+ web_contact WC
+ LEFT JOIN rhn_contact_methods CM
+ ON WC.id = CM.contact_id
+ LEFT JOIN rhn_method_types MT
+ ON CM.method_type_id = MT.recid
WHERE WC.org_id = :org_id
- AND CM.contact_id (+) = WC.id
- AND CM.method_type_id = MT.recid (+)
ORDER BY WC.login, CM.method_name
</query>
</mode>