summaryrefslogtreecommitdiff
path: root/sql/sql_string.cc
Commit message (Collapse)AuthorAgeFilesLines
* perfschema memory related instrumentation changesSergei Golubchik2020-03-101-4/+26
|
* MDEV-21581 Helper functions and methods for CHARSET_INFOAlexander Barkov2020-01-281-7/+6
|
* A cleanup for MDEV-8844: Fixing compilation failure on WindowsAlexander Barkov2019-12-071-3/+4
| | | | | | Fixing lossy type conversions: - from int64 to int - from size_t to uint
* MDEV-8844 Unreadable control characters printed as is in warningsAlexander Barkov2019-12-061-0/+22
|
* MDEV-20349: Assertion `to_len >= 8' failed in convert_to_printableVarun Gupta2019-08-161-0/+2
| | | | Use convert_to_printable function to write only non-empty ranges to the optimizer trace
* MDEV-19776: Assertion `to_len >= 8' failed in convert_to_printable with ↵Varun Gupta2019-06-201-1/+5
| | | | | | | optimizer trace enabled Introduced the convert_to_printable_required_length to return the correct length(taking into consideration of dots in the case of error messages).
* MDEV-18880: Optimizer trace prints date in hexadecimalVarun2019-06-111-0/+12
| | | | | Introduced a print_key_value function to makes sure that the trace prints data in readable format for readable characters and the rest of the characters are printed as hexadecimal.
* Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+22
|\
| * Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
| |\
| | * Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| | |\
| | | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | | |\
| | | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | | | | | * Update wrong zip-code
| * | | | Merge branch '10.2' into 10.3Oleksandr Byelkin2019-05-121-0/+21
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '10.1' into 10.2Oleksandr Byelkin2019-05-041-0/+21
| | |\ \ \ | | | |/ /
| | | * | MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fieldsAlexander Barkov2019-04-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | copy_if_not_alloced() did not handle situations when "from" is a constant string pointing to a substring of "to", so this code part freed "to" but then tried to copy its old (already freed) content to a new buffer: if (to->realloc(from_length)) return from; if ((to->str_length=MY_MIN(from->str_length,from_length))) memcpy(to->Ptr,from->Ptr,to->str_length); Adding a new code piece that catches such constant substrings and propery reallocs "to" to preserve its important part referenced by "from".
* | | | | MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_rawAlexander Barkov2019-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug was introduced in this commit: commit: a9ca819897f5c82582bfd3fedb09c78131cf8e00 Call alloc() instead of realloc() Use alloc() if we don't need original string (avoid copy) Removed not needed test of str_length in sql_string.cc copy_if_not_alloced() was forgotten when changing realloc()'s to alloc()'s. Changing it now.
* | | | | MDEV-17906 Class Binary_stringbb-10.4-mdev7063Alexander Barkov2018-12-051-67/+23
| | | | |
* | | | | MDEV-17907 Class Static_binary_stringAlexander Barkov2018-12-051-28/+8
| | | | |
* | | | | MDEV-17905 Add class CharsetAlexander Barkov2018-12-051-33/+23
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-10-101-2/+21
|\ \ \ \ \ | |/ / / /
| * | | | 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.
* | | | | Call alloc() instead of realloc()Monty2018-07-131-2/+1
|/ / / / | | | | | | | | | | | | | | | | Use alloc() if we don't need original string (avoid copy) Removed not needed test of str_length in sql_string.cc
* | | | 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
| | |