summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.2 into 10.3Marko Mäkelä2018-10-091-2/+21
|\
| * Remove valgrind warnings from Item_str_concatMichael Widenius2018-10-051-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | This warning come from a copy() operation of type: memcpy(ptr, ptr+A, B), which is safe but produces a warning when run with valgrind. To avoid the warning, I added copy_or_move() method which uses memmove() instead of memcpy(). In 10.3 the change in item_strfunc::Item_func_concat() has to be mirroed in Item_func_concat_oracle() to avoid future valgrind warnings.
* | Merge 10.2 into 10.3Marko Mäkelä2018-05-291-2/+11
|\ \ | |/
| * Merge 10.1 into 10.2Marko Mäkelä2018-05-291-1/+10
| |\
| | * Fix type mismatchMarko Mäkelä2018-05-291-1/+1
| | |
| | * Avoid warnings in String::copy when copying string on itself (ok to do)Monty2018-05-261-1/+10
| | |
* | | Merge 10.2 into 10.3Marko Mäkelä2018-04-241-6/+6
|\ \ \ | |/ /
| * | Remove most 'register' use in C++Marko Mäkelä2018-04-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Modern compilers (such as GCC 8) emit warnings that the 'register' keyword is deprecated and not valid C++17. Let us remove most use of the 'register' keyword. Code in 'extra/' is not touched.
* | | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-28/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'size_t' to 'type', possible loss of data) Handle string length as size_t, consistently (almost always:)) Change function prototypes to accept size_t, where in the past ulong or uint were used. change local/member variables to size_t when appropriate. This fix excludes rocksdb, spider,spider, sphinx and connect for now.
* | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-01-041-1/+1
|\ \ \
| * | | mysqlbinlog now prints "# Number of rows" and stops on errorsMonty2017-12-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Main problem was that no log-event print function checked for disk full error on the IO_CACHE. All changes in this patch only affects mysqlbinlog, not the server! - Changed all log-event print functions to return 1 on error - Fixed memory usage when not using --flashback. - Added printing of number of rows in row events. Can be disabled with --print-row-count=0 - Print annotated rows when using mysqlbinlog --short-form - Fixed that mysqlbinlog --debug works - Fixed create_drop_binlog.test test failure - Reorganized fields in PRINT_EVENT_INFO to be according to size to optimize storage - Don't change print_row_event_position or print_row_counts if set by user - Remove some testing of argument to my_free is 0 - base64-output=never is now supported and works in all context - Updated help information for --base64-output and --short-form - print_row_count is now on by default. Reset automatically if --short-form is used - Removed obsolote warning for mysql 5.6.0 - More DBUG_PRINT for mysqltest.cc - my_b_write_byte() now checks for flush failures. This fixed a memory overrun on disk full - my_b_printf() now returns 1 on failure, 0 on ok. This simplifies code and no old code was using the old return value of my_b_printf(). - my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok - Fixed some error conditions in log printing that was not previously handled. - Slave_rows_error_report() can now handle longlong positions - Write_on_release_cache() rewritten so that we can detect errors on flush. Not depending on automatic release anymore. - Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS - Fixed that copy_event_cache_to_string_and_reinit() works with strings longer than 4G (Changed to use LEX_STRING instead of String) - Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are anyway restricted to UINT32_MAX - Fixed bug in rpl_binlog_state::write_to_iocache() which hide write failures (duplicate variable name) - Fixed bug in String::append if original string was not allocated - Stop mysqlbinlog output at once if there is an error. - Before printing error message, flush result file. This ensures that the error message is printed last. (Easier to find)
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-10-041-16/+21
|\ \ \ \ | |/ / /
| * | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-10-021-16/+21
| |\ \ \ | | |/ /
| | * | MDEV-13384 - misc Windows warnings fixedVladislav Vaintroub2017-09-281-15/+20
| | | |
* | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-2/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2017-07-071-6/+5
|\ \ \ | |/ /
| * | cleanup: generate_partition_syntax()Sergei Golubchik2017-07-051-0/+8
| | | | | | | | | | | | | | | | | | Don't write to a temporary file, use String. Remove strange one-liner "helpers", use String methods. Don't use current_thd, don't allocate memory for 1-byte strings, etc.
* | | MDEV-10139 Support for SEQUENCE objectsMonty2017-04-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Working features: CREATE OR REPLACE [TEMPORARY] SEQUENCE [IF NOT EXISTS] name [ INCREMENT [ BY | = ] increment ] [ MINVALUE [=] minvalue | NO MINVALUE ] [ MAXVALUE [=] maxvalue | NO MAXVALUE ] [ START [ WITH | = ] start ] [ CACHE [=] cache ] [ [ NO ] CYCLE ] ENGINE=xxx COMMENT=".." SELECT NEXT VALUE FOR sequence_name; SELECT NEXTVAL(sequence_name); SELECT PREVIOUS VALUE FOR sequence_name; SELECT LASTVAL(sequence_name); SHOW CREATE SEQUENCE sequence_name; SHOW CREATE TABLE sequence_name; CREATE TABLE sequence-structure ... SEQUENCE=1 ALTER TABLE sequence RENAME TO sequence2; RENAME TABLE sequence TO sequence2; DROP [TEMPORARY] SEQUENCE [IF EXISTS] sequence_names Missing features - SETVAL(value,sequence_name), to be used with replication. - Check replication, including checking that sequence tables are marked not transactional. - Check that a commit happens for NEXT VALUE that changes table data (may already work) - ALTER SEQUENCE. ANSI SQL version of setval. - Share identical sequence entries to not add things twice to table list. - testing insert/delete/update/truncate/load data - Run and fix Alibaba sequence tests (part of mysql-test/suite/sql_sequence) - Write documentation for NEXT VALUE / PREVIOUS_VALUE - NEXTVAL in DEFAULT - Ensure that NEXTVAL in DEFAULT uses database from base table - Two NEXTVAL for same row should give same answer. - Oracle syntax sequence_table.nextval, without any FOR or FROM. - Sequence tables are treated as 'not read constant tables' by SELECT; Would be better if we would have a separate list for sequence tables so that select doesn't know about them, except if refereed to with FROM. Other things done: - Improved output for safemalloc backtrack - frm_type_enum changed to Table_type - Removed lex->is_view and replaced with lex->table_type. This allows use to more easy check if item is view, sequence or table. - Added table flag HA_CAN_TABLES_WITHOUT_ROLLBACK, needed for handlers that want's to support sequences - Added handler calls: - engine_name(), to simplify getting engine name for partition and sequences - update_first_row(), to be able to do efficient sequence implementations. - Made binlog_log_row() global to be able to call it from ha_sequence.cc - Added handler variable: row_already_logged, to be able to flag that the changed row is already logging to replication log. - Added CF_DB_CHANGE and CF_SCHEMA_CHANGE flags to simplify deny_updates_if_read_only_option() - Added sp_add_cfetch() to avoid new conflicts in sql_yacc.yy - Moved code for add_table_options() out from sql_show.cc::show_create_table() - Added String::append_longlong() and used it in sql_show.cc to simplify code. - Added extra option to dd_frm_type() and ha_table_exists to indicate if the table is a sequence. Needed by DROP SQUENCE to not drop a table.
* | | MDEV-11298 Split Item_func_hex::val_str_ascii() into virtual methods in ↵Alexander Barkov2016-12-161-4/+57
|/ / | | | | | | Type_handler
* | store/show vcols as item->print()Sergei Golubchik2016-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | otherwise we'd need to store sql_mode *per vcol* (consider CREATE INDEX...) and how SHOW CREATE TABLE would support that? Additionally, get rid of vcol::expr_str, just to make sure the string is always generated and never leaked in the original form.
* | MDEV-7769 MY_CHARSET_INFO refactoring# On branch 10.2Alexander Barkov2016-10-101-2/+2
| | | | | | | | Part 3 (final): removing MY_CHARSET_HANDLER::well_formed_len().
* | Merge branch '10.2' into bb-10.2-connector-c-integ-submSergei Golubchik2016-09-211-0/+1
|\ \
| * | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-2/+4
| | | | | | | | | | | | Transaction tracker
| * | MDEV-8931: (server part of) session state trackingOleksandr Byelkin2016-08-311-0/+14
|/ / | | | | | | initial commit to test
* | MDEV-10138 Support for decimals up to 38 digitsMonty2016-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Decimals with float, double and decimal now works the following way: - DECIMAL_NOT_SPECIFIED is used when declaring DECIMALS without a firm number of decimals. It's only used in asserts and my_decimal_int_part. - FLOATING_POINT_DECIMALS (31) is used to mark that a FLOAT or DOUBLE was defined without decimals. This is regarded as a floating point value. - Max decimals allowed for FLOAT and DOUBLE is FLOATING_POINT_DECIMALS-1 - Clients assumes that float and double with decimals >= NOT_FIXED_DEC are floating point values (no decimals) - In the .frm decimals=FLOATING_POINT_DECIMALS are used to define floating point for float and double (31, like before) To ensure compatibility with old clients we do: - When storing float and double, we change NOT_FIXED_DEC to FLOATING_POINT_DECIMALS. - When creating fields from .frm we change for float and double FLOATING_POINT_DEC to NOT_FIXED_DEC - When sending definition for a float/decimal field without decimals to the client as part of a result set we convert NOT_FIXED_DEC to FLOATING_POINT_DECIMALS. - variance() and std() has changed to limit the decimals to FLOATING_POINT_DECIMALS -1 to not get the double converted floating point. (This was to preserve compatiblity) - FLOAT and DOUBLE still have 30 as max number of decimals. Bugs fixed: variance() printed more decimals than we support for double values. New behaviour: - Strings now have 38 decimals instead of 30 when converted to decimal - CREATE ... SELECT with a decimal with > 30 decimals will create a column with a smaller range than before as we are trying to preserve the number of decimals. Other changes - We are now using the obsolete bit FIELDFLAG_LEFT_FULLSCREEN to specify decimals > 31 - NOT_FIXED_DEC is now declared in one place - For clients, NOT_FIXED_DEC is always 31 (to ensure compatibility). On the server NOT_FIXED_DEC is DECIMAL_NOT_SPECIFIED (39) - AUTO_SEC_PART_DIGITS is taken from DECIMAL_NOT_SPECIFIED - DOUBLE conversion functions are now using DECIMAL_NOT_SPECIFIED instead of NOT_FIXED_DEC
* | MDEV-8360 Clean-up CHARSET_INFO: strnncollsp: diff_if_only_endspace_differenceAlexander Barkov2016-03-311-1/+1
|/ | | | | | | | | | | | | | | | | | | - Removing the "diff_if_only_endspace_difference" argument from MY_COLLATION_HANDLER::strnncollsp(), my_strnncollsp_simple(), as well as in the function template MY_FUNCTION_NAME(strnncollsp) in strcoll.ic - Removing the "diff_if_only_space_different" from ha_compare_text(), hp_rec_key_cmp(). - Adding a new function my_strnncollsp_padspace_bin() and reusing it instead of duplicate code pieces in my_strnncollsp_8bit_bin(), my_strnncollsp_latin1_de(), my_strnncollsp_tis620(), my_strnncollsp_utf8_cs(). - Adding more tests for better coverage of the trailing space handling. - Removing the unused definition of HA_END_SPACE_ARE_EQUAL
* Merge branch '10.0' into 10.1Sergei Golubchik2016-03-211-2/+2
|\
| * Fix spelling: occurred, execute, which etcOtto Kekäläinen2016-03-041-2/+2
| |
* | MDEV-9332 Bug after upgrade to 10.1.10Alexander Barkov2016-01-271-4/+106
| |
* | MDEV-8253 EXPLAIN SELECT prints unexpected charactersAlexander Barkov2015-09-231-0/+10
| | | | | | | | | | | | | | | | | | Item_string::clone_item() creates a new Item_string that points exactly to the same buffer that the original one does. Later, Item_string::print() uses c_ptr() for the original Item_string, which reallocs the original buffer, and the clone remain with the old freed buffer. Refactoring the code not to use c_ptr() in Item_string::print().
* | Removing unused String_copier::copy_fix.Alexander Barkov2015-08-141-7/+1
| | | | | | | | Fixing misleading comments in String_copiers::well_formed_copy().
* | Moving the conversion code from String::well_formed_copy()Alexander Barkov2015-03-161-68/+3
| | | | | | | | to my_convert_fix() - a new function in /strings.
* | MDEV-6566 Different INSERT behaviour on bad bytes with and without character ↵Alexander Barkov2015-03-131-2/+2
| | | | | | | | set conversion
* | A preparatory patch for MDEV-6566.Alexander Barkov2015-03-021-67/+3
| | | | | | | | | | | | Adding a new virtual function MY_CHARSET_HANDLER::copy_abort(). Moving character set specific code into the correspoding implementations (for simple, multi-byte and mbmaxlen>1 character sets).
* | Reducing duplicate code and simplifying well formed string copyingAlexander Barkov2015-02-271-51/+54
|/ | | | | | | by adding a new class String_copier. This is a pre-requisite patch for MDEV-6566 and MDEV-6572, to avoid adding more similar code.
* MDEV-6752 Trailing incomplete characters are not replaced to question marks ↵Alexander Barkov2014-09-181-2/+9
| | | | on conversion
* - MDEV-6695 Bad column name for UCS2 string literalsAlexander Barkov2014-09-041-1/+1
| | | | | | | | | | | | | | | | The Item_string constructors called set_name() on the source string, which was wrong because in case of UCS2/UTF16/UTF32 the source value might be a not well formed string (e.g. have incomplete leftmost character). Now set_name() is called on str_value after its copied (with optionally left zero padding) from the source string. - MDEV-6694 Illegal mix of collation with a PS parameter Item_param::convert_str_value() did not set repertoire. Introducing a new structure MY_STRING_METADATA to collect character length and repertoire of a string in a single loop, to avoid two separate loops. Adding a new class Item_basic_value::Metadata as a convenience wrapper around MY_STRING_METADATA, to reuse the code between Item_string and Item_param.
* Moving Item::str_value from public to protected.Alexander Barkov2014-09-031-1/+1
|
* 5.5.38 mergeSergei Golubchik2014-06-061-0/+36
|\
| * mysql-5.5.38 mergeSergei Golubchik2014-06-031-0/+36
| |\
| | * Addendum #1 to the fix for bug #18359924Georgi Kodinov2014-04-111-5/+11
| | | | | | | | | | | | | | | Removed unused variable. Fixed long (>80 lines)
| | * Bug #18359924: INNODB AND MYISAM CORRUPTION ON PREFIX INDEXESGeorgi Kodinov2014-04-101-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem was in the validation of the input data for blob types. When assigned binary data, the character blob types were only checking if the length of these data is a multiple of the minimum char length for the destination charset. And since e.g. UTF-8's minimum character length is 1 (becuase it's variable length) even byte sequences that are invalid utf-8 strings (e.g. wrong leading byte etc) were copied verbatim into utf-8 columns when coming from binary strings or fields. Storing invalid data into string columns was having all kinds of ill effects on code that assumed that the encoding data are valid to begin with. Fixed by additionally checking the incoming binary string for validity when assigning it to a non-binary string column. Made sure the conversions to charsets with no known "invalid" ranges are not covered by the extra check. Removed trailing spaces. Test case added.
* | | make append_query_string() more usable:Sergei Golubchik2014-03-261-1/+1
| | | | | | | | | | | | simplify the prototype and move it to sql_string.h
* | | 10.0-base mergeSergei Golubchik2014-02-261-2/+1
|\ \ \
| * \ \ 5.5 mergeSergei Golubchik2014-02-251-2/+1
| |\ \ \ | | |/ /
| | * | MySQL-5.5.36 mergeSergei Golubchik2014-02-171-2/+1
| | |\ \ | | | |/ | | | | | | | | (without few incorrect bugfixes and with 1250 files where only a copyright year was changed)
| | | * Updated/added copyright headersMurthy Narkedimilli2014-01-061-1/+1
| | | |
* | | | 10.0-monty mergeSergei Golubchik2013-07-211-66/+5
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | | Temporary commit of 10.0-mergeMichael Widenius2013-03-261-66/+5
| | | | |
* | | | | 10.0-base mergeSergei Golubchik2013-06-061-1/+1
|\ \ \ \ \ | | |/ / / | |/| | | | | | | | (without InnoDB - all InnoDB changes were ignored)