Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-30062 Remove unnecessary delimiter from query for mariadb-client… #2338

Open
wants to merge 2 commits into
base: 11.0
Choose a base branch
from

Conversation

an3l
Copy link
Collaborator

@an3l an3l commented Nov 21, 2022

  • Check which buffer to use as an argument for the call to the function pointer of mysql shortcut command. Buffer shouldn't have delimiter.
  • By default check if shortcut command processed is go which doesn't take any parameter (takes_params) or if a server side comment (/*! \C latin1 */ select 1) is applied. If so use pos buffer, otherwise create buffer without delimiter.
  • Order of call of function pointer matters.
  • Example with the fix when specifying the delimiter
MariaDB [(none)]> \h;

Breakpoint 1, com_help (buffer=0x5555555b476b <find_command(char)+297>, line=0x7fffffffd9a0 "\240\332\377\377\377\177") at /home/anel/GitHub/mariadb/server/src/10.3/client/mysql.cc:3148
3148	{
(gdb) n
+n
3150	  char * help_arg= strchr(line,' '), buff[32], *end;
(gdb) p line
+p line
$1 = 0x5555559f8b98 "\\h"
  • Without delimiter using the fix
MariaDB [(none)]> \h

Breakpoint 1, com_help (buffer=0x5555555b476b <find_command(char)+297>, line=0x7fffffffd9a0 "\240\332\377\377\377\177") at /home/anel/GitHub/mariadb/server/src/10.3/client/mysql.cc:3150
3150	{
(gdb) n
+n
3152	  char * help_arg= strchr(line,' '), buff[32], *end;
(gdb) p line
+p line
$2 = 0x5555559f8b98 "\\h"
  • This part is not affected by the fix,but added for a review
### No delimiter
MariaDB [(none)]> help

Breakpoint 1, com_help (buffer=0x555555a3dfc0, line=0x7fffffffd9f0 " \221\235UUU") at /home/anel/GitHub/mariadb/server/src/10.3/client/mysql.cc:3150
3150	{
(gdb) n
+n
3152	  char * help_arg= strchr(line,' '), buff[32], *end;
(gdb) p line
+p line
$3 = 0x555555a3dfc0 "help"

### There is a delimiter
MariaDB [(none)]> help;

Breakpoint 1, com_help (buffer=0x5555559f8b98, line=0x555555a3dfc4 ";") at /home/anel/GitHub/mariadb/server/src/10.3/client/mysql.cc:3150
3150	{
(gdb) n
+n
3152	  char * help_arg= strchr(line,' '), buff[32], *end;
(gdb) p line
+p line
$4 = 0x5555559f8b98 "help"

@an3l an3l added the MariaDB Foundation Pull requests created by MariaDB Foundation label Nov 21, 2022
@an3l an3l added this to the 10.3 milestone Nov 21, 2022
@an3l an3l force-pushed the bb-10.3-anel-MDEV-30062-client branch from a20d5c9 to 1bf3558 Compare November 22, 2022 15:42
@an3l an3l force-pushed the bb-10.3-anel-MDEV-30062-client branch from a1b8783 to 3ab1b25 Compare November 22, 2022 17:46
@an3l an3l changed the base branch from 10.3 to 11.0 March 12, 2024 11:43
… shortcut command

- Check which buffer to use as an argument for the call to the function pointer of command. Buffer shouldn't have delimiter.
- By default check if command processed is `go` which doesn't take any parameter (`takes_params`) or if a server side comment (`/*! \C latin1 */ select 1`) is applied. If so use `pos` buffer, otherwise create buffer without delimiter.
- Order of call of function pointer matters.
@an3l an3l force-pushed the bb-10.3-anel-MDEV-30062-client branch from 3ab1b25 to 6196593 Compare March 13, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MariaDB Foundation Pull requests created by MariaDB Foundation
2 participants