Commit graph

756 commits

Author SHA1 Message Date
unknown
ed44a2ee51 Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint


client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/t/union.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/func_group.result:
  Merge manually
mysql-test/t/func_group.test:
  Merge manually
2006-08-03 09:32:58 +02:00
unknown
e44e344cac Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge


sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/r/sp.result:
  Manual merge.
mysql-test/r/udf.result:
  Manual merge.
mysql-test/t/sp.test:
  Manual merge.
mysql-test/t/udf.test:
  Manual merge.
2006-08-02 21:54:10 +04:00
unknown
1150869c4a item_func.h, item_func.cc, sql_select.cc, item.h:
Post review changes for bug#19862.


sql/sql_select.cc:
  Post review changes for bug#19862.
sql/item_func.h:
  Post review changes for bug#19862.
sql/item_func.cc:
  Post review changes for bug#19862.
sql/item.h:
  Post review changes for bug#19862.
2006-07-26 21:36:03 +04:00
unknown
9a63adc8fd Fixed bug#19862: Sort with filesort by function evaluates function twice
When there is no index defined filesort is used to sort the result of a
query. If there is a function in the select list and the result set should be
ordered by it's value then this function will be evaluated twice. First time to
get the value of the sort key and second time to send its value to a user.
This happens because filesort when sorts a table remembers only values of its
fields but not values of functions.
All functions are affected. But taking into account that SP and UDF functions
can be both expensive and non-deterministic a temporary table should be used 
to store their results and then sort it to avoid twice SP evaluation and to 
get a correct result.

If an expression referenced in an ORDER clause contains a SP or UDF 
function, force the use of a temporary table.

A new Item_processor function called func_type_checker_processor is added
to check whether the expression contains a function of a particular type.


mysql-test/t/udf.test:
  Added test case for bug#19862: Sort with filesort by function evaluates function twice
mysql-test/t/sp.test:
  Added test case for bug#19862: Sort with filesort by function evaluates function twice
mysql-test/r/sp.result:
  Added test case for bug#19862: Sort with filesort by function evaluates function twice
mysql-test/r/udf.result:
  Added test case for bug#19862: Sort with filesort by function evaluates function twice
sql/sql_select.cc:
  Fixed bug#19862: Sort with filesort by function evaluates function twice
  If an expression referenced in an ORDER clause contains a SP or UDF
  function, force the use of a temporary table.
sql/item_func.h:
  Fixed bug#19862: Sort with filesort by function evaluates function twice
  A new Item_processor function called func_type_checker_processor is added
  to check whether the expression contains a function of a particular type.
sql/item.h:
  Fixed bug#19862: Sort with filesort by function evaluates function twice
  A new Item_processor function called func_type_checker_processor is added
  to check whether the expression contains a function of a particular type.
sql/item_func.cc:
  Fixed bug#19862: Sort with filesort by function evaluates function twice
  A new Item_processor function called func_type_checker_processor is added
  to check whether the expression contains a function of a particular type.
2006-07-26 00:31:29 +04:00
unknown
22a963080b Merge neptunus.(none):/home/msvensson/mysql/bug7498/my50-bug7498
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint


sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
2006-07-20 13:41:50 +02:00
unknown
51dddb3ad1 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug18630


sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_trigger.cc:
  Auto merged
2006-07-13 17:21:44 +04:00
unknown
06bf59ad33 Bug#18630: Arguments of suid routine calculated in wrong security
context.

Routine arguments were evaluated in the security context of the routine
itself, not in the caller's context.

The bug is fixed the following way:

  - Item_func_sp::find_and_check_access() has been split into two
    functions: Item_func_sp::find_and_check_access() itself only
    finds the function and check that the caller have EXECUTE privilege
    on it.  New function set_routine_security_ctx() changes security
    context for SUID routines and checks that definer have EXECUTE
    privilege too.

  - new function sp_head::execute_trigger() is called from
    Table_triggers_list::process_triggers() instead of
    sp_head::execute_function(), and is effectively just as the
    sp_head::execute_function() is, with all non-trigger related code
    removed, and added trigger-specific security context switch.

  - call to Item_func_sp::find_and_check_access() stays outside
    of sp_head::execute_function(), and there is a code in
    sql_parse.cc before the call to sp_head::execute_procedure() that
    checks that the caller have EXECUTE privilege, but both
    sp_head::execute_function() and sp_head::execute_procedure() call
    set_routine_security_ctx() after evaluating their parameters,
    and restore the context after the body is executed.


mysql-test/r/sp-security.result:
  Add test case for bug#18630: Arguments of suid routine calculated
  in wrong security context.
mysql-test/t/sp-security.test:
  Add result for bug#18630: Arguments of suid routine calculated
  in wrong security context.
sql/item_func.cc:
  Do not change security context before executing the function, as it
  will be changed after argument evaluation.
  Do not change security context in Item_func_sp::find_and_check_access().
sql/item_func.h:
  Change prototype for Item_func_sp::find_and_check_access().
sql/sp_head.cc:
  Add set_routine_security_ctx() function.
  Add sp_head::execute_trigger() method.
  Change security context in sp_head::execute_trigger(), and in
  sp_head::execute_function() and sp_head::execute_procedure()
  after argument evaluation.
  Move pop_all_cursors() call to sp_head::execute().
sql/sp_head.h:
  Add declaration for sp_head::execute_trigger() and
  set_routine_security_ctx().
sql/sql_parse.cc:
  Do not change security context before executing the procedure, as it
  will be changed after argument evaluation.
sql/sql_trigger.cc:
  Call new sp_head::execute_trigger() instead of
  sp_head::execute_function(), which is responsible to switch
  security context.
2006-07-13 17:12:31 +04:00
unknown
46079624e2 Fix compiler warnings in sql_udf.h: ISO C++ forbids casting
between pointer to function and pointer to object.


sql/item_func.cc:
  Use typedef names instead of hard-coded types for udf init/deinit
  functions.
sql/sql_udf.cc:
  Use typedef names for udf function types.
2006-07-09 13:03:51 +04:00
unknown
d9cb536a55 BUG#20769: Dangling pointer in ctype_recoding test case.
In some functions dealing with strings and character sets, the wrong
pointers were saved for restoration in THD::rollback_item_tree_changes().
This could potentially cause random corruption or crashes.

Fixed by passing the original Item ** locations, not local stack copies.

Also remove unnecessary use of default arguments.


sql/item.cc:
  Function agg_item_charsets() now handles non-consequtive Item *'s.
sql/item.h:
  Remove use of default argument.
sql/item_cmpfunc.cc:
  Remove use of default argument.
sql/item_func.cc:
  Remove use of default argument.
sql/item_func.h:
  Function agg_item_charsets() now handles non-consequtive Item *'s.
sql/item_strfunc.cc:
  Pass original Item **'s to agg_arg_charsets(), not local copies, to ensure
  proper restoration in THD::rollback_item_tree_changes().
sql/item_sum.cc:
  Remove use of default argument.
2006-06-30 09:26:36 +02:00
unknown
3796e37c72 Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/usr/home/ram/work/mysql-5.0


sql/item_func.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
2006-06-16 16:43:44 +05:00
unknown
dd285aac1b after-merge fixes.
mysql-test/r/rpl_log.result:
  after-merge fix.
sql/ha_archive.cc:
  after-merge fix.
sql/item_func.cc:
  after-merge fix.
sql/sql_class.cc:
  after-merge fix.
sql/sql_class.h:
  after-merge fix.
2006-06-16 14:05:58 +05:00
unknown
710abe5390 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0


mysql-test/r/ctype_sjis.result:
  Auto merged
mysql-test/t/ctype_sjis.test:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
2006-06-16 10:01:13 +02:00
unknown
64c856c939 Bug#14708: Inconsistent treatment of NULLs in LEFT JOINed FULLTEXT matching without index
Don't rely on table->null_row when no index is used - it may be a multi-table search
2006-06-16 09:49:18 +02:00
unknown
f067dfe1c6 Bug #7498 User variable SET saves SIGNED BIGINT as UNSIGNED BIGINT
- Add unsigned flag to user_var_entry, used when 'type' is INT_RESULT
- Propagate unsigned flag from the query executed by Item_single_row_subselect


mysql-test/r/user_var.result:
  Update test results
mysql-test/t/user_var.test:
  Add test case
sql/item_func.cc:
  Add unsigned_flag to user_var_entry. Used when 'type' is INT_RESULT
  Pass unsigned_flag to 'update_hash' if type is INT_RESULT
sql/item_func.h:
  Removed unused variable save_buff
  Add parameter unsigned_arg to 'update_hash'
sql/item_subselect.cc:
  Propagate unsigned_flag to Item_singlerow_subselect from the items in the select to the cached items.
sql/sql_class.h:
  Add unsigned_flag to user_var_entry. Used when 'type' is INT_RESULT
2006-06-09 19:35:54 +02:00
unknown
1c6beaee06 Fixed bug#19077: A nested materialized derived table is used before being populated.
The convert_constant_item() function converts constant items to ints on
prepare phase to optimize execution speed. In this case it tries to evaluate
subselect which contains a derived table and is contained in a derived table. 
All derived tables are filled only after all derived tables are prepared.
So evaluation of subselect with derived table at the prepare phase will
return a wrong result.

A new flag with_subselect is added to the Item class. It indicates that
expression which this item represents is a subselect or contains a subselect.
It is set to 0 by default. It is set to 1 in the Item_subselect constructor
for subselects.
For Item_func and Item_cond derived classes it is set after fixing any argument
in Item_func::fix_fields() and Item_cond::fix_fields accordingly.
The convert_constant_item() function now doesn't convert a constant item
if the with_subselect flag set in it. 


mysql-test/t/view.test:
  Added test case for bug#19077: A nested materialized derived table is used before being populated.
mysql-test/t/subselect.test:
  Added test case for bug#19077: A nested materialized derived table is used before being populated.
mysql-test/r/view.result:
  Added test case for bug#19077: A nested materialized derived table is used before being populated.
mysql-test/r/subselect.result:
  Added test case for bug#19077: A nested materialized derived table is used before being populated.
sql/item_subselect.cc:
  Fixed bug#19077: A nested materialized derived table is used before being populated.
  The Item_subselect class constructor sets new with_subselect flag to 1.
sql/item_func.cc:
  Fixed bug#19077: A nested materialized derived table is used before being populated.
  
  The Item_func::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments.
sql/item_cmpfunc.cc:
  Fixed bug#19077: A nested materialized derived table is used before being populated.
  The convert_constant_item() function now doesn't convert a constant item
  with the with_subselect flag set.
  The Item_cond::fix_fields() sets new with_subselect flag from with_subselect flags of its arguments.
sql/item.cc:
  Fixed bug#19077: A nested materialized derived table is used before being populated.
  Set new with_subselect flag to default value - 0 in the Item constructor.
sql/item.h:
  Fixed bug#19077: A nested materialized derived table is used before being populated.
  A new flag with_subselect is added to the Item class. It indicates that
  expression which this item represents is a subselect or contains a subselect.
  It is set to 0 by default.
2006-05-18 00:55:28 +04:00
unknown
798e910bad After-merge fixes; some function signatures changed from Item * to Item **.
sql/item.cc:
  After-merge fixes.
sql/item.h:
  After-merge fixes.
sql/item_func.cc:
  After-merge fixes.
sql/item_func.h:
  After-merge fixes.
sql/sp_head.cc:
  After-merge fixes.
2006-05-15 19:57:10 +02:00
unknown
2ce5e54e0a Merge mysql.com:/opt/local/work/mysql-5.0-root
into  mysql.com:/opt/local/work/mysql-5.0-runtime-merge


mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/im_options_set.result:
  Auto merged
mysql-test/r/im_options_unset.result:
  Auto merged
mysql-test/r/trigger-grant.result:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2006-05-15 00:51:12 +04:00
unknown
afe2520ecf Bug#14635: Accept NEW.x as INOUT parameters to stored procedures
from within triggers

Add support for passing NEW.x as INOUT and OUT parameters to stored
procedures.  Passing NEW.x as INOUT parameter requires SELECT and
UPDATE privileges on that column, and passing it as OUT parameter
requires only UPDATE privilege.


mysql-test/r/sp-error.result:
  Update the result for new message.
mysql-test/r/trigger-grant.result:
  Add result for bug#14635.
mysql-test/r/trigger.result:
  Add result for bug#14635.
mysql-test/t/trigger-grant.test:
  Add test case for bug#14635.
mysql-test/t/trigger.test:
  Add test case for bug#14635.
sql/item.cc:
  Add implementations of set_value() and set_required_privilege() methods
  of Settable_routine_parameter interface.
  
  Use Item_trigger_field::want_privilege instead of
  Item_trigger_field::access_type.
  
  Reset privileges on Item_trigger_field::cleanup().
sql/item.h:
  Add interface class Settable_routine_parameter and interface query
  method to Item class.  Item_splocal and Item_trigger_field implement
  this interface.
  
  For Item_trigger_field:
   - add read_only attribute and is_read_only() method.
   - remove access_type and add original_privilege and want_privilege
     instead.
   - add set_value() method.
   - add reset_privilege() method.
sql/item_func.cc:
  Add implementations of set_value() method of Settable_routine_parameter
  interface.
sql/item_func.h:
  Item_func_get_user_var implements Settable_routine_parameter interface.
sql/share/errmsg.txt:
  Update english ER_SP_NOT_VAR_ARG message.
sql/sp_head.cc:
  Use Settable_routine_parameter interface for parameter update.
sql/sql_yacc.yy:
  Set read_only and want_privilege members in Item_trigger_field
  appropriately.  For NEW.x trigger variable used in left-hand-side
  of SET statement the latter is set to UPDATE_ACL, otherwise it is
  set to SELECT_ACL (but see Item_trigger_field::set_required_privilege(),
  where it may be updated to different value).
2006-05-12 13:55:21 +04:00
unknown
24a0b385fb Fix for BUG#18587: Function that accepts and returns TEXT
garbles data if longer than 766 chars.

The problem is that a stored routine returns BLOBs to the previous
caller, BLOBs are shallow-copied (i.e. only pointers to the data are
copied). The fix is to also copy data of BLOBs.


mysql-test/r/sp.result:
  Updated result file.
mysql-test/t/sp.test:
  Added a test case for BUG#18587.
sql/field_conv.cc:
  Do not jump to optimization if the field type is BLOB and
  the destination table requires copying of BLOBs.
sql/item_func.cc:
  Request copying BLOBs for the result table.
2006-05-10 23:16:30 +04:00
unknown
c7e2527c9a Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0


sql/item_func.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
2006-05-09 10:44:19 +02:00
unknown
048469eb79 Merge mysql.com:/usr_rh9/home/elkin.rh9/4.1
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/5.0-bug19136


sql/item_func.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
mysql-test/r/rpl_user_variables.result:
  manual merge use local
mysql-test/t/rpl_user_variables.test:
  manual merge use version 5.0's "show binlog events from 98"
2006-05-07 16:02:55 +03:00
unknown
ce6a2d32b3 Merge mysql.com:/usr_rh9/home/elkin.rh9/MySQL/BARE/4.1
into  mysql.com:/usr_rh9/home/elkin.rh9/MySQL/FIXES/4.1-bug19136_unass_user_var


sql/item_func.cc:
  Auto merged
2006-05-07 11:43:27 +03:00
unknown
77b7a71dd4 Merge mysql.com:/home/tomash/src/mysql_ab/tmp_merge
into  mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-merge


mysql-test/r/func_misc.result:
  Manual merge of the fix for bug#16501.
mysql-test/t/func_misc.test:
  Manual merge of the fix for bug#16501.
sql/item_func.cc:
  Manual merge of the fix for bug#16501.
sql/sql_acl.cc:
  For the fix of bug#16372, use local version, since the fix for 5.0 is
  different, and will go in separate ChangeSet.
2006-05-06 11:18:42 +04:00
unknown
4ab4631b06 Bug#19136: Crashing log-bin and uninitialized user variables in a derived table
The reason of the bug is in that `get_var_with_binlog' performs missed
assingment of
the variables as side-effect. Doing that it eventually calls
`free_underlaid_joins' to pass as an argument `thd->lex->select_lex' of the lex
which belongs to the user query, not 
to one which is emulated i.e SET @var1:=NULL.


`get_var_with_binlog' is refined to supply a temporary lex to sql_set_variables's stack.


mysql-test/r/rpl_user_variables.result:
  results changed
mysql-test/t/rpl_user_variables.test:
  a problematic query to be binlogged is added
sql/item_func.cc:
  BUG#19136: Crashing log-bin and uninitialized user variables
  
  The reason of the bug is in that how `get_var_with_binlog' performs missed
  assingment of the variables: `free_underlaid_joins' gets as an argument `thd->lex->select_lex'
  which belongs to the user query, not to one which is emulated i.e SET @var1:=NULL.
  
  `get_var_with_binlog' is refined to supply a temporary lex to sql_set_variables's stack.
2006-05-05 11:21:21 +03:00
unknown
d0ed411f79 Fix small bug in udf_example.cc, it was processing one char too much and thus returning junk
Add more DBUG_PRINT's in udf_handler::val_str
Enable udf.test


mysql-test/t/disabled.def:
  Enable udf.test
sql/item_func.cc:
  Add DBUG_ printouts for easier debugging of installed udf's
sql/udf_example.cc:
  Bug fix, break for loop when "n < n_end"
2006-04-28 11:37:20 +02:00
unknown
8d52b8a6b7 Merge mysql.com:/home/jimw/my/mysql-5.0-12792
into  mysql.com:/home/jimw/my/mysql-5.0-clean


sql/item_func.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
mysql-test/r/variables.result:
  Resolve conflict
mysql-test/t/variables.test:
  Resolve conflict
2006-04-26 11:39:48 -07:00
unknown
9fc25141a2 Bug#16501: IS_USED_LOCK does not appear to work
Update User_level_lock::thread_id on acquiring an existing lock,
and reset it on lock release.


mysql-test/r/func_misc.result:
  Add result for bug#16501.
mysql-test/t/func_misc.test:
  Add test case for bug#16501.
sql/item_func.cc:
  Update User_level_lock::thread_id on acquiring an existing lock,
  and reset it on lock release (for safety).
2006-04-24 18:06:43 +04:00
unknown
4e5bed78df Bug #12792: @@system_time_zone is not SELECTable
Bug #15684: @@version_* are not all SELECTable

  Added the appropriate information as read-only system variables, and
  also removed some special-case handling of @@version along the way.

  @@version_bdb was added, but isn't included in the test because it
  depends on the presence of BDB.


mysql-test/r/variables.result:
  Update results
mysql-test/t/variables.test:
  Fix error from setting @@version, reset sql_select_limit to avoid confusion
  in later tests, and add new regression tests.
sql/item_func.cc:
  Remove special-case handling of VERSION, it's just a read-only server
  variable like the others now.
sql/set_var.cc:
  Add system_time_zone and various version-related system variables
2006-04-20 21:56:53 -07:00
unknown
c7cd7951cf Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into  mysql.com:/home/dlenev/mysql-5.0-bg16021


sql/item_func.cc:
  Auto merged
2006-04-19 19:35:32 +04:00
unknown
750bc26998 Merge mysql.com:/extern/mysql/bk/mysql-5.0-runtime
into  mysql.com:/extern/mysql/5.0/bug18787/mysql-5.0-runtime


mysql-test/r/sp.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/item_func.cc:
  Auto merged
2006-04-18 11:20:18 +02:00
unknown
d9142f992e Post-review fix for BUG#18787. Renamed a local variable in
Item_func_sp::tmp_table_field() to something more descriptive.


sql/item_func.cc:
  Renamed local variable 'res' to 'field' in Item_func_sp::tmp_table_field(),
  because it is.
2006-04-18 11:16:39 +02:00
unknown
8dc06e0f06 Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into  sanja.is.com.ua:/home/bell/mysql/bk/work-5.0


sql/item_func.cc:
  Auto merged
2006-04-14 02:02:28 +03:00
unknown
1cc27df05d Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into  sanja.is.com.ua:/home/bell/mysql/bk/work-5.0


BitKeeper/deleted/.del-acinclude.m4~f4ab416bac5003:
  Auto merged
configure.in:
  Auto merged
mysql-test/r/func_op.result:
  Auto merged
sql/item_func.cc:
  Auto merged
2006-04-13 15:07:50 +03:00
unknown
a2066982f1 Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was
used

In a simple queries a result of the GROUP_CONCAT() function was always of 
varchar type.
But if length of GROUP_CONCAT() result is greater than 512 chars and temporary
table is used during select then the result is converted to blob, due to
policy to not to store fields longer than 512 chars in tmp table as varchar
fields.

In order to provide consistent behaviour, result of GROUP_CONCAT() now
will always be converted to blob if it is longer than 512 chars.
Item_func_group_concat::field_type() is modified accordingly.


mysql-test/t/func_gconcat.test:
  Added test case for bug#14169: type of group_concat() result changed to blob if tmp_table was used
mysql-test/r/func_gconcat.result:
  Added test case for bug#14169: type of group_concat() result changed to blob if tmp_table was used
sql/unireg.h:
  Added the CONVERT_IF_BIGGER_TO_BLOB constant
sql/sql_select.cc:
  Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
  The unnamed constant 255 in the create_tmp_field() and create_tmp_field_from_item() functions now defined as the CONVERT_IF_BIGGER_TO_BLOB constant.
  The create_tmp_field() function now converts the Item_sum string result to a blob field based on its char length.
sql/item_sum.h:
  Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
  To the Item_func_group_concat calls added the member function field_type() which returns the BLOB or VAR_STRING type based on the items length.
sql/item_func.cc:
  Fixed bug#14169: type of group_concat() result changed to blob if tmp_table was used
  In the Item_func::tmp_table_field() function the unnamed constant 255 is changed to the CONVERT_IF_BIGGER_TO_BLOB constant.
  The Item_func::tmp_table_field() function now measures the result length in chars rather than bytes when converting string result to a blob.
2006-04-12 23:05:38 +04:00
unknown
886a35bd82 Bug#16461: connection_id() does not work properly inside trigger
CONNECTION_ID() was implemented as a constant Item, i.e. an instance of
Item_static_int_func class holding value computed at creation time.
Since Items are created on parsing, and trigger statements are parsed
on table open, the first connection to open a particular table would
effectively set its own CONNECTION_ID() inside trigger statements for
that table.

Re-implement CONNECTION_ID() as a class derived from Item_int_func, and
compute connection_id on every call to fix_fields().


mysql-test/r/trigger.result:
  Add result for bug#16461.
mysql-test/t/trigger.test:
  Add test case for bug#16461.
sql/item.cc:
  Remove now unused class Item_static_int_func.
sql/item.h:
  Remove now unused class Item_static_int_func.
sql/item_create.cc:
  Use new implementation of CONNECTION_ID().
sql/item_func.cc:
  Re-implement CONNECTION_ID() as Item_func_connection_id
  (was Item_static_int_func).  Set max_length to 10, as it was before.
  Compute connection_id dynamically on every call to fix_fields().
sql/item_func.h:
  Re-implement CONNECTION_ID() as Item_func_connection_id
  (was Item_static_int_func).
2006-04-12 19:31:00 +04:00
unknown
9381c8a089 Fixed BUG#18787: Server crashed when calling a stored procedure containing
a misnamed function
  ... in the presence of a continue handler. The problem was that with a
  handler, it continued to execute as if function existed and had set a
  useful return value (which it hadn't).
  The fix is to set a null return value and do an error return when a function
  wasn't found.


mysql-test/r/sp.result:
  Updated results for a new test case (BUG#18787).
mysql-test/t/sp.test:
  New testcase for BUG#18787.
sql/item_func.cc:
  Don't set "out of resources" error in Item_func_sp::execute() if no
  result field is returned, it's simply wrong, it can be sometthing else,
  like a function not found. Instead set null_value and return error.
  Also, set "out of resources" when field creation fails in
  Item_func_sp::sp_result_field() and Item_func_sp::tmp_table_field().
2006-04-11 12:17:57 +02:00
unknown
974752bc1e Merge mysql.com:/usr/home/ram/work/mysql-4.0
into  mysql.com:/usr/home/ram/work/mysql-4.1


mysql-test/r/func_op.result:
  Auto merged
sql/item_func.cc:
  Auto merged
mysql-test/t/func_op.test:
  SCCS merged
2006-04-11 13:53:44 +05:00
unknown
2711b9d5de Remove DBUG print that looks at args[0] even if arg_count is 0 2006-03-23 21:45:00 +01:00
unknown
6219f23b94 Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/bug11835/my50-bug11835


client/mysqltest.c:
  Auto merged
configure.in:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sql_udf.cc:
  Auto merged
2006-03-20 21:35:05 +01:00
unknown
6ea2c3cd57 Fix for bug #17615: invalid handling of function results in UPDATE...SET statement.
sql/item_func.cc:
  Fix for bug #17615: invalid handling of function results in UPDATE...SET statement.
  - set proper collation
2006-03-02 15:05:55 +04:00
unknown
79258e4480 Bug#17261 Passing a variable from a stored procedure to UDF crashes mysqld
- Pass "buffers[i]" to val_str() in udf_handler::fix_fields insteead of NULL.
 - Add testcase for UDF that will load and run the udf_example functions 
   if available


sql/item_func.cc:
  Instead of passing a NULL pointer into val_str, use the "buffers" array to provide a temp string buffer.
sql/udf_example.cc:
  Spelling error"on"->"one"
mysql-test/include/have_udf.inc:
  New BitKeeper file ``mysql-test/include/have_udf.inc''
mysql-test/r/have_udf.require:
  New BitKeeper file ``mysql-test/r/have_udf.require''
mysql-test/r/udf.result:
  New BitKeeper file ``mysql-test/r/udf.result''
mysql-test/t/udf.test:
  New BitKeeper file ``mysql-test/t/udf.test''
2006-02-15 17:11:24 +01:00
unknown
c9bb7e1f02 item_func.cc:
fix for bug#8461

  BUG 8461 - TRUNCATE returns incorrect result if 2nd argument is negative
  Reason: Both TRUNCATE/ROUND converts INTEGERS to DOUBLE and back to INTEGERS
  Changed the integer routine to work on integers only.
  This bug affects 4.1, 5.0 and 5.1
  Fixing in 4.1 will need to change the routine to handle different types individually.
  5.0 did had different routines for different types already just the INTEGER routine was bad.


sql/item_func.cc:
  fix for bug#8461
  BUG 8461 - TRUNCATE returns incorrect result if 2nd argument is negative
  Reason: TRUNCATE converts INTEGERS to DOUBLE and back to INTEGERS
  Both ROUND and TRUNCATE are affected by this.
  Changed the integer routine to work on integers only.
  This bug affects 4.1 5,0 and 5
  Fixing in 4.1 will need to change the routine to handle different types individually.
2006-02-07 13:26:35 +01:00
unknown
494bccf044 Merging
mysql-test/ndb/ndbcluster.sh:
  Auto merged
mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/t/func_math.test:
  Auto merged
mysql-test/t/type_float.test:
  Auto merged
sql/spatial.h:
  Auto merged
mysql-test/r/type_float.result:
  merging
sql/item_func.cc:
  merging
2006-01-21 18:50:06 +04:00
unknown
32fc680089 Merge hf@192.168.21.12:work/mysql-4.1.9855
into eagle.intranet.mysql.r18.ru:/home/hf/work/mysql-4.1.mrg


sql/item_func.cc:
  Auto merged
2006-01-21 17:53:29 +04:00
unknown
c489cdebea merged
myisam/mi_delete.c:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_db.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
2006-01-03 18:12:03 +01:00
unknown
307c0b77a1 many warnings (practically safe but annoying) corrected
client/mysqladmin.cc:
  don't use the handler after it's closed
client/mysqlbinlog.cc:
  memory leak
client/mysqldump.c:
  many "ignore return value" warnings, one "NULL dereference"
cmd-line-utils/libedit/history.c:
  memory leak
include/my_base.h:
  cleanup
libmysql/libmysql.c:
  "return value ignored" warning
myisam/mi_delete.c:
  "return value ignored" warning
myisam/myisampack.c:
  "out-of-bound access" warning
myisam/sort.c:
  "double free" warning
mysys/default_modify.c:
  "double free" warning
mysys/mf_iocache2.c:
  "return value ignored" warnings
mysys/my_bitmap.c:
  s/return/DBUG_RETURN/
mysys/my_error.c:
  memory leak
server-tools/instance-manager/parse.cc:
  "NULL dereference" warning
sql-common/client.c:
  "NULL dereference" warning
sql/field.cc:
  deadcode, "NULL dereference", "uninitialized" warnings
sql/field.h:
  unused parameters removed from constructor
sql/ha_myisam.cc:
  "return value ignored" warnings
sql/item.cc:
  "return value ignored" warnings
  changed constructor
sql/item_func.cc:
  "return value ignored" warnings
sql/log_event.cc:
  uninitialized warning
sql/opt_range.cc:
  "double free" and uninitialized warnings
sql/opt_range.h:
  "return value ignored" warning
sql/repl_failsafe.cc:
  "return value ignored" warning
sql/set_var.cc:
  "return value ignored" warning
sql/slave.cc:
  "return value ignored" warnings
sql/slave.h:
  new prototype
sql/sql_acl.cc:
  deadcode and "NULL dereference" warnings
sql/sql_db.cc:
  "return value ignored" warning
sql/sql_handler.cc:
  "NULL dereference" warning
sql/sql_help.cc:
  "NULL dereference" warning
sql/sql_insert.cc:
  "return value ignored" warning
sql/sql_parse.cc:
  "return value ignored" warning
  one more DBUG_ASSERT
sql/sql_repl.cc:
  "return value ignored" and memory leak warnings
sql/sql_show.cc:
  "return value ignored" and "NULL dereference"  warnings
sql/sql_test.cc:
  "return value ignored" warning
sql/table.cc:
  memory leak
sql/uniques.cc:
  "return value ignored" warning
  endspaces deleted
2006-01-03 17:54:54 +01:00
unknown
53f8fed437 Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2


sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2005-12-10 23:31:03 -08:00
unknown
6b2f13098a Patch for WL#2894: Make stored routine variables work
according to the standard.

The idea is to use Field-classes to implement stored routines
variables. Also, we should provide facade to Item-hierarchy
by Item_field class (it is necessary, since SRVs take part
in expressions).

The patch fixes the following bugs:
  - BUG#8702: Stored Procedures: No Error/Warning shown for inappropriate data 
    type matching; 
 
  - BUG#8768: Functions: For any unsigned data type, -ve values can be passed 
    and returned; 
 
  - BUG#8769: Functions: For Int datatypes, out of range values can be passed 
    and returned; 
 
  - BUG#9078: STORED PROCDURE: Decimal digits are not displayed when we use 
    DECIMAL datatype; 
 
  - BUG#9572: Stored procedures: variable type declarations ignored; 
 
  - BUG#12903: upper function does not work inside a function; 
 
  - BUG#13705: parameters to stored procedures are not verified; 
 
  - BUG#13808: ENUM type stored procedure parameter accepts non-enumerated
    data; 
 
  - BUG#13909: Varchar Stored Procedure Parameter always BINARY string (ignores 
    CHARACTER SET); 
 
  - BUG#14161: Stored procedure cannot retrieve bigint unsigned;

  - BUG#14188: BINARY variables have no 0x00 padding;

  - BUG#15148: Stored procedure variables accept non-scalar values;


mysql-test/r/ctype_ujis.result:
  Explicitly specify correct charset.
mysql-test/r/schema.result:
  Drop our test database to not affect this test if some test
  left it cause of failure.
mysql-test/r/show_check.result:
  Drop our test database to not affect this test if some test
  left it cause of failure.
mysql-test/r/skip_name_resolve.result:
  Ignore columns with unpredictable values.
mysql-test/r/sp-big.result:
  Add cleanup statement.
mysql-test/r/sp-dynamic.result:
  Add cleanup statements.
mysql-test/r/sp.result:
  Update result file.
mysql-test/r/sum_distinct-big.result:
  Update result file.
mysql-test/r/type_newdecimal-big.result:
  Update result file.
mysql-test/t/ctype_ujis.test:
  Explicitly specify correct charset.
mysql-test/t/schema.test:
  Drop our test database to not affect this test if some test
  left it cause of failure.
mysql-test/t/show_check.test:
  Drop our test database to not affect this test if some test
  left it cause of failure.
mysql-test/t/skip_name_resolve.test:
  Ignore columns with unpredictable values.
mysql-test/t/sp-big.test:
  Add cleanup statement.
mysql-test/t/sp-dynamic.test:
  Add cleanup statements.
mysql-test/t/sp.test:
  Non-scalar values prohibited for assignment to SP-vars;
  polishing.
mysql-test/t/type_newdecimal-big.test:
  Update type specification so that the variables
  can contain the large values used in the test.
sql/field.cc:
  Extract create_field::init() to initialize an existing
  instance of create_field from new_create_field().
sql/field.h:
  Extract create_field::init() to initialize an existing
  instance of create_field from new_create_field().
sql/item.cc:
  - Introduce a new class: Item_sp_variable -- a base class
    of stored-routine-variables classes;
  - Introduce Item_case_expr -- an Item, which is used to access
    to the expression of CASE statement;
sql/item.h:
  - Introduce a new class: Item_sp_variable -- a base class
    of stored-routine-variables classes;
  - Introduce Item_case_expr -- an Item, which is used to access
    to the expression of CASE statement;
sql/item_func.cc:
  Pass the Field (instead of Item) for the return value of
  a function to the function execution routine.
sql/item_func.h:
  Pass the Field (instead of Item) for the return value of
  a function to the function execution routine.
sql/mysql_priv.h:
  Move create_virtual_tmp_table() out of sql_select.h.
sql/sp.cc:
  Use create_result_field() instead of make_field().
sql/sp_head.cc:
  - Add a function to map enum_field_types to Item::Type;
  - Add sp_instr_push_case_expr instruction -- an instruction
    to push CASE expression into the active running context;
  - Add sp_instr_pop_case_expr instruction -- an instruction
    to pop CASE expression from the active running context;
  - Adapt the SP-execution code to using Fields instead of Items
    for SP-vars;
  - Use create_field structure for field description instead of
    a set of members.
sql/sp_head.h:
  - Add a function to map enum_field_types to Item::Type;
  - Add sp_instr_push_case_expr instruction -- an instruction
    to push CASE expression into the active running context;
  - Add sp_instr_pop_case_expr instruction -- an instruction
    to pop CASE expression from the active running context;
  - Adapt the SP-execution code to using Fields instead of Items
    for SP-vars;
  - Use create_field structure for field description instead of
    a set of members.
sql/sp_pcontext.cc:
  - Change rules to assign an index of SP-variable: use
    transparent index;
  - Add an operation to retrieve a list of defined SP-vars
    from the processing context recursively.
sql/sp_pcontext.h:
  - Change rules to assign an index of SP-variable: use
    transparent index;
  - Add an operation to retrieve a list of defined SP-vars
    from the processing context recursively.
sql/sp_rcontext.cc:
  - Change rules to assign an index of SP-variable: use
    transparent index;
  - Use a tmp virtual table to store SP-vars instead of Items;
  - Provide operations to work with CASE expresion.
sql/sp_rcontext.h:
  - Change rules to assign an index of SP-variable: use
    transparent index;
  - Use a tmp virtual table to store SP-vars instead of Items;
  - Provide operations to work with CASE expresion.
sql/sql_class.cc:
  - Reflect Item_splocal ctor changes;
  - Item_splocal::get_offset() has been renamed to get_var_idx().
sql/sql_class.h:
  Polishing.
sql/sql_parse.cc:
  Extract create_field::init() to initialize an existing
  instance of create_field from new_create_field().
sql/sql_select.cc:
  Take care of BLOB columns in create_virtual_tmp_table().
sql/sql_select.h:
  Move create_virtual_tmp_table() out of sql_select.h.
sql/sql_trigger.cc:
  Use boolean constants for boolean type instead of numerical ones.
sql/sql_yacc.yy:
  Provide an instance of create_field for each SP-var.
mysql-test/include/sp-vars.inc:
  The definitions of common-procedures, which are created
  under different circumstances.
mysql-test/r/sp-vars.result:
  Result file for the SP-vars test.
mysql-test/sp-vars.test:
  A new test for checking SP-vars functionality.
2005-12-07 17:01:17 +03:00
unknown
e324da302f Merge rurik.mysql.com:/home/igor/mysql-5.0
into  rurik.mysql.com:/home/igor/dev/mysql-5.0-2


sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2005-12-02 20:42:36 -08:00
unknown
858eef452f Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/usr/home/ram/work/5.0.b12956


mysql-test/r/ps.result:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
2005-12-02 11:57:26 +04:00