Ok further investigation it seems it doesn't like having the iterator
statement in the block
I'm wondering how to programatically generate the block?
On Dec 15, 12:16 am, Jim Morris <[EMAIL PROTECTED]> wrote:
> Ok I am trying the following which builds an update using block, but I
> get an error...
>
> ds.update do
> periods.each do |p| # create updates for all periods
> (p|idx) << (p|idx) + v
> end
> end
>
> the error is...
>
> cycle_stats.rb:166:in `process': undefined method `+' for
> #<Sequel::SQL::Subscript:0xb75544cc @f=:day, @sub=[1]> (NoMethodError)
>
> Did I screw up somewhere?
>
> On Dec 14, 11:58 pm, Jim Morris <[EMAIL PROTECTED]> wrote:
>
> > Oops yep that is in the Changelog should have read that first;)
>
> > Thnks, that'll make this script I am working on even cleaner,
>
> > On Dec 14, 11:52 pm, Jim Morris <[EMAIL PROTECTED]> wrote:
>
> > > Will I be able to do this :)
>
> > > dataset.update_sql{: exp|2 << :exp|2 + 10} ?
>
> > > On Dec 14, 8:52 pm, Sharon Rosner <[EMAIL PROTECTED]> wrote:
>
> > > > > So the way to do that right now is:
>
> > > > > >> dataset.update_sql(:exp => 'exp + 10'.lit)
>
> > > > > => "UPDATE table SET exp = exp + 10"
>
> > > > I've added support for blocks for Dataset#update, which lets you do
> > > > this much more easily:
>
> > > > dataset.update {:exp << :exp + 10}
>
> > > > Because of the way Ruby is parsed I had to use the << operator for
> > > > assignment. So check out the trunk and let me know if it works for
> > > > you.
>
> > > > best
> > > > Sharon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" 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/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---