Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
0395a3dd
Commit
0395a3dd
authored
Dec 11, 2003
by
ram@gw.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added --comments mysqldump option (default value is 1).
Fixed mysqldump test.
parent
9698e236
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
21 deletions
+44
-21
client/mysqldump.c
client/mysqldump.c
+14
-9
mysql-test/r/mysqldump.result
mysql-test/r/mysqldump.result
+20
-0
mysql-test/t/mysqldump.test
mysql-test/t/mysqldump.test
+10
-12
No files found.
client/mysqldump.c
View file @
0395a3dd
...
@@ -78,7 +78,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
...
@@ -78,7 +78,7 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
opt_alldbs
=
0
,
opt_create_db
=
0
,
opt_first_slave
=
0
,
opt_alldbs
=
0
,
opt_create_db
=
0
,
opt_first_slave
=
0
,
opt_autocommit
=
0
,
opt_master_data
,
opt_disable_keys
=
0
,
opt_xml
=
0
,
opt_autocommit
=
0
,
opt_master_data
,
opt_disable_keys
=
0
,
opt_xml
=
0
,
opt_delete_master_logs
=
0
,
tty_password
=
0
,
opt_delete_master_logs
=
0
,
tty_password
=
0
,
opt_single_transaction
=
0
;
opt_single_transaction
=
0
,
opt_comments
=
0
;
static
MYSQL
mysql_connection
,
*
sock
=
0
;
static
MYSQL
mysql_connection
,
*
sock
=
0
;
static
char
insert_pat
[
12
*
1024
],
*
opt_password
=
0
,
*
current_user
=
0
,
static
char
insert_pat
[
12
*
1024
],
*
opt_password
=
0
,
*
current_user
=
0
,
*
current_host
=
0
,
*
path
=
0
,
*
fields_terminated
=
0
,
*
current_host
=
0
,
*
path
=
0
,
*
fields_terminated
=
0
,
...
@@ -242,6 +242,9 @@ static struct my_option my_long_options[] =
...
@@ -242,6 +242,9 @@ static struct my_option my_long_options[] =
(
gptr
*
)
&
net_buffer_length
,
(
gptr
*
)
&
net_buffer_length
,
0
,
(
gptr
*
)
&
net_buffer_length
,
(
gptr
*
)
&
net_buffer_length
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
1024
*
1024L
-
1025
,
4096
,
16
*
1024L
*
1024L
,
GET_ULONG
,
REQUIRED_ARG
,
1024
*
1024L
-
1025
,
4096
,
16
*
1024L
*
1024L
,
MALLOC_OVERHEAD
-
1024
,
1024
,
0
},
MALLOC_OVERHEAD
-
1024
,
1024
,
0
},
{
"comments"
,
'i'
,
"Write additional information."
,
(
gptr
*
)
&
opt_comments
,
(
gptr
*
)
&
opt_comments
,
0
,
GET_BOOL
,
NO_ARG
,
1
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
};
};
...
@@ -302,7 +305,7 @@ static void write_header(FILE *sql_file, char *db_name)
...
@@ -302,7 +305,7 @@ static void write_header(FILE *sql_file, char *db_name)
fprintf
(
sql_file
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
sql_file
,
"<?xml version=
\"
1.0
\"
?>
\n
"
);
fprintf
(
sql_file
,
"<mysqldump>
\n
"
);
fprintf
(
sql_file
,
"<mysqldump>
\n
"
);
}
}
else
else
if
(
opt_comments
)
{
{
fprintf
(
sql_file
,
"-- MySQL dump %s
\n
--
\n
"
,
DUMP_VERSION
);
fprintf
(
sql_file
,
"-- MySQL dump %s
\n
--
\n
"
,
DUMP_VERSION
);
fprintf
(
sql_file
,
"-- Host: %s Database: %s
\n
"
,
fprintf
(
sql_file
,
"-- Host: %s Database: %s
\n
"
,
...
@@ -620,7 +623,7 @@ static uint getTableStructure(char *table, char* db)
...
@@ -620,7 +623,7 @@ static uint getTableStructure(char *table, char* db)
}
}
write_header
(
sql_file
,
db
);
write_header
(
sql_file
,
db
);
}
}
if
(
!
opt_xml
)
if
(
!
opt_xml
&&
opt_comments
)
fprintf
(
sql_file
,
"
\n
--
\n
-- Table structure for table %s
\n
--
\n\n
"
,
fprintf
(
sql_file
,
"
\n
--
\n
-- Table structure for table %s
\n
--
\n\n
"
,
result_table
);
result_table
);
if
(
opt_drop
)
if
(
opt_drop
)
...
@@ -698,7 +701,7 @@ static uint getTableStructure(char *table, char* db)
...
@@ -698,7 +701,7 @@ static uint getTableStructure(char *table, char* db)
}
}
write_header
(
sql_file
,
db
);
write_header
(
sql_file
,
db
);
}
}
if
(
!
opt_xml
)
if
(
!
opt_xml
&&
opt_comments
)
fprintf
(
sql_file
,
"
\n
--
\n
-- Table structure for table %s
\n
--
\n\n
"
,
fprintf
(
sql_file
,
"
\n
--
\n
-- Table structure for table %s
\n
--
\n\n
"
,
result_table
);
result_table
);
if
(
opt_drop
)
if
(
opt_drop
)
...
@@ -964,14 +967,14 @@ static void dumpTable(uint numFields, char *table)
...
@@ -964,14 +967,14 @@ static void dumpTable(uint numFields, char *table)
}
}
else
else
{
{
if
(
!
opt_xml
)
if
(
!
opt_xml
&&
opt_comments
)
fprintf
(
md_result_file
,
"
\n
--
\n
-- Dumping data for table %s
\n
--
\n
"
,
fprintf
(
md_result_file
,
"
\n
--
\n
-- Dumping data for table %s
\n
--
\n
"
,
result_table
);
result_table
);
sprintf
(
query
,
"SELECT /*!40001 SQL_NO_CACHE */ * FROM %s"
,
sprintf
(
query
,
"SELECT /*!40001 SQL_NO_CACHE */ * FROM %s"
,
result_table
);
result_table
);
if
(
where
)
if
(
where
)
{
{
if
(
!
opt_xml
)
if
(
!
opt_xml
&&
opt_comments
)
fprintf
(
md_result_file
,
"-- WHERE: %s
\n
"
,
where
);
fprintf
(
md_result_file
,
"-- WHERE: %s
\n
"
,
where
);
strxmov
(
strend
(
query
),
" WHERE "
,
where
,
NullS
);
strxmov
(
strend
(
query
),
" WHERE "
,
where
,
NullS
);
}
}
...
@@ -1298,6 +1301,7 @@ static int init_dumping(char *database)
...
@@ -1298,6 +1301,7 @@ static int init_dumping(char *database)
/* length of table name * 2 (if name contain quotas), 2 quotas and 0 */
/* length of table name * 2 (if name contain quotas), 2 quotas and 0 */
char
quoted_database_buf
[
64
*
2
+
3
];
char
quoted_database_buf
[
64
*
2
+
3
];
char
*
qdatabase
=
quote_name
(
database
,
quoted_database_buf
,
opt_quoted
);
char
*
qdatabase
=
quote_name
(
database
,
quoted_database_buf
,
opt_quoted
);
if
(
opt_comments
)
fprintf
(
md_result_file
,
"
\n
--
\n
-- Current Database: %s
\n
--
\n
"
,
database
);
fprintf
(
md_result_file
,
"
\n
--
\n
-- Current Database: %s
\n
--
\n
"
,
database
);
if
(
!
opt_create_db
)
if
(
!
opt_create_db
)
fprintf
(
md_result_file
,
"
\n
CREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;
\n
"
,
fprintf
(
md_result_file
,
"
\n
CREATE DATABASE /*!32312 IF NOT EXISTS*/ %s;
\n
"
,
...
@@ -1499,6 +1503,7 @@ int main(int argc, char **argv)
...
@@ -1499,6 +1503,7 @@ int main(int argc, char **argv)
row
=
mysql_fetch_row
(
master
);
row
=
mysql_fetch_row
(
master
);
if
(
row
&&
row
[
0
]
&&
row
[
1
])
if
(
row
&&
row
[
0
]
&&
row
[
1
])
{
{
if
(
opt_comments
)
fprintf
(
md_result_file
,
fprintf
(
md_result_file
,
"
\n
--
\n
-- Position to start replication from
\n
--
\n\n
"
);
"
\n
--
\n
-- Position to start replication from
\n
--
\n\n
"
);
fprintf
(
md_result_file
,
fprintf
(
md_result_file
,
...
...
mysql-test/r/mysqldump.result
View file @
0395a3dd
...
@@ -15,3 +15,23 @@ INSERT INTO t1 VALUES (1), (2);
...
@@ -15,3 +15,23 @@ INSERT INTO t1 VALUES (1), (2);
</database>
</database>
</mysqldump>
</mysqldump>
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
CREATE TABLE t1 (
a decimal(240,20) default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890.00000000000000000000");
INSERT INTO t1 VALUES ("0987654321098765432109876543210987654321.00000000000000000000");
DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
CREATE TABLE t1 (
a double default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES (NULL);
DROP TABLE t1;
mysql-test/t/mysqldump.test
View file @
0395a3dd
...
@@ -6,26 +6,24 @@ DROP TABLE IF EXISTS t1;
...
@@ -6,26 +6,24 @@ DROP TABLE IF EXISTS t1;
CREATE
TABLE
t1
(
a
int
);
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
);
--
exec
$MYSQL_DUMP
-
X
test
t1
--
exec
$MYSQL_DUMP
-
-
skip
-
comments
-
X
test
t1
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
# Bug #2005
# Bug #2005
# TODO: solve the problem with 'replace' and enable test
#
#
#
CREATE TABLE t1 (a decimal(240, 20));
CREATE
TABLE
t1
(
a
decimal
(
240
,
20
));
#
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
INSERT
INTO
t1
VALUES
(
"1234567890123456789012345678901234567890"
),
#
("0987654321098765432109876543210987654321");
(
"0987654321098765432109876543210987654321"
);
#--exec $MYSQL_DUMP
test t1
--
exec
$MYSQL_DUMP
--
skip
-
comments
test
t1
#
DROP TABLE t1;
DROP
TABLE
t1
;
#
#
# Bug #2055
# Bug #2055
# TODO: solve the problem with 'replace' and enable test
#
#
#
CREATE TABLE t1 (a double);
CREATE
TABLE
t1
(
a
double
);
#
INSERT INTO t1 VALUES (-9e999999);
INSERT
INTO
t1
VALUES
(
-
9
e999999
);
#--exec $MYSQL_DUMP -X
test t1
--
exec
$MYSQL_DUMP
--
skip
-
comments
test
t1
#
DROP TABLE t1;
DROP
TABLE
t1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment