Hi all,
I'm using MYSQL, and have this weird problem, here is self-explaining
snippet:
sub save_url {
my $url = shift || die "Need url!";
my ($id) = $dbh->selectrow_array("select id from db_url where id = ?",
{}, $url);
unless ($id) {
my $sth = $dbh->prepare(qq{
INSERT INTO db_url
(url) values (?)
});
$sth->execute($url);
$id = $dbh->{'mysql_insertid'};
}
return $id
}
I call this sub multiple times, and after some thousand calls it always dies
on the same $url and don't know why. Error is:
DBD::mysql::st execute failed: Duplicate entry 'http://www.some-web.com' for
key 2 at ...
DDL
`url` char(255) character set latin1 collate latin1_bin NOT NULL default '',
UNIQUE KEY `url` (`url`),
Thanks for any help. Also nothing other is inserting to table, so I
don't need lock table I guess.
/brano
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>