Can anyone offer some insight on this error:
Can't call method "prepare" on an undefined value at
lib/MT/ObjectDriver/DBI.pm line 103. at lib/MT.pm line 867
Content-Type: text/plain; charset=utf-8 Got an error:
Can't call method "prepare" on an undefined value at
lib/MT/ObjectDriver/DBI.pm line 103. at lib/MT/App/CMS.pm line 906
I’ve been getting it since I upgraded to MT version 3.32; Googling doesn’t find much.
It happens when I save an entry after adding or editing it, but not when I preview those changes. I believe it’s part of the page-rebuilding process (though simply rebuilding files doesn’t trigger it either).
I can’t comment out the offending part of the code (below) without creating other errors:
[code] my($tbl, $sql, $bind) =
$driver->prepare_from_where($class, $terms, $args);
my(%rec, @bind, @cols);
my $cols = $class->column_names;
for my $col (@$cols) {
push @cols, $col;
push @bind, $rec{$col};
}
my $tmp = "select ";
$tmp .= "distinct " if $args->{join} && $args->{join}[3]{unique};
$tmp .= join(’, ', map "${tbl}$_", @cols) . “\n”;
$sql = $tmp . $sql;
my $dbh = $driver->{dbh};
warn “load - Preparing SQL: $sql” if $MT::DebugMode & 4;
my $sth = $dbh->prepare($sql)
or return $driver->error(MT->translate(“Loading data failed with SQL error [_1]”, $dbh->errstr));
[/code]I’m no Perl guru, but it seems to me that $sql should be defined in the first line of the code snippet.
I ran mt-check and got the all-clear. I ran mt-upgrade and it did what it needed to (doing so subsequently confirms that the database schema is OK). I’m pretty much stumped at this point.