mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge baker@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into zim.(none):/home/brian/mysql/mysql-5.1-new
This commit is contained in:
@ -51,5 +51,6 @@ enum options_client
|
|||||||
#endif
|
#endif
|
||||||
OPT_TRIGGERS,
|
OPT_TRIGGERS,
|
||||||
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
|
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
|
||||||
OPT_TZ_UTC, OPT_AUTO_CLOSE
|
OPT_TZ_UTC, OPT_AUTO_CLOSE,
|
||||||
|
OPT_MYSQL_REPLACE_INTO
|
||||||
};
|
};
|
||||||
|
@ -92,6 +92,7 @@ static my_bool verbose=0,tFlag=0,dFlag=0,quick= 1, extended_insert= 1,
|
|||||||
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
|
opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
|
||||||
opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0,
|
opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0,
|
||||||
opt_complete_insert= 0, opt_drop_database= 0,
|
opt_complete_insert= 0, opt_drop_database= 0,
|
||||||
|
opt_replace_into= 0,
|
||||||
opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1;
|
opt_dump_triggers= 0, opt_routines=0, opt_tz_utc=1;
|
||||||
static ulong opt_max_allowed_packet, opt_net_buffer_length;
|
static ulong opt_max_allowed_packet, opt_net_buffer_length;
|
||||||
static MYSQL mysql_connection,*sock=0;
|
static MYSQL mysql_connection,*sock=0;
|
||||||
@ -339,6 +340,9 @@ static struct my_option my_long_options[] =
|
|||||||
{"quote-names",'Q', "Quote table and column names with backticks (`).",
|
{"quote-names",'Q', "Quote table and column names with backticks (`).",
|
||||||
(gptr*) &opt_quoted, (gptr*) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
|
(gptr*) &opt_quoted, (gptr*) &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
|
{"replace-names", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.",
|
||||||
|
(gptr*) &opt_replace_into, (gptr*) &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
|
||||||
|
0, 0},
|
||||||
{"result-file", 'r',
|
{"result-file", 'r',
|
||||||
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
|
"Direct output to a given file. This option should be used in MSDOS, because it prevents new line '\\n' from being converted to '\\r\\n' (carriage return + line feed).",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
@ -1515,7 +1519,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
|||||||
*/
|
*/
|
||||||
if (write_data)
|
if (write_data)
|
||||||
{
|
{
|
||||||
dynstr_append_mem(&insert_pat, "INSERT ", 7);
|
if (opt_replace_into)
|
||||||
|
dynstr_append_mem(&insert_pat, "REPLACE ", 8);
|
||||||
|
else
|
||||||
|
dynstr_append_mem(&insert_pat, "INSERT ", 7);
|
||||||
dynstr_append(&insert_pat, insert_option);
|
dynstr_append(&insert_pat, insert_option);
|
||||||
dynstr_append_mem(&insert_pat, "INTO ", 5);
|
dynstr_append_mem(&insert_pat, "INTO ", 5);
|
||||||
dynstr_append(&insert_pat, opt_quoted_table);
|
dynstr_append(&insert_pat, opt_quoted_table);
|
||||||
@ -1592,7 +1599,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
|
|||||||
|
|
||||||
if (write_data)
|
if (write_data)
|
||||||
{
|
{
|
||||||
dynstr_append_mem(&insert_pat, "INSERT ", 7);
|
if (opt_replace_into)
|
||||||
|
dynstr_append_mem(&insert_pat, "REPLACE ", 8);
|
||||||
|
else
|
||||||
|
dynstr_append_mem(&insert_pat, "INSERT ", 7);
|
||||||
dynstr_append(&insert_pat, insert_option);
|
dynstr_append(&insert_pat, insert_option);
|
||||||
dynstr_append_mem(&insert_pat, "INTO ", 5);
|
dynstr_append_mem(&insert_pat, "INTO ", 5);
|
||||||
dynstr_append(&insert_pat, result_table);
|
dynstr_append(&insert_pat, result_table);
|
||||||
|
@ -2494,6 +2494,44 @@ drop view v2;
|
|||||||
drop view v0;
|
drop view v0;
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
drop table if exists t1;
|
||||||
|
CREATE TABLE t1(a int, b int);
|
||||||
|
INSERT INTO t1 VALUES (1,1);
|
||||||
|
INSERT INTO t1 VALUES (2,3);
|
||||||
|
INSERT INTO t1 VALUES (3,4), (4,5);
|
||||||
|
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||||
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||||
|
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||||
|
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||||
|
DROP TABLE IF EXISTS `t1`;
|
||||||
|
CREATE TABLE `t1` (
|
||||||
|
`a` int(11) default NULL,
|
||||||
|
`b` int(11) default NULL
|
||||||
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
|
|
||||||
|
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||||
|
LOCK TABLES `t1` WRITE;
|
||||||
|
REPLACE INTO `t1` VALUES (1,1),(2,3),(3,4),(4,5);
|
||||||
|
UNLOCK TABLES;
|
||||||
|
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||||
|
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||||
|
|
||||||
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||||
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
SET @old_sql_mode = @@SQL_MODE;
|
SET @old_sql_mode = @@SQL_MODE;
|
||||||
SET SQL_MODE = IGNORE_SPACE;
|
SET SQL_MODE = IGNORE_SPACE;
|
||||||
CREATE TABLE t1 (a INT);
|
CREATE TABLE t1 (a INT);
|
||||||
@ -2549,4 +2587,3 @@ DELIMITER ;
|
|||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||||
|
|
||||||
DROP TRIGGER tr1;
|
DROP TRIGGER tr1;
|
||||||
DROP TABLE t1;
|
|
||||||
|
@ -994,12 +994,25 @@ create view v2 as select * from v0;
|
|||||||
|
|
||||||
select * from v2;
|
select * from v2;
|
||||||
--exec $MYSQL_DUMP -x --skip-comments --databases test
|
--exec $MYSQL_DUMP -x --skip-comments --databases test
|
||||||
|
|
||||||
drop view v2;
|
drop view v2;
|
||||||
drop view v0;
|
drop view v0;
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
# Check new --replace option
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int, b int);
|
||||||
|
INSERT INTO t1 VALUES (1,1);
|
||||||
|
INSERT INTO t1 VALUES (2,3);
|
||||||
|
INSERT INTO t1 VALUES (3,4), (4,5);
|
||||||
|
--exec $MYSQL_DUMP --replace --skip-comments test t1
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
|
# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
|
||||||
# for tables with trigger created in the IGNORE_SPACE sql mode.
|
# for tables with trigger created in the IGNORE_SPACE sql mode.
|
||||||
@ -1022,4 +1035,3 @@ SET SQL_MODE = @old_sql_mode;
|
|||||||
--exec $MYSQL_DUMP --skip-comments --databases test
|
--exec $MYSQL_DUMP --skip-comments --databases test
|
||||||
|
|
||||||
DROP TRIGGER tr1;
|
DROP TRIGGER tr1;
|
||||||
DROP TABLE t1;
|
|
||||||
|
Reference in New Issue
Block a user