Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

How to get NOT NULL value in a global

Quote Reply
How to get NOT NULL value in a global
I would like to get all rows where value is NOT NULL from a field in links table,

example : Check XYZ Field below

sub {
# Displays the newest links on the home page.
my ($output,$sth,$link);
my $search_db = $DB->table('Links');
$search_db->select_options ('ORDER BY Add_Date DESC Limit 10');
$sth = $search_db->select ( { xyz => IS NOT NULL, isValidated => 'Yes' });
while ($link = $sth->fetchrow_hashref) {
$output .= Links::SiteHTML::display ('link1', $link);
}
return $output;
}


( xyz => IS NOT NULL ) This is giving me error,

What is the syntax to get fields of NOT NULL,

Thanks in Advance.
Quote Reply
Re: [cassandra] How to get NOT NULL value in a global In reply to
Try using:

require GT::SQL::Condition;

my $cond = GT::SQL::Condition->new( 'XYX', 'IS NOT', 'NULL', 'isValidated', '=', 'Yes');

Then get rid of { ... } and use $cond

If it doesn't work change 'NULL' to \'NULL' ....I can't remember if it needs a reference or not.

Last edited by:

Paul: Apr 9, 2002, 2:35 PM
Quote Reply
Re: [Paul] How to get NOT NULL value in a global In reply to
Thanks Paul, it worked Cool
Quote Reply
Re: [Paul] How to get NOT NULL value in a global In reply to
It does. Remember, the value in any where clause is automatically quoted (column = 'value'). Since you want NULL and not 'NULL', you need to reference it. Things that aren't quoted normaly (i.e. select values: SELECT Col1, Col2, Col3) do not need to be backslashed.

Cheers,

Alex
--
Gossamer Threads Inc.