Merge pull request #3443 from Icinga/fix/search-over-customvars-results-in-sql-error-2508
Fix search over customvars results in sql error 2508
This commit is contained in:
commit
60295f3407
library/Icinga/Data/Db
modules/monitoring/library/Monitoring/Backend/Ido/Query
|
@ -98,6 +98,16 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||
return $query->getSelectQuery()->query();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection configuration
|
||||
*
|
||||
* @return ConfigObject
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for database type
|
||||
*
|
||||
|
|
|
@ -106,8 +106,7 @@ abstract class IdoQuery extends DbQuery
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $customVarsJoinTemplate =
|
||||
'%1$s = %2$s.object_id AND %2$s.varname = %3$s COLLATE latin1_general_ci';
|
||||
private $customVarsJoinTemplate = '%1$s = %2$s.object_id AND %2$s.varname = %3$s';
|
||||
|
||||
/**
|
||||
* An array with all 'virtual' tables that are already joined
|
||||
|
@ -701,6 +700,9 @@ abstract class IdoQuery extends DbQuery
|
|||
$this->initializeForOracle();
|
||||
} elseif ($dbType === 'pgsql') {
|
||||
$this->initializeForPostgres();
|
||||
} else {
|
||||
$charset = $this->ds->getConfig()->get('charset') ?: 'latin1';
|
||||
$this->customVarsJoinTemplate .= " COLLATE {$charset}_general_ci";
|
||||
}
|
||||
$this->joinBaseTables();
|
||||
$this->select->columns($this->columns);
|
||||
|
|
Loading…
Reference in New Issue