On Sun, Jul 25, 2004 at 01:31:51PM -0700, Dean Arnold wrote:
>
> A couple years ago, someone posted an RFC and some
> questions about building an Inline::SQL module. Alas,
> while I was pretty enthused about it, it never
> seemed to get off the ground.
I don't see the point. What would be benefits be?
I've yet to see a convincing argument that:
> EXEC SQL DECLARE CURSOR mycursor AS
> SELECT * FROM mytable FOR UPDATE;
is better than:
$mycursor = $dbh->prepare("SELECT * FROM mytable FOR UPDATE");
There IS a good case for a functional interface to handle
simple cases. But I don't think EXEC SQL is a step forward!
There are many DBIx::* modules competing for that niche but none
have significant mind-share. (Party, I think, because they either
try to do too much, or too little, or they're just plain odd.)
Here's something to ponder:
CONNECT "dbi:Driver:foo", "user", "pass";
$id = 42;
SELECT "foo, bar FROM table WHERE id = ", \$id, INTO \$foo, \$bar;
print "foo=$foo, bar=$bar\n";
SELECT "foo, bar FROM table", USING {
print "foo=$_->{foo}, bar=$_->{bar}\n";
};
SELECT "foo, bar FROM table", INTO \$foo, \$bar, USING {
print "foo=$foo, bar=$bar\n";
};
SELECT "* FROM mytable
RETURNING LINEGRAPH(*), IMAGEMAP
WHERE WIDTH=500 AND HEIGHT=500
AND FORMAT='PNG'
AND LOGO='myimage.png'
AND X_AXIS='Date' AND Y_AXIS='Stock Price'
AND MAPNAME='stockmap'
AND SIGNATURE='GOWI Systems, Inc.'
AND SHOWPOINTS=1 AND POINT='opencircle'",
INTO \$chart, \$map;
No source-code filtering required, just "plain" perl, albeit
a little advanced in places.
I'd be happy to see someone implement something along those lines.
(If someone's interested I'll expand on the ideas implied above.)
Tim.