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

run sql query with GT::SQL

Quote Reply
run sql query with GT::SQL
Is there a way to run just a regular sql query with the GT::SQL module?

Example:

Code:

$DB->do_query(qq|my random sql query|) or die $GT::SQL::error;


Thanks,

- Jonathan

Last edited by:

jdgamble: Jul 29, 2007, 4:23 PM
Quote Reply
Re: [jdgamble] run sql query with GT::SQL In reply to
Yes. I sometimes do that with a table object. Something like this

my $db= $DB->table('Users');
$db->do_query($raw_query);

Hope that helps!

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] run sql query with GT::SQL In reply to
Thanks, I don't know why I couldn't figure that out. I was thinking I had to create a SQL::Driver object to get what I needed accomplished.

My $DB object has to pick a table, and my raw $query has to pick a table too.

I see that

$db->do($query);

also works.

- Jonathan
Quote Reply
Re: [jdgamble] run sql query with GT::SQL In reply to
Hi,

Yeah, its a bit odd like that =) You would expect just $DB->do_query('xxxx') to work, but you have to do $DB->table('Foo')->do_query('xxxx') for it to work.

Still, its a cool feature for doing queries you can't quite get right using GT::SQL directly :)

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!