fixed case when real length very close to calculated (BUG#5150)
mysql-test/r/view.result: tested problem when function name length close to ALIGN_SIZE mysql-test/t/view.test: tested problem when function name length close to ALIGN_SIZE sql/item_func.cc: fixed case when real length very close to calculated (less then ALIGN)
This commit is contained in:
parent
36b5ed33c8
commit
fa8a74b3ba
@ -1176,3 +1176,10 @@ test.`f``1` ()
|
||||
5
|
||||
drop view v1;
|
||||
drop function `f``1`;
|
||||
create function x () returns int return 5;
|
||||
create view v1 as select x ();
|
||||
select * from v1;
|
||||
x ()
|
||||
5
|
||||
drop view v1;
|
||||
drop function x;
|
||||
|
@ -1116,3 +1116,12 @@ show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop function `f``1`;
|
||||
|
||||
#
|
||||
# tested problem when function name length close to ALIGN_SIZE
|
||||
#
|
||||
create function x () returns int return 5;
|
||||
create view v1 as select x ();
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop function x;
|
||||
|
@ -3271,12 +3271,14 @@ const char *
|
||||
Item_func_sp::func_name() const
|
||||
{
|
||||
THD * thd= current_thd;
|
||||
/* Calculate length to avoud reallocation of string for sure */
|
||||
uint len= ((m_name->m_db.length +
|
||||
m_name->m_name.length)*2 + //characters*quoting
|
||||
2 + // ` and `
|
||||
1 + // .
|
||||
1); // end of string
|
||||
String qname(alloc_root(&thd->mem_root, len), len,
|
||||
1 + // end of string
|
||||
ALIGN_SIZE(1)); // to avoid String reallocation
|
||||
String qname((char *)alloc_root(&thd->mem_root, len), len,
|
||||
system_charset_info);
|
||||
qname.length(0);
|
||||
append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length);
|
||||
|
Loading…
x
Reference in New Issue
Block a user