do 'localconfig';
-use Mysql;
+use DBI;
use Date::Format; # For time2str().
use Date::Parse; # For str2time().
$name = Param("shadowdb");
$::dbwritesallowed = 0;
}
- $::db = Mysql->Connect($db_host, $name, $db_user, $db_pass)
+ $::db = DBI->connect("DBI:mysql:host=$db_host;database=$name", $db_user, $db_pass)
|| die "Can't connect to database server.";
}
}
$str =~ s/^LOCK TABLES/LOCK TABLES shadowlog WRITE, /i;
}
SqlLog($str);
- $::currentquery = $::db->query($str)
+ $::currentquery = $::db->prepare($str);
+ $::currentquery->execute
|| die "$str: " . $::db->errmsg;
SqlLog("Done");
if (!$dontshadow && $iswrite && Param("shadowdb")) {
if (defined @::fetchahead) {
return 1;
}
- if (@::fetchahead = $::currentquery->fetchrow()) {
+ if (@::fetchahead = $::currentquery->fetchrow_array) {
return 1;
}
return 0;
undef @::fetchahead;
return @result;
}
- return $::currentquery->fetchrow();
+ return $::currentquery->fetchrow_array;
}