Updates for PDO

This commit is contained in:
DariusIII
2013-12-08 17:52:20 +01:00
parent d327523bef
commit cfd089ff85
4 changed files with 14 additions and 10 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php");
require(WWW_DIR.'/lib/postprocess.php');
require_once (WWW_DIR.'/lib/site.php');
$version="0.3r302";
$version="0.3r305";
$db = new DB();
$s = new Sites();
+8 -5
View File
@@ -32,10 +32,12 @@ function preName($argv)
echo $tot." Releases had no searchname\n";
echo "Getting work\n";
if (isset($argv[1]) && $argv[1]=="full")
$res = $db->query("SELECT ID, name, searchname, groupID, categoryID FROM releases WHERE ( relnamestatus in (1, 20, 21, 22) AND categoryID BETWEEN 8000 AND 8999)");
elseif (isset($argv[1]) && is_numeric($argv[1]))
$res = $db->query("SELECT ID, name, searchname, groupID, categoryID FROM releases WHERE ( relnamestatus in (1, 20, 21, 22) AND categoryID BETWEEN 8000 AND 8999) AND adddate > NOW() - INTERVAL %d HOUR",$argv[1]);
$total = $res->rowCount();
$res = $db->prepare("SELECT ID, name, searchname, groupID, categoryID FROM releases WHERE ( relnamestatus in (1, 20, 21, 22) AND categoryID BETWEEN 8000 AND 8999)");
$res->execute();
elseif (isset($argv[1]) && is_numeric($argv[1]))
$res = $db->prepare("SELECT ID, name, searchname, groupID, categoryID FROM releases WHERE ( relnamestatus in (1, 20, 21, 22) AND categoryID BETWEEN 8000 AND 8999) AND adddate > NOW() - INTERVAL %d HOUR",$argv[1]);
$res->execute();
$total = $res->rowCount();
if ($total > 0)
{
$consoletools = new ConsoleTools();
@@ -92,7 +94,8 @@ function resetSearchnames()
{
$db = new DB();
echo "\nResetting blank searchnames\n";
$bad = $db->query("UPDATE releases SET searchname = name WHERE searchname = ''");
$bad = $db->prepare("UPDATE releases SET searchname = name WHERE searchname = ''");
$bad->execute();
$tot = count($bad);
if ($tot > 0)
echo $tot." Releases had no searchname\n";
+3 -3
View File
@@ -77,7 +77,7 @@ class Namefixer
if ($time == 2 && $cats == 2)
$relres = $db->queryDirect($query.$this->fullall);
$rowcount = $db->getAffectedRows();
$rowcount = $relres->rowCount();
if ($rowcount > 0)
{
while ($relrow = $functions->fetchArray($relres))
@@ -126,7 +126,7 @@ class Namefixer
if ($time == 2 && $cats == 2)
$relres = $db->queryDirect($query.$this->fullall);
$rowcount = $db->getAffectedRows();
$rowcount = $relres->rowCount();
if ($rowcount > 0)
{
while ($relrow = $functions->fetchArray($relres))
@@ -173,7 +173,7 @@ class Namefixer
if ($time == 2 && $cats == 2)
$relres = $db->queryDirect($query.$this->fullother);
$rowcount = $db->getAffectedRows();
$rowcount = $relres->rowCount();
if ($rowcount > 0)
{
+2 -1
View File
@@ -118,7 +118,8 @@ Class Predb
else
$nfo = $db->escapeString("http://nzb.isasecret.com/".$matches2["nfo"]);
$db->query(sprintf("INSERT INTO prehash (title, nfo, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $nfo, $size, $db->escapeString($matches2["category"]), $db->escapeString("womble"), $db->escapeString(md5($matches2["title"]))));
$qry = $db->prepare(sprintf("INSERT INTO prehash (title, nfo, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $nfo, $size, $db->escapeString($matches2["category"]), $db->escapeString("womble"), $db->escapeString(md5($matches2["title"]))));
$qry->execute();
$newnames++;
}
}