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

Using GT::SQL::Condition, and options in select?

Quote Reply
Using GT::SQL::Condition, and options in select?
Hi. Does anyone know how I could acheive the following;

my $cond = GT::SQL::Condition->new( 'Top_Order', '>', '0' );
$sth = $table->select( { isValidated => 'Yes' }, { CategoryID => $cat_id }, $cond );

Basically, I want to select any links where Top_Order IS > than 0, and CategoryID => $cat_id (CatLinks), and isValidated = 'Yes' in the 'Links' table.

It works fine if I don't use the GT::SQL::Condition... so I'm assuming it has something to do with how I am calling it from within the select().

TIA.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Using GT::SQL::Condition, and options in select? In reply to
I keep doing your homework (RTFM), but anyway:

Code:
my $cond = GT::SQL::Condition->new( 'Top_Order', '>', '0',
'isValidated', '=', 'Yes',
'CategoryID', '=', $cat_id);
$sth = $table->select($cond);

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Using GT::SQL::Condition, and options in select? In reply to
So you have to do everything in GT::SQL::Condition? Seems a bit silly.. surely that just makes more work,out of a couple of simple statements, and one advanced one? BTW, does this support the calling of several tables? (lsql_Links lsql_Category and lsql_CatLinks) ?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Using GT::SQL::Condition, and options in select? In reply to
Just tried it, and it doesn't seem to work Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Using GT::SQL::Condition, and options in select? In reply to
This seems to work.. very odd...Laugh

Code:
$sth = $table->select( { isValidated => 'Yes' }, { CategoryID => $cat_id }, GT::SQL::Condition->new( 'Top_Order', '>', '0' ) );


Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!