summaryrefslogtreecommitdiff
path: root/sql/field_conv.cc
Commit message (Collapse)AuthorAgeFilesLines
* Fix various spelling errorsOtto Kekäläinen2020-03-161-1/+1
| | | | | | | | | | | | | | | | | e.g. - dont -> don't - occurence -> occurrence - succesfully -> successfully - easyly -> easily Also remove trailing space in selected files. These changes span: - server core - Connect and Innobase storage engine code - OQgraph, Sphinx and TokuDB storage engines Related to MDEV-21769.
* MDEV-21581 Helper functions and methods for CHARSET_INFOAlexander Barkov2020-01-281-14/+13
|
* MDEV-21497 Make Field_time, Field_datetime, Field_timestamp abstractAlexander Barkov2020-01-161-2/+2
| | | | | | | - Making classes Field_time, Field_datetime, Field_timestamp abstract - Adding instantiable Field_time0, Field_datetime0, Field_timestamp0 classes - Removing redundant cast in field_conv.cc, item_timefunc.cc, sp.cc in calls for set_time() and get_timestamp() - Replacing store_TIME() to store_timestamp() in log.cc and removing redundant cast
* MDEV-20783 INET6 cannot be converted to BINARY(16)Alexander Barkov2019-10-101-3/+3
|
* MDEV-20785 Converting INET6 to CHAR(39) produces garbage without a warningAlexander Barkov2019-10-091-1/+1
|
* Revert "MDEV-20342 Turn Field::flags from a member to a method"Alexander Barkov2019-08-141-2/+3
| | | | | | | This reverts commit e86010f909fb6b8c4ffd9d6df92991ac079e67e7. Reverting on Monty's request, as this change makes merging things from 10.5 to 10.2 much harder.
* MDEV-20342 Turn Field::flags from a member to a methodAlexander Barkov2019-08-141-3/+2
|
* Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-1/+1
|\
| * 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
* | | | | MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMPbb-10.4-mdev16991Alexander Barkov2018-11-261-3/+3
| | | | |
* | | | | MDEV-17792 New class Timestamp and cleanups in Date, Datetime, Field for ↵Alexander Barkov2018-11-221-9/+24
| | | | | | | | | | | | | | | | | | | | rounding
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-11-061-1/+1
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2018-11-061-1/+1
| |\ \ \ \ | | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | main.derived_cond_pushdown: Move all 10.3 tests to the end, trim trailing white space, and add an "End of 10.3 tests" marker. Add --sorted_result to tests where the ordering is not deterministic. main.win_percentile: Add --sorted_result to tests where the ordering is no longer deterministic.
| | * | | Merge 10.1 into 10.2Marko Mäkelä2018-11-061-1/+1
| | |\ \ \ | | | |/ /
| | | * | Merge branch '10.0' into 10.1Sergei Golubchik2018-10-301-1/+1
| | | |\ \
| | | | * \ Merge branch '5.5' into 10.0Sergei Golubchik2018-10-271-1/+1
| | | | |\ \ | | | | | |/
| | | | | * Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2018-10-231-1/+1
| | | | | |\
| | | | | | * BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATAKarthik Kamath2018-07-231-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LOSS ANALYSIS: ========= When converting from a BLOB/TEXT type to a smaller BLOB/TEXT type, no warning/error is reported to the user informing about the truncation/data loss. FIX: ==== We are now reporting a warning in non-strict mode and an appropriate error in strict mode.
* | | | | | | MDEV-17317 Add THD* parameter into Item::get_date() and stricter data type ↵Alexander Barkov2018-09-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | control to "fuzzydate"
* | | | | | | MDEV-16910 Add class VDecAlexander Barkov2018-08-071-2/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Adding classes VDec and VDec2_lazy, according to the task description. This patch removes around 250 duplicate code lines.
* | | | | | Add likely/unlikely to speed up executionMonty2018-05-071-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added to: - if (error) - Lex - sql_yacc.yy and sql_yacc_ora.yy - In header files to alloc() calls - Added thd argument to thd_net_is_killed()
* | | | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2018-02-151-3/+3
|\ \ \ \ \ \
| * \ \ \ \ \ Merge remote-tracking branch 'origin/10.2' into bb-10.2-extAlexander Barkov2018-02-081-3/+3
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | Merge branch 'github/10.1' into 10.2Sergei Golubchik2018-02-061-3/+3
| | |\ \ \ \ \ | | | |/ / / /
| | | * | | | Merge branch 'github/10.0' into 10.1Sergei Golubchik2018-02-021-3/+3
| | | |\ \ \ \ | | | | |/ / /
| | | | * | | Merge remote-tracking branch '5.5' into 10.0Vicențiu Ciorbaru2018-01-241-3/+3
| | | | |\ \ \ | | | | | |/ /
| | | | | * | BIT field woesSergei Golubchik2018-01-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * get_rec_bits() was always reading two bytes, even if the bit field contained only of one byte * In various places the code used field->pack_length() bytes starting from field->ptr, while it should be field->pack_length_in_rec() * Field_bit::key_cmp and Field_bit::cmp_max passed field_length as an argument to memcmp(), but field_length is the number of bits!
| | | * | | | bugfix: copy timestamps correctly in INSERT...SELECTSergei Golubchik2017-09-211-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | don't do it via MYSQL_TIME, that conversion is lossy around DST change dates.
| | | * | | | MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST changeSergei Golubchik2017-09-211-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a special Copy_field method for timestamps, that copies timestamps without converting them to MYSQL_TIME (the conversion is lossy around DST change dates).
* | | | | | | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '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.
* | | | | | | Added CHECK_FIELD_EXPRESSIONMonty2017-12-221-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed for MDEV 13679 Enabled sequences to be used in DEFAULT Added new option for count_cuted_fields: CHECK_FIELD_EXPRESSION which is used to check if a DEFAULT expression is correct before ALTER TABLE starts Changed also all test: if (thd->count_cuted_fields) to if (thd->count_cuted_fields > CHECK_FIELD_EXPRESSION)
* | | | | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-09-251-0/+17
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Merge branch '10.2' into bb-10.2-extSergei Golubchik2017-09-231-0/+17
| |\ \ \ \ \ \ | | |/ / / / /
| | * | | | | bugfix: copy timestamps correctly in INSERT...SELECTSergei Golubchik2017-09-221-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement Field_timestamp::save_in_field(timestamp_field) that stores timestamp values without converting them to MYSQL_TIME and back, because this conversion is lossy around DST change time. This fixes main.old-mode test. This is 10.2 version of f8a800bec81
| | * | | | | bugfix: ALTER TABLE and TIMESTAMPs around DST change timeSergei Golubchik2017-09-221-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a special Copy_func function for timestamps, that copies timestamps without converting them to MYSQL_TIME (the conversion is lossy around DST change time). This fixes ALTER TABLE part of main.old-mode test. This is 10.2 version of f4f48e06215
* | | | | | | MDEV-11371 - column compressionSergey Vojtovich2017-08-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Storage engine independent support for column compression. TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT, VARCHAR and VARBINARY columns can be compressed. New COMPRESSED column attribute added: COMPRESSED[=<compression_method>] System variables added: column_compression_threshold column_compression_zlib_level column_compression_zlib_strategy column_compression_zlib_wrap Status variables added: Column_compressions Column_decompressions Limitations: - the only supported method currently is zlib - CSV storage engine stores data uncompressed on-disk even if COMPRESSED attribute is present - it is not possible to create indexes over compressed columns.
* | | | | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-1/+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
* | | | | | Changing field::field_name and Item::name to LEX_CSTRINGMonty2017-04-231-1/+1
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Benefits of this patch: - Removed a lot of calls to strlen(), especially for field_string - Strings generated by parser are now const strings, less chance of accidently changing a string - Removed a lot of calls with LEX_STRING as parameter (changed to pointer) - More uniform code - Item::name_length was not kept up to date. Now fixed - Several bugs found and fixed (Access to null pointers, access of freed memory, wrong arguments to printf like functions) - Removed a lot of casts from (const char*) to (char*) Changes: - This caused some ABI changes - lex_string_set now uses LEX_CSTRING - Some fucntions are now taking const char* instead of char* - Create_field::change and after changed to LEX_CSTRING - handler::connect_string, comment and engine_name() changed to LEX_CSTRING - Checked printf() related calls to find bugs. Found and fixed several errors in old code. - A lot of changes from LEX_STRING to LEX_CSTRING, especially related to parsing and events. - Some changes from LEX_STRING and LEX_STRING & to LEX_CSTRING* - Some changes for char* to const char* - Added printf argument checking for my_snprintf() - Introduced null_clex_str, star_clex_string, temp_lex_str to simplify code - Added item_empty_name and item_used_name to be able to distingush between items that was given an empty name and items that was not given a name This is used in sql_yacc.yy to know when to give an item a name. - select table_name."*' is not anymore same as table_name.* - removed not used function Item::rename() - Added comparision of item->name_length before some calls to my_strcasecmp() to speed up comparison - Moved Item_sp_variable::make_field() from item.h to item.cc - Some minimal code changes to avoid copying to const char * - Fixed wrong error message in wsrep_mysql_parse() - Fixed wrong code in find_field_in_natural_join() where real_item() was set when it shouldn't - ER_ERROR_ON_RENAME was used with extra arguments. - Removed some (wrong) ER_OUTOFMEMORY, as alloc_root will already give the error. TODO: - Check possible unsafe casts in plugin/auth_examples/qa_auth_interface.c - Change code to not modify LEX_CSTRING for database name (as part of lower_case_table_names)
* | | | | MDEV-7769 MY_CHARSET_INFO refactoring# On branch 10.2Alexander Barkov2016-10-101-21/+14
| | | | | | | | | | | | | | | | | | | | Part 3 (final): removing MY_CHARSET_HANDLER::well_formed_len().
* | | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-03-231-3/+0
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-5542: GROUP_CONCAT truncate output to 65.536 chars when using DISTINCT ↵Oleksandr Byelkin2016-03-011-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or ORDER BY port of mysql fix WL#6098
* | | | | Merge branch '10.1' into 10.2Sergei Golubchik2016-02-251-3/+2
|\ \ \ \ \ | |/ / / /
| * | | | Merge branch '10.0' into 10.1Sergei Golubchik2016-02-231-4/+8
| |\ \ \ \ | | |/ / /
| | * | | Merge branch '5.5' into 10.0Sergei Golubchik2016-02-151-4/+8
| | |\ \ \ | | | |/ /
| | | * | Merge branch 'mysql/5.5' into 5.5Sergei Golubchik2016-02-091-4/+8
| | | |\ \ | | | | |/ | | | | | | | | | | | | | | | reverted about half of commits as either not applicable or outright wrong
| | | | * Bug #22232332: SAVING TEXT FIELD TO TEXT VARIABLE IN ASreeharsha Ramanavarapu2016-01-081-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PROCEDURE RESULTS IN GARBAGE BYTES Issue: ----- This problem occurs under the following conditions: a) Stored procedure has a variable is declared as TEXT/BLOB. b) Data is copied into the the variable using the SELECT...INTO syntax from a TEXT/BLOB column. Data corruption can occur in such cases. SOLUTION: --------- The blob type does not allocate space for the string to be stored. Instead it contains a pointer to the source string. Since the source is deallocated immediately after the select statement, this can cause data corruption. As part of the fix for Bug #21143080, when the source was part of the table's write-set, blob would allocate the neccessary space. But this fix missed the possibility that, as in the above case, the target might be a variable. The fix will add the copy_blobs check that was removed by the earlier fix.
| | | | * Bug #22123583: MYSQL 5.5: MAIN.SP HAS VALGRIND ISSUESSreeharsha Ramanavarapu2015-11-031-69/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: ----- When a varchar column is used to fill the record in an internal temporary table, the length of the string stored in the column is not taken into account. Instead the default length of packed data is used to copy with memmove. This will cause valgrind issues since some bytes are uninitialized. SOLUTION: --------- The solution is to take into account the length of the string stored in the column while filling the record. This fix is a backport of BUG#13389854.