summaryrefslogtreecommitdiff
path: root/sql/protocol.cc
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.5 into 10.6Marko Mäkelä2020-11-021-3/+5
|\
| * Merge branch '10.4' into 10.5Sujatha2020-09-291-3/+5
| |\
| | * Merge branch '10.3' into 10.4Sujatha2020-09-281-3/+5
| | |\
| | | * Merge branch '10.2' into 10.3Sujatha2020-09-281-3/+5
| | | |\
| | | | * MDEV-22387: Do not violate __attribute__((nonnull))Marko Mäkelä2020-09-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing a null pointer to a nonnull argument is not only undefined behaviour, but it also grants the compiler the permission to optimize away further checks whether the pointer is null. GCC -O2 at least starting with version 8 may do that, potentially causing SIGSEGV.
* | | | | Merge branch '10.5' into 10.6Oleksandr Byelkin2020-09-021-58/+52
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-19275 Provide SQL service to plugins.Alexey Botchkov2020-08-141-23/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Protocol_local fixed so it can be used now. Some Protocol:: methods made virtual so they can adapt. as well as net_ok and net_send_error functions. execute_sql_string function is exported to the plugins. To be changed with the mysql_use_result.
| * | | | MDEV-23162 Improve Protocol performance for numeric dataAlexander Barkov2020-08-141-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An alternative implementation (replacing the one based on repertoire). This implementation makes Field send itself to Protocol_text using data type specific Protocol methods rather than field->val_str() followed by protocol_text->store_str(). As now Field sends itself in the same way to all protocol types (e.g. Protocol_binary, Protocol_text, Protocol_local), the method Field::send_binary() was renamed just to Field::send(). Note, this change introduces symmetry between Field and Item, because Items also send themself using a single method Item::send(), which is used for *all* protocol types. Performance improvement is achieved by the fact that Protocol_text implements these data type specific methods using store_numeric_string_aux() rather than store_string_aux(). The conversion now happens only when character_set_results is not ASCII compatible character sets (e.g. UCS2, UTF16, UTF32). In the old code (before any MDEV-23162 work, e.g. as of 10.5.4), Protocol_text::store(Field*) used val_str() for all data types. So the execution went through the character set conversion routines even for numeric and temporal data types. Benchmarking summary (see details in MDEV-23478): The new approach stably demonstrates additional improvement comparing to the previous implementation (the smaller time - the better): Original - the commit before MDEV-23162 be98036f25ac8cfb34fa5bb5066975d79f595aec 1m9.336s 1m9.290s 1m9.300s MDEV-23162 - the repertoire optimization 1m6.101s 1m5.988s 1m6.264s MDEV-23478 - this commit 1m2.150s 1m2.079s 1m2.099s
| * | | | Revert "MDEV-23162 Improve Protocol performance for numeric data"Alexander Barkov2020-08-141-19/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit eb2eaba7fdbd13c9814ab4619cc23d9f140e5485. A different implementation of MDEV-23162 is coming.
| * | | | MDEV-23270 Remove a String parameter from Protocol::store(double/float)Alexander Barkov2020-08-141-8/+8
| | | | |
* | | | | Merge 10.5 into 10.6Marko Mäkelä2020-08-121-18/+27
|\ \ \ \ \ | |/ / / /
| * | | | MDEV-23435 Functions do not convert numbers to character_set_resultsAlexander Barkov2020-08-101-18/+27
| | | | |
* | | | | Merge 10.5 into 10.6Marko Mäkelä2020-08-041-45/+41
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.4 into 10.5Marko Mäkelä2020-08-011-1/+1
| |\ \ \ \ | | |/ / /
| | * | | MDEV-23311 CEILING() and FLOOR() convert temporal input to numbers, unlike ↵Alexander Barkov2020-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ROUND() and TRUNCATE() Fixing functions CEILING and FLOOR to return - TIME for TIME input - DATETIME for DATETIME and TIMESTAMP input
| * | | | Fixed removed warning from valgrind in Protocol::store_strMonty2020-07-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The problem was that field_count is not initialized for the Protocol variable used when printing metadata.
| * | | | Remove String::lex_string() and String::lex_cstring()Monty2020-07-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Better to use 'String *' directly. - Added String::get_value(LEX_STRING*) for the few cases where we want to convert a String to LEX_CSTRING. Other things: - Use StringBuffer for some functions to avoid mallocs
| * | | | MDEV-23162 Improve Protocol performance for numeric dataAlexander Barkov2020-07-151-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid character set conversion for numeric data in this scenario: SET NAMES utf8; CREATE OR REPLACE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); SELECT a FROM t1;
| * | | | Preparatory changes for MDEV-23162 Improve Protocol performance for numeric dataAlexander Barkov2020-07-151-26/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Renaming this virtual method store() to store_str(): store(const char *str, size_t length, CHARSET_INFO *src_cs, CHARSET_INFO *dst_cs) We'll be adding more variants of store*() soon. This change will help to avoid ambiguities during overloading. - Adding a helper method store_ident(). - Renaming store_str(const LEX_CSTRING &s...) to store_lex_cstring(), to avoid ambiguties during overloading. - Adding a helper method store() for backward compatibility, to avoid a lot of changes in the code now. But eventually we should replace store() to non-ambiguius methods store_str() or store_ident(). - Adding a helper method Protocol::needs_conversion() and reusing it in two places.
| * | | | MDEV-23157 Remove redundant virtual Protocol::store()Alexander Barkov2020-07-131-20/+8
| | | | |
* | | | | MDEV-21612 - remove COM_MULTI from server and C/CVladislav Vaintroub2020-07-141-11/+8
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | The COM_MULTI did not take off. No connector is using it. Remove related code from server, and client. If anything it is a step simplification of already-bloated dispatch_command(), and related code.
* | | | Fixed access to undefined memory found by valgrind and MSANMonty2020-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When my_vsnprintf() is patched, the code protected disabled with 'WAITING_FOR_BUGFIX_TO_VSPRINTF' should be enabled again. Also all %b formats in this patch should be revert to %s again
* | | | MDEV-22130 SHOW WARNINGS will SIGSEGV 10.5 optimized build after setting ↵Alexander Barkov2020-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CHARACTER_SET_RESULTS to NULL and running any invalid SQL | Binary_string::copy_printable_hhhh The old code did not take into account that thd->variables.character_set_results can be NULL.
* | | | MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRYAlexander Barkov2020-03-101-2/+49
| | | |
* | | | MDEV-8844 Unreadable control characters printed as is in warningsAlexander Barkov2019-12-061-0/+12
| | | |
* | | | Merge 10.4 into 10.5Marko Mäkelä2019-08-131-0/+11
|\ \ \ \ | |/ / /
| * | | Merge 10.3 into 10.4Marko Mäkelä2019-07-021-0/+11
| |\ \ \ | | |/ /
| | * | Merge 10.2 into 10.3Marko Mäkelä2019-07-021-0/+11
| | |\ \ | | | |/
| | | * MDEV-19893 Do not send error packets with seqno= 0Vladislav Vaintroub2019-06-271-0/+11
| | | |
* | | | MDEV-19599 Change db_name, table_name to LEX_CSTRING in Item_ident and ↵Alexander Barkov2019-05-261-1/+1
|/ / / | | | | | | | | | Send_field
* | | Merge branch '10.3' into 10.4Oleksandr Byelkin2019-05-191-2/+2
|\ \ \ | |/ /
| * | MDEV-19468 Hybrid type expressions return wrong format for FLOATAlexander Barkov2019-05-151-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-19125 Change Send_field::type from enum_field_types to Type_handler*Alexander Barkov2019-04-021-50/+29
| | | | |
* | | | | MDEV-18796 Synchronize PS grammar between sql_yacc.yy and sql_yacc_ora.yyAlexander Barkov2019-03-031-3/+2
| | | | |
* | | | | MDEV-18408 Assertion `0' failed in Item::val_native_result / ↵Alexander Barkov2019-02-251-108/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null upon mysqld_list_fields after crash recovery The problem happened because Item_ident_for_show did not implement val_native(). Solution: - Removing class Item_ident_for_show - Implementing a new method Protocol::send_list_fields() instead, which accepts a List<Field> instead of List<Item> as input. Now no any Item creation is done during mysqld_list_fields(). Adding helper methods, to reuse the code easier: - Moved a part of Protocol::send_result_set_metadata(), responsible for sending an individual field metadata, into a new method Protocol_text::store_field_metadata(). Reusing it in both send_list_fields() and send_result_set_metadata(). - Adding Protocol_text::store_field_metadata() - Adding Protocol_text::store_field_metadata_for_list_fields() Note, this patch also automatically fixed another bug: MDEV-18685 mysql_list_fields() returns DEFAULT 0 instead of DEFAULT NULL for view columns The reason for this bug was that Item_ident_for_show::val_xxx() and get_date() did not check field->is_null() before calling field->val_xxx()/get_date(). Now the default value is correctly sent by Protocol_text::store(Field*).
* | | | | Galera4Brave Galera Crew2019-01-231-2/+20
| | | | |
* | | | | Merge 10.3 into 10.4Marko Mäkelä2018-09-111-4/+4
|\ \ \ \ \ | |/ / / /
| * | | | Merge 10.2 into 10.3Marko Mäkelä2018-08-281-4/+4
| |\ \ \ \ | | |/ / /
| | * | | Merge 10.1 into 10.2Marko Mäkelä2018-08-211-4/+4
| | |\ \ \ | | | |/ /
| | | * | Merge branch '10.0' into 10.1Oleksandr Byelkin2018-08-211-4/+4
| | | |\ \
| | | | * \ Merge branch '5.5' into 10.0Oleksandr Byelkin2018-08-151-4/+4
| | | | |\ \ | | | | | |/
| | | | | * MDEV-16810 AddressSanitizer: stack-buffer-overflow in int10_to_strSergei Golubchik2018-08-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | truncate incorrect values in convert_period_to_month() so that PERIOD_DIFF never returns a value outside of 2^23 range. And, for safety, increase buffer sizes for int10_to_str to be sufficienly big for any int10_to_str result.
* | | | | | MDEV-16910 Add class VDecAlexander Barkov2018-08-071-6/+4
|/ / / / / | | | | | | | | | | | | | | | | | | | | 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-5/+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()
* | | | | Cleanup: renaming methods make_field(Send_field*) to make_send_field(..)Alexander Barkov2018-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renaming methods: - Field::make_field(Send_field*) to make_send_field(..) - Item::make_field(THD *,Send_field *) to make_send_field(..) - Item::init_make_field(Send_field *, enum_field_type) to init_make_send_field(..) These names looked similar to other functions that are used for a very different purpose (creating Field instances): - Public function "Field * make_field(..)" - Method "Field *Column_defitinion::make_field(..)" The rename makes it's easier to search the code using "grep".
* | | | | MDEV-15091 : Windows, 64bit: reenable and fix warning C4267 (conversion from ↵Vladislav Vaintroub2018-02-061-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '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.