On Tue Apr 07 04:25:20 2015, MJEVANS wrote:
Show quoted text> On Tue Apr 07 04:08:57 2015, MJEVANS wrote:
> > On Mon Apr 06 18:10:48 2015, kbenson@ticketfrontier.com wrote:
> > > Sample test program and trace attached. The test program attempts
> > > to
> > > set a
> > > value of type MONEY twice, and fails on the second attempt because
> > > the
> > > cached underlying type has changed.
> > >
> > > -Kevan Benson
> > > -Ticket Frontier, Inc
> >
> > Thank you for this RT.
> >
> > Could you please provide:
> >
> > DBI, DBD::ODBC and perl versions.
> >
> > ODBC driver and version are you using.
> >
> > Platform you are running on. If the platform is unix what version of
> > unixODBC are you using.
> >
> > Martin
>
> I assume retail_price is of type money in your schema, could you
> confirm that also?
>
> Martin
create table ticket (retail_price money);
use DBI;
use DBD::ODBC;
our $dbuser = 'dbuser';
our $dbpass = '****';
my $dbh = DBI->connect(
"dbi:ODBC:xxx",
'xx', 'xxx',
{ PrintError => 0, RaiseError => 1, AutoCommit => 1, @_ },
);
for (1, 2) {
my $sth = $dbh->prepare_cached( "UPDATE [ticket] SET [retail_price] = CAST(? AS MONEY) WHERE 1=0" );
$sth->execute( 100.21 + $_ );
}
Works without error for me with MS SQL Server and the Easysoft ODBC driver.
I am using the latest DBD::ODBC from github.
If you are using an older DBD::ODBC see the Changes file as your issue sounds like one I've addressed in the past.
Martin
--
Martin J. Evans
Wetherby, UK