Gossamer Forum
Home : General : Perl Programming :

Finding long strings with GT::SQL

Quote Reply
Finding long strings with GT::SQL
Hi,

I'd like to select non-validated links from my LSQL data with a Title length greater than 50 characters (including spaces) - anyone know how I would do that?

Thanks in advance

All the best
Shaun
Quote Reply
Re: [qango] Finding long strings with GT::SQL In reply to
Best bet would be to do a while{} loop, and when grabbing the title, check to see the length of it. I'm not sure there is a feature that will do this in GT::SQL.

Hope that helps.

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: [qango] Finding long strings with GT::SQL In reply to
Try something like:

Code:
my $cond = GT::SQL::Condition->new( 'isValidated', 'No', 'LENGTH(Title)', '<', 50);
my $links = $DB->table('Links')->select($cond)->fetchall_hashref;
Quote Reply
Re: [Paul] Finding long strings with GT::SQL In reply to
Thanks Andy and Paul,

I tried the suggested code but couldn't get it working. However, I fiddled around and copied a previous loop Paul had given me for another modification, and used the perl 'length' function to pull out the links with longer titles.

Seems to be working okay - thanks again Smile

All the best
Shaun
Quote Reply
Re: [qango] Finding long strings with GT::SQL In reply to
Quote:
my $cond = GT::SQL::Condition->new( 'isValidated', '=', 'No', 'LENGTH(Title)', '>', 50);
my $links = $DB->table('Links')->select($cond)->fetchall_hashref;

Should do the trick.

Cheers,

Alex
--
Gossamer Threads Inc.