summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcyeh%bluemartini.com <>2000-05-20 10:22:07 +0200
committercyeh%bluemartini.com <>2000-05-20 10:22:07 +0200
commitf910d39fb6e0ed2746ad69e0e9c3b68e1e7f7e0b (patch)
treeef12c56a189450d7edf566a1f2a78942f12322e3
parent10c004c5600e0806cf15d72c902375c158f42e87 (diff)
downloadbugzilla-f910d39fb6e0ed2746ad69e0e9c3b68e1e7f7e0b.tar.gz
bugzilla-f910d39fb6e0ed2746ad69e0e9c3b68e1e7f7e0b.tar.xz
remove dependency on Mysql, use DBI instead. Patch submitted by
sstock@iconnect-inc.com, reworked slightly by cyeh@bluemartini.com to update it to the tip
-rw-r--r--globals.pl11
1 files changed, 6 insertions, 5 deletions
diff --git a/globals.pl b/globals.pl
index f058f8cf4..80f517c85 100644
--- a/globals.pl
+++ b/globals.pl
@@ -61,7 +61,7 @@ my $db_pass = "";
do 'localconfig';
-use Mysql;
+use DBI;
use Date::Format; # For time2str().
use Date::Parse; # For str2time().
@@ -85,7 +85,7 @@ sub ConnectToDatabase {
$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.";
}
}
@@ -130,7 +130,8 @@ sub SendSQL {
$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")) {
@@ -152,7 +153,7 @@ sub MoreSQLData {
if (defined @::fetchahead) {
return 1;
}
- if (@::fetchahead = $::currentquery->fetchrow()) {
+ if (@::fetchahead = $::currentquery->fetchrow_array) {
return 1;
}
return 0;
@@ -164,7 +165,7 @@ sub FetchSQLData {
undef @::fetchahead;
return @result;
}
- return $::currentquery->fetchrow();
+ return $::currentquery->fetchrow_array;
}