-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MDEV-28911: Add --init-command option to mysqldump #4723
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
Open
HNOONa-0
wants to merge
1
commit into
MariaDB:main
Choose a base branch
from
HNOONa-0:MDEV-28911
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−13
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #ifndef COMMON_CLI_LONGOPTS_INCLUDED | ||
| #define COMMON_CLI_LONGOPTS_INCLUDED | ||
|
|
||
| {"init-command", 0, | ||
| "SQL Command to execute when connecting to MariaDB server. Will " | ||
| "automatically be re-executed when reconnecting.", | ||
| &opt_init_command, &opt_init_command, 0, | ||
| GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, | ||
|
|
||
| #endif /* COMMON_CLI_LONGOPTS_INCLUDED */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #ifndef COMMON_CLI_VARS_INCLUDED | ||
| #define COMMON_CLI_VARS_INCLUDED | ||
|
|
||
| static char *opt_init_command= 0; | ||
|
|
||
| #endif /* COMMON_CLI_VARS_INCLUDED */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| CREATE DATABASE 28911_mysqldump; | ||
| USE 28911_mysqldump; | ||
| CREATE TABLE t1(id INT, ts TIMESTAMP); | ||
| SET time_zone='+00:00'; | ||
| INSERT INTO t1 VALUES (1, '2026-01-01 12:00:00'); | ||
|
|
||
| # dump with --init-command="SET SESSION time_zone='+05:00'" (INSERT shows 17:00:00) | ||
| /*M!999999\- enable the sandbox mode */ | ||
| /*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| /*!40101 SET character_set_client = utf8mb4 */; | ||
| CREATE TABLE `t1` ( | ||
| `id` int(11) DEFAULT NULL, | ||
| `ts` timestamp NULL DEFAULT NULL | ||
| ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci; | ||
| /*!40101 SET character_set_client = @saved_cs_client */; | ||
| SET @OLD_AUTOCOMMIT=@@AUTOCOMMIT, @@AUTOCOMMIT=0; | ||
| INSERT INTO `t1` VALUES | ||
| (1,'2026-01-01 17:00:00'); | ||
| COMMIT; | ||
| SET AUTOCOMMIT=@OLD_AUTOCOMMIT; | ||
| DROP TABLE t1; | ||
| DROP DATABASE 28911_mysqldump; | ||
| # End of MDEV-28911 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --source include/not_embedded.inc | ||
|
|
||
| # MDEV-28911: Add --init-command option to mariadb-dump / mysqldump | ||
|
|
||
| CREATE DATABASE 28911_mysqldump; | ||
| USE 28911_mysqldump; | ||
| CREATE TABLE t1(id INT, ts TIMESTAMP); | ||
| SET time_zone='+00:00'; | ||
| INSERT INTO t1 VALUES (1, '2026-01-01 12:00:00'); | ||
|
|
||
| --echo | ||
| --echo # dump with --init-command="SET SESSION time_zone='+05:00'" (INSERT shows 17:00:00) | ||
| --exec $MYSQL_DUMP --compact --skip-comments --skip-tz-utc --init-command="SET SESSION time_zone='+05:00'" 28911_mysqldump | ||
|
|
||
| DROP TABLE t1; | ||
| DROP DATABASE 28911_mysqldump; | ||
HNOONa-0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| --echo # End of MDEV-28911 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.