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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0dd620ce
Commit
0dd620ce
authored
Jul 23, 2001
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean-up, more work on LOAD DATA INFILE
parent
f935dcf2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
7 deletions
+63
-7
sql/log_event.cc
sql/log_event.cc
+59
-7
sql/log_event.h
sql/log_event.h
+4
-0
No files found.
sql/log_event.cc
View file @
0dd620ce
...
@@ -89,7 +89,9 @@ void Log_event::pack_info(String* packet)
...
@@ -89,7 +89,9 @@ void Log_event::pack_info(String* packet)
void
Query_log_event
::
pack_info
(
String
*
packet
)
void
Query_log_event
::
pack_info
(
String
*
packet
)
{
{
String
tmp
;
char
buf
[
256
];
String
tmp
(
buf
,
sizeof
(
buf
));
tmp
.
length
(
0
);
if
(
db
&&
db_len
)
if
(
db
&&
db_len
)
{
{
tmp
.
append
(
"use "
);
tmp
.
append
(
"use "
);
...
@@ -104,7 +106,9 @@ void Query_log_event::pack_info(String* packet)
...
@@ -104,7 +106,9 @@ void Query_log_event::pack_info(String* packet)
void
Start_log_event
::
pack_info
(
String
*
packet
)
void
Start_log_event
::
pack_info
(
String
*
packet
)
{
{
String
tmp
;
char
buf1
[
256
];
String
tmp
(
buf1
,
sizeof
(
buf1
));
tmp
.
length
(
0
);
char
buf
[
22
];
char
buf
[
22
];
tmp
.
append
(
"Server ver: "
);
tmp
.
append
(
"Server ver: "
);
...
@@ -116,7 +120,9 @@ void Start_log_event::pack_info(String* packet)
...
@@ -116,7 +120,9 @@ void Start_log_event::pack_info(String* packet)
void
Load_log_event
::
pack_info
(
String
*
packet
)
void
Load_log_event
::
pack_info
(
String
*
packet
)
{
{
String
tmp
;
char
buf
[
256
];
String
tmp
(
buf
,
sizeof
(
buf
));
tmp
.
length
(
0
);
if
(
db
&&
db_len
)
if
(
db
&&
db_len
)
{
{
tmp
.
append
(
"use "
);
tmp
.
append
(
"use "
);
...
@@ -190,7 +196,9 @@ void Load_log_event::pack_info(String* packet)
...
@@ -190,7 +196,9 @@ void Load_log_event::pack_info(String* packet)
void
Rotate_log_event
::
pack_info
(
String
*
packet
)
void
Rotate_log_event
::
pack_info
(
String
*
packet
)
{
{
String
tmp
;
char
buf1
[
256
];
String
tmp
(
buf1
,
sizeof
(
buf1
));
tmp
.
length
(
0
);
char
buf
[
22
];
char
buf
[
22
];
tmp
.
append
(
new_log_ident
,
ident_len
);
tmp
.
append
(
new_log_ident
,
ident_len
);
tmp
.
append
(
";pos="
);
tmp
.
append
(
";pos="
);
...
@@ -202,7 +210,9 @@ void Rotate_log_event::pack_info(String* packet)
...
@@ -202,7 +210,9 @@ void Rotate_log_event::pack_info(String* packet)
void
Intvar_log_event
::
pack_info
(
String
*
packet
)
void
Intvar_log_event
::
pack_info
(
String
*
packet
)
{
{
String
tmp
;
char
buf1
[
256
];
String
tmp
(
buf1
,
sizeof
(
buf1
));
tmp
.
length
(
0
);
char
buf
[
22
];
char
buf
[
22
];
tmp
.
append
(
get_var_type_name
());
tmp
.
append
(
get_var_type_name
());
tmp
.
append
(
'='
);
tmp
.
append
(
'='
);
...
@@ -212,7 +222,9 @@ void Intvar_log_event::pack_info(String* packet)
...
@@ -212,7 +222,9 @@ void Intvar_log_event::pack_info(String* packet)
void
Slave_log_event
::
pack_info
(
String
*
packet
)
void
Slave_log_event
::
pack_info
(
String
*
packet
)
{
{
String
tmp
;
char
buf1
[
256
];
String
tmp
(
buf1
,
sizeof
(
buf1
));
tmp
.
length
(
0
);
char
buf
[
22
];
char
buf
[
22
];
tmp
.
append
(
"host="
);
tmp
.
append
(
"host="
);
tmp
.
append
(
master_host
);
tmp
.
append
(
master_host
);
...
@@ -967,19 +979,59 @@ Create_file_log_event::Create_file_log_event(THD* thd, TABLE_LIST * table,
...
@@ -967,19 +979,59 @@ Create_file_log_event::Create_file_log_event(THD* thd, TABLE_LIST * table,
int
Create_file_log_event
::
write_data
(
IO_CACHE
*
file
)
int
Create_file_log_event
::
write_data
(
IO_CACHE
*
file
)
{
{
return
0
;
char
buf
[
CREATE_FILE_HEADER_LEN
];
buf
[
CF_DB_LEN_OFFSET
]
=
(
uchar
)
db_len
;
buf
[
CF_TBL_LEN_OFFSET
]
=
(
uchar
)
tbl_name_len
;
int4store
(
buf
+
CF_FILE_ID_OFFSET
,
file_id
);
return
my_b_write
(
file
,
buf
,
CREATE_FILE_HEADER_LEN
)
||
my_b_write
(
file
,
db
,
db_len
)
||
my_b_write
(
file
,
tbl_name
,
tbl_name_len
)
||
my_b_write
(
file
,
block
,
block_len
);
}
}
Create_file_log_event
::
Create_file_log_event
(
const
char
*
buf
,
int
len
)
:
Log_event
(
buf
),
db
(
0
)
{
db_len
=
(
uint
)
buf
[
LOG_EVENT_HEADER_LEN
+
CF_DB_LEN_OFFSET
];
tbl_name_len
=
(
uint
)
buf
[
CF_TBL_LEN_OFFSET
+
LOG_EVENT_HEADER_LEN
];
if
((
uint
)
len
<
db_len
+
tbl_name_len
+
CREATE_FILE_EVENT_OVERHEAD
)
return
;
file_id
=
uint4korr
(
buf
+
LOG_EVENT_HEADER_LEN
+
CF_FILE_ID_OFFSET
);
db
=
(
char
*
)
buf
+
CREATE_FILE_EVENT_OVERHEAD
;
tbl_name
=
db
+
db_len
;
block
=
tbl_name
+
tbl_name_len
;
block_len
=
len
-
(
db_len
+
tbl_name_len
+
CREATE_FILE_EVENT_OVERHEAD
);
}
#ifdef MYSQL_CLIENT
#ifdef MYSQL_CLIENT
void
Create_file_log_event
::
print
(
FILE
*
file
,
bool
short_form
=
0
,
void
Create_file_log_event
::
print
(
FILE
*
file
,
bool
short_form
=
0
,
char
*
last_db
=
0
)
char
*
last_db
=
0
)
{
{
if
(
short_form
)
return
;
print_header
(
file
);
fputc
(
'\n'
,
file
);
fprintf
(
file
,
"Create_file: db='%-*s' table='%-*s' file_id=%d,\
block_len=%d
\n
"
,
db_len
,
db
,
tbl_name_len
,
tbl_name
,
file_id
,
block_len
);
}
}
#endif
#endif
#ifndef MYSQL_CLIENT
#ifndef MYSQL_CLIENT
void
Create_file_log_event
::
pack_info
(
String
*
packet
)
void
Create_file_log_event
::
pack_info
(
String
*
packet
)
{
{
char
buf1
[
256
];
String
tmp
(
buf1
,
sizeof
(
buf1
));
tmp
.
length
(
0
);
char
buf
[
22
];
tmp
.
append
(
"db="
);
tmp
.
append
(
db
,
db_len
);
tmp
.
append
(
";table="
);
tmp
.
append
(
tbl_name
,
tbl_name_len
);
tmp
.
append
(
";file_id="
);
tmp
.
append
(
llstr
(
file_id
,
buf
));
tmp
.
append
(
";block_len="
);
tmp
.
append
(
llstr
(
block_len
,
buf
));
}
}
#endif
#endif
...
...
sql/log_event.h
View file @
0dd620ce
...
@@ -105,6 +105,10 @@
...
@@ -105,6 +105,10 @@
#define R_POS_OFFSET 0
#define R_POS_OFFSET 0
#define R_IDENT_OFFSET 8
#define R_IDENT_OFFSET 8
#define CF_DB_LEN_OFFSET 0
#define CF_TBL_LEN_OFFSET 1
#define CF_FILE_ID_OFFSET 2
#define QUERY_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+QUERY_HEADER_LEN)
#define QUERY_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+QUERY_HEADER_LEN)
#define QUERY_DATA_OFFSET (LOG_EVENT_HEADER_LEN+QUERY_HEADER_LEN)
#define QUERY_DATA_OFFSET (LOG_EVENT_HEADER_LEN+QUERY_HEADER_LEN)
#define ROTATE_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+ROTATE_HEADER_LEN)
#define ROTATE_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+ROTATE_HEADER_LEN)
...
...
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