Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Concrete SQL from SQL::Abstract?

by metaperl (Curate)
on May 14, 2010 at 14:22 UTC ( [id://840004]=note: print w/replies, xml ) Need Help??


in reply to Concrete SQL from SQL::Abstract?

Also SQL::DB has a query_as_string method that does what you want.



The mantra of every experienced web application developer is the same: thou shalt separate business logic from display. Ironically, almost all template engines allow violation of this separation principle, which is the very impetus for HTML template engine development.

-- Terence Parr, "Enforcing Strict Model View Separation in Template Engines"

Replies are listed 'Best First'.
Re^2: Concrete SQL from SQL::Abstract?
by benizi (Hermit) on May 17, 2010 at 19:04 UTC

    Thanks for finding this. As with the other helpful suggestion, it's not really the intended use case (for SQL::DB, in this case). But the following hack works:

    my $dbh; # connected elsewhere my $sqlgen = SQL::Abstract->new; my $sqldb = SQL::DB->new; $$sqldb{sqldb_dbh} = $dbh; # <- this is why I called it a hack print $sqldb->query_as_string($sqlgen->insert(atable=>{bar=>1,baz=>und +ef,foo=>"a string's error"})); __END__ #prints INSERT INTO foo ( bar, baz, foo) VALUES ( '1', NULL, 'a string\'s erro +r' )

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://840004]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-23 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found