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

Scripts installation and plugin creation
Plugins
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


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates