in reply to The Naughty Nought "OEO" blues

You have to coerce numeric context.

while (0+(my $rows = $dbh->do(<<SQL))) { update #LAG set tmpDate = dateadd( day, case when datepart( weekday, cl.tmpDate) = 2 then -3 else - +1 end, cl.tmpDate) from #LAG cl, $db..HOLIDAY h where cl.tmpDate = h.Date and cl.country = h.country SQL print "$rows holidays adjusted\n"; }
---
demerphq

Replies are listed 'Best First'.
Re^2: The Naughty Nought "OEO" blues (simpler)
by tye (Sage) on Jan 20, 2005 at 17:27 UTC

    I'd write

    while( my $rows= 0 + $dbh->do(...) ) {

    in this case.

    I'd prefer "00" but it looks less like a real number to some people than "0E0". Therefore, "0.0" might be an even better choice.

    I like the feature. It makes it easy to pick whether you want to care about number of rows or about success (simply add "0+" or "0==" or don't).

    When RaiseError is turned on, it isn't useful. So I could see adding an option for PlainZero which would default to "never" (for compatability) but could be changed to "always" or "only when RaiseError is off". Though I probably wouldn't use such a feature since I see too much risk from action-at-a-distance with it.

    - tye        

      Yeah, i think that notationally nicer to read as well. Good point. Yet another ++ for tye :-)

      ---
      demerphq