Duplicate entry in auto-increment field
Dear all,
I'm having a stange problem:
I'm inserting several entries in tables which has in primary key an auto-increment field.
For example:
create table Ethernet ( \
packet DOUBLE auto_increment,\
time DATETIME,\
src_mac VARCHAR(12),\
dest_mac VARCHAR(12),\
type VARCHAR(5),\
primary key (packet)\
);
When I'm inserting the entries (using Perl DBI) I got, here and there, a "Duplicate entry 'xxxxx' for key 1". It is strange, since the key 1 is an auto-increment field. I assume mysql deals with this issue.
The code I'm using is:
my $sth = $dbh->prepare('INSERT INTO Ethernet VALUES (?,?,?,?,?)');
die "Error preparing INSERT statement; aborting" unless defined $sth;
$sth->execute($packet,$time,$src_mac,$dest_mac,$type_proto) or print "ERR:xxx";
Any help is welcome.
Regards,
Mário