Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^3: SQL::Abstract 'between' clause (about done)

by Anonymous Monk
on Nov 22, 2011 at 10:53 UTC ( #939422=note: print w/replies, xml ) Need Help??

in reply to Re^2: SQL::Abstract 'between' clause (about done)
in thread SQL::Abstract 'between' clause (about done)

The problem in a nutshell

$ cat junk use strict; use warnings; use diagnostics; my %where = (); $where{something} = 4; $where{something}{else} = 5; __END__ $ perl junk Can't use string ("4") as a HASH ref while "strict refs" in use at jun +k line 5 (#1) (F) Only hard references are allowed by "strict refs". Symbolic references are disallowed. See perlref. Uncaught exception from user code: Can't use string ("4") as a HASH ref while "strict refs" in us +e at junk line 5. at junk line 5

Either $where{something} is a hashref or it isn't, it can't be both, so pick one

You can pick

#~ $where{$colname}=$colval; $where{$colname}{colval} =$colval;

There are other problem, but I'll leave that to others

Replies are listed 'Best First'.
Re^4: SQL::Abstract 'between' clause (about done)
by Anonymous Monk on Nov 22, 2011 at 14:16 UTC
    From the POD I see
    my %where = ( user => 'nwiger', completion_date => { -not_between => ['2002-10-01', '2003-02-06'] } );
    I don't see where I can use this functionality with the two choices you mentioned to pick from. Thanks for the advice by the way. If I can get this part working I am keen to know what other problems you have found

      To create the data you see in the POD with scalar assignements you would have to write this:

      $where{user}= 'nwiger'; $where{completion_date}{-not_between}= ['2002-10-01', '2003-02-06'];

      What would be a problem is if you used this as well:

      $where{completion_date}= 5;

      Because $where{completion_date} can't be pointer to a hash and scalar value at the same time. But nothing prevents you from storing further scalar values or hash pointers in $where{thingy} or $where{stuff} or $where{completion_date}{depperstuff}

      A big help might be to watch Data::Dumper output of %where after you execute each of the above statements

        Thanks but isn't my code doing what your code does?
        $where{$colname}{'-between'} = [$from,$to]; #my code where{completion_date}{-not_between}= ['2002-10-01', '2003-02-06'];#yo +ur code
        I though $from and $to would work as they contain the right values.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939422]
[ambrus]: 1nickt: for some reason, these days they call every computer "gaming", even ones that gamers wouldn't buy. I've bought a keyboard that was labelled "gamer", despite that it has hard springs and seems to be way better for typing than for gaming;
[1nickt]: I though the gamers like that because they bash the keys so hard.
[ambrus]: and I've seen motherboards with no fast expansion ports for a video card but built-in hardware RAID advertized as "gaming".
LanX has a shaming laptop
[ambrus]: 1nickt: my impression is that the gamers like the softer springs, because fast reaction time is more important to them then feedback from keypresses to recognize typos.
[1nickt]: Ah, I see. I did read some gamer mag reviews, and yes, they lamented the fact that laptops with no discrete video card are sold as "gaming" hardware.
[1nickt]: But, they do have red keyboard backlighting! And gargoyles on the front, or words like "Maxxx" here and there. They know their demographic!
[1nickt]: True gamers don;t buy Dells, HPs, or Lenovos, I think ;-)
[ambrus]: The keyboard I bought doesn't have backlighting. I specifically had to select for that, because so many keyboards these days have lights. Why would I want lights in the keyboard? I want lights in the room, such as on the ceiling, not in the keyboard.
choroba has a small USB lamp

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (11)
As of 2017-03-27 13:47 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.