fixed MsSQL and MaxDB problem: DISTINCT on text column in function get_installed_charsets

This commit is contained in:
Ralf Becker 2004-09-19 12:46:22 +00:00
parent 33918385fc
commit 35ef5df8a3

View File

@ -248,7 +248,14 @@
{ {
if (!is_array($this->charsets)) if (!is_array($this->charsets))
{ {
$this->db->query("SELECT DISTINCT l.lang,lx.lang_name,l.content AS charset FROM phpgw_lang l,phpgw_languages lx WHERE l.lang = lx.lang_id AND l.message_id='charset'",__LINE__,__FILE__); $distinct = 'DISTINCT';
switch($this->db->Type)
{
case 'sapdb': case 'maxdb':
case 'mssql':
$distinct = ''; // cant use distinct on text columns (l.content is text)
}
$this->db->query("SELECT $distinct l.lang,lx.lang_name,l.content AS charset FROM phpgw_lang l,phpgw_languages lx WHERE l.lang = lx.lang_id AND l.message_id='charset'",__LINE__,__FILE__);
if (!$this->db->num_rows()) if (!$this->db->num_rows())
{ {
return False; return False;
@ -256,8 +263,11 @@
while ($this->db->next_record()) while ($this->db->next_record())
{ {
$data = &$this->charsets[$charset = strtolower($this->db->f('charset'))]; $data = &$this->charsets[$charset = strtolower($this->db->f('charset'))];
$data .= ($data ? ', ' : $charset.': '). $lang = $this->db->f('lang_name').' ('.$this->db->f('lang').')';
$this->db->f('lang_name').' ('.$this->db->f('lang').')'; if ($distinct || strstr($data,$lang) === false)
{
$data .= ($data ? ', ' : $charset.': ').$lang;
}
} }
} }
return $this->charsets; return $this->charsets;