Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Miss something in Documentation

Quote Reply
Miss something in Documentation
Hi all, i just try to select some Links, where one field has a def value and another which should have any value but not be empty.

Try to find something about in docu, find a lot of examples but not this one.


my $sth = $cat_db->select ( ['Links.ID','Links.Aufmacher','Links.Logo'], { FatherID => '1'}, {Logo => '?????'} );

I want to have: select from .... where FatherID='1' AND Logo <> ''
or where FatherID = '1' AND Logo = 'Anything, but not empty'

Robert
Quote Reply
Re: [Robert] Miss something in Documentation In reply to
You probably need a condition.

require GT::SQL::Condition;

my $cond = GT::SQL::Condition->new( 'Logo', 'IS NOT', 'NULL' );
Quote Reply
Re: [Paul] Miss something in Documentation In reply to
ok, thank you. Got it.

Robert
Quote Reply
Re: [Robert] Miss something in Documentation In reply to
Just a few more details, you can either pass in a hash reference or a GT::SQL::Condition object to select(). If you are using a HASH ref, it's assumed it's key = val. If you need more complex things, like key <> val, or key is null, then you need to use a condition. Your code would look like:

my $cond = GT::SQL::Condition->new(
'FatherID', '=', 1,
'Logo', '<>', "''"
);
my $sth = $cat_db->select(['ID', 'Aufmacher', 'Logo'], $cond);

Cheers,

Alex
--
Gossamer Threads Inc.