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
0fa2a457
Commit
0fa2a457
authored
Apr 26, 2001
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a new option --result-file to mysqlbinlog.
sql/mysqlbinlog.cc: Added option -r.
parent
3df4148a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
28 deletions
+38
-28
sql/mysqlbinlog.cc
sql/mysqlbinlog.cc
+38
-28
No files found.
sql/mysqlbinlog.cc
View file @
0fa2a457
...
@@ -38,6 +38,7 @@ ulong mysqld_net_retry_count = 10L;
...
@@ -38,6 +38,7 @@ ulong mysqld_net_retry_count = 10L;
ulong
net_read_timeout
=
NET_READ_TIMEOUT
;
ulong
net_read_timeout
=
NET_READ_TIMEOUT
;
ulong
net_write_timeout
=
NET_WRITE_TIMEOUT
;
ulong
net_write_timeout
=
NET_WRITE_TIMEOUT
;
uint
test_flags
=
0
;
uint
test_flags
=
0
;
FILE
*
result_file
;
#ifndef DBUG_OFF
#ifndef DBUG_OFF
static
const
char
*
default_dbug_option
=
"d:t:o,/tmp/mysqlbinlog.trace"
;
static
const
char
*
default_dbug_option
=
"d:t:o,/tmp/mysqlbinlog.trace"
;
...
@@ -54,11 +55,11 @@ static struct option long_options[] =
...
@@ -54,11 +55,11 @@ static struct option long_options[] =
{
"password"
,
required_argument
,
0
,
'p'
},
{
"password"
,
required_argument
,
0
,
'p'
},
{
"port"
,
required_argument
,
0
,
'P'
},
{
"port"
,
required_argument
,
0
,
'P'
},
{
"position"
,
required_argument
,
0
,
'j'
},
{
"position"
,
required_argument
,
0
,
'j'
},
{
"result-file"
,
required_argument
,
0
,
'r'
},
{
"short-form"
,
no_argument
,
0
,
's'
},
{
"short-form"
,
no_argument
,
0
,
's'
},
{
"table"
,
required_argument
,
0
,
't'
},
{
"table"
,
required_argument
,
0
,
't'
},
{
"user"
,
required_argument
,
0
,
'u'
},
{
"user"
,
required_argument
,
0
,
'u'
},
{
"version"
,
no_argument
,
0
,
'V'
},
{
"version"
,
no_argument
,
0
,
'V'
},
{
0
,
0
,
0
,
0
}
};
};
void
sql_print_error
(
const
char
*
format
,...);
void
sql_print_error
(
const
char
*
format
,...);
...
@@ -107,7 +108,7 @@ static void die(const char* fmt, ...)
...
@@ -107,7 +108,7 @@ static void die(const char* fmt, ...)
static
void
print_version
()
static
void
print_version
()
{
{
printf
(
"%s Ver 1.
2
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
printf
(
"%s Ver 1.
3
for %s at %s
\n
"
,
my_progname
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
}
}
...
@@ -134,6 +135,7 @@ the mysql command line client\n\n");
...
@@ -134,6 +135,7 @@ the mysql command line client\n\n");
-P, --port=port Use port to connect to the remove server
\n
\
-P, --port=port Use port to connect to the remove server
\n
\
-u, --user=username Connect to the remove server as username
\n
\
-u, --user=username Connect to the remove server as username
\n
\
-p, --password=password Password to connect to remote server
\n
\
-p, --password=password Password to connect to remote server
\n
\
-r, --result-file=file Direct output to a given file
\n
\
-j, --position=N Start reading the binlog at position N
\n
\
-j, --position=N Start reading the binlog at position N
\n
\
-t, --table=name Get raw table dump using COM_TABLE_DUMB
\n
\
-t, --table=name Get raw table dump using COM_TABLE_DUMB
\n
\
-V, --version Print version and exit.
\n
\
-V, --version Print version and exit.
\n
\
...
@@ -164,17 +166,18 @@ static void dump_remote_file(NET* net, const char* fname)
...
@@ -164,17 +166,18 @@ static void dump_remote_file(NET* net, const char* fname)
die
(
"Failed reading a packet during the dump of %s "
,
fname
);
die
(
"Failed reading a packet during the dump of %s "
,
fname
);
if
(
!
short_form
)
if
(
!
short_form
)
(
void
)
my_fwrite
(
stdout
,
(
byte
*
)
net
->
read_pos
,
packet_len
,
MYF
(
0
));
(
void
)
my_fwrite
(
result_file
,
(
byte
*
)
net
->
read_pos
,
packet_len
,
MYF
(
0
));
}
}
fflush
(
stdout
);
fflush
(
result_file
);
}
}
static
int
parse_args
(
int
*
argc
,
char
***
argv
)
static
int
parse_args
(
int
*
argc
,
char
***
argv
)
{
{
int
c
,
opt_index
=
0
;
int
c
,
opt_index
=
0
;
while
((
c
=
getopt_long
(
*
argc
,
*
argv
,
"so:#::h:j:u:p:P:t:?V"
,
long_options
,
result_file
=
stdout
;
while
((
c
=
getopt_long
(
*
argc
,
*
argv
,
"so:#::h:j:u:p:P:r:t:?V"
,
long_options
,
&
opt_index
))
!=
EOF
)
&
opt_index
))
!=
EOF
)
{
{
switch
(
c
)
switch
(
c
)
...
@@ -211,6 +214,11 @@ static int parse_args(int *argc, char*** argv)
...
@@ -211,6 +214,11 @@ static int parse_args(int *argc, char*** argv)
pass
=
my_strdup
(
optarg
,
MYF
(
0
));
pass
=
my_strdup
(
optarg
,
MYF
(
0
));
break
;
break
;
case
'r'
:
if
(
!
(
result_file
=
my_fopen
(
optarg
,
O_WRONLY
|
O_BINARY
,
MYF
(
MY_WME
))))
exit
(
1
);
break
;
case
'u'
:
case
'u'
:
use_remote
=
1
;
use_remote
=
1
;
user
=
my_strdup
(
optarg
,
MYF
(
0
));
user
=
my_strdup
(
optarg
,
MYF
(
0
));
...
@@ -282,8 +290,8 @@ static void dump_remote_table(NET* net, const char* db, const char* table)
...
@@ -282,8 +290,8 @@ static void dump_remote_table(NET* net, const char* db, const char* table)
if
(
packet_len
==
0
)
break
;
// end of file
if
(
packet_len
==
0
)
break
;
// end of file
if
(
packet_len
==
packet_error
)
if
(
packet_len
==
packet_error
)
die
(
"Error reading packet in table dump"
);
die
(
"Error reading packet in table dump"
);
my_fwrite
(
stdout
,
(
byte
*
)
net
->
read_pos
,
packet_len
,
MYF
(
MY_WME
));
my_fwrite
(
result_file
,
(
byte
*
)
net
->
read_pos
,
packet_len
,
MYF
(
MY_WME
));
fflush
(
stdout
);
fflush
(
result_file
);
}
}
}
}
...
@@ -325,7 +333,7 @@ Unfortunately, no sweepstakes today, adjusted position to 4\n");
...
@@ -325,7 +333,7 @@ Unfortunately, no sweepstakes today, adjusted position to 4\n");
len
-
1
);
len
-
1
);
if
(
ev
)
if
(
ev
)
{
{
ev
->
print
(
stdout
,
short_form
,
last_db
);
ev
->
print
(
result_file
,
short_form
,
last_db
);
if
(
ev
->
get_type_code
()
==
LOAD_EVENT
)
if
(
ev
->
get_type_code
()
==
LOAD_EVENT
)
dump_remote_file
(
net
,
((
Load_log_event
*
)
ev
)
->
fname
);
dump_remote_file
(
net
,
((
Load_log_event
*
)
ev
)
->
fname
);
delete
ev
;
delete
ev
;
...
@@ -352,7 +360,7 @@ static void dump_local_log_entries(const char* logname)
...
@@ -352,7 +360,7 @@ static void dump_local_log_entries(const char* logname)
}
}
else
else
{
{
if
(
init_io_cache
(
file
,
fileno
(
stdout
),
0
,
READ_CACHE
,
(
my_off_t
)
0
,
if
(
init_io_cache
(
file
,
fileno
(
result_file
),
0
,
READ_CACHE
,
(
my_off_t
)
0
,
0
,
MYF
(
MY_WME
|
MY_NABP
|
MY_DONT_CHECK_FILESIZE
)))
0
,
MYF
(
MY_WME
|
MY_NABP
|
MY_DONT_CHECK_FILESIZE
)))
exit
(
1
);
exit
(
1
);
if
(
position
)
if
(
position
)
...
@@ -398,9 +406,9 @@ Could not read entry at offset %s : Error in log format or read error",
...
@@ -398,9 +406,9 @@ Could not read entry at offset %s : Error in log format or read error",
if
(
rec_count
>=
offset
)
if
(
rec_count
>=
offset
)
{
{
if
(
!
short_form
)
if
(
!
short_form
)
printf
(
"# at %s
\n
"
,
llstr
(
old_off
,
llbuff
));
fprintf
(
result_file
,
"# at %s
\n
"
,
llstr
(
old_off
,
llbuff
));
ev
->
print
(
stdout
,
short_form
,
last_db
);
ev
->
print
(
result_file
,
short_form
,
last_db
);
}
}
rec_count
++
;
rec_count
++
;
delete
ev
;
delete
ev
;
...
@@ -448,6 +456,8 @@ int main(int argc, char** argv)
...
@@ -448,6 +456,8 @@ int main(int argc, char** argv)
dump_log_entries
(
*
(
argv
++
));
dump_log_entries
(
*
(
argv
++
));
}
}
}
}
if
(
result_file
!=
stdout
)
my_fclose
(
result_file
,
MYF
(
0
));
if
(
use_remote
)
if
(
use_remote
)
mc_mysql_close
(
mysql
);
mc_mysql_close
(
mysql
);
return
0
;
return
0
;
...
...
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