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
3e50dc3c
Commit
3e50dc3c
authored
Aug 27, 2005
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/psergey/mysql-5.0-rpl-bug
parents
3514fb4b
5f231a5f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
44 additions
and
58 deletions
+44
-58
sql/item.cc
sql/item.cc
+2
-2
sql/item.h
sql/item.h
+1
-1
sql/log.cc
sql/log.cc
+4
-0
sql/sp_head.cc
sql/sp_head.cc
+30
-33
sql/sql_class.cc
sql/sql_class.cc
+1
-1
sql/sql_class.h
sql/sql_class.h
+0
-7
sql/sql_delete.cc
sql/sql_delete.cc
+2
-7
sql/sql_insert.cc
sql/sql_insert.cc
+1
-2
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_update.cc
sql/sql_update.cc
+2
-4
No files found.
sql/item.cc
View file @
3e50dc3c
...
@@ -936,7 +936,7 @@ my_decimal *Item_name_const::val_decimal(my_decimal *decimal_value)
...
@@ -936,7 +936,7 @@ my_decimal *Item_name_const::val_decimal(my_decimal *decimal_value)
{
{
DBUG_ASSERT
(
fixed
);
DBUG_ASSERT
(
fixed
);
my_decimal
*
val
=
value_item
->
val_decimal
(
decimal_value
);
my_decimal
*
val
=
value_item
->
val_decimal
(
decimal_value
);
Item
::
null_value
=
value_item
->
null_value
;
null_value
=
value_item
->
null_value
;
return
val
;
return
val
;
}
}
...
@@ -944,7 +944,7 @@ my_decimal *Item_name_const::val_decimal(my_decimal *decimal_value)
...
@@ -944,7 +944,7 @@ my_decimal *Item_name_const::val_decimal(my_decimal *decimal_value)
bool
Item_name_const
::
is_null
()
bool
Item_name_const
::
is_null
()
{
{
bool
ret
=
value_item
->
is_null
();
bool
ret
=
value_item
->
is_null
();
Item
::
null_value
=
value_item
->
null_value
;
null_value
=
value_item
->
null_value
;
return
ret
;
return
ret
;
}
}
...
...
sql/item.h
View file @
3e50dc3c
...
@@ -853,7 +853,7 @@ public:
...
@@ -853,7 +853,7 @@ public:
return
value_item
->
save_in_field
(
field
,
no_conversions
);
return
value_item
->
save_in_field
(
field
,
no_conversions
);
}
}
inline
bool
send
(
Protocol
*
protocol
,
String
*
str
)
bool
send
(
Protocol
*
protocol
,
String
*
str
)
{
{
return
value_item
->
send
(
protocol
,
str
);
return
value_item
->
send
(
protocol
,
str
);
}
}
...
...
sql/log.cc
View file @
3e50dc3c
...
@@ -1579,6 +1579,10 @@ bool MYSQL_LOG::write(Log_event *event_info)
...
@@ -1579,6 +1579,10 @@ bool MYSQL_LOG::write(Log_event *event_info)
if
(
thd
->
binlog_evt_union
.
do_union
)
if
(
thd
->
binlog_evt_union
.
do_union
)
{
{
/*
In Stored function; Remember that function call caused an update.
We will log the function call to the binary log on function exit
*/
thd
->
binlog_evt_union
.
unioned_events
=
TRUE
;
thd
->
binlog_evt_union
.
unioned_events
=
TRUE
;
thd
->
binlog_evt_union
.
unioned_events_trans
|=
event_info
->
cache_stmt
;
thd
->
binlog_evt_union
.
unioned_events_trans
|=
event_info
->
cache_stmt
;
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
...
sql/sp_head.cc
View file @
3e50dc3c
...
@@ -672,7 +672,7 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
...
@@ -672,7 +672,7 @@ int cmp_splocal_locations(Item_splocal * const *a, Item_splocal * const *b)
variables with NAME_CONST('sp_var_name', value) calls.
variables with NAME_CONST('sp_var_name', value) calls.
RETURN
RETURN
0 Ok, thd->query{_length} either has been appropr
a
iately replaced or
0 Ok, thd->query{_length} either has been appropriately replaced or
there is no need for replacements.
there is no need for replacements.
1 Out of memory error.
1 Out of memory error.
*/
*/
...
@@ -683,6 +683,9 @@ static bool subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
...
@@ -683,6 +683,9 @@ static bool subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
if
(
thd
->
prelocked_mode
==
NON_PRELOCKED
&&
mysql_bin_log
.
is_open
())
if
(
thd
->
prelocked_mode
==
NON_PRELOCKED
&&
mysql_bin_log
.
is_open
())
{
{
Dynamic_array
<
Item_splocal
*>
sp_vars_uses
;
Dynamic_array
<
Item_splocal
*>
sp_vars_uses
;
char
*
pbuf
,
*
cur
,
buffer
[
512
];
String
qbuf
(
buffer
,
sizeof
(
buffer
),
&
my_charset_bin
);
int
prev_pos
,
res
;
/* Find all instances of item_splocal used in this statement */
/* Find all instances of item_splocal used in this statement */
for
(
Item
*
item
=
instr
->
free_list
;
item
;
item
=
item
->
next
)
for
(
Item
*
item
=
instr
->
free_list
;
item
;
item
=
item
->
next
)
...
@@ -704,41 +707,35 @@ static bool subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
...
@@ -704,41 +707,35 @@ static bool subst_spvars(THD *thd, sp_instr *instr, LEX_STRING *query_str)
Construct a statement string where SP local var refs are replaced
Construct a statement string where SP local var refs are replaced
with "NAME_CONST(name, value)"
with "NAME_CONST(name, value)"
*/
*/
char
buffer
[
512
];
String
qbuf
(
buffer
,
sizeof
(
buffer
),
&
my_charset_bin
);
qbuf
.
length
(
0
);
qbuf
.
length
(
0
);
cur
=
query_str
->
str
;
char
*
cur
=
query_str
->
str
;
prev_pos
=
res
=
0
;
int
prev_pos
=
0
;
int
res
=
0
;
for
(
Item_splocal
**
splocal
=
sp_vars_uses
.
front
();
for
(
Item_splocal
**
splocal
=
sp_vars_uses
.
front
();
splocal
<
sp_vars_uses
.
back
();
splocal
++
)
splocal
<
sp_vars_uses
.
back
();
splocal
++
)
{
{
Item
*
val
;
/* append the text between sp ref occurences */
/* append the text between sp ref occurences */
res
|=
qbuf
.
append
(
cur
+
prev_pos
,
(
*
splocal
)
->
pos_in_query
-
prev_pos
);
res
|=
qbuf
.
append
(
cur
+
prev_pos
,
(
*
splocal
)
->
pos_in_query
-
prev_pos
);
prev_pos
=
(
*
splocal
)
->
pos_in_query
+
(
*
splocal
)
->
m_name
.
length
;
prev_pos
=
(
*
splocal
)
->
pos_in_query
+
(
*
splocal
)
->
m_name
.
length
;
/* append the spvar substitute */
/* append the spvar substitute */
res
|=
qbuf
.
append
(
" NAME_CONST('"
);
res
|=
qbuf
.
append
(
" NAME_CONST('"
);
res
|=
qbuf
.
append
((
*
splocal
)
->
m_name
.
str
,
(
*
splocal
)
->
m_name
.
length
);
res
|=
qbuf
.
append
((
*
splocal
)
->
m_name
.
str
,
(
*
splocal
)
->
m_name
.
length
);
res
|=
qbuf
.
append
(
"',"
);
res
|=
qbuf
.
append
(
"',"
);
Item
*
val
=
(
*
splocal
)
->
this_item
();
val
=
(
*
splocal
)
->
this_item
();
DBUG_PRINT
(
"info"
,
(
"print %p"
,
val
));
DBUG_PRINT
(
"info"
,
(
"print %p"
,
val
));
val
->
print
(
&
qbuf
);
val
->
print
(
&
qbuf
);
res
|=
qbuf
.
append
(
')'
);
res
|=
qbuf
.
append
(
')'
);
if
(
res
)
if
(
res
)
break
;
break
;
}
}
res
|=
qbuf
.
append
(
cur
+
prev_pos
,
query_str
->
length
-
prev_pos
);
res
|=
qbuf
.
append
(
cur
+
prev_pos
,
query_str
->
length
-
prev_pos
);
if
(
res
)
if
(
res
)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
char
*
pbuf
=
thd
->
alloc
(
qbuf
.
length
()
+
1
);
if
(
!
(
pbuf
=
thd
->
strmake
(
qbuf
.
ptr
(),
qbuf
.
length
())))
if
(
!
pbuf
)
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
memcpy
(
pbuf
,
qbuf
.
ptr
(),
qbuf
.
length
()
+
1
);
thd
->
query
=
pbuf
;
thd
->
query
=
pbuf
;
thd
->
query_length
=
qbuf
.
length
();
thd
->
query_length
=
qbuf
.
length
();
}
}
...
@@ -1058,9 +1055,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
...
@@ -1058,9 +1055,9 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
if
(
need_binlog_call
)
if
(
need_binlog_call
)
mysql_bin_log
.
stop_union_events
(
thd
);
mysql_bin_log
.
stop_union_events
(
thd
);
if
(
thd
->
binlog_evt_union
.
unioned_events
)
if
(
thd
->
binlog_evt_union
.
unioned_events
&&
mysql_bin_log
.
is_open
()
)
{
{
char
buf
[
64
];
char
buf
[
256
];
String
bufstr
(
buf
,
sizeof
(
buf
),
&
my_charset_bin
);
String
bufstr
(
buf
,
sizeof
(
buf
),
&
my_charset_bin
);
bufstr
.
length
(
0
);
bufstr
.
length
(
0
);
bufstr
.
append
(
"DO "
,
3
);
bufstr
.
append
(
"DO "
,
3
);
...
@@ -1074,17 +1071,14 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
...
@@ -1074,17 +1071,14 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
}
}
bufstr
.
append
(
')'
);
bufstr
.
append
(
')'
);
if
(
mysql_bin_log
.
is_open
())
Query_log_event
qinfo
(
thd
,
bufstr
.
ptr
(),
bufstr
.
length
(),
thd
->
binlog_evt_union
.
unioned_events_trans
,
FALSE
);
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
thd
->
binlog_evt_union
.
unioned_events_trans
)
{
{
bool
transactional_table
=
FALSE
;
push_warning
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_UNKNOWN_ERROR
,
Query_log_event
qinfo
(
thd
,
bufstr
.
ptr
(),
bufstr
.
length
(),
"Invoked ROUTINE modified a transactional table but MySQL "
thd
->
binlog_evt_union
.
unioned_events_trans
,
FALSE
);
"failed to reflect this change in the binary log"
);
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
transactional_table
)
{
push_warning
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_UNKNOWN_ERROR
,
"Invoked ROUTINE modified a transactional table but MYSQL"
"failed to reflect this change in the binary log."
);
}
}
}
}
}
...
@@ -1905,15 +1899,18 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
...
@@ -1905,15 +1899,18 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
query
=
thd
->
query
;
query
=
thd
->
query
;
query_length
=
thd
->
query_length
;
query_length
=
thd
->
query_length
;
if
(
!
(
res
=
alloc_query
(
thd
,
m_query
.
str
,
m_query
.
length
+
1
)))
if
(
!
(
res
=
alloc_query
(
thd
,
m_query
.
str
,
m_query
.
length
+
1
))
&&
!
(
res
=
subst_spvars
(
thd
,
this
,
&
m_query
)))
{
{
/*
(the order of query cache and subst_spvars calls is irrelevant because
queries with SP vars can't be cached)
*/
if
(
query_cache_send_result_to_client
(
thd
,
if
(
query_cache_send_result_to_client
(
thd
,
thd
->
query
,
thd
->
query_length
)
<=
0
)
thd
->
query
,
thd
->
query_length
)
<=
0
)
{
{
thd
->
query_str_binlog_unsuitable
=
subst_spvars
(
thd
,
this
,
&
m_query
);
res
=
m_lex_keeper
.
reset_lex_and_exec_core
(
thd
,
nextp
,
FALSE
,
this
);
res
=
m_lex_keeper
.
reset_lex_and_exec_core
(
thd
,
nextp
,
FALSE
,
this
);
query_cache_end_of_result
(
thd
);
query_cache_end_of_result
(
thd
);
thd
->
query_str_binlog_unsuitable
=
FALSE
;
}
}
else
else
*
nextp
=
m_ip
+
1
;
*
nextp
=
m_ip
+
1
;
...
...
sql/sql_class.cc
View file @
3e50dc3c
...
@@ -178,7 +178,7 @@ THD::THD()
...
@@ -178,7 +178,7 @@ THD::THD()
rand_used
(
0
),
time_zone_used
(
0
),
rand_used
(
0
),
time_zone_used
(
0
),
last_insert_id_used
(
0
),
insert_id_used
(
0
),
clear_next_insert_id
(
0
),
last_insert_id_used
(
0
),
insert_id_used
(
0
),
clear_next_insert_id
(
0
),
in_lock_tables
(
0
),
bootstrap
(
0
),
derived_tables_processing
(
FALSE
),
in_lock_tables
(
0
),
bootstrap
(
0
),
derived_tables_processing
(
FALSE
),
spcont
(
NULL
)
,
query_str_binlog_unsuitable
(
FALSE
)
spcont
(
NULL
)
{
{
current_arena
=
this
;
current_arena
=
this
;
host
=
user
=
priv_user
=
db
=
ip
=
0
;
host
=
user
=
priv_user
=
db
=
ip
=
0
;
...
...
sql/sql_class.h
View file @
3e50dc3c
...
@@ -1350,13 +1350,6 @@ public:
...
@@ -1350,13 +1350,6 @@ public:
long
long_value
;
long
long_value
;
}
sys_var_tmp
;
}
sys_var_tmp
;
/*
If true, thd->query is not a suitable query to write to binary log. This
is not handled everywhere currently - we check it only in statements
that can have SP variable references.
*/
bool
query_str_binlog_unsuitable
;
struct
{
struct
{
/*
/*
If true, mysql_bin_log::write(Log_event) call will not write events to
If true, mysql_bin_log::write(Log_event) call will not write events to
...
...
sql/sql_delete.cc
View file @
3e50dc3c
...
@@ -14,15 +14,12 @@
...
@@ -14,15 +14,12 @@
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
/*
Delete of records and truncate of tables.
Delete of records and truncate of tables.
Multi-table deletes were introduced by Monty and Sinisa
Multi-table deletes were introduced by Monty and Sinisa
*/
*/
#include "mysql_priv.h"
#include "mysql_priv.h"
#include "ha_innodb.h"
#include "ha_innodb.h"
#include "sql_select.h"
#include "sql_select.h"
...
@@ -254,8 +251,7 @@ cleanup:
...
@@ -254,8 +251,7 @@ cleanup:
thd
->
clear_error
();
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
transactional_table
,
FALSE
);
transactional_table
,
FALSE
);
if
((
thd
->
query_str_binlog_unsuitable
||
mysql_bin_log
.
write
(
&
qinfo
))
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
transactional_table
)
&&
transactional_table
)
error
=
1
;
error
=
1
;
}
}
if
(
!
transactional_table
)
if
(
!
transactional_table
)
...
@@ -720,8 +716,7 @@ bool multi_delete::send_eof()
...
@@ -720,8 +716,7 @@ bool multi_delete::send_eof()
thd
->
clear_error
();
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
transactional_tables
,
FALSE
);
transactional_tables
,
FALSE
);
if
((
thd
->
query_str_binlog_unsuitable
||
mysql_bin_log
.
write
(
&
qinfo
))
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
!
normal_tables
)
&&
!
normal_tables
)
local_error
=
1
;
// Log write failed: roll back the SQL statement
local_error
=
1
;
// Log write failed: roll back the SQL statement
}
}
if
(
!
transactional_tables
)
if
(
!
transactional_tables
)
...
...
sql/sql_insert.cc
View file @
3e50dc3c
...
@@ -592,8 +592,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
...
@@ -592,8 +592,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
thd
->
clear_error
();
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
transactional_table
,
FALSE
);
transactional_table
,
FALSE
);
if
((
thd
->
query_str_binlog_unsuitable
||
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
transactional_table
)
mysql_bin_log
.
write
(
&
qinfo
))
&&
transactional_table
)
error
=
1
;
error
=
1
;
}
}
if
(
!
transactional_table
)
if
(
!
transactional_table
)
...
...
sql/sql_parse.cc
View file @
3e50dc3c
...
@@ -620,7 +620,7 @@ void init_update_queries(void)
...
@@ -620,7 +620,7 @@ void init_update_queries(void)
bool
is_update_query
(
enum
enum_sql_command
command
)
bool
is_update_query
(
enum
enum_sql_command
command
)
{
{
DBUG_ASSERT
(
command
>=
0
&&
command
<=
SQLCOM_END
);
DBUG_ASSERT
(
command
>=
0
&&
command
<=
SQLCOM_END
);
return
uc_update_queries
[
command
];
return
uc_update_queries
[
command
]
!=
0
;
}
}
/*
/*
...
...
sql/sql_update.cc
View file @
3e50dc3c
...
@@ -475,8 +475,7 @@ int mysql_update(THD *thd,
...
@@ -475,8 +475,7 @@ int mysql_update(THD *thd,
thd
->
clear_error
();
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
transactional_table
,
FALSE
);
transactional_table
,
FALSE
);
if
((
thd
->
query_str_binlog_unsuitable
||
mysql_bin_log
.
write
(
&
qinfo
))
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
transactional_table
)
&&
transactional_table
)
error
=
1
;
// Rollback update
error
=
1
;
// Rollback update
}
}
if
(
!
transactional_table
)
if
(
!
transactional_table
)
...
@@ -1442,8 +1441,7 @@ bool multi_update::send_eof()
...
@@ -1442,8 +1441,7 @@ bool multi_update::send_eof()
thd
->
clear_error
();
thd
->
clear_error
();
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
Query_log_event
qinfo
(
thd
,
thd
->
query
,
thd
->
query_length
,
transactional_tables
,
FALSE
);
transactional_tables
,
FALSE
);
if
((
thd
->
query_str_binlog_unsuitable
||
mysql_bin_log
.
write
(
&
qinfo
))
if
(
mysql_bin_log
.
write
(
&
qinfo
)
&&
trans_safe
)
&&
trans_safe
)
local_error
=
1
;
// Rollback update
local_error
=
1
;
// Rollback update
}
}
if
(
!
transactional_tables
)
if
(
!
transactional_tables
)
...
...
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