PosgreSQL: use ENCODE, not HEX
This commit is contained in:
parent
6c8213f4db
commit
3087776f6b
|
@ -8,13 +8,19 @@ class GeneratedConfigTable extends QuickTable
|
||||||
{
|
{
|
||||||
public function getColumns()
|
public function getColumns()
|
||||||
{
|
{
|
||||||
return array(
|
$columns = array(
|
||||||
'checksum' => 'LOWER(HEX(c.checksum))',
|
'checksum' => 'LOWER(HEX(c.checksum))',
|
||||||
'duration' => "c.duration || 'ms'",
|
'duration' => "c.duration || 'ms'",
|
||||||
'files' => 'COUNT(cf.file_checksum)',
|
'files' => 'COUNT(cf.file_checksum)',
|
||||||
'last_related_change' => 'l.change_time',
|
'last_related_change' => 'l.change_time',
|
||||||
'activity_log_id' => 'l.id'
|
'activity_log_id' => 'l.id'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->db->getDbType() === 'psql') {
|
||||||
|
$columns['checksum'] = "LOWER(ENCODE(c.checksum, 'hex'))";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getActionUrl($row)
|
protected function getActionUrl($row)
|
||||||
|
|
|
@ -33,7 +33,11 @@ class Db extends DbConnection
|
||||||
|
|
||||||
public function getLastActivityChecksum()
|
public function getLastActivityChecksum()
|
||||||
{
|
{
|
||||||
$select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(HEX(checksum)) AS checksum FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1";
|
if ($this->getDbType() === 'psql') {
|
||||||
|
$select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(HEX(checksum)) AS checksum FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1";
|
||||||
|
} else {
|
||||||
|
$select = "SELECT checksum FROM (SELECT * FROM (SELECT 1 AS pos, LOWER(ENCODE(checksum, 'hex')) AS checksum FROM director_activity_log ORDER BY change_time DESC LIMIT 1) a UNION SELECT 2 AS pos, '' AS checksum) u ORDER BY pos LIMIT 1";
|
||||||
|
}
|
||||||
|
|
||||||
return $this->db()->fetchOne($select);
|
return $this->db()->fetchOne($select);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue