Skip Menu |

This queue is for tickets about the DBD-ODBC CPAN distribution.

Report information
The Basics
Id: 103347
Status: resolved
Priority: 0/
Queue: DBD-ODBC

People
Owner: Nobody in particular
Requestors: kbenson [...] ticketfrontier.com
Cc: ribasushi [...] leporine.io
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.51_4



Subject: Multiple updates to same statement handle may result in parameter type being changed and truncation errors on subsequent requests
Date: Mon, 6 Apr 2015 15:10:35 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Kevan Benson <kbenson [...] ticketfrontier.com>
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

Message body is not shown because sender requested not to inline it.

Download DBD-ODBC-error.trace
application/octet-stream 15.1k

Message body not shown because it is not plain text.

On Mon Apr 06 18:10:48 2015, kbenson@ticketfrontier.com wrote: Show quoted text
> 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 -- Martin J. Evans Wetherby, UK
On Tue Apr 07 04:08:57 2015, MJEVANS wrote: Show quoted text
> 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 -- Martin J. Evans Wetherby, UK
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
Subject: Re: [rt.cpan.org #103347] Multiple updates to same statement handle may result in parameter type being changed and truncation errors on subsequent requests
Date: Tue, 14 Apr 2015 15:55:56 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Kevan Benson <kbenson [...] ticketfrontier.com>
Sorry for the late reply. This thread got lost a bit. I'm using DBD::ODBC 1.50. I just downloaded the latest developer release, 1.51_4, and indeed it is no longer throwing that error. It looks like this changelog entry does reference the fix: 1.51_3 2015-01-17 [BUG FIXES] RT101579 - using bound input parameters for numeric columns (e.g., SQL_NUMERIC) only works the first time and will quite likey fail with "string data, right truncation" on the second and subsequent calls to execute. Thanks to Laura for finding. Any chance of getting a release out soon with that fix in it? -Kevan Benson -Ticket Frontier, Inc On Tue, Apr 7, 2015 at 1:28 AM, Martin J Evans via RT < bug-DBD-ODBC@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=103347 > > > On Tue Apr 07 04:25:20 2015, MJEVANS wrote:
> > 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 >
On Tue Apr 14 18:56:12 2015, kbenson@ticketfrontier.com wrote: Show quoted text
> Sorry for the late reply. This thread got lost a bit. > > I'm using DBD::ODBC 1.50. > > I just downloaded the latest developer release, 1.51_4, and indeed it > is no > longer throwing that error. It looks like this changelog entry does > reference the fix: > > 1.51_3 2015-01-17 > > [BUG FIXES] > > RT101579 - using bound input parameters for numeric columns (e.g., > SQL_NUMERIC) only works the first time and will quite likey fail > with "string data, right truncation" on the second and subsequent > calls to execute. Thanks to Laura for finding. > > > > Any chance of getting a release out soon with that fix in it?
I'll do it today. Martin -- Martin J. Evans Wetherby, UK
On Wed Apr 15 03:53:06 2015, MJEVANS wrote: Show quoted text
> On Tue Apr 14 18:56:12 2015, kbenson@ticketfrontier.com wrote:
> > Sorry for the late reply. This thread got lost a bit. > > > > I'm using DBD::ODBC 1.50. > > > > I just downloaded the latest developer release, 1.51_4, and indeed it > > is no > > longer throwing that error. It looks like this changelog entry does > > reference the fix: > > > > 1.51_3 2015-01-17 > > > > [BUG FIXES] > > > > RT101579 - using bound input parameters for numeric columns (e.g., > > SQL_NUMERIC) only works the first time and will quite likey fail > > with "string data, right truncation" on the second and subsequent > > calls to execute. Thanks to Laura for finding. > > > > > > > > Any chance of getting a release out soon with that fix in it?
> > I'll do it today. > > Martin
Just uploaded 1.52 now. It may be a bit before you can see it. Martin -- Martin J. Evans Wetherby, UK
CC: ribasushi [...] cpan.org
Subject: Re: [rt.cpan.org #103347] Multiple updates to same statement handle may result in parameter type being changed and truncation errors on subsequent requests
Date: Wed, 15 Apr 2015 07:06:36 -0700
To: bug-DBD-ODBC [...] rt.cpan.org
From: Kevan Benson <kbenson [...] ticketfrontier.com>
Thanks! -Kevan Benson -Ticket Frontier, Inc On Wed, Apr 15, 2015 at 2:02 AM, Martin J Evans via RT < bug-DBD-ODBC@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=103347 > > > On Wed Apr 15 03:53:06 2015, MJEVANS wrote:
> > On Tue Apr 14 18:56:12 2015, kbenson@ticketfrontier.com wrote:
> > > Sorry for the late reply. This thread got lost a bit. > > > > > > I'm using DBD::ODBC 1.50. > > > > > > I just downloaded the latest developer release, 1.51_4, and indeed it > > > is no > > > longer throwing that error. It looks like this changelog entry does > > > reference the fix: > > > > > > 1.51_3 2015-01-17 > > > > > > [BUG FIXES] > > > > > > RT101579 - using bound input parameters for numeric columns (e.g., > > > SQL_NUMERIC) only works the first time and will quite likey fail > > > with "string data, right truncation" on the second and subsequent > > > calls to execute. Thanks to Laura for finding. > > > > > > > > > > > > Any chance of getting a release out soon with that fix in it?
> > > > I'll do it today. > > > > Martin
> > Just uploaded 1.52 now. It may be a bit before you can see it. > > Martin > -- > Martin J. Evans > Wetherby, UK >