Db: and once again

This commit is contained in:
Thomas Gelf 2016-03-15 17:55:59 +01:00
parent 289939a1bb
commit 6243fa33ff

View File

@ -312,8 +312,8 @@ class Db extends DbConnection
{ {
$db = $this->db(); $db = $this->db();
$query = $db->select() $query = $db->select()
->from('import_run', $this->dbHexFunc('rowset_checksum')) ->from(array('r' => 'import_run'), $this->dbHexFunc('r.rowset_checksum'))
->where('id = ?', $id); ->where('r.id = ?', $id);
return $db->fetchOne($query); return $db->fetchOne($query);
} }
@ -388,17 +388,17 @@ class Db extends DbConnection
} }
$lastRun = $db->select()->from( $lastRun = $db->select()->from(
'import_run', array('r' => 'import_run'),
array('checksum' => $this->dbHexFunc('rowset_checksum')) array('checksum' => $this->dbHexFunc('r.rowset_checksum'))
); );
if (is_int($source) || ctype_digit($source)) { if (is_int($source) || ctype_digit($source)) {
$lastRun->where('source_id = ?', $source); $lastRun->where('r.source_id = ?', $source);
} else { } else {
$lastRun->where('source_name = ?', $source); $lastRun->where('r.source_name = ?', $source);
} }
$lastRun->order('start_time DESC')->limit(1); $lastRun->order('r.start_time DESC')->limit(1);
$checksum = $db->fetchOne($lastRun); $checksum = $db->fetchOne($lastRun);
return $this->fetchImportedRowsetRows($checksum, $columns); return $this->fetchImportedRowsetRows($checksum, $columns);