-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> I would like to do in SQL
> " INSERT table VALUES (DEFAULT, NOW()); "
> ...
> is there any simple way I can write like this?
I'm not exactly sure how DBI::Class does things, but currently
in plain old DBI your only real option is to create a separate statement
handle like this:
my %sth;
$sth{nodefault} = $dbh->prepare("INSERT INTO mytable(foo,bar) VALUES (?, ?)");
$sth{nodefault}->execute(11,12);
$sth{default} = $dbh->prepare("INSERT INTO mytable(foo,bar) VALUES (DEFAULT,
?)");
$sth{default}->execute(12);
In recent versions of DBD::Pg, you can also pass in a special variable to the
execute method which allows using only one statement handle:
$sth{nodefault}->execute($DBDPG_DEFAULT, 12);
I've proposed adding something simlilar to DBI itself, but I don't recall
getting
any feedback on it. Presumably once in place DBIx::Class will someday support
it.
- --
Greg Sabino Mullane [EMAIL PROTECTED]
PGP Key: 0x14964AC8 200604241124
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----
iD8DBQFETO4zvJuQZxSWSsgRApL3AKDLdmt0B+G0d5eziZYMnEW3LyULsQCgzj5n
gJWNshh94iV5vrdHDLnuA7k=
=DgPG
-----END PGP SIGNATURE-----