added secondary table related to shares to share class

This commit is contained in:
Sebastian Grewe 2013-05-14 16:30:11 +02:00
parent b489d77969
commit 5c72a859eb

View File

@ -7,6 +7,7 @@ if (!defined('SECURITY'))
class Share { class Share {
private $sError = ''; private $sError = '';
private $table = 'shares'; private $table = 'shares';
private $tableArchive = 'shares_archive';
private $oUpstream; private $oUpstream;
private $iLastUpstreamId; private $iLastUpstreamId;
// This defines each share // This defines each share
@ -26,6 +27,9 @@ class Share {
return $this->sError; return $this->sError;
} }
public function getArchiveTableName() {
return $this->tableArchive;
}
public function getTableName() { public function getTableName() {
return $this->table; return $this->table;
} }
@ -93,7 +97,7 @@ class Share {
} }
public function moveArchive($previous_upstream=0, $current_upstream,$block_id) { public function moveArchive($previous_upstream=0, $current_upstream,$block_id) {
$archive_stmt = $this->mysqli->prepare("INSERT INTO shares_archive (share_id, username, our_result, upstream_result, block_id, time) $archive_stmt = $this->mysqli->prepare("INSERT INTO $this->tableArchive (share_id, username, our_result, upstream_result, block_id, time)
SELECT id, username, our_result, upstream_result, ?, time SELECT id, username, our_result, upstream_result, ?, time
FROM $this->table FROM $this->table
WHERE id BETWEEN ? AND ?"); WHERE id BETWEEN ? AND ?");