1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 15:16:30 +02:00

More code cleanup

This commit is contained in:
Cameron
2019-02-11 16:56:37 -08:00
parent 762c8b5a1a
commit 645ad037f5
2 changed files with 25 additions and 46 deletions

View File

@@ -172,7 +172,7 @@
public function db_Mark_Time($sMarker) public function db_Mark_Time($sMarker)
{ {
$this->markTime($sMarker); return $this->markTime($sMarker);
} }
} }

View File

@@ -234,12 +234,12 @@ class e_db_pdo implements e_db
} }
/** /**
* @return void *
* @param string $sMarker * @param string $sMarker
* @desc Enter description here... * @desc Enter description here...
* @access private * @return null|true
*/ */
function markTime($sMarker) public function markTime($sMarker)
{ {
if($this->debugMode !== true) if($this->debugMode !== true)
{ {
@@ -247,6 +247,8 @@ class e_db_pdo implements e_db
} }
$this->dbg->Mark_Time($sMarker); $this->dbg->Mark_Time($sMarker);
return true;
} }
@@ -1246,51 +1248,25 @@ class e_db_pdo implements e_db
$type='both'; $type='both';
} }
if(defined('MYSQL_ASSOC'))
switch ($type)
{ {
switch ($type) case 'both':
{ case 3: // MYSQL_BOTH:
case 'both': $type = PDO::FETCH_BOTH; // 3
case 3: // MYSQL_BOTH: break;
$type = PDO::FETCH_BOTH; // 3
break;
case 'num': case 'num':
case 2; // MYSQL_NUM: // 2 case 2; // MYSQL_NUM: // 2
$type = PDO::FETCH_NUM; $type = PDO::FETCH_NUM;
break; break;
default: default:
case 'assoc': case 'assoc':
case 1; //: // 1 case 1; // MYSQL_ASSOC // 1
$type = PDO::FETCH_ASSOC;
$type = PDO::FETCH_ASSOC; break;
break;
}
} }
else
{
// convert type to PDO.
switch ($type)
{
case 'both': // 3
$type = PDO::FETCH_BOTH;
break;
case 'num': // 2
$type = PDO::FETCH_NUM;
break;
case 'assoc': // 1
default:
$type = PDO::FETCH_ASSOC;
break;
}
}
$b = microtime(); $b = microtime();
@@ -1300,14 +1276,17 @@ class e_db_pdo implements e_db
$resource = $this->mySQLresult; $resource = $this->mySQLresult;
$row = $resource->fetch($type); $row = $resource->fetch($type);
$this->traffic->Bump('db_Fetch', $b); $this->traffic->Bump('db_Fetch', $b);
if ($row) if ($row)
{ {
$this->dbError('db_Fetch'); $this->dbError('db_Fetch');
return $row; // Success - return data return $row; // Success - return data
} }
} }
$this->dbError('db_Fetch'); $this->dbError('db_Fetch');
return false; // Failure
return false;
} }