Commit 52124c33 authored by Sinisa@sinisa.nasamreza.org's avatar Sinisa@sinisa.nasamreza.org

Merge sinisa@bk-internal.mysql.com:/home/bk/mysql-5.0

into sinisa.nasamreza.org:/mnt/work/petica
parents aeb013b6 bf661081
Stored Procedures implemented 2003-12-10: Stored Procedures implemented 2004-01-29:
Summary of Not Yet Implemented:
- SQL statements using table (like SELECT, INSERT, UPDATE etc)
in FUNCTIONs
- External languages
- Access control
- Routine characteristics (mostly used for external languages)
- SQL-99 COMMIT (related to BEGIN/END)
- FOR-loops
- CASCADE/RESTRICT for ALTER and DROP
- ALTER/DROP METHOD (as it implies User Defined Types)
- SIGNAL and RESIGNAL, and UNDO handlers
Summary of what's implemented: Summary of what's implemented:
...@@ -29,6 +15,18 @@ Summary of what's implemented: ...@@ -29,6 +15,18 @@ Summary of what's implemented:
- SHOW DECLARE PROCEDURE/FUNCTION and SHOW PROCEDURE/FUNCTION STATUS - SHOW DECLARE PROCEDURE/FUNCTION and SHOW PROCEDURE/FUNCTION STATUS
Summary of Not Yet Implemented:
- SQL statements using tables (like SELECT, INSERT, UPDATE etc) in FUNCTIONs
- External languages
- Access control
- SQL-99 COMMIT (related to BEGIN/END)
- FOR-loops
- CASCADE/RESTRICT for ALTER and DROP
- ALTER/DROP METHOD (as it implies User Defined Types)
- SIGNAL and RESIGNAL, and UNDO handlers
List of what's implemented: List of what's implemented:
- CREATE PROCEDURE|FUNCTION name ( args ) characteristics body - CREATE PROCEDURE|FUNCTION name ( args ) characteristics body
...@@ -91,7 +89,7 @@ List of what's implemented: ...@@ -91,7 +89,7 @@ List of what's implemented:
context which makes sharing prepared SPs impossible. And, even when context which makes sharing prepared SPs impossible. And, even when
this is resolved, it's not necessarily the case that it will be faster this is resolved, it's not necessarily the case that it will be faster
than a cache per thread. A global cache requires locks, which might than a cache per thread. A global cache requires locks, which might
become a buttleneck. (It would save memory though.) become a bottleneck. (It would save memory though.)
- CONDITIONs and HANDLERs are implemented, but not the SIGNAL and - CONDITIONs and HANDLERs are implemented, but not the SIGNAL and
RESIGNAL statements. (It's unclear if these can be implemented.) RESIGNAL statements. (It's unclear if these can be implemented.)
The semantics of CONDITIONs is expanded to allow catching MySQL error The semantics of CONDITIONs is expanded to allow catching MySQL error
...@@ -102,6 +100,10 @@ List of what's implemented: ...@@ -102,6 +100,10 @@ List of what's implemented:
(NEXT, PRIOR, etc). Cursors are ASENSITIVE, READ-ONLY, non-SCROLLing. (NEXT, PRIOR, etc). Cursors are ASENSITIVE, READ-ONLY, non-SCROLLing.
(The additional syntax will be added for completeness, but for the (The additional syntax will be added for completeness, but for the
most part unsupported with the current underlying cursor mechanism.) most part unsupported with the current underlying cursor mechanism.)
N.B. The current implementation is temporary and only works within a
stored procedure, and may not perform well for very large result sets.
A "real" cursor implementation is under development; this will replace
the current one when it's finished.
- SHOW procedures and functions - SHOW procedures and functions
SHOW DECLARE PROCEDURE|FUNCTION <name> SHOW DECLARE PROCEDURE|FUNCTION <name>
......
...@@ -968,6 +968,16 @@ drop procedure bug2267_1| ...@@ -968,6 +968,16 @@ drop procedure bug2267_1|
drop procedure bug2267_2| drop procedure bug2267_2|
drop procedure bug2267_3| drop procedure bug2267_3|
drop procedure bug2267_4| drop procedure bug2267_4|
create procedure bug2227(x int)
begin
declare y float default 2.6;
declare z char(16) default "zzz";
select 1.3, x, y, 42, z;
end|
call bug2227(9)|
1.3 x y 42 z
1.3 9 2.6 42 zzz
drop procedure bug2227|
drop table if exists fac| drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)| create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned) create procedure ifac(n int unsigned)
......
...@@ -502,7 +502,6 @@ drop procedure sel2| ...@@ -502,7 +502,6 @@ drop procedure sel2|
delete from t1| delete from t1|
delete from t2| delete from t2|
# SELECT INTO local variables # SELECT INTO local variables
create procedure into_test(x char(16), y int) create procedure into_test(x char(16), y int)
begin begin
...@@ -1107,6 +1106,20 @@ drop procedure bug2267_2| ...@@ -1107,6 +1106,20 @@ drop procedure bug2267_2|
drop procedure bug2267_3| drop procedure bug2267_3|
drop procedure bug2267_4| drop procedure bug2267_4|
#
# BUG#2227
#
create procedure bug2227(x int)
begin
declare y float default 2.6;
declare z char(16) default "zzz";
select 1.3, x, y, 42, z;
end|
call bug2227(9)|
drop procedure bug2227|
# #
# Some "real" examples # Some "real" examples
......
...@@ -296,7 +296,10 @@ public: ...@@ -296,7 +296,10 @@ public:
inline void make_field(Send_field *field) inline void make_field(Send_field *field)
{ {
this_item()->make_field(field); Item *it= this_item();
it->set_name(m_name.str, m_name.length, system_charset_info);
it->make_field(field);
} }
inline Item_result result_type() const inline Item_result result_type() const
...@@ -318,6 +321,11 @@ public: ...@@ -318,6 +321,11 @@ public:
{ {
str->append(m_name.str, m_name.length); str->append(m_name.str, m_name.length);
} }
inline bool send(Protocol *protocol, String *str)
{
return this_item()->send(protocol, str);
}
}; };
......
...@@ -94,8 +94,14 @@ sp_eval_func_item(THD *thd, Item *it, enum enum_field_types type) ...@@ -94,8 +94,14 @@ sp_eval_func_item(THD *thd, Item *it, enum enum_field_types type)
} }
else else
{ {
/* There's some difference between Item::new_item() and the
* constructor; the former crashes, the latter works... weird. */
uint8 decimals= it->decimals;
uint32 max_length= it->max_length;
DBUG_PRINT("info", ("REAL_RESULT: %g", d)); DBUG_PRINT("info", ("REAL_RESULT: %g", d));
it= new Item_real(it->val()); it= new Item_real(it->val());
it->decimals= decimals;
it->max_length= max_length;
} }
break; break;
} }
...@@ -271,6 +277,12 @@ sp_head::execute(THD *thd) ...@@ -271,6 +277,12 @@ sp_head::execute(THD *thd)
int ret= 0; int ret= 0;
uint ip= 0; uint ip= 0;
#ifndef EMBEDDED_LIBRARY
if (check_stack_overrun(thd, olddbptr))
{
DBUG_RETURN(-1);
}
#endif
if (olddbptr) if (olddbptr)
{ {
uint i= 0; uint i= 0;
......
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