Skip Menu |
 

This queue is for tickets about the Net-MySQL CPAN distribution.

Report information
The Basics
Id: 53558
Status: new
Priority: 0/
Queue: Net-MySQL

People
Owner: Nobody in particular
Requestors: florian [...] demmer.org
Cc:
AdminCc:

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



Subject: affected_rows_length inaccurate after error
Date: Sun, 10 Jan 2010 03:04:30 +0100
To: bug-Net-MySQL [...] rt.cpan.org
From: Florian Demmer <florian [...] demmer.org>
Download (untitled) / with headers
text/plain 780b
Hi, ... I found the following minor issue with Net::MySQL 0.09. I ran into it, because I misused the affected rows count as a way to determine if my insert was successful. I am using is_error now ;) However...: - assuming a lot of insert statements, one after the other. - first insert is successful, affected_rows_length = 1 - next insert fails because eg. of unmet foreign key constrain (error 1452..) ... affected_rows_length is still 1, because it is not reset after the execute_command. fix is easy; add it to _reset_status: sub _reset_status { my $self = shift; $self->{insert_id} = 0; $self->{server_message} = ''; $self->{error_code} = undef; $self->{selected_record} = undef; $self->{affected_rows_length} = 0; } br, Florian


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.