mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
cleanup for Item_func_regex (Bug #4199)
This commit is contained in:
@ -81,3 +81,20 @@ _latin1'a' regexp _latin1'A' collate latin1_general_ci
|
|||||||
select _latin1'a' regexp _latin1'A' collate latin1_bin;
|
select _latin1'a' regexp _latin1'A' collate latin1_bin;
|
||||||
_latin1'a' regexp _latin1'A' collate latin1_bin
|
_latin1'a' regexp _latin1'A' collate latin1_bin
|
||||||
0
|
0
|
||||||
|
create table t1 (a varchar(40));
|
||||||
|
insert into t1 values ('C1'),('C2'),('R1'),('C3'),('R2'),('R3');
|
||||||
|
prepare stmt1 from 'select a from t1 where a rlike ? order by a';
|
||||||
|
set @a="^C.*";
|
||||||
|
execute stmt1 using @a;
|
||||||
|
a
|
||||||
|
C1
|
||||||
|
C2
|
||||||
|
C3
|
||||||
|
set @a="^R.*";
|
||||||
|
execute stmt1 using @a;
|
||||||
|
a
|
||||||
|
R1
|
||||||
|
R2
|
||||||
|
R3
|
||||||
|
deallocate prepare stmt1;
|
||||||
|
drop table t1;
|
||||||
|
@ -60,3 +60,16 @@ select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]';
|
|||||||
|
|
||||||
select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
|
select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
|
||||||
select _latin1'a' regexp _latin1'A' collate latin1_bin;
|
select _latin1'a' regexp _latin1'A' collate latin1_bin;
|
||||||
|
|
||||||
|
#
|
||||||
|
# regexp cleanup()
|
||||||
|
#
|
||||||
|
create table t1 (a varchar(40));
|
||||||
|
insert into t1 values ('C1'),('C2'),('R1'),('C3'),('R2'),('R3');
|
||||||
|
prepare stmt1 from 'select a from t1 where a rlike ? order by a';
|
||||||
|
set @a="^C.*";
|
||||||
|
execute stmt1 using @a;
|
||||||
|
set @a="^R.*";
|
||||||
|
execute stmt1 using @a;
|
||||||
|
deallocate prepare stmt1;
|
||||||
|
drop table t1;
|
||||||
|
@ -2298,15 +2298,19 @@ longlong Item_func_regex::val_int()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Item_func_regex::~Item_func_regex()
|
void Item_func_regex::cleanup()
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("Item_func_regex::cleanup");
|
||||||
|
Item_bool_func::cleanup();
|
||||||
if (regex_compiled)
|
if (regex_compiled)
|
||||||
{
|
{
|
||||||
regfree(&preg);
|
regfree(&preg);
|
||||||
regex_compiled=0;
|
regex_compiled=0;
|
||||||
}
|
}
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* USE_REGEX */
|
#endif /* USE_REGEX */
|
||||||
|
|
||||||
|
|
||||||
|
@ -869,7 +869,7 @@ class Item_func_regex :public Item_bool_func
|
|||||||
public:
|
public:
|
||||||
Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b),
|
Item_func_regex(Item *a,Item *b) :Item_bool_func(a,b),
|
||||||
regex_compiled(0),regex_is_const(0) {}
|
regex_compiled(0),regex_is_const(0) {}
|
||||||
~Item_func_regex();
|
void cleanup();
|
||||||
longlong val_int();
|
longlong val_int();
|
||||||
bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref);
|
bool fix_fields(THD *thd, struct st_table_list *tlist, Item **ref);
|
||||||
const char *func_name() const { return "regexp"; }
|
const char *func_name() const { return "regexp"; }
|
||||||
|
Reference in New Issue
Block a user