[Spacewalk-devel] Re: 489590 - Updated query to retrieve configuration managed systems to check that the...

2009-03-23 Thread Michael Mraka
% 489590 - Updated query to retrieve configuration managed systems to check 
that the systems returned have provisioning entitlements.
% 
%   • [DH] java/code/src/com/redhat/rhn/common/db/datasource/xml/
% config_queries.xml
% 
% URL: http://git.fedoraproject.org/git/?p=spacewalk.git;a=commitdiff;h=
% fb66c0dcc377f8d789a31e829a7de97b7120

+SELECT DISTINCT S.id,
+S.name
+  FROM rhnServer S
+INNER JOIN rhnUserServerPerms USP on S.id = USP.server_id
+INNER JOIN rhnClientCapability CC on S.id = CC.server_id 
+INNER JOIN rhnClientCapabilityName CCN on CC.capability_name_id = CCN.id
+ WHERE USP.user_id = :user_id
+   AND CCN.name LIKE 'configfiles%'
+   AND S.id in (
+   SELECT SS.id
+ FROM rhnServer SS,
+  rhnServerGroupMembers MM,
+  rhnServerGroup GG,
+  rhnServerGroupType TT
+WHERE SS.id = MM.server_id
+  AND MM.server_group_id = GG.id
+  AND GG.group_type = TT.id
+  AND TT.label = 'provisioning_entitled'
+)
+  ORDER BY UPPER(NVL(S.name, '(none)')), S.id

The 'rhnServer SS' table in subselect is redundant :). As I can see the only
reason to have it there is join SS.id = MM.server_id and then return SS.id,
so why not return MM.server_id directly? It will save us one table scan
(well, its primary key index in fact) and one table join...

So modified version could be
SELECT DISTINCT S.id,
S.name
  FROM rhnServer S
INNER JOIN rhnUserServerPerms USP on S.id = USP.server_id
INNER JOIN rhnClientCapability CC on S.id = CC.server_id 
INNER JOIN rhnClientCapabilityName CCN on CC.capability_name_id = CCN.id
 WHERE USP.user_id = :user_id
   AND CCN.name LIKE 'configfiles%'
   AND S.id in (
   SELECT MM.server_id
  rhnServerGroupMembers MM,
  rhnServerGroup GG,
  rhnServerGroupType TT
WHERE MM.server_group_id = GG.id
  AND GG.group_type = TT.id
  AND TT.label = 'provisioning_entitled'
)
  ORDER BY UPPER(NVL(S.name, '(none)')), S.id


--
Michael Mráka
Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] Automatic commit of package [spacewalk-java] release [0.5.36-1]

2009-03-23 Thread Miroslav Suchý

Commit 65c8964a14bd176a9141df0af0d86e654f73e690
I do not see tag attached to this commit. Jesus did you forget git push 
--tags, or it is my problem?

--
Miroslav Suchy
RHN Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


[Spacewalk-devel] Re: 250134:Added code to do a check on multibyte chars for max lenght in the validation...

2009-03-23 Thread Michael Mraka
Fedora Hosted Git Repositories - spacewalk.git/rss log, Partha Aji  wrote:
% 250134:Added code to do a check on multibyte chars for max lenght in the
% validation...
% 
% 250134:Added code to do a check on multibyte chars for max lenght in the 
validation rhnvalidationhelper...
% 
%   • [DH] java/code/src/com/redhat/rhn/common/validator/StringConstraint.java
%   • [DH] java/code/src/com/redhat/rhn/frontend/strings/jsp/
% StringResource_en_US.xml
% 
% URL: http://git.fedoraproject.org/git/?p=spacewalk.git;a=commitdiff;h=
% 376e0035e09003a9918db3f1aa8e542bf639f605

+private boolean lengthLessThan(String str, Number length) {
...
+return str.getBytes(UTF8).length  length.intValue();
...
+private boolean lengthGreaterThan(String str, Number length) {
...
+return str.getBytes(UTF8).length = length.intValue(); 

Why lengthLessThan have different semantic than lengthGreaterThan?
I mean  vs. =. Should not lengthGreaterThan be lengthGreaterOrEqualThan?

And why the whole procedure code is duplicated and not simply

private boolean lengthGreaterOrEqualThan(String str, Number length) {
return ! (lengthLessThan(str, length));
}
?

--
Michael Mráka
Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel