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
5dc23bcc
Commit
5dc23bcc
authored
Oct 14, 2006
by
msvensson@shellback.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0-maint
into shellback.(none):/home/msvensson/mysql/mysql-5.0-maint
parents
21e257b9
23727a85
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
226 additions
and
131 deletions
+226
-131
BitKeeper/etc/collapsed
BitKeeper/etc/collapsed
+5
-0
mysql-test/r/func_compress.result
mysql-test/r/func_compress.result
+10
-0
mysql-test/t/func_compress.test
mysql-test/t/func_compress.test
+13
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+1
-0
sql/sp.cc
sql/sp.cc
+23
-0
sql/sql_acl.cc
sql/sql_acl.cc
+66
-1
sql/sql_db.cc
sql/sql_db.cc
+5
-0
sql/sql_parse.cc
sql/sql_parse.cc
+24
-105
sql/sql_table.cc
sql/sql_table.cc
+8
-7
sql/sql_trigger.cc
sql/sql_trigger.cc
+5
-3
sql/sql_view.cc
sql/sql_view.cc
+56
-4
sql/sql_view.h
sql/sql_view.h
+1
-1
vio/viosocket.c
vio/viosocket.c
+7
-7
vio/viossl.c
vio/viossl.c
+2
-2
No files found.
BitKeeper/etc/collapsed
View file @
5dc23bcc
...
...
@@ -5,8 +5,13 @@
45001f7c3b2hhCXDKfUvzkX9TNe6VA
45002051rHJfMEXAIMiAZV0clxvKSA
4513d8e4Af4dQWuk13sArwofRgFDQw
45143312u0Tz4r0wPXCbUKwdHa2jWA
45143b90ewOQuTW8-jrB3ZSAQvMRJw
45184588w9U72A6KX1hUFeAC4shSHA
45185df8mZbxfp85FbA0VxUXkmDewA
4519a6c5BVUxEHTf5iJnjZkixMBs8g
451ab499rgdjXyOnUDqHu-wBDoS-OQ
451b110a3ZV6MITl93ehXk2wxrbW7g
45214442pBGT9KuZEGixBH71jTzbOA
45214a07hVsIGwvwa-WrO-jpeaSwVw
452a92d0-31-8wSzSfZi165fcGcXPA
mysql-test/r/func_compress.result
View file @
5dc23bcc
...
...
@@ -79,6 +79,16 @@ uncompress(a) uncompressed_length(a)
NULL NULL
a 1
drop table t1;
create table t1(a blob);
insert into t1 values ('0'), (NULL), ('0');
select compress(a), compress(a) from t1;
select compress(a) is null from t1;
compress(a) is null
0
1
0
drop table t1;
End of 4.1 tests
create table t1 (a varchar(32) not null);
insert into t1 values ('foo');
explain select * from t1 where uncompress(a) is null;
...
...
mysql-test/t/func_compress.test
View file @
5dc23bcc
...
...
@@ -56,7 +56,19 @@ insert into t1 values(NULL), (compress('a'));
select
uncompress
(
a
),
uncompressed_length
(
a
)
from
t1
;
drop
table
t1
;
# End of 4.1 tests
#
# Bug #23254: problem with compress(NULL)
#
create
table
t1
(
a
blob
);
insert
into
t1
values
(
'0'
),
(
NULL
),
(
'0'
);
--
disable_result_log
select
compress
(
a
),
compress
(
a
)
from
t1
;
--
enable_result_log
select
compress
(
a
)
is
null
from
t1
;
drop
table
t1
;
--
echo
End
of
4.1
tests
#
# Bug #18539: uncompress(d) is null: impossible?
...
...
sql/item_strfunc.cc
View file @
5dc23bcc
...
...
@@ -2965,6 +2965,7 @@ String *Item_func_compress::val_str(String *str)
null_value
=
1
;
return
0
;
}
null_value
=
0
;
if
(
res
->
is_empty
())
return
res
;
/*
...
...
sql/sp.cc
View file @
5dc23bcc
...
...
@@ -651,6 +651,17 @@ db_drop_routine(THD *thd, int type, sp_name *name)
if
(
table
->
file
->
delete_row
(
table
->
record
[
0
]))
ret
=
SP_DELETE_ROW_FAILED
;
}
if
(
ret
==
SP_OK
)
{
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
close_thread_tables
(
thd
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -686,6 +697,17 @@ db_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
if
((
table
->
file
->
update_row
(
table
->
record
[
1
],
table
->
record
[
0
])))
ret
=
SP_WRITE_ROW_FAILED
;
}
if
(
ret
==
SP_OK
)
{
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
close_thread_tables
(
thd
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -764,6 +786,7 @@ print_field_values(THD *thd, TABLE *table,
return
SP_INTERNAL_ERROR
;
}
}
return
SP_OK
;
}
...
...
sql/sql_acl.cc
View file @
5dc23bcc
...
...
@@ -2999,9 +2999,22 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
grant_option
=
TRUE
;
thd
->
mem_root
=
old_root
;
pthread_mutex_unlock
(
&
acl_cache
->
lock
);
if
(
!
result
)
/* success */
{
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
rw_unlock
(
&
LOCK_grant
);
if
(
!
result
)
if
(
!
result
)
/* success */
send_ok
(
thd
);
/* Tables are automatically closed */
DBUG_RETURN
(
result
);
}
...
...
@@ -3153,9 +3166,21 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
grant_option
=
TRUE
;
thd
->
mem_root
=
old_root
;
pthread_mutex_unlock
(
&
acl_cache
->
lock
);
if
(
!
result
&&
!
no_error
)
{
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
rw_unlock
(
&
LOCK_grant
);
if
(
!
result
&&
!
no_error
)
send_ok
(
thd
);
/* Tables are automatically closed */
DBUG_RETURN
(
result
);
}
...
...
@@ -3253,11 +3278,23 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
}
}
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
if
(
!
result
)
{
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
rw_unlock
(
&
LOCK_grant
);
close_thread_tables
(
thd
);
if
(
!
result
)
send_ok
(
thd
);
DBUG_RETURN
(
result
);
}
...
...
@@ -5251,6 +5288,13 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
}
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
rw_unlock
(
&
LOCK_grant
);
close_thread_tables
(
thd
);
if
(
result
)
...
...
@@ -5307,6 +5351,13 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
rebuild_check_host
();
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
rw_unlock
(
&
LOCK_grant
);
close_thread_tables
(
thd
);
if
(
result
)
...
...
@@ -5376,6 +5427,13 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
rebuild_check_host
();
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
rw_unlock
(
&
LOCK_grant
);
close_thread_tables
(
thd
);
if
(
result
)
...
...
@@ -5549,6 +5607,13 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
}
VOID
(
pthread_mutex_unlock
(
&
acl_cache
->
lock
));
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
rw_unlock
(
&
LOCK_grant
);
close_thread_tables
(
thd
);
...
...
sql/sql_db.cc
View file @
5dc23bcc
...
...
@@ -585,6 +585,7 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
qinfo
.
db
=
db
;
qinfo
.
db_len
=
strlen
(
db
);
/* These DDL methods and logging protected with LOCK_mysql_create_db */
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
,
result
);
...
...
@@ -656,6 +657,7 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
qinfo
.
db_len
=
strlen
(
db
);
thd
->
clear_error
();
/* These DDL methods and logging protected with LOCK_mysql_create_db */
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
,
result
);
...
...
@@ -779,6 +781,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
qinfo
.
db_len
=
strlen
(
db
);
thd
->
clear_error
();
/* These DDL methods and logging protected with LOCK_mysql_create_db */
mysql_bin_log
.
write
(
&
qinfo
);
}
thd
->
server_status
|=
SERVER_STATUS_DB_DROPPED
;
...
...
@@ -805,6 +808,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
tbl_name_len
=
strlen
(
tbl
->
table_name
)
+
3
;
if
(
query_pos
+
tbl_name_len
+
1
>=
query_end
)
{
/* These DDL methods and logging protected with LOCK_mysql_create_db */
write_to_binlog
(
thd
,
query
,
query_pos
-
1
-
query
,
db
,
db_len
);
query_pos
=
query_data_start
;
}
...
...
@@ -817,6 +821,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
if
(
query_pos
!=
query_data_start
)
{
/* These DDL methods and logging protected with LOCK_mysql_create_db */
write_to_binlog
(
thd
,
query
,
query_pos
-
1
-
query
,
db
,
db_len
);
}
}
...
...
sql/sql_parse.cc
View file @
5dc23bcc
...
...
@@ -3209,6 +3209,7 @@ end_with_restore_list:
/* ! we write after unlocking the table */
if
(
!
res
&&
!
lex
->
no_write_to_binlog
)
{
/* Presumably, REPAIR and binlog writing doesn't require synchronization */
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
// No binlog error generated
...
...
@@ -3243,6 +3244,7 @@ end_with_restore_list:
/* ! we write after unlocking the table */
if
(
!
res
&&
!
lex
->
no_write_to_binlog
)
{
/* Presumably, ANALYZE and binlog writing doesn't require synchronization */
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
// No binlog error generated
...
...
@@ -3268,6 +3270,7 @@ end_with_restore_list:
/* ! we write after unlocking the table */
if
(
!
res
&&
!
lex
->
no_write_to_binlog
)
{
/* Presumably, OPTIMIZE and binlog writing doesn't require synchronization */
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
// No binlog error generated
...
...
@@ -3554,6 +3557,7 @@ end_with_restore_list:
/* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
thd
->
options
|=
OPTION_STATUS_NO_TRANS_UPDATE
;
}
/* DDL and binlog write order protected by LOCK_open */
res
=
mysql_rm_table
(
thd
,
first_table
,
lex
->
drop_if_exists
,
lex
->
drop_temporary
);
}
...
...
@@ -3842,15 +3846,9 @@ end_with_restore_list:
break
;
if
(
end_active_trans
(
thd
))
goto
error
;
/* Conditionally writes to binlog */
if
(
!
(
res
=
mysql_create_user
(
thd
,
lex
->
users_list
)))
{
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
}
break
;
}
case
SQLCOM_DROP_USER
:
...
...
@@ -3860,15 +3858,9 @@ end_with_restore_list:
break
;
if
(
end_active_trans
(
thd
))
goto
error
;
/* Conditionally writes to binlog */
if
(
!
(
res
=
mysql_drop_user
(
thd
,
lex
->
users_list
)))
{
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
}
break
;
}
case
SQLCOM_RENAME_USER
:
...
...
@@ -3878,15 +3870,9 @@ end_with_restore_list:
break
;
if
(
end_active_trans
(
thd
))
goto
error
;
/* Conditionally writes to binlog */
if
(
!
(
res
=
mysql_rename_user
(
thd
,
lex
->
users_list
)))
{
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
}
break
;
}
case
SQLCOM_REVOKE_ALL
:
...
...
@@ -3894,15 +3880,9 @@ end_with_restore_list:
if
(
check_access
(
thd
,
UPDATE_ACL
,
"mysql"
,
0
,
1
,
1
,
0
)
&&
check_global_access
(
thd
,
CREATE_USER_ACL
))
break
;
/* Conditionally writes to binlog */
if
(
!
(
res
=
mysql_revoke_all
(
thd
,
lex
->
users_list
)))
{
if
(
mysql_bin_log
.
is_open
())
{
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
}
break
;
}
case
SQLCOM_REVOKE
:
...
...
@@ -3961,6 +3941,7 @@ end_with_restore_list:
check_grant_routine
(
thd
,
grants
|
GRANT_ACL
,
all_tables
,
lex
->
type
==
TYPE_ENUM_PROCEDURE
,
0
))
goto
error
;
/* Conditionally writes to binlog */
res
=
mysql_routine_grant
(
thd
,
all_tables
,
lex
->
type
==
TYPE_ENUM_PROCEDURE
,
lex
->
users_list
,
grants
,
...
...
@@ -3973,16 +3954,11 @@ end_with_restore_list:
GRANT_ACL
),
all_tables
,
0
,
UINT_MAX
,
0
))
goto
error
;
/* Conditionally writes to binlog */
res
=
mysql_table_grant
(
thd
,
all_tables
,
lex
->
users_list
,
lex
->
columns
,
lex
->
grant
,
lex
->
sql_command
==
SQLCOM_REVOKE
);
}
if
(
!
res
&&
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
else
{
...
...
@@ -3993,16 +3969,11 @@ end_with_restore_list:
goto
error
;
}
else
/* Conditionally writes to binlog */
res
=
mysql_grant
(
thd
,
select_lex
->
db
,
lex
->
users_list
,
lex
->
grant
,
lex
->
sql_command
==
SQLCOM_REVOKE
);
if
(
!
res
)
{
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
if
(
lex
->
sql_command
==
SQLCOM_GRANT
)
{
List_iterator
<
LEX_USER
>
str_list
(
lex
->
users_list
);
...
...
@@ -4040,6 +4011,7 @@ end_with_restore_list:
We WANT to write and we CAN write.
! we write after unlocking the table.
*/
/* Presumably, RESET and binlog writing doesn't require synchronization */
if
(
!
lex
->
no_write_to_binlog
&&
write_to_binlog
)
{
if
(
mysql_bin_log
.
is_open
())
...
...
@@ -4560,20 +4532,16 @@ end_with_restore_list:
already puts on CREATE FUNCTION.
*/
if
(
lex
->
sql_command
==
SQLCOM_ALTER_PROCEDURE
)
/* Conditionally writes to binlog */
result
=
sp_update_procedure
(
thd
,
lex
->
spname
,
&
lex
->
sp_chistics
);
else
/* Conditionally writes to binlog */
result
=
sp_update_function
(
thd
,
lex
->
spname
,
&
lex
->
sp_chistics
);
}
}
switch
(
result
)
{
case
SP_OK
:
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
break
;
case
SP_KEY_NOT_FOUND
:
...
...
@@ -4618,9 +4586,11 @@ end_with_restore_list:
}
#endif
if
(
lex
->
sql_command
==
SQLCOM_DROP_PROCEDURE
)
result
=
sp_drop_procedure
(
thd
,
lex
->
spname
);
/* Conditionally writes to binlog */
result
=
sp_drop_procedure
(
thd
,
lex
->
spname
);
/* Conditionally writes to binlog */
else
result
=
sp_drop_function
(
thd
,
lex
->
spname
);
/* Conditionally writes to binlog */
result
=
sp_drop_function
(
thd
,
lex
->
spname
);
/* Conditionally writes to binlog */
}
else
{
...
...
@@ -4633,6 +4603,8 @@ end_with_restore_list:
{
if
(
check_access
(
thd
,
DELETE_ACL
,
"mysql"
,
0
,
1
,
0
,
0
))
goto
error
;
/* Does NOT write to binlog */
if
(
!
(
res
=
mysql_drop_function
(
thd
,
&
lex
->
spname
->
m_name
)))
{
send_ok
(
thd
);
...
...
@@ -4653,12 +4625,6 @@ end_with_restore_list:
switch
(
result
)
{
case
SP_OK
:
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
send_ok
(
thd
);
break
;
case
SP_KEY_NOT_FOUND
:
...
...
@@ -4754,50 +4720,6 @@ end_with_restore_list:
{
if
(
end_active_trans
(
thd
))
goto
error
;
if
(
!
(
res
=
mysql_create_view
(
thd
,
thd
->
lex
->
create_view_mode
))
&&
mysql_bin_log
.
is_open
())
{
String
buff
;
const
LEX_STRING
command
[
3
]
=
{{(
char
*
)
STRING_WITH_LEN
(
"CREATE "
)},
{(
char
*
)
STRING_WITH_LEN
(
"ALTER "
)},
{(
char
*
)
STRING_WITH_LEN
(
"CREATE OR REPLACE "
)}};
thd
->
clear_error
();
buff
.
append
(
command
[
thd
->
lex
->
create_view_mode
].
str
,
command
[
thd
->
lex
->
create_view_mode
].
length
);
view_store_options
(
thd
,
first_table
,
&
buff
);
buff
.
append
(
STRING_WITH_LEN
(
"VIEW "
));
/* Test if user supplied a db (ie: we did not use thd->db) */
if
(
first_table
->
db
&&
first_table
->
db
[
0
]
&&
(
thd
->
db
==
NULL
||
strcmp
(
first_table
->
db
,
thd
->
db
)))
{
append_identifier
(
thd
,
&
buff
,
first_table
->
db
,
first_table
->
db_length
);
buff
.
append
(
'.'
);
}
append_identifier
(
thd
,
&
buff
,
first_table
->
table_name
,
first_table
->
table_name_length
);
if
(
lex
->
view_list
.
elements
)
{
List_iterator_fast
<
LEX_STRING
>
names
(
lex
->
view_list
);
LEX_STRING
*
name
;
int
i
;
for
(
i
=
0
;
name
=
names
++
;
i
++
)
{
buff
.
append
(
i
?
", "
:
"("
);
append_identifier
(
thd
,
&
buff
,
name
->
str
,
name
->
length
);
}
buff
.
append
(
')'
);
}
buff
.
append
(
STRING_WITH_LEN
(
" AS "
));
buff
.
append
(
first_table
->
source
.
str
,
first_table
->
source
.
length
);
Query_log_event
qinfo
(
thd
,
buff
.
ptr
(),
buff
.
length
(),
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
break
;
}
case
SQLCOM_DROP_VIEW
:
...
...
@@ -4805,13 +4727,8 @@ end_with_restore_list:
if
(
check_table_access
(
thd
,
DROP_ACL
,
all_tables
,
0
)
||
end_active_trans
(
thd
))
goto
error
;
if
(
!
(
res
=
mysql_drop_view
(
thd
,
first_table
,
thd
->
lex
->
drop_mode
))
&&
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
/* Conditionally writes to binlog. */
res
=
mysql_drop_view
(
thd
,
first_table
,
thd
->
lex
->
drop_mode
);
break
;
}
case
SQLCOM_CREATE_TRIGGER
:
...
...
@@ -4819,6 +4736,7 @@ end_with_restore_list:
if
(
end_active_trans
(
thd
))
goto
error
;
/* Conditionally writes to binlog. */
res
=
mysql_create_or_drop_trigger
(
thd
,
all_tables
,
1
);
/* We don't care about trigger body after this point */
...
...
@@ -4831,6 +4749,7 @@ end_with_restore_list:
if
(
end_active_trans
(
thd
))
goto
error
;
/* Conditionally writes to binlog. */
res
=
mysql_create_or_drop_trigger
(
thd
,
all_tables
,
0
);
break
;
}
...
...
sql/sql_table.cc
View file @
5dc23bcc
...
...
@@ -3173,6 +3173,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
/* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */
if
(
alter_info
->
tablespace_op
!=
NO_TABLESPACE_OP
)
/* Conditionally writes to binlog. */
DBUG_RETURN
(
mysql_discard_or_import_tablespace
(
thd
,
table_list
,
alter_info
->
tablespace_op
));
if
(
!
(
table
=
open_ltable
(
thd
,
table_list
,
TL_WRITE_ALLOW_READ
)))
...
...
@@ -3254,10 +3255,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
!
table
->
s
->
tmp_table
)
// no need to touch frm
{
error
=
0
;
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
if
(
new_name
!=
table_name
||
new_db
!=
db
)
{
thd
->
proc_info
=
"rename"
;
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
/* Then do a 'simple' rename of the table */
error
=
0
;
if
(
!
access
(
new_name_buff
,
F_OK
))
...
...
@@ -3279,7 +3280,6 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
error
=
-
1
;
}
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
}
if
(
!
error
)
...
...
@@ -3288,16 +3288,12 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
case
LEAVE_AS_IS
:
break
;
case
ENABLE
:
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
wait_while_table_is_used
(
thd
,
table
,
HA_EXTRA_FORCE_REOPEN
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
error
=
table
->
file
->
enable_indexes
(
HA_KEY_SWITCH_NONUNIQ_SAVE
);
/* COND_refresh will be signaled in close_thread_tables() */
break
;
case
DISABLE
:
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
wait_while_table_is_used
(
thd
,
table
,
HA_EXTRA_FORCE_REOPEN
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
error
=
table
->
file
->
disable_indexes
(
HA_KEY_SWITCH_NONUNIQ_SAVE
);
/* COND_refresh will be signaled in close_thread_tables() */
break
;
...
...
@@ -3327,6 +3323,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
table
->
file
->
print_error
(
error
,
MYF
(
0
));
error
=
-
1
;
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
table_list
->
table
=
0
;
// For query cache
query_cache_invalidate3
(
thd
,
table_list
,
0
);
DBUG_RETURN
(
error
);
...
...
@@ -3773,6 +3770,10 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
my_free
((
gptr
)
new_table
,
MYF
(
0
));
goto
err
;
}
/*
Writing to the binlog does not need to be synchronized for temporary tables,
which are thread-specific.
*/
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
...
...
@@ -3955,7 +3956,7 @@ end_temporary:
thd
->
some_tables_deleted
=
0
;
DBUG_RETURN
(
FALSE
);
err:
err:
DBUG_RETURN
(
TRUE
);
}
...
...
sql/sql_trigger.cc
View file @
5dc23bcc
...
...
@@ -270,8 +270,6 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
table
->
triggers
->
drop_trigger
(
thd
,
tables
,
&
stmt_query
));
end:
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
start_waiting_global_read_lock
(
thd
);
if
(
!
result
)
{
...
...
@@ -284,9 +282,13 @@ end:
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
start_waiting_global_read_lock
(
thd
);
if
(
!
result
)
send_ok
(
thd
);
}
DBUG_RETURN
(
result
);
}
...
...
sql/sql_view.cc
View file @
5dc23bcc
...
...
@@ -212,6 +212,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
SYNOPSIS
mysql_create_view()
thd - thread handler
views - views to create
mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE
RETURN VALUE
...
...
@@ -219,7 +220,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
TRUE Error
*/
bool
mysql_create_view
(
THD
*
thd
,
bool
mysql_create_view
(
THD
*
thd
,
TABLE_LIST
*
views
,
enum_view_create_mode
mode
)
{
LEX
*
lex
=
thd
->
lex
;
...
...
@@ -548,6 +549,50 @@ bool mysql_create_view(THD *thd,
}
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
res
=
mysql_register_view
(
thd
,
view
,
mode
);
if
(
mysql_bin_log
.
is_open
())
{
String
buff
;
const
LEX_STRING
command
[
3
]
=
{{(
char
*
)
STRING_WITH_LEN
(
"CREATE "
)},
{(
char
*
)
STRING_WITH_LEN
(
"ALTER "
)},
{(
char
*
)
STRING_WITH_LEN
(
"CREATE OR REPLACE "
)}};
buff
.
append
(
command
[
thd
->
lex
->
create_view_mode
].
str
,
command
[
thd
->
lex
->
create_view_mode
].
length
);
view_store_options
(
thd
,
views
,
&
buff
);
buff
.
append
(
STRING_WITH_LEN
(
"VIEW "
));
/* Test if user supplied a db (ie: we did not use thd->db) */
if
(
views
->
db
&&
views
->
db
[
0
]
&&
(
thd
->
db
==
NULL
||
strcmp
(
views
->
db
,
thd
->
db
)))
{
append_identifier
(
thd
,
&
buff
,
views
->
db
,
views
->
db_length
);
buff
.
append
(
'.'
);
}
append_identifier
(
thd
,
&
buff
,
views
->
table_name
,
views
->
table_name_length
);
if
(
lex
->
view_list
.
elements
)
{
List_iterator_fast
<
LEX_STRING
>
names
(
lex
->
view_list
);
LEX_STRING
*
name
;
int
i
;
for
(
i
=
0
;
name
=
names
++
;
i
++
)
{
buff
.
append
(
i
?
", "
:
"("
);
append_identifier
(
thd
,
&
buff
,
name
->
str
,
name
->
length
);
}
buff
.
append
(
')'
);
}
buff
.
append
(
STRING_WITH_LEN
(
" AS "
));
buff
.
append
(
views
->
source
.
str
,
views
->
source
.
length
);
Query_log_event
qinfo
(
thd
,
buff
.
ptr
(),
buff
.
length
(),
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
if
(
view
->
revision
!=
1
)
query_cache_invalidate3
(
thd
,
view
,
0
);
...
...
@@ -1306,12 +1351,12 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
char
*
wrong_object_db
=
NULL
,
*
wrong_object_name
=
NULL
;
bool
error
=
FALSE
;
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
for
(
view
=
views
;
view
;
view
=
view
->
next_local
)
{
strxnmov
(
path
,
FN_REFLEN
,
mysql_data_home
,
"/"
,
view
->
db
,
"/"
,
view
->
table_name
,
reg_ext
,
NullS
);
(
void
)
unpack_filename
(
path
,
path
);
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
type
=
FRMTYPE_ERROR
;
if
(
access
(
path
,
F_OK
)
||
FRMTYPE_VIEW
!=
(
type
=
mysql_frm_type
(
thd
,
path
,
&
not_used
)))
...
...
@@ -1323,7 +1368,6 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
push_warning_printf
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_NOTE
,
ER_BAD_TABLE_ERROR
,
ER
(
ER_BAD_TABLE_ERROR
),
name
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
continue
;
}
if
(
type
==
FRMTYPE_TABLE
)
...
...
@@ -1347,8 +1391,16 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
error
=
TRUE
;
query_cache_invalidate3
(
thd
,
view
,
0
);
sp_cache_invalidate
();
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
}
if
(
mysql_bin_log
.
is_open
())
{
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
0
,
FALSE
);
mysql_bin_log
.
write
(
&
qinfo
);
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
if
(
error
)
{
DBUG_RETURN
(
TRUE
);
...
...
sql/sql_view.h
View file @
5dc23bcc
...
...
@@ -16,7 +16,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
bool
mysql_create_view
(
THD
*
thd
,
bool
mysql_create_view
(
THD
*
thd
,
TABLE_LIST
*
view
,
enum_view_create_mode
mode
);
bool
mysql_make_view
(
THD
*
thd
,
File_parser
*
parser
,
TABLE_LIST
*
table
,
...
...
vio/viosocket.c
View file @
5dc23bcc
...
...
@@ -33,7 +33,7 @@ int vio_read(Vio * vio, gptr buf, int size)
{
int
r
;
DBUG_ENTER
(
"vio_read"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
/* Ensure nobody uses vio_read_buff and vio_read simultaneously */
DBUG_ASSERT
(
vio
->
read_end
==
vio
->
read_pos
);
...
...
@@ -64,7 +64,7 @@ int vio_read_buff(Vio *vio, gptr buf, int size)
int
rc
;
#define VIO_UNBUFFERED_READ_MIN_SIZE 2048
DBUG_ENTER
(
"vio_read_buff"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
if
(
vio
->
read_pos
<
vio
->
read_end
)
{
...
...
@@ -102,7 +102,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
{
int
r
;
DBUG_ENTER
(
"vio_write"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
#ifdef __WIN__
r
=
send
(
vio
->
sd
,
buf
,
size
,
0
);
#else
...
...
@@ -411,7 +411,7 @@ int vio_read_pipe(Vio * vio, gptr buf, int size)
{
DWORD
length
;
DBUG_ENTER
(
"vio_read_pipe"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
if
(
!
ReadFile
(
vio
->
hPipe
,
buf
,
size
,
&
length
,
NULL
))
DBUG_RETURN
(
-
1
);
...
...
@@ -425,7 +425,7 @@ int vio_write_pipe(Vio * vio, const gptr buf, int size)
{
DWORD
length
;
DBUG_ENTER
(
"vio_write_pipe"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
if
(
!
WriteFile
(
vio
->
hPipe
,
(
char
*
)
buf
,
size
,
&
length
,
NULL
))
DBUG_RETURN
(
-
1
);
...
...
@@ -470,7 +470,7 @@ int vio_read_shared_memory(Vio * vio, gptr buf, int size)
char
*
current_postion
;
DBUG_ENTER
(
"vio_read_shared_memory"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
remain_local
=
size
;
current_postion
=
buf
;
...
...
@@ -531,7 +531,7 @@ int vio_write_shared_memory(Vio * vio, const gptr buf, int size)
char
*
current_postion
;
DBUG_ENTER
(
"vio_write_shared_memory"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
remain
=
size
;
current_postion
=
buf
;
...
...
vio/viossl.c
View file @
5dc23bcc
...
...
@@ -82,7 +82,7 @@ int vio_ssl_read(Vio *vio, gptr buf, int size)
{
int
r
;
DBUG_ENTER
(
"vio_ssl_read"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p, size: %d, ssl_: 0x%p
"
,
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx, size: %d, ssl_: 0x%lx
"
,
vio
->
sd
,
buf
,
size
,
vio
->
ssl_arg
));
r
=
SSL_read
((
SSL
*
)
vio
->
ssl_arg
,
buf
,
size
);
...
...
@@ -99,7 +99,7 @@ int vio_ssl_write(Vio *vio, const gptr buf, int size)
{
int
r
;
DBUG_ENTER
(
"vio_ssl_write"
);
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
p
, size: %d"
,
vio
->
sd
,
buf
,
size
));
DBUG_PRINT
(
"enter"
,
(
"sd: %d, buf: 0x%
lx
, size: %d"
,
vio
->
sd
,
buf
,
size
));
r
=
SSL_write
((
SSL
*
)
vio
->
ssl_arg
,
buf
,
size
);
#ifndef DBUG_OFF
...
...
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