From eb3010e6d9e7795e9b5774a4b40516fc2f16ce17 Mon Sep 17 00:00:00 2001 From: Kazuhiro Osawa Date: Mon, 23 Jul 2012 12:40:51 +0900 Subject: [PATCH] Fixes a duplication entry bug on MySQL replication delay If you are using as a replication slave if the r_handle, exists by the delay of replication is not correct. --- lib/Data/ObjectDriver/Driver/DBI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Data/ObjectDriver/Driver/DBI.pm b/lib/Data/ObjectDriver/Driver/DBI.pm index b7833a8..8dc057d 100644 --- a/lib/Data/ObjectDriver/Driver/DBI.pm +++ b/lib/Data/ObjectDriver/Driver/DBI.pm @@ -298,7 +298,7 @@ sub exists { my $stmt = $driver->prepare_statement($class, $terms, { limit => 1 }); my $sql = "SELECT 1 FROM $tbl\n"; $sql .= $stmt->as_sql_where; - my $dbh = $driver->r_handle($obj->properties->{db}); + my $dbh = $driver->rw_handle($obj->properties->{db}); $driver->start_query($sql, $stmt->{bind}); my $sth = $driver->_prepare_cached($dbh, $sql); $sth->execute(@{ $stmt->{bind} });