Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ae52de49
Commit
ae52de49
authored
May 18, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert fix for Bug #6048: it introduced new problems.
parent
d5ee2349
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
100 deletions
+24
-100
sql/item.cc
sql/item.cc
+4
-15
sql/item.h
sql/item.h
+2
-52
sql/sp_head.cc
sql/sp_head.cc
+15
-22
sql/sp_rcontext.cc
sql/sp_rcontext.cc
+3
-11
No files found.
sql/item.cc
View file @
ae52de49
...
...
@@ -307,14 +307,8 @@ Item::Item():
/* Put item in free list so that we can free all items at end */
THD
*
thd
=
current_thd
;
if
(
reused
)
next
=
reuse_next
;
else
{
next
=
thd
->
free_list
;
thd
->
free_list
=
this
;
}
next
=
thd
->
free_list
;
thd
->
free_list
=
this
;
/*
Item constructor can be called during execution other then SQL_COM
command => we should check thd->lex->current_select on zero (thd->lex
...
...
@@ -349,13 +343,8 @@ Item::Item(THD *thd, Item *item):
fixed
(
item
->
fixed
),
collation
(
item
->
collation
)
{
if
(
reused
)
next
=
reuse_next
;
else
{
next
=
thd
->
free_list
;
// Put in free list
thd
->
free_list
=
this
;
}
next
=
thd
->
free_list
;
// Put in free list
thd
->
free_list
=
this
;
}
...
...
sql/item.h
View file @
ae52de49
...
...
@@ -229,59 +229,9 @@ class Item {
Item
(
const
Item
&
);
/* Prevent use of these */
void
operator
=
(
Item
&
);
public:
/* For SP reuse mechanism */
bool
reused
;
size_t
reuse_slot_size
;
Item
*
reuse_next
;
static
void
*
operator
new
(
size_t
size
)
{
Item
*
me
=
(
Item
*
)
sql_alloc
((
uint
)
size
);
if
(
me
)
{
me
->
reuse_slot_size
=
size
;
me
->
reused
=
FALSE
;
}
return
(
void
*
)
me
;
}
static
void
*
operator
new
(
size_t
size
)
{
return
(
void
*
)
sql_alloc
((
uint
)
size
);
}
static
void
*
operator
new
(
size_t
size
,
MEM_ROOT
*
mem_root
)
{
Item
*
me
=
(
Item
*
)
alloc_root
(
mem_root
,
(
uint
)
size
);
if
(
me
)
{
me
->
reuse_slot_size
=
size
;
me
->
reused
=
FALSE
;
}
return
(
void
*
)
me
;
}
static
void
*
operator
new
(
size_t
size
,
MEM_ROOT
*
mem_root
,
Item
*
reuse
)
{
Item
*
me
;
if
(
!
reuse
||
size
>
reuse
->
reuse_slot_size
)
{
me
=
(
Item
*
)
alloc_root
(
mem_root
,
(
uint
)
size
);
if
(
me
)
{
me
->
reuse_slot_size
=
size
;
me
->
reused
=
FALSE
;
}
}
else
{
/* Reuse old item */
size_t
slot_size
=
reuse
->
reuse_slot_size
;
reuse
->
delete_self
();
me
=
reuse
;
me
->
reuse_slot_size
=
slot_size
;
/* For the constructor */
me
->
reuse_next
=
reuse
->
next
;
me
->
reused
=
TRUE
;
}
return
(
void
*
)
me
;
}
{
return
(
void
*
)
alloc_root
(
mem_root
,
(
uint
)
size
);
}
static
void
operator
delete
(
void
*
ptr
,
size_t
size
)
{
TRASH
(
ptr
,
size
);
}
static
void
operator
delete
(
void
*
ptr
,
MEM_ROOT
*
mem_root
)
{}
...
...
sql/sp_head.cc
View file @
ae52de49
...
...
@@ -131,9 +131,7 @@ sp_prepare_func_item(THD* thd, Item **it_addr)
** if nothing else.
*/
Item
*
sp_eval_func_item
(
THD
*
thd
,
Item
**
it_addr
,
enum
enum_field_types
type
,
MEM_ROOT
*
mem_root
,
Item
*
reuse
)
sp_eval_func_item
(
THD
*
thd
,
Item
**
it_addr
,
enum
enum_field_types
type
)
{
DBUG_ENTER
(
"sp_eval_func_item"
);
Item
*
it
=
sp_prepare_func_item
(
thd
,
it_addr
);
...
...
@@ -146,7 +144,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
/* QQ How do we do this? Is there some better way? */
if
(
type
==
MYSQL_TYPE_NULL
)
it
=
new
(
mem_root
,
reuse
)
Item_null
();
it
=
new
Item_null
();
else
{
switch
(
sp_map_result_type
(
type
))
{
...
...
@@ -157,12 +155,12 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
if
(
it
->
null_value
)
{
DBUG_PRINT
(
"info"
,
(
"INT_RESULT: null"
));
it
=
new
(
mem_root
,
reuse
)
Item_null
();
it
=
new
Item_null
();
}
else
{
DBUG_PRINT
(
"info"
,
(
"INT_RESULT: %d"
,
i
));
it
=
new
(
mem_root
,
reuse
)
Item_int
(
i
);
it
=
new
Item_int
(
i
);
}
break
;
}
...
...
@@ -173,7 +171,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
if
(
it
->
null_value
)
{
DBUG_PRINT
(
"info"
,
(
"REAL_RESULT: null"
));
it
=
new
(
mem_root
,
reuse
)
Item_null
();
it
=
new
Item_null
();
}
else
{
...
...
@@ -182,7 +180,7 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
uint8
decimals
=
it
->
decimals
;
uint32
max_length
=
it
->
max_length
;
DBUG_PRINT
(
"info"
,
(
"REAL_RESULT: %g"
,
d
));
it
=
new
(
mem_root
,
reuse
)
Item_float
(
d
);
it
=
new
Item_float
(
d
);
it
->
decimals
=
decimals
;
it
->
max_length
=
max_length
;
}
...
...
@@ -192,9 +190,9 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
{
my_decimal
value
,
*
val
=
it
->
val_decimal
(
&
value
);
if
(
it
->
null_value
)
it
=
new
(
mem_root
,
reuse
)
Item_null
();
it
=
new
Item_null
();
else
it
=
new
(
mem_root
,
reuse
)
Item_decimal
(
val
);
it
=
new
Item_decimal
(
val
);
#ifndef DBUG_OFF
char
dbug_buff
[
DECIMAL_MAX_STR_LENGTH
+
1
];
DBUG_PRINT
(
"info"
,
(
"DECIMAL_RESULT: %s"
,
dbug_decimal_as_string
(
dbug_buff
,
val
)));
...
...
@@ -210,16 +208,14 @@ sp_eval_func_item(THD *thd, Item **it_addr, enum enum_field_types type,
if
(
it
->
null_value
)
{
DBUG_PRINT
(
"info"
,
(
"default result: null"
));
it
=
new
(
mem_root
,
reuse
)
Item_null
();
it
=
new
Item_null
();
}
else
{
DBUG_PRINT
(
"info"
,(
"default result: %*s"
,
s
->
length
(),
s
->
c_ptr_quick
()));
it
=
new
(
mem_root
,
reuse
)
Item_string
(
thd
->
strmake
(
s
->
ptr
(),
s
->
length
()),
s
->
length
(),
it
->
collation
.
collation
);
it
=
new
Item_string
(
thd
->
strmake
(
s
->
ptr
(),
s
->
length
()),
s
->
length
(),
it
->
collation
.
collation
);
}
break
;
}
...
...
@@ -712,7 +708,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
for
(
i
=
0
;
i
<
params
&&
i
<
argcount
;
i
++
)
{
sp_pvar_t
*
pvar
=
m_pcont
->
find_pvar
(
i
);
Item
*
it
=
sp_eval_func_item
(
thd
,
argp
++
,
pvar
->
type
,
thd
->
mem_root
,
NULL
);
Item
*
it
=
sp_eval_func_item
(
thd
,
argp
++
,
pvar
->
type
);
if
(
it
)
nctx
->
push_item
(
it
);
...
...
@@ -827,8 +823,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
}
else
{
Item
*
it2
=
sp_eval_func_item
(
thd
,
li
.
ref
(),
pvar
->
type
,
thd
->
mem_root
,
NULL
);
Item
*
it2
=
sp_eval_func_item
(
thd
,
li
.
ref
(),
pvar
->
type
);
if
(
it2
)
nctx
->
push_item
(
it2
);
// IN or INOUT
...
...
@@ -1474,9 +1469,7 @@ sp_instr_set::exec_core(THD *thd, uint *nextp)
Item
*
it
;
int
res
;
it
=
sp_eval_func_item
(
thd
,
&
m_value
,
m_type
,
thd
->
mem_root
,
thd
->
spcont
->
get_item
(
m_offset
));
it
=
sp_eval_func_item
(
thd
,
&
m_value
,
m_type
);
if
(
!
it
)
res
=
-
1
;
else
...
...
@@ -1722,7 +1715,7 @@ sp_instr_freturn::exec_core(THD *thd, uint *nextp)
Item
*
it
;
int
res
;
it
=
sp_eval_func_item
(
thd
,
&
m_value
,
m_type
,
thd
->
mem_root
,
NULL
);
it
=
sp_eval_func_item
(
thd
,
&
m_value
,
m_type
);
if
(
!
it
)
res
=
-
1
;
else
...
...
sql/sp_rcontext.cc
View file @
ae52de49
...
...
@@ -43,11 +43,8 @@ sp_rcontext::sp_rcontext(uint fsize, uint hmax, uint cmax)
int
sp_rcontext
::
set_item_eval
(
uint
idx
,
Item
**
item_addr
,
enum_field_types
type
)
{
extern
Item
*
sp_eval_func_item
(
THD
*
thd
,
Item
**
it
,
enum_field_types
type
,
MEM_ROOT
*
mem_root
,
Item
*
reuse
);
THD
*
thd
=
current_thd
;
Item
*
it
=
sp_eval_func_item
(
thd
,
item_addr
,
type
,
thd
->
mem_root
,
NULL
);
extern
Item
*
sp_eval_func_item
(
THD
*
thd
,
Item
**
it
,
enum_field_types
type
);
Item
*
it
=
sp_eval_func_item
(
current_thd
,
item_addr
,
type
);
if
(
!
it
)
return
-
1
;
...
...
@@ -114,12 +111,7 @@ void
sp_rcontext
::
save_variables
(
uint
fp
)
{
while
(
fp
<
m_count
)
{
Item
*
it
=
m_frame
[
fp
];
m_frame
[
fp
++
]
=
NULL
;
// Prevent reuse
m_saved
.
push_front
(
it
);
}
m_saved
.
push_front
(
m_frame
[
fp
++
]);
}
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment