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
f43e7910
Commit
f43e7910
authored
Nov 25, 2000
by
sasha@mysql.sashanet.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yes, and a small change to log_event.h
parent
dd24015e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
7 deletions
+65
-7
sql/log_event.h
sql/log_event.h
+2
-2
sql/sql_base.cc
sql/sql_base.cc
+63
-5
No files found.
sql/log_event.h
View file @
f43e7910
...
...
@@ -115,7 +115,7 @@ class Query_log_event: public Log_event
// otherwise, set it to 0, in which case, we compute it with strlen()
uint32
db_len
;
uint16
error_code
;
int
thread_id
;
ulong
thread_id
;
#if !defined(MYSQL_CLIENT)
THD
*
thd
;
Query_log_event
(
THD
*
thd_arg
,
const
char
*
query_arg
)
:
...
...
@@ -186,7 +186,7 @@ class Load_log_event: public Log_event
void
copy_log_event
(
const
char
*
buf
,
ulong
data_len
);
public:
int
thread_id
;
ulong
thread_id
;
uint32
table_name_len
;
uint32
db_len
;
uint32
fname_len
;
...
...
sql/sql_base.cc
View file @
f43e7910
...
...
@@ -422,11 +422,48 @@ void close_temporary(TABLE *table,bool delete_table)
void
close_temporary_tables
(
THD
*
thd
)
{
TABLE
*
table
,
*
next
;
uint
init_query_buf_size
=
11
,
query_buf_size
;
// "drop table "
char
*
query
,
*
p
;
LINT_INIT
(
p
);
query_buf_size
=
init_query_buf_size
;
for
(
table
=
thd
->
temporary_tables
;
table
;
table
=
table
->
next
)
{
query_buf_size
+=
table
->
key_length
;
}
if
(
query_buf_size
==
init_query_buf_size
)
return
;
// no tables to close
if
((
query
=
alloc_root
(
&
thd
->
mem_root
,
query_buf_size
)))
{
memcpy
(
query
,
"drop table "
,
init_query_buf_size
);
p
=
query
+
init_query_buf_size
;
}
for
(
table
=
thd
->
temporary_tables
;
table
;
table
=
next
)
{
if
(
query
)
// we might be out of memory, but this is not fatal
{
p
=
strmov
(
p
,
table
->
table_cache_key
);
// here we assume it always starts
// with \0 terminated db name
*
p
++
=
'.'
;
p
=
strmov
(
p
,
table
->
table_name
);
*
p
++
=
','
;
}
next
=
table
->
next
;
close_temporary
(
table
);
}
if
(
query
&&
mysql_bin_log
.
is_open
())
{
uint
save_query_len
=
thd
->
query_length
;
*--
p
=
0
;
thd
->
query_length
=
(
uint
)(
p
-
query
);
Query_log_event
qinfo
(
thd
,
query
);
mysql_bin_log
.
write
(
&
qinfo
);
thd
->
query_length
=
save_query_len
;
}
thd
->
temporary_tables
=
0
;
}
...
...
@@ -437,6 +474,9 @@ TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name)
uint
key_length
=
(
uint
)
(
strmov
(
strmov
(
key
,
db
)
+
1
,
table_name
)
-
key
)
+
1
;
TABLE
*
table
,
**
prev
;
*
((
ulong
*
)(
key
+
key_length
))
=
thd
->
slave_proxy_id
;
key_length
+=
4
;
prev
=
&
thd
->
temporary_tables
;
for
(
table
=
thd
->
temporary_tables
;
table
;
table
=
table
->
next
)
{
...
...
@@ -457,21 +497,25 @@ bool close_temporary_table(THD *thd, const char *db, const char *table_name)
table
=
*
prev
;
*
prev
=
table
->
next
;
close_temporary
(
table
);
if
(
thd
->
slave_thread
)
--
slave_open_temp_tables
;
return
0
;
}
bool
rename_temporary_table
(
TABLE
*
table
,
const
char
*
db
,
bool
rename_temporary_table
(
T
HD
*
thd
,
T
ABLE
*
table
,
const
char
*
db
,
const
char
*
table_name
)
{
char
*
key
;
if
(
!
(
key
=
(
char
*
)
alloc_root
(
&
table
->
mem_root
,
(
uint
)
strlen
(
db
)
+
(
uint
)
strlen
(
table_name
)
+
2
)))
(
uint
)
strlen
(
table_name
)
+
6
)))
return
1
;
/* purecov: inspected */
table
->
key_length
=
(
uint
)
(
strmov
((
table
->
real_name
=
strmov
(
table
->
table_cache_key
=
key
,
db
)
+
1
),
table_name
)
-
table
->
table_cache_key
)
+
1
;
*
((
ulong
*
)(
key
+
table
->
key_length
))
=
thd
->
slave_proxy_id
;
table
->
key_length
+=
4
;
return
0
;
}
...
...
@@ -624,7 +668,9 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
*
refresh
=
0
;
if
(
thd
->
killed
)
DBUG_RETURN
(
0
);
key_length
=
(
uint
)
(
strmov
(
strmov
(
key
,
db
)
+
1
,
table_name
)
-
key
)
+
1
;
key_length
=
(
uint
)
(
strmov
(
strmov
(
key
,
db
)
+
1
,
table_name
)
-
key
)
+
1
;
*
((
ulong
*
)(
key
+
key_length
))
=
thd
->
slave_proxy_id
;
key_length
+=
4
;
for
(
table
=
thd
->
temporary_tables
;
table
;
table
=
table
->
next
)
{
...
...
@@ -1339,8 +1385,14 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
{
TABLE
*
tmp_table
;
DBUG_ENTER
(
"open_temporary_table"
);
// the extra size in my_malloc() is for table_cache_key
// 4 bytes for master thread id if we are in the slave
// 1 byte to terminate db
// 1 byte to terminate table_name
// total of 6 extra bytes in my_malloc in addition to table/db stuff
if
(
!
(
tmp_table
=
(
TABLE
*
)
my_malloc
(
sizeof
(
*
tmp_table
)
+
(
uint
)
strlen
(
db
)
+
(
uint
)
strlen
(
table_name
)
+
2
,
(
uint
)
strlen
(
table_name
)
+
6
,
MYF
(
MY_WME
))))
DBUG_RETURN
(
0
);
/* purecov: inspected */
...
...
@@ -1361,10 +1413,16 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
tmp_table
->
key_length
=
(
uint
)
(
strmov
(
strmov
(
tmp_table
->
table_cache_key
,
db
)
+
1
,
table_name
)
-
tmp_table
->
table_cache_key
)
+
1
;
*
((
ulong
*
)(
tmp_table
->
table_cache_key
+
tmp_table
->
key_length
))
=
thd
->
slave_proxy_id
;
tmp_table
->
key_length
+=
4
;
if
(
link_in_list
)
{
tmp_table
->
next
=
thd
->
temporary_tables
;
thd
->
temporary_tables
=
tmp_table
;
if
(
thd
->
slave_thread
)
++
slave_open_temp_tables
;
}
DBUG_RETURN
(
tmp_table
);
}
...
...
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