On Oct 20, 2009, at 2:33 PM, Brice Figureau wrote:
>
> On 20/10/09 20:54, Luke Kanies wrote:
>> I'm a little confused by this patch, or at least by the last test -
>> does it make it so you can't query both tags and params at the same
>> time, or does it just make it so that tag queries don't also query
>> the
>> tag param?
>
> First, and unlike what I wrote in my Puppet Camp presentation you
> can't
> use and/or in an exported collection expression, so you can't query by
> tag and parameters at the same time.
You couldn't a long time ago, but I'm pretty sure you can now:
if oper == "=" or oper == "!="
# Add the rails association info where necessary
case str1
when "title"
str = "title #{oper} '#{str2}'"
when "tag"
str = "puppet_tags.name #{oper} '#{str2}'"
else
str = "param_values.value #{oper} '#{str2}' and " +
"param_names.name = '#{str1}'"
end
else
str = "(%s) %s (%s)" % [str1, oper, str2]
end
that second to last line certainly implies that you can do 'AND' and
'OR'.
> Second, this fix only touches what we tell AR to "include" which seems
> to mean tables we join with. In this case when querying by tags we
> were
> joining with parameters (2 extra joins) which returned much more data
> than was really needed, triggering rails inefficiencies.
After looking more closely, I see what you mean now.
> And finally, I have chosen a poor wording for those tests titles. It
> should say:
> it should not include parameters when querying ActiveRecord with a tag
> exported query
> which is closer to the reality.
>
> I'll push the modification, but that doesn't prevent the brave souls
> to
> actually test the patch :-)
>
>
>> On Oct 20, 2009, at 11:43 AM, Brice Figureau wrote:
> patch elided
>
> --
> Brice Figureau
> My Blog: http://www.masterzen.fr/
>
>
> >
--
It's a small world, but I wouldn't want to paint it.
-- Stephen Wright
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---