Commit fc969bbc authored by unknown's avatar unknown

Merge mysql.com:/home/dlenev/src/mysql-5.0-bg17866-2

into  mysql.com:/home/dlenev/src/mysql-5.0-merges


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents f8862a05 350475fa
......@@ -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)
{
......
......@@ -69,3 +69,10 @@ c_cp932
+----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+
| >a < | b | 123421 |
| >a < | 0123456789 | 4 |
| >abcd< | | 4 |
+----------------------+------------+--------+
......@@ -787,46 +787,52 @@ drop trigger t1_bi;
ERROR 3D000: No database selected
create table t1 (id int);
create trigger t1_bi before insert on t1 for each row set @a:=new.id;
create trigger t1_ai after insert on test.t1 for each row set @b:=new.id;
insert into t1 values (101);
select @a;
@a
101
select @a, @b;
@a @b
101 101
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t1 set @a:=new.id
test t1_ai test t1 set @b:=new.id
rename table t1 to t2;
insert into t2 values (102);
select @a;
@a
102
select @a, @b;
@a @b
102 102
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t2 set @a:=new.id
test t1_ai test t2 set @b:=new.id
alter table t2 rename to t3;
insert into t3 values (103);
select @a;
@a
103
select @a, @b;
@a @b
103 103
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t3 set @a:=new.id
test t1_ai test t3 set @b:=new.id
alter table t3 rename to t4, add column val int default 0;
insert into t4 values (104, 1);
select @a;
@a
104
select @a, @b;
@a @b
104 104
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
trigger_schema trigger_name event_object_schema event_object_table action_statement
test t1_bi test t4 set @a:=new.id
test t1_ai test t4 set @b:=new.id
drop trigger t1_bi;
drop trigger t1_ai;
drop table t4;
create database mysqltest;
use mysqltest;
......
......@@ -56,3 +56,8 @@ drop table t1;
--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; set character_set_client= cp932; select '\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select '\'"
--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select '\'"
#
# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
#
--exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1
......@@ -960,38 +960,42 @@ drop trigger t1_bi;
connection default;
#
# Test for bug #13525 "Rename table does not keep info of triggers"
# Tests for bug #13525 "Rename table does not keep info of triggers"
# and bug #17866 "Problem with renaming table with triggers with fully
# qualified subject table".
#
create table t1 (id int);
create trigger t1_bi before insert on t1 for each row set @a:=new.id;
create trigger t1_ai after insert on test.t1 for each row set @b:=new.id;
insert into t1 values (101);
select @a;
select @a, @b;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
rename table t1 to t2;
# Trigger should work after rename
insert into t2 values (102);
select @a;
select @a, @b;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
# Let us check that the same works for simple ALTER TABLE ... RENAME
alter table t2 rename to t3;
insert into t3 values (103);
select @a;
select @a, @b;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
# And for more complex ALTER TABLE
alter table t3 rename to t4, add column val int default 0;
insert into t4 values (104, 1);
select @a;
select @a, @b;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test';
# .TRN file should be updated with new table name
drop trigger t1_bi;
drop trigger t1_ai;
drop table t4;
# Rename between different databases if triggers exist should fail
create database mysqltest;
......
......@@ -1217,6 +1217,7 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
buff.append(def->str, before_on_len);
buff.append(STRING_WITH_LEN("ON "));
append_identifier(thd, &buff, new_table_name->str, new_table_name->length);
buff.append(STRING_WITH_LEN(" "));
on_q_table_name_len= buff.length() - before_on_len;
buff.append(on_table_name->str + on_table_name->length,
def->length - (before_on_len + on_table_name->length));
......
......@@ -9127,7 +9127,7 @@ view_check_option:
trigger_tail:
TRIGGER_SYM remember_name sp_name trg_action_time trg_event
ON remember_name table_ident remember_end FOR_SYM EACH_SYM ROW_SYM
ON remember_name table_ident FOR_SYM remember_name EACH_SYM ROW_SYM
{
LEX *lex= Lex;
sp_head *sp;
......@@ -9145,7 +9145,7 @@ trigger_tail:
lex->trigger_definition_begin= $2;
lex->ident.str= $7;
lex->ident.length= $9 - $7;
lex->ident.length= $10 - $7;
sp->m_type= TYPE_ENUM_TRIGGER;
lex->sphead= sp;
......
......@@ -369,8 +369,8 @@ BuildMySQL "--disable-shared \
--with-client-ldflags='-all-static' \
$USE_OTHER_LIBC_DIR \
%else
%endif
--with-zlib-dir=bundled \
%endif
--with-comment=\"MySQL Community Edition - Standard (GPL)\" \
--with-server-suffix='%{server_suffix}' \
--with-archive-storage-engine \
......@@ -690,8 +690,11 @@ fi
%{_libdir}/mysql/libndbclient.a
%{_libdir}/mysql/libndbclient.la
%{_libdir}/mysql/libvio.a
%if %{STATIC_BUILD}
%else
%{_libdir}/mysql/libz.a
%{_libdir}/mysql/libz.la
%endif
%files shared
%defattr(-, root, root, 0755)
......@@ -723,6 +726,11 @@ fi
* Fri Mar 03 2006 Kent Boortz <kent@mysql.com>
- Don't output an embedded package as it is empty
- Can't use bundled zlib when doing static build. Might be a
automake/libtool problem, having two .la files, "libmysqlclient.la"
and "libz.la", on the same command line to link "thread_test"
expands to too many "-lc", "-lpthread" and other libs giving hard
to nail down duplicate symbol defintion problems.
* Fri Jan 10 2006 Joerg Bruehe <joerg@mysql.com>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment