Commit b0d15b92 by Scott

Remove unreachable code from qa-db.php

Plus add deprecation notices.
parent 81dc9e36
...@@ -35,9 +35,9 @@ function qa_db_increment_views($postid) ...@@ -35,9 +35,9 @@ function qa_db_increment_views($postid)
$query = 'UPDATE ^posts SET views=views+1, lastviewip=UNHEX($) WHERE postid=# AND (lastviewip IS NULL OR lastviewip!=UNHEX($))'; $query = 'UPDATE ^posts SET views=views+1, lastviewip=UNHEX($) WHERE postid=# AND (lastviewip IS NULL OR lastviewip!=UNHEX($))';
$ipHex = bin2hex(@inet_pton(qa_remote_ip_address())); $ipHex = bin2hex(@inet_pton(qa_remote_ip_address()));
qa_db_query_sub($query, $ipHex, $postid, $ipHex); $result = qa_db_query_sub($query, $ipHex, $postid, $ipHex);
return qa_db_affected_rows() > 0; return $result->affectedRows() > 0;
} }
......
...@@ -206,9 +206,9 @@ function qa_db_points_update_ifuser($userid, $columns) ...@@ -206,9 +206,9 @@ function qa_db_points_update_ifuser($userid, $columns)
'ON DUPLICATE KEY UPDATE ' . $updates . 'points=' . $updatepoints . '+bonus'; 'ON DUPLICATE KEY UPDATE ' . $updates . 'points=' . $updatepoints . '+bonus';
// build like this so that a #, $ or ^ character in the $userid (if external integration) isn't substituted // build like this so that a #, $ or ^ character in the $userid (if external integration) isn't substituted
qa_db_query_raw(str_replace('~', "='" . qa_db_escape_string($userid) . "'", qa_db_apply_sub($query, array($userid)))); $result = qa_db_query_raw(str_replace('~', "='" . qa_db_escape_string($userid) . "'", qa_db_apply_sub($query, array($userid))));
if (qa_db_insert_on_duplicate_inserted()) { if ($result->affectedRows() > 0) {
qa_db_userpointscount_update(); qa_db_userpointscount_update();
} }
} }
......
...@@ -1901,7 +1901,7 @@ function qa_opt($name, $value = null) ...@@ -1901,7 +1901,7 @@ function qa_opt($name, $value = null)
*/ */
function qa_debug($var) function qa_debug($var)
{ {
echo "\n" . '<pre style="padding: 10px; background-color: #eee; color: #444; font-size: 11px; text-align: left">'; echo "\n" . '<pre style="padding: 10px; background-color: #eee; color: #444; font-size: 12px; text-align: left; white-space: pre-wrap">';
echo $var === null ? 'NULL' : htmlspecialchars(print_r($var, true), ENT_COMPAT|ENT_SUBSTITUTE); echo $var === null ? 'NULL' : htmlspecialchars(print_r($var, true), ENT_COMPAT|ENT_SUBSTITUTE);
echo '</pre>' . "\n"; echo '</pre>' . "\n";
} }
......
...@@ -302,7 +302,7 @@ class DbConnection ...@@ -302,7 +302,7 @@ class DbConnection
$arraykey = isset($selectspec['arraykey']) ? $selectspec['arraykey'] : null; $arraykey = isset($selectspec['arraykey']) ? $selectspec['arraykey'] : null;
$result = $this->query($query, $params); $result = $this->query($query, $params);
$data = $result->fetchAllAssoc($arraykey); // arrayvalue is applied in qa_db_post_select() $data = $result->fetchAllAssoc($arraykey); // arrayvalue is applied in formatSelect()
$this->formatSelect($data, $selectspec); // post-processing $this->formatSelect($data, $selectspec); // post-processing
......
...@@ -128,7 +128,7 @@ class DbResult ...@@ -128,7 +128,7 @@ class DbResult
* Number of rows found (SELECT queries) or rows affected (UPDATE/INSERT/DELETE queries). * Number of rows found (SELECT queries) or rows affected (UPDATE/INSERT/DELETE queries).
* @return int * @return int
*/ */
public function rowCount() public function affectedRows()
{ {
return $this->stmt->rowCount(); return $this->stmt->rowCount();
} }
...@@ -140,7 +140,7 @@ class DbResult ...@@ -140,7 +140,7 @@ class DbResult
*/ */
public function isEmpty() public function isEmpty()
{ {
return $this->stmt->rowCount() === 0; return $this->affectedRows() === 0;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment