Commit 25df33a7 authored by unknown's avatar unknown
Browse files

Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into mysql.com:/Users/kent/mysql/bk/mysql-5.1-new


support-files/mysql.spec.sh:
  Auto merged
parents 910d6788 47653b48
Loading
Loading
Loading
Loading
+47 −8
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ void tee_fprintf(FILE *file, const char *fmt, ...);
void tee_fputs(const char *s, FILE *file);
void tee_puts(const char *s, FILE *file);
void tee_putc(int c, FILE *file);
static void tee_print_sized_data(const char *data, unsigned int length, unsigned int width);
/* The names of functions that actually do the manipulation. */
static int get_options(int argc,char **argv);
static int com_quit(String *str,char*),
@@ -2308,20 +2309,29 @@ print_table_data(MYSQL_RES *result)
    for (uint off= 0; off < mysql_num_fields(result); off++)
    {
      const char *str= cur[off] ? cur[off] : "NULL";
      uint currlength;
      uint maxlength;
      uint numcells;

      field= mysql_fetch_field(result);
      uint maxlength= field->max_length;
      maxlength= field->max_length;
      currlength= (uint) lengths[off];
      numcells= charset_info->cset->numcells(charset_info, 
                                                    str, str + currlength);
      if (maxlength > MAX_COLUMN_LENGTH)
      {
	tee_fputs(str, PAGER);
        tee_print_sized_data(str, currlength, maxlength);
        tee_fputs(" |", PAGER);
      }
      else
      {
        uint currlength= (uint) lengths[off];
        uint numcells= charset_info->cset->numcells(charset_info, 
                                                    str, str + currlength);
        tee_fprintf(PAGER, num_flag[off] ? "%*s |" : " %-*s|",
                    maxlength + currlength - numcells, str);
        if (num_flag[off] != 0)
          tee_fprintf(PAGER, " %-*s|", maxlength + currlength - numcells, str);
        else 
        {
          tee_print_sized_data(str, currlength, maxlength);
          tee_fputs(" |", PAGER);
        }
      }
    }
    (void) tee_fputs("\n", PAGER);
@@ -2331,6 +2341,35 @@ print_table_data(MYSQL_RES *result)
}


static void
tee_print_sized_data(const char *data, unsigned int length, unsigned int width)
{
  /* 
    It is not a number, so print each character justified to the left.
    For '\0's print ASCII spaces instead, as '\0' is eaten by (at
    least my) console driver, and that messes up the pretty table
    grid.  (The \0 is also the reason we can't use fprintf() .) 
  */
  unsigned int i;
  const char *p;

  tee_putc(' ', PAGER);

  for (i= 0, p= data; i < length; i+= 1, p+= 1)
  {
    if (*p == '\0')
      tee_putc((int)' ', PAGER);
    else
      tee_putc((int)*p, PAGER);
  }

  i+= 1; 
  for (   ; i < width; i+= 1)
    tee_putc((int)' ', PAGER);
}



static void
print_table_data_html(MYSQL_RES *result)
{
+43 −0
Original line number Diff line number Diff line
@@ -1558,6 +1558,49 @@ id
3
4
5
DROP TABLE IF EXISTS federated.bug_17377_table;
CREATE TABLE federated.bug_17377_table (
`fld_cid` bigint(20) NOT NULL auto_increment,
`fld_name` varchar(255) NOT NULL default '',
`fld_parentid` bigint(20) NOT NULL default '0',
`fld_delt` int(1) NOT NULL default '0',
PRIMARY KEY (`fld_cid`),
KEY `fld_parentid` (`fld_parentid`),
KEY `fld_delt` (`fld_delt`),
KEY `fld_cid` (`fld_cid`)
) ENGINE=MyISAM;
insert into federated.bug_17377_table( fld_name )
values
("Mats"), ("Sivert"), ("Sigvard"), ("Torgny"), ("Torkel");
DROP TABLE IF EXISTS federated.t1;
CREATE TABLE federated.t1 (
`fld_cid` bigint(20) NOT NULL auto_increment,
`fld_name` varchar(255) NOT NULL default '',
`fld_parentid` bigint(20) NOT NULL default '0',
`fld_delt` int(1) NOT NULL default '0',
PRIMARY KEY (`fld_cid`),
KEY `fld_parentid` (`fld_parentid`),
KEY `fld_delt` (`fld_delt`),
KEY `fld_cid` (`fld_cid`)
) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/bug_17377_table';
select * from federated.t1 where fld_parentid=0 and fld_delt=0
order by fld_name;
fld_cid	fld_name	fld_parentid	fld_delt
1	Mats	0	0
3	Sigvard	0	0
2	Sivert	0	0
4	Torgny	0	0
5	Torkel	0	0
select * from federated.t1 where fld_parentid=0 and fld_delt=0;
fld_cid	fld_name	fld_parentid	fld_delt
1	Mats	0	0
2	Sivert	0	0
3	Sigvard	0	0
4	Torgny	0	0
5	Torkel	0	0
DROP TABLE federated.t1;
DROP TABLE federated.bug_17377_table;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
+20 −0
Original line number Diff line number Diff line
@@ -218,3 +218,23 @@ truncate(-5000111000111000155,-1)
select truncate(15000111000111000155,-1);
truncate(15000111000111000155,-1)
15000111000111000150
set names utf8;
create table t1
(f1 varchar(32) not null,
f2 smallint(5) unsigned not null,
f3 int(10) unsigned not null default '0')
engine=myisam default charset=utf8;
insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
create table t2
(f1 int(10) unsigned not null,
f2 int(10) unsigned not null,
f3 smallint(5) unsigned not null)
engine=myisam default charset=utf8;
insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
select format(t2.f2-t2.f1+1,0) from t1,t2
where t1.f2 = t2.f3 order by t1.f1;
format(t2.f2-t2.f1+1,0)
10,000
10,000
drop table t1, t2;
set names default;
+18 −0
Original line number Diff line number Diff line
@@ -626,3 +626,21 @@ drop user mysqltest_7@;
flush privileges;
show grants for mysqltest_7@;
ERROR 42000: There is no such grant defined for user 'mysqltest_7' on host ''
create database mysqltest;
use mysqltest;
create table t1(f1 int);
GRANT DELETE ON mysqltest.t1 TO mysqltest1@'%';
GRANT SELECT ON mysqltest.t1 TO mysqltest1@'192.%';
show grants for mysqltest1@'192.%';
Grants for mysqltest1@192.%
GRANT USAGE ON *.* TO 'mysqltest1'@'192.%'
GRANT SELECT ON `mysqltest`.`t1` TO 'mysqltest1'@'192.%'
show grants for mysqltest1@'%';
Grants for mysqltest1@%
GRANT USAGE ON *.* TO 'mysqltest1'@'%'
GRANT DELETE ON `mysqltest`.`t1` TO 'mysqltest1'@'%'
delete from mysql.user where user='mysqltest1';
delete from mysql.db where user='mysqltest1';
delete from mysql.tables_priv where user='mysqltest1';
flush privileges;
drop database mysqltest;
+47 −0
Original line number Diff line number Diff line
@@ -475,6 +475,22 @@ b c a c b y
1	10	2	3	1	2
1	3	2	3	1	11
1	3	2	3	1	2
select * from t5 natural join ((t1 natural join t2), (t3 natural join t4));
y	z	b	c	a	c	b
11	4	1	10	2	3	1
11	4	1	3	2	3	1
select * from  ((t1 natural join t2),  (t3 natural join t4)) natural join t5;
y	b	c	a	c	b	z
11	1	10	2	3	1	4
11	1	3	2	3	1	4
select * from t5 natural join ((t1 natural join t2) cross join (t3 natural join t4));
y	z	b	c	a	c	b
11	4	1	10	2	3	1
11	4	1	3	2	3	1
select * from  ((t1 natural join t2) cross join (t3 natural join t4)) natural join t5;
y	b	c	a	c	b	z
11	1	10	2	3	1	4
11	1	3	2	3	1	4
select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c);
c	b	a	b	y
3	1	2	1	11
@@ -665,6 +681,8 @@ select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
ERROR 23000: Column 'c' in from clause is ambiguous
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
ERROR 23000: Column 'c' in from clause is ambiguous
select * from t6 natural join ((t1 natural join t2),  (t3 natural join t4));
ERROR 23000: Column 'c' in from clause is ambiguous
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
ERROR 23000: Column 'b' in from clause is ambiguous
select * from  (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
@@ -673,6 +691,8 @@ select * from (t3 join (t4 natural join t5) on (b < z))
natural join
(t1 natural join t2);
ERROR 23000: Column 'c' in from clause is ambiguous
select * from (t1 natural join t2) natural join (t3 join (t4 natural join t5) on (b < z));
ERROR 23000: Column 'c' in from clause is ambiguous
select t1.b from v1a;
ERROR 42S22: Unknown column 't1.b' in 'field list'
select * from v1a join v1b on t1.b = t2.b;
@@ -697,3 +717,30 @@ drop view v2b;
drop view v3a;
drop view v3b;
drop view v4;
create table t1 (a1 int, a2 int);
create table t2 (a1 int, b int);
create table t3 (c1 int, c2 int);
create table t4 (c2 int);
insert into t1 values (1,1);
insert into t2 values (1,1);
insert into t3 values (1,1);
insert into t4 values (1);
select * from t1 join t2 using (a1) join t3 on b=c1 join t4 using (c2);
c2	a1	a2	b	c1
1	1	1	1	1
select * from t3 join (t1 join t2 using (a1)) on b=c1 join t4 using (c2);
c2	c1	a1	a2	b
1	1	1	1	1
select a2 from t1 join t2 using (a1) join t3 on b=c1 join t4 using (c2);
a2
1
select a2 from t3 join (t1 join t2 using (a1)) on b=c1 join t4 using (c2);
a2
1
select a2 from ((t1 join t2 using (a1)) join t3 on b=c1) join t4 using (c2);
a2
1
select a2 from ((t1 natural join t2) join t3 on b=c1) natural join t4;
a2
1
drop table t1,t2,t3,t4;
Loading