[PATCH mogilefs 5/7] Only DBD::MySQL allows all undefs to last_insert_id safely. In other systems you need to provide the table and column (MySQL ignores them).

Robin H. Johnson robbat2 at gentoo.org
Tue Jun 5 13:38:13 UTC 2007


From: Robin H. Johnson <robbat2 at gentoo.org>

Signed-off-by: Robin H. Johnson <robbat2 at gentoo.org>
---
 server/lib/MogileFS/Store.pm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/lib/MogileFS/Store.pm b/server/lib/MogileFS/Store.pm
index 0906cb3..9448c7a 100644
--- a/server/lib/MogileFS/Store.pm
+++ b/server/lib/MogileFS/Store.pm
@@ -780,7 +780,7 @@ sub register_tempfile {
         unless (defined $fid) {
             # if they did not give us a fid, then we want to grab the one that was
             # theoretically automatically generated
-            $fid = $dbh->last_insert_id(undef, undef, undef, undef)
+            $fid = $dbh->last_insert_id(undef, undef, 'tempfile', 'fid')
                 or die "No last_insert_id found";
         }
         return undef unless defined $fid && $fid > 0;
@@ -1288,7 +1288,7 @@ sub fsck_log {
                    delete $opts{devid});
     croak("Unknown opts") if %opts;
 
-    my $logid = $self->dbh->last_insert_id(undef, undef, undef, undef)
+    my $logid = $self->dbh->last_insert_id(undef, undef, 'fsck_log', 'logid')
         or die "No last_insert_id found for fsck_log table";
 
     # sum-up evcode counts every so often, to make fsck_status faster,
-- 
1.5.2



More information about the mogilefs mailing list