Commit 05265d57 authored by unknown's avatar unknown
Browse files

Merge jlindstrom@build.mysql.com:/home/bk/mysql-4.1

into hundin.mysql.fi:/home/jan/mysql-4.1

parents 0ee9e4d7 0ceb4ddc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ explain extended select grp,group_concat(c) from t1 group by grp;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	9	Using filesort
Warnings:
Note	1003	select test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
Note	1003	select test.t1.grp AS `grp`,group_concat(test.t1.c separator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
select grp,group_concat(a,c) from t1 group by grp;
grp	group_concat(a,c)
1	1a
@@ -93,7 +93,7 @@ explain extended select grp,group_concat(distinct c order by c desc) from t1 gro
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	9	Using filesort
Warnings:
Note	1003	select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
Note	1003	select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
select grp,group_concat(c order by c separator ",") from t1 group by grp;
grp	group_concat(c order by c separator ",")
1	a
@@ -113,7 +113,7 @@ explain extended select grp,group_concat(distinct c order by c separator ",") fr
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	9	Using filesort
Warnings:
Note	1003	select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
Note	1003	select test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c separator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
grp	group_concat(distinct c order by c desc separator ",")
1	a
+10 −0
Original line number Diff line number Diff line
@@ -148,6 +148,16 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note	1003	select test.t1.a AS `a`,test.t1.b AS `b`,test.t1.c AS `c` from test.t1 where (_latin1'a' in (test.t1.a,test.t1.b,(test.t1.c collate _latin1'latin1_bin')))
drop table t1;
set names utf8;
create table t1 (a char(10) character set utf8 not null);
insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ');
select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a;
a
ÄÄÄÄ
bbbb
цццц
drop table t1;
set names latin1;
select '1.0' in (1,2);
'1.0' in (1,2)
1
+7 −0
Original line number Diff line number Diff line
@@ -75,6 +75,13 @@ select * from t1 where 'a' in (a,b,c collate latin1_bin);
explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
drop table t1;

set names utf8;
create table t1 (a char(10) character set utf8 not null);
insert into t1 values ('bbbb'),(_koi8r'ÃÃÃÃ'),(_latin1'ÄÄÄÄ');
select a from t1 where a in ('bbbb',_koi8r'ÃÃÃÃ',_latin1'ÄÄÄÄ') order by a;
drop table t1;
set names latin1;

select '1.0' in (1,2);
select 1 in ('1.0',2);
select 1 in (1,'2.0');
+28 −2
Original line number Diff line number Diff line
@@ -265,8 +265,9 @@ CHARSET_INFO *Item::default_charset()
  return current_thd->variables.collation_connection;
}

bool DTCollation::aggregate(DTCollation &dt)
bool DTCollation::aggregate(DTCollation &dt, bool superset_conversion)
{
  nagg++;
  if (!my_charset_same(collation, dt.collation))
  {
    /* 
@@ -280,15 +281,39 @@ bool DTCollation::aggregate(DTCollation &dt)
      if (derivation <= dt.derivation)
	; // Do nothing
      else
      {
	set(dt); 
        strong= nagg;
      }
    }
    else if (dt.collation == &my_charset_bin)
    {
      if (dt.derivation <= derivation)
      {
        set(dt);
        strong= nagg;
      }
      else
       ; // Do nothing
    }
    else if (superset_conversion)
    {
      if (derivation < dt.derivation &&
          collation->state & MY_CS_UNICODE)
        ; // Do nothing
      else if (dt.derivation < derivation &&
               dt.collation->state & MY_CS_UNICODE)
      {
        set(dt);
        strong= nagg;
      }
      else
      {
        // Cannot convert to superset
        set(0, DERIVATION_NONE);
        return 1;
      }
    }
    else
    {
      set(0, DERIVATION_NONE);
@@ -302,6 +327,7 @@ bool DTCollation::aggregate(DTCollation &dt)
  else if (dt.derivation < derivation)
  {
    set(dt);
    strong= nagg;
  }
  else
  { 
+9 −3
Original line number Diff line number Diff line
@@ -41,16 +41,22 @@ class DTCollation {
public:
  CHARSET_INFO     *collation;
  enum Derivation derivation;
  uint nagg;    // Total number of aggregated collations.
  uint strong;  // Number of the strongest collation.
  
  DTCollation()
  {
    collation= &my_charset_bin;
    derivation= DERIVATION_NONE;
    nagg= 0;
    strong= 0;
  }
  DTCollation(CHARSET_INFO *collation_arg, Derivation derivation_arg)
  {
    collation= collation_arg;
    derivation= derivation_arg;
    nagg= 0;
    strong= 0;
  }
  void set(DTCollation &dt)
  { 
@@ -66,9 +72,9 @@ class DTCollation {
  { collation= collation_arg; }
  void set(Derivation derivation_arg)
  { derivation= derivation_arg; }
  bool aggregate(DTCollation &dt);
  bool set(DTCollation &dt1, DTCollation &dt2)
  { set(dt1); return aggregate(dt2); }
  bool aggregate(DTCollation &dt, bool superset_conversion= FALSE);
  bool set(DTCollation &dt1, DTCollation &dt2, bool superset_conversion= FALSE)
  { set(dt1); return aggregate(dt2, superset_conversion); }
  const char *derivation_name() const
  {
    switch(derivation)
Loading