Commit graph

395 commits

Author SHA1 Message Date
Sergei Golubchik
59d9d08e2b 5.5 merge 2014-02-01 00:54:03 +01:00
Alexander Barkov
94868914b8 merge 5.3 -> 5.5 2014-01-28 13:00:50 +04:00
Sergei Golubchik
bec1d903d9 Do the partial merge of WL#5602 correctly:
Remove unused code (that should not have been merged)
  Add protocol extension (that should have been merged)
  Fix bugs (see pack.c)
2013-12-09 12:38:02 +01:00
Sergei Golubchik
0fdb3bcfdb 10.0-base merge (roles) 2013-10-29 15:08:44 +01:00
Sergei Golubchik
8122996a59 CURRENT_ROLE() function 2013-10-18 06:55:26 -07:00
Alexander Barkov
426d246f5b MDEV-5163 Merge WEIGHT_STRING function from MySQL-5.6 2013-10-23 20:25:52 +04:00
Alexander Barkov
a9240dce9e Merge 10.0-base -> 10.0 2013-10-15 10:26:08 +04:00
Alexander Barkov
285e7aa179 MDEV-4425 REGEXP enhancements 2013-09-26 18:02:17 +04:00
unknown
9d83468e78 merge 5.5 -> 10.0-base 2013-09-25 21:07:06 +03:00
unknown
64d6d8334f merge 5.3 -> 5.5 2013-09-25 17:16:13 +03:00
unknown
ec7da1561e MDEV-5039: incorrect Item_func_regex::update_used_tables()
Other fix of maybe_null problem and revert of revno: 3608 "MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery from a MERGE view."
2013-09-25 15:30:13 +03:00
unknown
e5746665c9 merge 10.0-base -> 10.0 2013-09-26 21:20:15 +03:00
Alexander Barkov
e33582d20d Merging TO_BASE64() and FROM_BASE64() from MySQL-5.6 2013-09-23 18:58:33 +04:00
Alexander Barkov
9adb6e991e MDEV-4841 Wrong character set of ADDTIME() and DATE_ADD() 2013-08-22 13:59:30 +04:00
Sergei Golubchik
b7b5f6f1ab 10.0-monty merge
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
2013-07-21 16:39:19 +02:00
Sergei Golubchik
97e640b9ae 5.5 merge 2013-07-17 21:24:29 +02:00
Sergei Golubchik
005c7e5421 mysql-5.5.32 merge 2013-07-16 19:09:54 +02:00
unknown
6135585efa fixed typo. 2013-07-04 10:39:19 +03:00
Michael Widenius
2534521f9a Fixed some merge issues:
- temporary tables now works
- mysql-system_tables updated to not use temporary tables
- PASSWORD() function fixed
- Support for STATS_AUTO_RECALC, STATS_PERSISTENT and STATS_SAMPLE_PAGES table options
2013-06-18 02:01:34 +03:00
Michael Widenius
5f1f2fc0e4 Applied all changes from Igor and Sanja 2013-06-15 18:32:08 +03:00
Sergei Golubchik
4749d40c63 5.5 merge 2013-06-06 17:51:28 +02:00
unknown
2e830cfbc8 MDEV-4402 A function to visualize histograms data. 2013-04-20 23:30:21 +03:00
Sergei Golubchik
84ce6832e6 MDEV-4332 Increase username length from 16 characters 2013-04-18 22:17:29 +02:00
unknown
665a31af2b MDEV-26: Global transaction ID. First alpha release.
Merge of 10.0-mdev26 feature tree into 10.0-base.

Global transaction ID is prepended to each event group in the binlog.

Slave connect can request to start from GTID position instead of specifying
file name/offset of master binlog. This facilitates easy switch to a new
master.

Slave GTID state is stored in a table mysql.rpl_slave_state, which can be
InnoDB to get crash-safe slave state.

GTID includes a replication domain ID, allowing to keep track of distinct
positions for each of multiple masters.
2013-04-15 10:55:27 +02:00
Sergei Golubchik
993ea79f2d 5.5 merge 2013-03-27 23:41:02 +01:00
Sergei Golubchik
6599fd3e9c 5.3 merge 2013-03-27 10:03:28 +01:00
Sergei Golubchik
e308d7417b 5.2 merge 2013-03-26 19:09:47 +01:00
Sergei Golubchik
48be80cd95 5.1 merge 2013-03-26 17:39:45 +01:00
Michael Widenius
068c61978e Temporary commit of 10.0-merge 2013-03-26 00:03:13 +02:00
Murthy Narkedimilli
8afe262ae5 Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 15:53:48 +01:00
Sergei Golubchik
a4a18e0cbb MDEV-4289 Assertion `0' fails in make_sortkey with GROUP_CONCAT, MAKE_SET, GROUP BY
Item_func_make_set wasn't taking into account the first argument when
calculating maybe_null.

sql/item_strfunc.cc:
  rewrite Item_func_make_set, removing separate storage of the first argument
sql/item_strfunc.h:
  rewrite Item_func_make_set, removing separate storage of the first argument
2013-03-18 10:35:03 +01:00
unknown
ecd4bf62d4 MDEV-4272 fix.
Incorrect NULL value handling in Item_func_conv_charset fixed.
2013-03-14 19:07:20 +02:00
unknown
041f26d349 MDEV-26. Intermediate commit.
Implement binlog_gtid_pos() function. This will be used so that
the slave can obtain the gtid position automatically from first
connect with old-style position - then MASTER_GTID_POS=AUTO will
work the next time. Can also be used by mysqldump --master-data
to give the current gtid position directly.
2013-02-11 16:44:38 +01:00
unknown
1f85b1e069 MDEV-3873: post-merge fix. 2013-02-04 17:25:10 +02:00
Sergei Golubchik
0af4b6c6ee 5.5 merge 2013-01-29 15:10:47 +01:00
Sergei Golubchik
aca8e7ed6b 5.3 merge 2013-01-15 19:07:46 +01:00
unknown
6f26aac940 MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery
from a MERGE view.

The problem was in the lost ability to be null for the table of a left join if it
is a view/derived table.

It hapenned because setup_table_map(), was called earlier then we merged
the view or derived.

Fixed by propagating new maybe_null flag during Item::update_used_tables().

Change in join_outer.test and join_outer_jcl6.test appeared because
IS NULL reported no used tables (i.e. constant) for argument which could not be
NULL and new maybe_null flag was propagated for IS NULL argument (Item_field)
because table the Item_field belonged to changed its maybe_null status.
2012-12-28 14:41:46 +02:00
unknown
082ff59317 Post-post review fixes. 2012-12-23 22:17:22 +02:00
unknown
40ae63dd65 backport to 5.5 dyncol changes and names support 2012-12-23 20:57:54 +02:00
unknown
7327cd9717 MDEV-377 Name support for dynamic columns
MDEV-127 Optimization of memory allocation
MDEV-483 Make column_check function which cheсks dynamic columns integrit
JSON conversion function
2012-09-28 14:01:17 +03:00
unknown
0b93b444b6 Merged the fix for bug lp:944706, mdev-193 2012-06-19 15:06:45 +03:00
Sergei Golubchik
b8153269f1 fix an overly agressive optimization in Item_func_conv_charset 2012-06-17 16:09:16 +02:00
Sergei Golubchik
a247b12fe6 MDEV-316 lp:1009085 Assertion failed: warn_item, file item_cmpfunc.cc, line 3613
make sure that find_date_time_item() is called before agg_arg_charsets_for_comparison().
optimize Item_func_conv_charset to avoid conversion if no string result is needed
2012-06-15 17:22:49 +02:00
unknown
da5214831d Fix for bug lp:944706, task MDEV-193
The patch enables back constant subquery execution during
query optimization after it was disabled during the development
of MWL#89 (cost-based choice of IN-TO-EXISTS vs MATERIALIZATION).

The main idea is that constant subqueries are allowed to be executed
during optimization if their execution is not expensive.

The approach is as follows:
- Constant subqueries are recursively optimized in the beginning of
  JOIN::optimize of the outer query. This is done by the new method
  JOIN::optimize_constant_subqueries(). This is done so that the cost
  of executing these queries can be estimated.
- Optimization of the outer query proceeds normally. During this phase
  the optimizer may request execution of non-expensive constant subqueries.
  Each place where the optimizer may potentially execute an expensive
  expression is guarded with the predicate Item::is_expensive().
- The implementation of Item_subselect::is_expensive has been extended
  to use the number of examined rows (estimated by the optimizer) as a
  way to determine whether the subquery is expensive or not.
- The new system variable "expensive_subquery_limit" controls how many
  examined rows are considered to be not expensive. The default is 100.

In addition, multiple changes were needed to make this solution work
in the light of the changes made by MWL#89. These changes were needed
to fix various crashes and wrong results, and legacy bugs discovered
during development.
2012-05-17 13:46:05 +03:00
Sergei Golubchik
18c51eee35 5.3 merge 2012-03-06 20:46:07 +01:00
unknown
8a5940c477 Fix for LP BUG#944504
Problem is that subquery execution can't be called during prepare/optimize phase.

Also small fix for subquery test suite.
2012-03-05 15:48:12 +02:00
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Michael Widenius
6920457142 Merge with MariaDB 5.1 2011-11-24 18:48:58 +02:00
Michael Widenius
a8d03ab235 Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
2011-11-21 19:13:14 +02:00
Sergei Golubchik
90b43902b0 compilation warnings on Windows 2011-11-02 12:55:46 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Kent Boortz
027b5f1ed4 Updated/added copyright headers 2011-07-03 17:47:37 +02:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Kent Boortz
68f00a5686 Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
44135d4725 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Michael Widenius
f09f1c7c7d Merge with dynamic column code 2011-05-12 14:30:34 +03:00
Michael Widenius
052d1bfb1a Fixed all reported bugs for dynamic columns.
Bugs fixed:
- Added automatic detection of unsigned arguments to COLUMN_CREATE()
- If string length is not know for COLUMN_GET() use MAX_DYNAMIC_COLUMN_LENGTH instead of MAX_FIELD_BLOBLENGTH
- null_value flag was not propery reset for COLUMN_LIST() and COLUMN_CREATE() which could lead to crashes later:
- lp:778905 Assertion `value->year <= 9999' failed in dynamic_column_date_store
- lp:778912 Assertion `field_pos < field_count' failed in Protocol_text::store in maria-5.3-mwl34

include/ma_dyncol.h:
  Added define for max dynamic column length.
mysql-test/r/cast.result:
  Added test of cast big unsigned int to signed (this test case was missing)
mysql-test/r/dyncol.result:
  Added tests from reported bugs
  Added testing of automatic store of signed/unsigned integers
mysql-test/t/cast.test:
  Added test of cast big unsigned int to signed (this test case was missing)
mysql-test/t/dyncol.test:
  Added tests from reported bugs
  Added testing of automatic store of signed/unsigned integers
sql/item.cc:
  Added assert to catch cases where null_value is not set properly
sql/item_strfunc.cc:
  Added automatic detection of unsigned arguments to COLUMN_CREATE()
  COLUMN_GET() returned wrong value for illegal strings which lead to assert later
  null_value flag was not propery reset for COLUMN_LIST() and COLUMN_CREATE() which could lead to crashes later.
sql/item_strfunc.h:
  If string length is not know for COLUMN_GET() use MAX_DYNAMIC_COLUMN_LENGTH
2011-05-11 02:41:02 +03:00
Michael Widenius
5ab92b1f85 Adding support for Dynamic columns (WL#34):
- COLUMN_CREATE(column_nr, value, [column_nr,value]...)
- COLUMN_ADD(blob,column_nr, value, column_nr,value]...)
- COLUMN_DELETE(blob, column_nr, column_nr...)
- COLUMN_EXISTS(blob, column_nr)
- COLUMN_LIST(blob, column_nr)
- COLUMN_GET(string, column_nr AS type)

Added cast(X as DOUBLE) and cast(x as INT)
Better warning and error messages for wrong cast's
Created some sub functions to simplify and reuse code.
Added a lot of conversation functions with error/warnings for what went wrong.
Fixed some issues when casting time to datetime.
Added functions to dynamic strings and Strings to allow one to move a string buffer from dynamic strings to String (to save malloc+ copy)
Added dynamic columns library to libmysqlclient


include/Makefile.am:
  Added ma_dyncol.h
include/decimal.h:
  Added 'const' to arguments for some functions.
include/my_sys.h:
  Added dynstr_reassociate()
include/my_time.h:
  Added TIME_SUBSECOND_RANGE
  Added double_to_datetime()
  Added flag argument to str_to_time()
libmysql/CMakeLists.txt:
  Added mysys/ma_dyncol.c
libmysql/Makefile.shared:
  Added ma_dyncol
libmysql/libmysql.c:
  Added argument to str_to_time()
mysql-test/r/bigint.result:
  Better error messages
mysql-test/r/cast.result:
  Better warning and error messages
  A lot of new cast() tests
mysql-test/r/func_math.result:
  Better warning messages
mysql-test/r/func_str.result:
  Better warning messages
mysql-test/r/func_time.result:
  Better warning messages
mysql-test/r/sp-vars.result:
  Better warning messages
mysql-test/r/strict.result:
  Better warning messages
  New test result
mysql-test/r/type_newdecimal.result:
  Better warning messages
mysql-test/r/warnings.result:
  Better warning messages
mysql-test/suite/funcs_1/r/innodb_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/funcs_1/r/memory_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/funcs_1/r/myisam_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test:
  Added begin...commit to speed up test.
mysql-test/suite/parts/inc/part_supported_sql_funcs_delete.inc:
  Added begin...commit to speed up test.
mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/rpl_partition.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
  Removed duplicated --big_test
mysql-test/suite/parts/t/rpl_partition.test:
  Added begin...commit to speed up test.
mysql-test/suite/pbxt/r/cast.result:
  Updated results after better cast warnings
mysql-test/suite/pbxt/r/func_str.result:
  Updated results after better cast warnings
mysql-test/suite/pbxt/r/type_newdecimal.result:
  Updated results after better cast warnings
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
  Added begin...commit to speed up test.
mysql-test/suite/rpl/t/rpl_innodb_bug28430.test:
  Added begin...commit to speed up test.
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result:
  More warnings
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result:
  More warnings
mysql-test/t/cast.test:
  A lot of new cast() tests
mysql-test/t/strict.test:
  Added new test
mysys/CMakeLists.txt:
  Added ma_dyncol.c
mysys/Makefile.am:
  Added ma_dyncol.c
mysys/string.c:
  Added dynstr_reassociate() to move a buffer from dynamic_strings to some other allocator
sql-common/my_time.c:
  Added 'fuzzydate' flag to str_to_time()
  Added support for microseconds to my_time_to_str() and my_datetime_to_str()
  Reset second_parts in number_to_datetime()
  Added double_to_datetime()
sql/field.cc:
  Added double_to_longlong() and truncate_double() to simplify and reuse code
sql/field.h:
  New prototypes
sql/item.cc:
  Changed Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) to be aware of type of argument.
  (Needed to make it microsecond safe and get better warnings).
  Updated call to str_to_time_with_warn()
sql/item.h:
  Added struct st_dyncall_create_def used by dynamic columns
  Added virtual bool dynamic_result() to tell if type of argument may change over calls.
sql/item_cmpfunc.cc:
  Added Item_func_dyncol_exists()
sql/item_cmpfunc.h:
  Added class Item_func_dyncol_exists
sql/item_create.cc:
  Added get_length_and_scale() to simplify other functions
  Simplified and extended create_func_cast()
  Added support for cast(X as double(X,Y))
  Added functions to create dynamic column functions.
sql/item_create.h:
  Added prototypes
sql/item_func.cc:
  Extended cast functions Item_func_signed() and Item_func_unsigned() to work with dynamic types
  Added Item_double_typecast()
sql/item_func.h:
  Added class Item_double_typecast()
sql/item_strfunc.cc:
  Added functions for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_strfunc.h:
  Added classes for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_timefunc.cc:
  Added flag argument to str_to_time_with_warn()
  Updated Item_char_typecast() to handle result type that may change between calls (for dynamic columns)
  Added Item_time_typecast::get_date() to ensure that we cast a datetime to time properly.
sql/item_timefunc.h:
  Added get_date() to Item_time_typecast() to allow proper results for casting time to datetime
sql/lex.h:
  Added new SQL function names
sql/my_decimal.cc:
  Added 'const' to some arguments.
  Better error message in case of errors (we now print out the wrong value)
  Added my_decimal2int()
sql/my_decimal.h:
  Moved some constants to my_decimal_limits.h
  Updated prototypes.
  Made my_decimal2int() a function as it's rather long (no reason to have it inline)
  Added decimal2my_decimal() function.
sql/mysql_priv.h:
  Prototypes for new functions
sql/share/errmsg.txt:
  New error messages for wrong casts and dynamic columns
sql/sql_acl.cc:
  Fixed indentation
sql/sql_base.cc:
  Added dynamic_column_error_message()
sql/sql_string.h:
  Added reassociate() to move a buffer to be owned by String object.
sql/sql_yacc.yy:
  Added syntax for COLUMN_ functions.
sql/time.cc:
  Updated str_to_datetime_with_warn() flag argument to same type as other functions
  Added conversion flag to str_to_time_with_warn() (Similar to all datetime functions)
  Added conversion functions with warnings: double_to_datetime_with_warn() and decimal_to_datetime_with_warn()
strings/decimal.c:
  Added 'const' to arguments for some functions.
unittest/mysys/Makefile.am:
  Added test for dynamic columns code
2011-05-08 13:24:06 +03:00
Michael Widenius
1be5462d59 Merge with MariaDB 5.1 2011-05-03 19:10:10 +03:00
Michael Widenius
e415ba0fb2 Merge with MySQL 5.1.57/58
Moved some BSD string functions from Unireg
2011-05-02 20:58:45 +03:00
Alexander Barkov
1a48afc1c6 Merging from mysql-5.1 2011-03-03 18:46:30 +03:00
Alexander Barkov
a1e9be8e8b Bug 11766519 - 59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
Part 2. Function QUOTE() was not multi-byte safe.

  @ mysql-test/r/ctype_ucs.result
  @ mysql-test/t/ctype_ucs.test
  Adding tests

  @ sql/item_strfunc.cc
  Fixing Item_func_quote::val_str to be multi-byte safe.

  @ sql/item_strfunc.h
  Multiple size needed for quote characters to mbmaxlen
2011-03-03 18:39:26 +03:00
Alexander Barkov
6665ca25af Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
Introduced by the fix for bug#44766.

Problem: it's not correct to use args[0]->str_value as a buffer,
because args[0] may need this buffer for its own purposes.

Fix: adding a new class member tmp_value to use as return value.

  @ mysql-test/r/ctype_many.result
  @ mysql-test/t/ctype_many.test
  Adding tests

  @ sql/item_strfunc.cc
  Changing code into traditional style:
  use "str" as a buffer for the argument and tmp_value for the result value.

  @ sql/item_strfunc.h
  Adding tmp_value
2011-01-17 15:11:33 +03:00
Martin Hansson
716b64cdb0 Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail and
other crashes

Some string manipulating SQL functions use a shared string object intended to
contain an immutable empty string. This object was used by the SQL function
SUBSTRING_INDEX() to return an empty string when one argument was of the wrong
datatype. If the string object was then modified by the sql function INSERT(),
undefined behavior ensued.

Fixed by instead modifying the string object representing the function's
result value whenever string manipulating SQL functions return an empty
string.

Relevant code has also been documented.
2011-01-13 08:57:15 +01:00
Alexander Barkov
7d88b552e2 Bug#31384 DATE_ADD() and DATE_SUB() return binary data
Problem: DATE_ADD() is a hybrid function and can return
DATE, DATETIME or VARCHAR data type depending on arguments.

In case of VARCHAR data type, DATE_ADD() reported "binary" character set,
which was wrong.

Fix: make DATE_ADD() return @character_set_connection in VARCHAR context.
 @ mysql-test/include/ctype_numconv.inc
   Adding tests
 @ mysql-test/r/ctype_binary.result
   Adding tests
 @ mysql-test/r/ctype_cp1251.result
   Adding tests
 @ mysql-test/r/ctype_latin1.result
   Adding tests
 @ mysql-test/r/ctype_ucs.result
   Adding tests
 @ mysql-test/r/ctype_utf8.result
   Adding tests
 @ sql/item_strfunc.cc
  - Moving code from Item_str_ascii_func::val_str() to
  Item_str_func::val_str_from_val_str_ascii(), as
  this code needs to be shared by Item_date_add_interval.
  - Adding str2 parameter to be used as a buffer, instead of
   using private ascii_buf member.
 @ sql/item_strfunc.h
  - Moving code from Item_str_ascii_func::val_str() to
  Item_str_func::val_str_from_val_str_ascii()
  - Removing "String *val_str_convert_from_ascii(String *str, String *ascii_buf)"
    prototype as it was neither used nor declared.
 @ sql/item_timefunc.h
  - Overwriting parent's charset_for_protocol() method,
    becase we need to behave differenlty in VARCHAR and DATE/DATETYPE context.
  - Adding ascii_buf for conversion.
  - Adding val_str_ascii() prototype.
  - Adding val_str() which uses newly added
    Item_str_func::val_str_from_val_str_ascii(),
    passing ascii_buf as a conversion buffer.
2011-02-10 11:18:08 +03:00
Tor Didriksen
dcd9f246e3 Bug #59632 Assertion failed: arg_length > length
The problem was overflow in max_length when we tried to des_decrypt()
something which is not the output of des_encrypt()


mysql-test/r/ssl_and_innodb.result:
  New test case.
mysql-test/t/ssl_and_innodb.test:
  New test case.
sql/item_strfunc.h:
  Do not subtract the encrypt overhead (9U) if args[0] has length < 9
  (In unsigned arithmetic, (1-9) becomes a very large number)
2011-02-07 11:17:46 +01:00
Alexander Barkov
498a5bbc82 Merging from 5.1. 2011-01-17 15:26:13 +03:00
Martin Hansson
ef6b98ee5a Merge of fix for Bug#58165. 2011-01-13 09:07:21 +01:00
Alexander Barkov
e3dee8a7fd Bug#57737 Character sets: search fails with like, contraction, index
Problem: LIKE over an indexed column optimized away good results,
because my_like_range_utf32/utf16 returned wrong ranges for contractions.
Contraction related code was missing in my_like_range_utf32/utf16,
but did exist in my_like_range_ucs2/utf8.
It was forgotten in utf32/utf16 versions (during mysql-6.0 push/revert mess).

Fix:
The patch removes individual functions my_like_range_ucs2,
my_like_range_utf16, my_like_range_utf32 and introduces a single function
my_like_range_generic() instead. The new function handles contractions
correctly. It can handle any character set with cs->min_sort_char and
cs->max_sort_char represented in Unicode code points.

added:
  @ mysql-test/include/ctype_czech.inc
  @ mysql-test/include/ctype_like_ignorable.inc
  @ mysql-test/r/ctype_like_range.result
  @ mysql-test/t/ctype_like_range.test
  Adding tests


modified:

  @ include/m_ctype.h
  - Adding helper functions for contractions.
  - Prototypes: removing ucs2,utf16,utf32 functions, adding generic function.
  @ mysql-test/r/ctype_uca.result
  @ mysql-test/r/ctype_utf16_uca.result
  @ mysql-test/r/ctype_utf32_uca.result
  @ mysql-test/t/ctype_uca.test
  @ mysql-test/t/ctype_utf16_uca.test
  @ mysql-test/t/ctype_utf32_uca.test
  - Adding tests.

  @ strings/ctype-mb.c
  - Pad function did not put the last character.
  - Implementing my_like_range_generic() - an universal replacement
    for three separate functions
    my_like_range_ucs2(), my_like_range_utf16() and my_like_range_utf32(),
    with correct contraction handling.

  @ strings/ctype-ucs2.c
  - my_fill_mb2 did not put the high byte, as previously
    it was used to put only characters in ASCII range.
    Now it puts high byte as well
    (needed to pupulate cs->max_sort_char correctly).
  - Adding DBUG_ASSERT()
  - Removing character set specific functions:
    my_like_range_ucs2(), my_like_range_utf16() and my_like_range_utf32().
  - Using my_like_range_generic() instead of the old functions.

  @ strings/ctype-uca.c
  - Using generic function instead of the old character set specific ones.

  @ sql/item_create.cc
  @ sql/item_strfunc.cc
  @ sql/item_strfunc.h
  - Adding SQL functions LIKE_RANGE_MIN and LIKE_RANGE_MAX,
    available only in debug build to make sure like_range()
    works correctly for all character sets and collations.
2010-11-26 13:44:39 +03:00
Sergei Golubchik
65ca700def merge.
checkpoint.
does not compile.
2010-11-25 18:17:28 +01:00
Alexander Barkov
84ee0a9fa4 Bug#55912 FORMAT with locale set fails for numbers < 1000
Problems:
- dot character was always printed as decimal point
  instead of localized decimal point for short
  numbers without thousands
- Item_func_format::val_str always returned values in ASCII
format,
  regargless of @@character_set_connection, which in case of utf32
  led to crash in debug build, or to incorrect values in release build.

Fix:
- Adding a piece of code to replace dot character to
  localized decimal point in short numbers.
- Changing parent class for Item_func_format to
  Item_str_ascii_func, because its val_str() implementation is heavily ASCII oriented.
2010-08-20 15:14:11 +04:00
Alexander Barkov
9452dd1122 Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT
Problem: Item_func_hex::val_str() returned data in ASCII format,
which did not match collation.collation pointing to my_charset_utf32_general_ci.
Fix: changing parent class of Item_func_hex to Item_str_ascii_func,
as val_str() implementation is heavily ASCII-oriented.

  mysql-test/r/ctype_utf32.result
  mysql-test/t/ctype_utf32.test
  Adding test case


  sql/item_strfunc.cc
  sql/item_strfunc.h
  - Changing parent class to Item_str_ascii_func
  - Clean-up in Item_func_hex::fix_length_and_dec()
    Using fix_char_length() instead of setting max_length directly.
2010-08-18 16:08:59 +04:00
Alexander Barkov
00e86d01a7 Bug#54661 sha2() returns BINARY result
Problem: sha2() reported its result as BINARY

Fix:
- Inheriting Item_func_sha2 from Item_str_ascii_func
- Setting max_length via fix_length_and_charset() 
  instead of direct assignment.
- Adding tests
2010-07-07 10:38:11 +04:00
Sergei Golubchik
ffc8f62b08 merge 5.1->5.2 2010-06-01 21:52:20 +02:00
unknown
b1e00b6be8 Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
2010-04-28 14:52:24 +02:00
Alexander Nozdrin
e642701c32 Manual merge from mysql-trunk.
Conflicts:
  - mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
2010-04-27 13:58:21 +04:00
Alexey Kopytov
fa3b2dcb83 Manual merge of mysql-5.1-bugteam to
mysql-trunk-merge.

Conflicts:

Text conflict in sql/sql_priv.h
2010-04-19 16:09:44 +04:00
Konstantin Osipov
3227ba706f Backport of:
ChangeSet@1.2703, 2007-12-07 09:35:28-05:00, cmiller@zippy.cornsilk.net +40 -0
Bug#13174: SHA2 function
Patch contributed from Bill Karwin, paper unnumbered CLA in Seattle

Implement SHA2 functions.

Chad added code to make it work with YaSSL.  Also, he removed the 
(probable) bug of embedded server never using SSL-dependent 
functions.  (libmysqld/Makefile.am didn't read ANY autoconf defs.)

Function specification:
  SHA2( string cleartext, integer hash_length ) 
    -> string hash, or NULL
where hash_length is one of 224, 256, 384, or 512.  If either is 
NULL or a length is unsupported, then the result is NULL.  The 
resulting string is always the length of the hash_length parameter
or is NULL.

Include the canonical hash examples from the NIST in the test
results.
---
Polish and address concerns of reviewers.


.bzrignore:
  Added libmysqld/sha2.cc to the ignore list.
client/mysql.cc:
  Add condition to remove code for embedded server.
client/mysqltest.cc:
  Add condition to remove code for embedded server.
include/Makefile.am:
  New header file to header list.
include/mysql_embed.h:
  Embedded servers can use SSL-library functions too!
include/sha2.h:
  Compatibility layer to make YaSSL behave like OpenSSL.
include/sslopt-case.h:
  Remove SSL-communication parameters from command lines.
include/sslopt-longopts.h:
  Remove SSL-communication parameters from command lines.
include/sslopt-vars.h:
  Don't declare variables that are only used in SSL communication, if
  we are compiling the embedded server.
include/violite.h:
  Don't even compile the SSL-communication function if we're in the
  embedded server.
  ---
  Remove CPP condition indentation.
libmysqld/CMakeLists.txt:
  Add new file to source list.
libmysqld/Makefile.am:
  Include standard DEFS in embedded compilation.  It's an undiscovered
  but that it's not there.
  
  Add new file to source list.
libmysqld/examples/Makefile.am:
  Include autoconf DEFS.
libmysqld/lib_sql.cc:
  Initialize SSL-related variables in embedded server.
mysql-test/include/have_ssl_crypto_functs.inc:
  Distinguish between communication and crypto.
  Use the tristate value of "have_ssl" variable to know whether to
  test or not for SSL-provided crypto functions.
mysql-test/r/func_digest.result:
  
  Test against the sample test vectors in the NIST Secure
  Hash Standard (http://csrc.nist.gov/cryptval/shs.htm)
mysql-test/r/func_encrypt_nossl.result:
  Update results to the new error message text.
mysql-test/r/have_ssl_is_yes_or_disabled_only.require:
  Distinguish between communication and crypto.
  
  Use the tristate value of "have_ssl" variable to know whether to
  test or not for SSL-provided crypto functions.
mysql-test/suite/rpl/t/rpl_ssl.test:
  Distinguish between communication and crypto.
mysql-test/suite/rpl/t/rpl_ssl1.test:
  Distinguish between communication and crypto.
mysql-test/t/func_des_encrypt.test:
  Distinguish between communication and crypto.
mysql-test/t/func_digest.test:
  Test against the sample test vectors in the NIST Secure
  Hash Standard (http://csrc.nist.gov/cryptval/shs.htm)
  
  Also, test that various parameters (legal and illegal)
  do what we expect.
  ---
  Distinguish between communication and crypto.
mysql-test/t/func_encrypt.test:
  Distinguish between communication and crypto.
mysql-test/t/openssl_1.test:
  Don't test SSL communication if we're in the embedded server.
  ---
  Distinguish between communication and crypto.
mysql-test/t/ssl-big.test:
  Don't test SSL communication if we're in the embedded server.
  ---
  Distinguish between communication and crypto.
mysql-test/t/ssl.test:
  Don't test SSL communication if we're in the embedded server.
  ---
  Distinguish between communication and crypto.
mysql-test/t/ssl_8k_key.test:
  Don't test SSL communication if we're in the embedded server.
  ---
  Distinguish between communication and crypto.
mysql-test/t/ssl_compress.test:
  Don't test SSL communication if we're in the embedded server.
  ---
  Distinguish between communication and crypto.
mysql-test/t/ssl_connect.test:
  Don't test SSL communication if we're in the embedded server.
  ---
  Distinguish between communication and crypto.
sql-common/client.c:
  SSL is useful for more functionality than just connecting.  Test
  for whether we are not embedded server also.
sql/CMakeLists.txt:
  Add new source file to source list so that we have access to SHA2
  functions.
sql/Makefile.am:
  Add new source file to source list so that we have access to SHA2
  functions.
sql/item_create.cc:
  Bootstrap the SHA2 function into the server.
sql/item_strfunc.cc:
  Add new SHA2 Item class methods.
  
  Clean up two minor problems.
  ---
  Remove extraneous debugging.
  ---
  We must check nullness of a parameter only /after/ computing its
  value.
sql/item_strfunc.h:
  Declare new SHA2 Item class.
sql/mysqld.cc:
  For embedded server, don't refer to SSL-communications variables
  or values.
  ---
  Remove CPP condition indentation.
sql/sha2.cc:
  Compatibility layer to make YaSSL behave like OpenSSL.
  ---
  Add comment for generated functions.
sql/sql_acl.cc:
  For embedded server, don't refer to SSL-communications variables
  or values.
sql/sql_connect.cc:
  SSL is useful for more functionality than just connecting.  Test
  for whether we are not embedded server also.
sql/sys_vars.cc:
  For embedded server, don't refer to SSL-communications variables
  or values.
2010-04-13 19:04:45 +04:00
Alexey Kopytov
3df8e88dd8 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result
Text conflict in sql/log.cc
Text conflict in sql/set_var.cc
Text conflict in sql/sql_class.cc
2010-04-03 21:35:51 +04:00
Alexey Kopytov
5a59d706be Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

Text conflict in mysql-test/r/func_str.result
Text conflict in mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_32.result
Text conflict in mysql-test/suite/sys_vars/r/myisam_sort_buffer_size_basic_64.result
Text conflict in mysql-test/t/func_str.test
Text conflict in sql/mysqld.cc
Text conflict in sql/protocol.cc
Text conflict in storage/myisam/mi_open.c
2010-04-02 19:17:43 +04:00
Mats Kindahl
23d8586dbf WL#5030: Split and remove mysql_priv.h
This patch:

- Moves all definitions from the mysql_priv.h file into
  header files for the component where the variable is
  defined
- Creates header files if the component lacks one
- Eliminates all include directives from mysql_priv.h
- Eliminates all circular include cycles
- Rename time.cc to sql_time.cc
- Rename mysql_priv.h to sql_priv.h
2010-03-31 16:05:33 +02:00
Sergey Glukhov
6eca53f1d3 fixed compiler warning 2010-03-29 18:42:49 +05:00
Sergey Glukhov
d5325c7793 Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149
The crash happens because of incorrect max_length calculation
in QUOTE function(due to overflow). max_length is set
to 0 and it leads to assert failure.
The fix is to cast expression result to
ulonglong variable and adjust it if the
result exceeds MAX_BLOB_WIDTH.


mysql-test/r/func_str.result:
  test case
mysql-test/t/func_str.test:
  test case
sql/item_strfunc.h:
  cast expression result to ulonglong variable and
  adjust it if the result exceeds MAX_BLOB_WIDTH.
2010-03-26 09:49:35 +04:00
unknown
4bf849c23c Merge MySQL 5.1.44 into MariaDB. 2010-03-04 09:03:07 +01:00
Sergei Golubchik
f09ca00e08 merged 2010-03-15 12:51:23 +01:00
Alexander Barkov
702166bcde WL#2649 Number-to-string conversions
added:
  include/ctype_numconv.inc
  mysql-test/include/ctype_numconv.inc
  mysql-test/r/ctype_binary.result
  mysql-test/t/ctype_binary.test
  Adding tests

modified:

  mysql-test/r/bigint.result
  mysql-test/r/case.result
  mysql-test/r/create.result
  mysql-test/r/ctype_cp1251.result
  mysql-test/r/ctype_latin1.result
  mysql-test/r/ctype_ucs.result
  mysql-test/r/func_gconcat.result
  mysql-test/r/func_str.result
  mysql-test/r/metadata.result
  mysql-test/r/ps_1general.result
  mysql-test/r/ps_2myisam.result
  mysql-test/r/ps_3innodb.result
  mysql-test/r/ps_4heap.result
  mysql-test/r/ps_5merge.result
  mysql-test/r/show_check.result
  mysql-test/r/type_datetime.result
  mysql-test/r/type_ranges.result
  mysql-test/r/union.result
  mysql-test/suite/ndb/r/ps_7ndb.result
  mysql-test/t/ctype_cp1251.test
  mysql-test/t/ctype_latin1.test
  mysql-test/t/ctype_ucs.test
  mysql-test/t/func_str.test
    Fixing tests


  @ sql/field.cc
     - Return str result using my_charset_numeric.
     - Using real multi-byte aware str_to_XXX functions
       to handle tricky charset values propely (e.g. UCS2)
  @ sql/field.h
     - Changing derivation of non-string field types to DERIVATION_NUMERIC.
     - Changing binary() for numeric/datetime fields to always
     return TRUE even if charset is not my_charset_bin. We need
     this to keep ha_base_keytype() return HA_KEYTYPE_BINARY.
     - Adding BINARY_FLAG into some fields, because it's not
     being set automatically anymore with
     "my_charset_bin to my_charset_numeric" change.
    - Changing derivation for numeric/datetime datatypes to a weaker
      value, to make "SELECT concat('string', field)" use character
      set of the string literal for the result of the function.
  @ sql/item.cc
     - Implementing generic val_str_ascii().
     - Using max_char_length() instead of direct read of max_length
       to make "tricky" charsets like UCS2 work.
       NOTE: in the future we'll possibly remove all direct reads of max_length
     - Fixing Item_num::safe_charset_converter().
       Previously it alligned binary string to
       character string (for example by adding leading 0x00
       when doing binary->UCS2 conversion). Now it just
       converts from my_charset_numbner to "tocs".
     - Using val_str_ascii() in Item::get_time() to make UCS2 arguments work.
     - Other misc changes
  @ sql/item.h
     - Changing MY_COLL_CMP_CONV and MY_COLL_ALLOW_CONV to
       bit operations instead of hard-coded bit masks.
     - Addding new method DTCollation.set_numeric().
     - Adding new methods to Item.
     - Adding helper functions to make code look nicer:
       agg_item_charsets_for_string_result()
       agg_item_charsets_for_comparison()
     - Changing charset for Item_num-derived items
       from my_charset_bin to my_charset_numeric
       (which is an alias for latin1).
  @ sql/item_cmpfunc.cc
     - Using new helper functions
     - Other misc changes
  @ sql/item_cmpfunc.h
     - Fixing strcmp() to return max_length=2.
       Previously it returned 1, which was wrong,
       because it did not fit '-1'.
  @ sql/item_func.cc
     - Using new helper functions
     - Other minor changes
  @ sql/item_func.h
     - Removing unused functions
     - Adding helper functions
       agg_arg_charsets_for_string_result()
       agg_arg_charsets_for_comparison()
     - Adding set_numeric() into constructors of numeric items.
     - Using fix_length_and_charset() and fix_char_length()
       instead of direct write to max_length.
  @ sql/item_geofunc.cc
     - Changing class for Item_func_geometry_type and
       Item_func_as_wkt from Item_str_func to
       Item_str_ascii_func, to make them return UCS2 result
       properly (when character_set_connection=ucs2).
  @ sql/item_geofunc.h
     - Changing class for Item_func_geometry_type and
       Item_func_as_wkt from Item_str_func to
       Item_str_ascii_func, to make them return UCS2 result
       properly (when @@character_set_connection=ucs2).
  @ sql/item_strfunc.cc
     - Implementing Item_str_func::val_str().
     - Renaming val_str to val_str_ascii for some items,
       to make them work with UCS2 properly.
     - Using new helper functions
     - All single-argument functions that expect string
       result now call this method:
       agg_arg_charsets_for_string_result(collation, args, 1);
       This enables character set conversion to @@character_set_connection
       in case of pure numeric input.
  @ sql/item_strfunc.h
     - Introducing Item_str_ascii_func - for functions
       which return pure ASCII data, for performance purposes,
       as well as for the cases when the old implementation
       of val_str() was heavily 8-bit oriented and implementing
       a UCS2-aware version is tricky.
  @ sql/item_sum.cc
     - Using new helper functions.
  @ sql/item_timefunc.cc
     - Using my_charset_numeric instead of my_charset_bin.
     - Using fix_char_length(), fix_length_and_charset()
       and fix_length_and_charset_datetime()
       instead of direct write to max_length.
     - Using tricky-charset aware function str_to_time_with_warn()
  @ sql/item_timefunc.h
     - Using new helper functions for charset and length initialization.
     - Changing base class for Item_func_get_format() to make
       it return UCS2 properly (when character_set_connection=ucs2).
  @ sql/item_xmlfunc.cc
     - Using new helper function
  @ sql/my_decimal.cc
     - Adding a new DECIMAL to CHAR converter
       with real multibyte support (e.g. UCS2)

  @ sql/mysql_priv.h
     - Introducing a new derivation level for numeric/datetime data types.
     - Adding macros for my_charset_numeric and MY_REPERTOIRE_NUMERIC.
     - Adding prototypes for str_set_decimal()
     - Adding prototypes for character-set aware str_to_xxx() functions.
  @ sql/protocol.cc
     - Changing charsetnr to "binary" client-side metadata for
       numeric/datetime data types.
  @ sql/time.cc
     - Adding to_ascii() helper function, to convert a string
       in any character set to ascii representation. In the
       future can be extended to understand digits written
       in various non-Latin word scripts.
     - Adding real multy-byte character set aware versions for str_to_XXXX,
       to make these these type of queries work correct:
         INSERT INTO t1 SET datetime_column=ucs2_expression;
   @  strings/ctype-ucs2.c
     - endptr was not calculated correctly. INSERTing of UCS2
       values into numeric columns returned warnings about
       truncated wrong data.
2010-02-11 08:17:25 +04:00
Alexander Nozdrin
2b0f6b5ace Manual merge from mysql-trunk-merge.
Conflicts:
  - mysql-test/suite/rpl/r/rpl_binlog_grant.result
  - mysql-test/suite/rpl/r/rpl_sp.result
  - mysql-test/suite/rpl/t/rpl_binlog_grant.test
  - sql/sql_parse.cc
  - sql/sql_table.cc
  - sql/sql_test.cc
2010-01-31 01:06:50 +03:00
Davi Arnaut
c3a73a8f6d Fix for compiler warnings:
Rename method as to not hide a base.
Reorder attributes initialization.
Remove unused variable.
Rework code to silence a warning due to assignment used as truth value.


sql/item_strfunc.cc:
  Rename method as to not hide a base.
sql/item_strfunc.h:
  Rename method as to not hide a base.
sql/log_event.cc:
  Reorder attributes initialization.
sql/rpl_injector.cc:
  Rework code to silence a warning due to assignment used as truth value.
sql/rpl_record.cc:
  Remove unused variable.
sql/sql_db.cc:
  Rework code to silence a warning due to assignment used as truth value.
sql/sql_parse.cc:
  Rework code to silence a warning due to assignment used as truth value.
sql/sql_table.cc:
  Rework code to silence a warning due to assignment used as truth value.
2010-01-28 19:51:40 -02:00
Alexey Kopytov
ebdef570e5 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge. 2009-12-11 19:40:58 +03:00
Davi Arnaut
e53ecf2dc2 Bug#49141: Encode function is significantly slower in 5.1 compared to 5.0
The problem was that the multiple evaluations of a ENCODE or
DECODE function within a single statement caused the random
generator to be reinitialized at each evaluation, even though
the parameters were constants.

The solution is to initialize the random generator only once
if the password (seed) parameter is constant.

This patch borrows code and ideas from Georgi Kodinov's patch.

mysql-test/r/func_str.result:
  Add test case result.
mysql-test/r/ps.result:
  Add test case result.
mysql-test/t/func_str.test:
  Add test case for Bug#49141
mysql-test/t/ps.test:
  Add test case for Bug#49141
sql/item_strfunc.cc:
  Move seed generation code to a separate method.
  Seed only once if the password (seed) argument
  is constant.
  Remove duplicated code and use a transform method
  to apply encoding or decoding.
sql/item_strfunc.h:
  Add parameter to signal whether the PRNG is already seeded.
  Introduce transform method.
  Combine val_str methods.
sql/sql_crypt.cc:
  Remove method.
sql/sql_crypt.h:
  Seed is supplied as two long integers.
2009-12-04 13:36:58 -02:00
Luis Soares
f1bb8c3c55 manual merge: mysql-5.1-rep+2-delivery1 --> mysql-5.1-rpl-merge
Conflicts
=========

Text conflict in .bzr-mysql/default.conf
Text conflict in libmysqld/CMakeLists.txt
Text conflict in libmysqld/Makefile.am
Text conflict in mysql-test/collections/default.experimental
Text conflict in mysql-test/extra/rpl_tests/rpl_row_sp006.test
Text conflict in mysql-test/suite/binlog/r/binlog_tmp_table.result
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata.result
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata_fatal.result
Text conflict in mysql-test/suite/rpl/r/rpl_row_create_table.result
Text conflict in mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
Text conflict in mysql-test/suite/rpl/r/rpl_stm_log.result
Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result
Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result
Text conflict in mysql-test/t/mysqlbinlog.test
Text conflict in sql/CMakeLists.txt
Text conflict in sql/Makefile.am
Text conflict in sql/log_event_old.cc
Text conflict in sql/rpl_rli.cc
Text conflict in sql/slave.cc
Text conflict in sql/sql_binlog.cc
Text conflict in sql/sql_lex.h
21 conflicts encountered.

NOTE
====
 mysql-5.1-rpl-merge has been made a mirror of mysql-next-mr:
 - "mysql-5.1-rpl-merge$ bzr pull ../mysql-next-mr"

 This is the first cset (merge/...) committed after pulling 
 from mysql-next-mr.
2009-10-22 23:30:28 +01:00
Igor Babaev
f7a75b999b The main commit of Andrey Zhakov's patch introducing vurtual(computed) columns.
The original patch has been ameliorated by Sanja and Igor.
2009-10-16 15:57:48 -07:00
Alexander Barkov
636ea6a1c4 WL#4584 Internationalized number format
@ mysql-test/r/func_str.result
   Adding tests
@ mysql-test/t/func_str.test
   Adding tests
@ mysql-test/t/variables.test
   Fixing error number
@ sql/item_create.cc
   Allowing 2 and 3 arguments to format()
@ sql/item_strfunc.cc
   Adding new formatting code.
@ sql/item_strfunc.h
   Adding new contructors and "locale" member
@ sql/mysql_priv.h
   Adding number formatting members into MY_LOCALE
@ sql/sql_locale.cc
   Adding number formatting data into locale constants
@ sql/set_var.cc
   Using new error message
@ sql/share/errmgs.txt
   Adding new error message
2009-10-05 20:06:04 +05:00
Mats Kindahl
d47710c8dc WL#5016: Fix header file include guards
Adding header include file guards to files that are missing such.
2009-09-23 23:32:31 +02:00
Sergey Petrunya
29f0dcb563 Merge MySQL->MariaDB
* Finished Monty and Jani's merge
* Some InnoDB tests still fail (because it's old xtradb code run against
  newer testsuite). They are expected to go after mergning with the latest
  xtradb.
2009-09-08 00:50:10 +04:00
Alexey Kopytov
7561bc9212 Manual merge. 2009-06-01 16:00:38 +04:00
Alexey Kopytov
1b8322c3c6 Bug #44767: invalid memory reads in password() and
old_password() functions   
The PASSWORD() and OLD_PASSWORD() functions could lead to   
memory reads outside of an internal buffer when used with BLOB   
arguments.   
  
String::c_ptr() assumes there is at least one extra byte  
in the internally allocated buffer when adding the trailing  
'\0'.  This, however, may not be the case when a String object  
was initialized with externally allocated buffer.  
  
The bug was fixed by adding an additional "length" argument to  
make_scrambled_password_323() and make_scrambled_password() in  
order to avoid String::c_ptr() calls for  
PASSWORD()/OLD_PASSWORD().  
  
However, since the make_scrambled_password[_323] functions are  
a part of the client library ABI, the functions with the new  
interfaces were implemented with the 'my_' prefix in their  
names, with the old functions changed to be wrappers around  
the new ones to maintain interface compatibility.  

mysql-test/r/func_crypt.result:
  Added a test case for bug #44767.
mysql-test/t/func_crypt.test:
  Added a test case for bug #44767.
sql/item_strfunc.cc:
  Use the new my_make_scrambled_password*() to avoid 
  String::c_ptr().
sql/item_strfunc.h:
  Changed Item_func[_old]_password::alloc() interfaces so that
  we can use the new my_make_scrambled_password*() functions.
sql/mysql_priv.h:
  Added declarations for the new my_make_scrambled_password*() 
  functions.
sql/password.c:
  Added new my_make_scrambled_password*() functions with an
  additional "length" argument. Changed ones to be wrappers
  around the new ones to maintain interface compatibility.
sql/sql_yacc.yy:
  Utilize the new password hashing functions with additional length
  argument.
2009-05-27 14:20:57 +04:00
Georgi Kodinov
ed2d0035de merged bug 35087 to 5.1-bugteam 2009-04-17 19:18:00 +03:00
Georgi Kodinov
0804479569 Bug #35087: Inserting duplicate values at one time with DES_ENCRYPT leads
to wrong results
      
3 problems found with DES_ENCRYPT/DES_DECRYPT :

1. The max length was not calculated properly. Fixed in fix_length_and_dec()
2. DES_ENCRYPT had a side effect of sometimes reallocating and changing 
the value of its argument. Fixed by explicitly pre-allocating the necessary
space to pad the argument with trailing '*' (stars) when calculating the 
DES digest.
3. in DES_ENCRYPT the string buffer for the result value was not 
reallocated to the correct size and only string length was assigned to it. 
Fixed by making sure there's enough space to hold the result.
2009-04-17 18:52:57 +03:00