summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorunknown <petr@mysql.com>2005-08-25 15:34:14 +0400
committerunknown <petr@mysql.com>2005-08-25 15:34:14 +0400
commitd29df5645bf0cdac2ff08a7da305e62edcd79604 (patch)
tree8fae7ec65a099365bef1673b8fe3f482e29eb39d /sql/item.h
parent141a36c31b9b9732a479f5b40a2ba35781418ad6 (diff)
downloadmariadb-git-d29df5645bf0cdac2ff08a7da305e62edcd79604.tar.gz
Fix Bug#11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO query"
mysql-test/r/sp.result: update result mysql-test/t/sp.test: Add test for Bug #11333 "Stored Procedure: Memory blow up on repeated SELECT ... INTO query" sql/item.cc: we should call destructors for Items before reuse sql/item.h: Add new method and constructor for Item_string. sql/sp_head.cc: String allocation should be done on the system heap for now.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index 4dfd99e0dbd..51f7c641de1 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1298,6 +1298,15 @@ public:
// it is constant => can be used without fix_fields (and frequently used)
fixed= 1;
}
+ /* Just create an item and do not fill string representation */
+ Item_string(CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
+ {
+ collation.set(cs, dv);
+ max_length= 0;
+ set_name(NULL, 0, cs);
+ decimals= NOT_FIXED_DEC;
+ fixed= 1;
+ }
Item_string(const char *name_par, const char *str, uint length,
CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE)
{
@@ -1309,6 +1318,15 @@ public:
// it is constant => can be used without fix_fields (and frequently used)
fixed= 1;
}
+ /*
+ This is used in stored procedures to avoid memory leaks and
+ does a deep copy of its argument.
+ */
+ void set_str_with_copy(const char *str_arg, uint length_arg)
+ {
+ str_value.copy(str_arg, length_arg, collation.collation);
+ max_length= str_value.numchars() * collation.collation->mbmaxlen;
+ }
enum Type type() const { return STRING_ITEM; }
double val_real();
longlong val_int();