[PATCH] Ima::DBI generates prepare_cached warnings

[prev] [thread] [next] [Date index for 2005/05/27]

From: Casey West
Subject: [PATCH] Ima::DBI generates prepare_cached warnings
Date: 20:08 on 27 May 2005
By default DBI will generate warnings if you try to prepare_cached() a
statement that already has an active handle. Ima::DBI can generate
those warnings when used with Class::DBI/DBIx::ContextualFetch. Below
my sig is a patch to do the safe thing, gracefully clear the active
statement handle and create a new one.

  Casey West

        -- 
        The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer
professionals. We cause accidents. 
 -- Nathaniel Borenstein

--- /tmp/DBI.pm Fri May 27 16:03:27 2005
+++ /usr/local/lib/perl5/site_perl/5.8.4/Ima/DBI.pm     Fri May 27 16:01:56 2005
@@ -389,7 +389,7 @@
                # This is to do proper '%%' translation.
                my $sql = $class->transform_sql($statement => @_);
                return $cache
-                       ? $dbh->prepare_cached($sql)
+                       ? $dbh->prepare_cached($sql, {}, 3)
                        : $dbh->prepare($sql);
        };
 }

[PATCH] Ima::DBI generates prepare_cached warnings
Casey West 20:08 on 27 May 2005

Generated at 20:11 on 05 Jun 2005 by mariachi v0.52