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
7dc2f1a6
Commit
7dc2f1a6
authored
Sep 15, 2001
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Portability fixes
libmysql/libmysql.c: Cleanup & portability fixes
parent
ef2e7508
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
103 additions
and
105 deletions
+103
-105
libmysql/libmysql.c
libmysql/libmysql.c
+35
-32
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+3
-1
myisam/ft_dump.c
myisam/ft_dump.c
+1
-0
sql/ha_myisam.cc
sql/ha_myisam.cc
+0
-1
sql/item_sum.cc
sql/item_sum.cc
+2
-2
sql/log_event.cc
sql/log_event.cc
+33
-31
sql/log_event.h
sql/log_event.h
+2
-2
sql/mini_client.cc
sql/mini_client.cc
+1
-1
sql/net_serv.cc
sql/net_serv.cc
+0
-4
sql/opt_range.cc
sql/opt_range.cc
+4
-2
sql/slave.cc
sql/slave.cc
+0
-3
sql/sql_base.cc
sql/sql_base.cc
+0
-1
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_db.cc
sql/sql_db.cc
+1
-1
sql/sql_delete.cc
sql/sql_delete.cc
+2
-2
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_repl.cc
sql/sql_repl.cc
+9
-12
sql/sql_select.cc
sql/sql_select.cc
+1
-1
sql/sql_union.cc
sql/sql_union.cc
+2
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-3
sql/uniques.cc
sql/uniques.cc
+2
-1
No files found.
libmysql/libmysql.c
View file @
7dc2f1a6
...
...
@@ -1018,7 +1018,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
int
STDCALL
mysql_master_query
(
MYSQL
*
mysql
,
const
char
*
q
,
unsigned
int
length
)
{
if
(
mysql_master_send_query
(
mysql
,
q
,
length
))
if
(
mysql_master_send_query
(
mysql
,
q
,
length
))
return
1
;
return
mysql_read_query_result
(
mysql
);
}
...
...
@@ -1040,7 +1040,7 @@ int STDCALL mysql_master_send_query(MYSQL *mysql, const char *q,
int
STDCALL
mysql_slave_query
(
MYSQL
*
mysql
,
const
char
*
q
,
unsigned
int
length
)
{
if
(
mysql_slave_send_query
(
mysql
,
q
,
length
))
if
(
mysql_slave_send_query
(
mysql
,
q
,
length
))
return
1
;
return
mysql_read_query_result
(
mysql
);
}
...
...
@@ -1050,7 +1050,7 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
{
MYSQL
*
last_used_slave
,
*
slave_to_use
=
0
;
if
((
last_used_slave
=
mysql
->
last_used_slave
))
if
((
last_used_slave
=
mysql
->
last_used_slave
))
slave_to_use
=
last_used_slave
->
next_slave
;
else
slave_to_use
=
mysql
->
next_slave
;
...
...
@@ -1058,9 +1058,9 @@ int STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q,
if there are no slaves, mysql->next_slave == mysql
*/
mysql
->
last_used_con
=
mysql
->
last_used_slave
=
slave_to_use
;
if
(
!
length
)
if
(
!
length
)
length
=
strlen
(
q
);
if
(
!
slave_to_use
->
net
.
vio
&&
!
mysql_real_connect
(
slave_to_use
,
0
,
0
,
0
,
if
(
!
slave_to_use
->
net
.
vio
&&
!
mysql_real_connect
(
slave_to_use
,
0
,
0
,
0
,
0
,
0
,
0
,
0
))
return
1
;
return
simple_command
(
slave_to_use
,
COM_QUERY
,
q
,
length
,
1
);
...
...
@@ -1122,11 +1122,11 @@ static inline void expand_error(MYSQL* mysql, int error)
static
inline
int
get_master
(
MYSQL
*
mysql
,
MYSQL_RES
*
res
,
MYSQL_ROW
row
)
{
MYSQL
*
master
;
if
(
mysql_num_fields
(
res
)
<
3
)
if
(
mysql_num_fields
(
res
)
<
3
)
return
1
;
/* safety */
/* use the same username and password as the original connection */
if
(
!
(
master
=
spawn_init
(
mysql
,
row
[
0
],
atoi
(
row
[
2
]),
0
,
0
)))
if
(
!
(
master
=
spawn_init
(
mysql
,
row
[
0
],
atoi
(
row
[
2
]),
0
,
0
)))
return
1
;
mysql
->
master
=
master
;
return
0
;
...
...
@@ -1178,7 +1178,7 @@ static inline int get_slaves_from_master(MYSQL* mysql)
tmp_pass
=
mysql
->
passwd
;
}
if
(
!
(
slave
=
spawn_init
(
mysql
,
row
[
1
],
atoi
(
row
[
2
]),
if
(
!
(
slave
=
spawn_init
(
mysql
,
row
[
1
],
atoi
(
row
[
2
]),
tmp_user
,
tmp_pass
)))
goto
err
;
...
...
@@ -1188,7 +1188,7 @@ static inline int get_slaves_from_master(MYSQL* mysql)
}
error
=
0
;
err:
if
(
res
)
if
(
res
)
mysql_free_result
(
res
);
return
error
;
}
...
...
@@ -1231,7 +1231,7 @@ int STDCALL mysql_rpl_probe(MYSQL* mysql)
error
=
0
;
err:
if
(
res
)
if
(
res
)
mysql_free_result
(
res
);
return
error
;
}
...
...
@@ -1255,7 +1255,7 @@ STDCALL mysql_rpl_query_type(const char* q, int len)
for
(;
q
<
q_end
;
++
q
)
{
char
c
;
if
(
isalpha
(
c
=*
q
))
if
(
isalpha
(
c
=*
q
))
switch
(
tolower
(
c
))
{
case
'i'
:
/* insert */
...
...
@@ -2013,7 +2013,7 @@ mysql_close(MYSQL *mysql)
tmp
=
tmp1
;
}
}
if
(
mysql
!=
mysql
->
master
)
if
(
mysql
!=
mysql
->
master
)
mysql_close
(
mysql
->
master
);
if
(
mysql
->
free_me
)
my_free
((
gptr
)
mysql
,
MYF
(
0
));
...
...
@@ -2033,9 +2033,9 @@ mysql_query(MYSQL *mysql, const char *query)
return
mysql_real_query
(
mysql
,
query
,
(
uint
)
strlen
(
query
));
}
static
MYSQL
*
spawn_init
(
MYSQL
*
parent
,
const
char
*
host
,
unsigned
int
port
,
const
char
*
user
,
unsigned
int
port
,
const
char
*
user
,
const
char
*
passwd
)
{
MYSQL
*
child
;
...
...
@@ -2045,16 +2045,18 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
child
->
options
.
user
=
my_strdup
((
user
)
?
user
:
(
parent
->
user
?
parent
->
user
:
parent
->
options
.
user
),
MYF
(
0
));
child
->
options
.
password
=
my_strdup
((
passwd
)
?
passwd
:
(
parent
->
passwd
?
child
->
options
.
password
=
my_strdup
((
passwd
)
?
passwd
:
(
parent
->
passwd
?
parent
->
passwd
:
parent
->
options
.
password
),
MYF
(
0
));
child
->
options
.
port
=
port
;
child
->
options
.
host
=
my_strdup
((
host
)
?
host
:
(
parent
->
host
?
child
->
options
.
host
=
my_strdup
((
host
)
?
host
:
(
parent
->
host
?
parent
->
host
:
parent
->
options
.
host
),
MYF
(
0
));
if
(
parent
->
db
)
if
(
parent
->
db
)
child
->
options
.
db
=
my_strdup
(
parent
->
db
,
MYF
(
0
));
else
if
(
parent
->
options
.
db
)
else
if
(
parent
->
options
.
db
)
child
->
options
.
db
=
my_strdup
(
parent
->
options
.
db
,
MYF
(
0
));
child
->
options
.
rpl_parse
=
child
->
options
.
rpl_probe
=
child
->
rpl_pivot
=
0
;
...
...
@@ -2065,13 +2067,12 @@ static MYSQL* spawn_init(MYSQL* parent, const char* host,
int
STDCALL
mysql_set_master
(
MYSQL
*
mysql
,
const
char
*
host
,
unsigned
int
port
,
const
char
*
user
,
unsigned
int
port
,
const
char
*
user
,
const
char
*
passwd
)
{
if
(
mysql
->
master
!=
mysql
&&
!
mysql
->
master
->
rpl_pivot
)
mysql_close
(
mysql
->
master
);
if
(
!
(
mysql
->
master
=
spawn_init
(
mysql
,
host
,
port
,
user
,
passwd
)))
if
(
!
(
mysql
->
master
=
spawn_init
(
mysql
,
host
,
port
,
user
,
passwd
)))
return
1
;
mysql
->
master
->
rpl_pivot
=
0
;
mysql
->
master
->
options
.
rpl_parse
=
0
;
...
...
@@ -2086,7 +2087,7 @@ STDCALL mysql_add_slave(MYSQL* mysql, const char* host,
const
char
*
passwd
)
{
MYSQL
*
slave
;
if
(
!
(
slave
=
spawn_init
(
mysql
,
host
,
port
,
user
,
passwd
)))
if
(
!
(
slave
=
spawn_init
(
mysql
,
host
,
port
,
user
,
passwd
)))
return
1
;
slave
->
next_slave
=
mysql
->
next_slave
;
mysql
->
next_slave
=
slave
;
...
...
@@ -2105,21 +2106,21 @@ mysql_send_query(MYSQL* mysql, const char* query, uint length)
{
if
(
mysql
->
options
.
rpl_parse
&&
mysql
->
rpl_pivot
)
{
switch
(
mysql_rpl_query_type
(
query
,
length
))
{
switch
(
mysql_rpl_query_type
(
query
,
length
))
{
case
MYSQL_RPL_MASTER
:
return
mysql_master_send_query
(
mysql
,
query
,
length
);
case
MYSQL_RPL_SLAVE
:
return
mysql_slave_send_query
(
mysql
,
query
,
length
);
case
MYSQL_RPL_ADMIN
:
/*fall through */
case
MYSQL_RPL_ADMIN
:
break
;
/* fall through */
}
}
mysql
->
last_used_con
=
mysql
;
return
simple_command
(
mysql
,
COM_QUERY
,
query
,
length
,
1
);
}
int
STDCALL
mysql_read_query_result
(
MYSQL
*
mysql
)
{
uchar
*
pos
;
...
...
@@ -2173,6 +2174,7 @@ int STDCALL mysql_read_query_result(MYSQL *mysql)
DBUG_RETURN
(
0
);
}
int
STDCALL
mysql_real_query
(
MYSQL
*
mysql
,
const
char
*
query
,
uint
length
)
{
...
...
@@ -2185,6 +2187,7 @@ mysql_real_query(MYSQL *mysql, const char *query, uint length)
DBUG_RETURN
(
mysql_read_query_result
(
mysql
));
}
static
int
send_file_to_server
(
MYSQL
*
mysql
,
const
char
*
filename
)
{
...
...
myisam/ft_boolean_search.c
View file @
7dc2f1a6
...
...
@@ -153,7 +153,9 @@ int do_boolean(ALL_IN_ONE *aio, uint nested __attribute__((unused)),
if
(
selem
->
count
==
1
)
/* document's first match */
{
sptr
->
yes
=
sptr
->
no
=
sptr
->
doc
.
weight
=
0
;
sptr
->
yes
=
0
;
sptr
->
no
=
0
;
sptr
->
doc
.
weight
=
0
;
sptr
->
aio
=
aio
;
sptr
->
wno
=
0
;
}
...
...
myisam/ft_dump.c
View file @
7dc2f1a6
...
...
@@ -17,6 +17,7 @@
/* Written by Sergei A. Golubchik, who has a shared copyright to this code */
#include "ftdefs.h"
#include <getopt.h>
static
void
get_options
(
int
argc
,
char
*
argv
[]);
static
void
usage
(
char
*
argv
[]);
...
...
sql/ha_myisam.cc
View file @
7dc2f1a6
...
...
@@ -937,7 +937,6 @@ THR_LOCK_DATA **ha_myisam::store_lock(THD *thd,
void
ha_myisam
::
update_create_info
(
HA_CREATE_INFO
*
create_info
)
{
MI_ISAMINFO
info
;
table
->
file
->
info
(
HA_STATUS_AUTO
|
HA_STATUS_CONST
);
if
(
!
(
create_info
->
used_fields
&
HA_CREATE_USED_AUTO
))
{
...
...
sql/item_sum.cc
View file @
7dc2f1a6
...
...
@@ -795,7 +795,7 @@ static int simple_raw_key_cmp(void* arg, byte* key1, byte* key2)
static
int
simple_str_key_cmp
(
void
*
arg
,
byte
*
key1
,
byte
*
key2
)
{
return
my_sortcmp
(
key1
,
key2
,
*
(
uint
*
)
arg
);
return
my_sortcmp
(
(
char
*
)
key1
,
(
char
*
)
key2
,
*
(
uint
*
)
arg
);
}
/*
...
...
@@ -832,7 +832,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2)
int
dump_leaf
(
byte
*
key
,
uint32
count
__attribute__
((
unused
)),
Item_sum_count_distinct
*
item
)
{
char
*
buf
=
item
->
table
->
record
[
0
];
byte
*
buf
=
item
->
table
->
record
[
0
];
int
error
;
/*
The first item->rec_offset bytes are taken care of with
...
...
sql/log_event.cc
View file @
7dc2f1a6
...
...
@@ -320,7 +320,7 @@ void Log_event::init_show_field_list(List<Item>* field_list)
field_list
->
push_back
(
new
Item_empty_string
(
"Info"
,
20
));
}
int
Log_event
::
net_send
(
THD
*
thd
,
const
char
*
log_name
,
ulong
pos
)
int
Log_event
::
net_send
(
THD
*
thd
,
const
char
*
log_name
,
my_off_t
pos
)
{
String
*
packet
=
&
thd
->
packet
;
const
char
*
p
=
strrchr
(
log_name
,
FN_LIBCHAR
);
...
...
@@ -330,7 +330,7 @@ int Log_event::net_send(THD* thd, const char* log_name, ulong pos)
packet
->
length
(
0
);
net_store_data
(
packet
,
log_name
,
strlen
(
log_name
));
net_store_data
(
packet
,
(
longlong
)
pos
);
net_store_data
(
packet
,
(
longlong
)
pos
);
event_type
=
get_type_str
();
net_store_data
(
packet
,
event_type
,
strlen
(
event_type
));
net_store_data
(
packet
,
server_id
);
...
...
@@ -907,16 +907,16 @@ Load_log_event::Load_log_event(THD* thd, sql_exchange* ex,
db_len
=
(
db
)
?
(
uint32
)
strlen
(
db
)
:
0
;
table_name_len
=
(
table_name
)
?
(
uint32
)
strlen
(
table_name
)
:
0
;
fname_len
=
(
fname
)
?
(
uint
)
strlen
(
fname
)
:
0
;
sql_ex
.
field_term
=
(
char
*
)
ex
->
field_term
->
ptr
();
sql_ex
.
field_term_len
=
ex
->
field_term
->
length
();
sql_ex
.
enclosed
=
(
char
*
)
ex
->
enclosed
->
ptr
();
sql_ex
.
enclosed_len
=
ex
->
enclosed
->
length
();
sql_ex
.
line_term
=
(
char
*
)
ex
->
line_term
->
ptr
();
sql_ex
.
line_term_len
=
ex
->
line_term
->
length
();
sql_ex
.
line_start
=
(
char
*
)
ex
->
line_start
->
ptr
();
sql_ex
.
line_start_len
=
ex
->
line_start
->
length
();
sql_ex
.
escaped
=
(
char
*
)
ex
->
escaped
->
ptr
();
sql_ex
.
escaped_len
=
ex
->
escaped
->
length
();
sql_ex
.
field_term
=
(
char
*
)
ex
->
field_term
->
ptr
();
sql_ex
.
field_term_len
=
(
uint8
)
ex
->
field_term
->
length
();
sql_ex
.
enclosed
=
(
char
*
)
ex
->
enclosed
->
ptr
();
sql_ex
.
enclosed_len
=
(
uint8
)
ex
->
enclosed
->
length
();
sql_ex
.
line_term
=
(
char
*
)
ex
->
line_term
->
ptr
();
sql_ex
.
line_term_len
=
(
uint8
)
ex
->
line_term
->
length
();
sql_ex
.
line_start
=
(
char
*
)
ex
->
line_start
->
ptr
();
sql_ex
.
line_start_len
=
(
uint8
)
ex
->
line_start
->
length
();
sql_ex
.
escaped
=
(
char
*
)
ex
->
escaped
->
ptr
();
sql_ex
.
escaped_len
=
(
uint8
)
ex
->
escaped
->
length
();
sql_ex
.
opt_flags
=
0
;
sql_ex
.
cached_new_format
=
-
1
;
...
...
@@ -991,7 +991,7 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len)
num_fields
=
uint4korr
(
buf
+
L_NUM_FIELDS_OFFSET
+
LOG_EVENT_HEADER_LEN
);
int
body_offset
=
get_data_body_offset
();
if
((
int
)
event_len
<
body_offset
)
if
((
int
)
event_len
<
body_offset
)
return
1
;
//sql_ex.init() on success returns the pointer to the first byte after
//the sql_ex structure, which is the start of field lengths array
...
...
@@ -1233,7 +1233,8 @@ int Create_file_log_event::write_data_body(IO_CACHE* file)
int
res
;
if
((
res
=
Load_log_event
::
write_data_body
(
file
))
||
fake_base
)
return
res
;
return
my_b_write
(
file
,
""
,
1
)
||
my_b_write
(
file
,
block
,
block_len
);
return
(
my_b_write
(
file
,
(
byte
*
)
""
,
1
)
||
my_b_write
(
file
,
(
byte
*
)
block
,
block_len
));
}
int
Create_file_log_event
::
write_data_header
(
IO_CACHE
*
file
)
...
...
@@ -1241,7 +1242,7 @@ int Create_file_log_event::write_data_header(IO_CACHE* file)
int
res
;
if
((
res
=
Load_log_event
::
write_data_header
(
file
))
||
fake_base
)
return
res
;
char
buf
[
CREATE_FILE_HEADER_LEN
];
byte
buf
[
CREATE_FILE_HEADER_LEN
];
int4store
(
buf
+
CF_FILE_ID_OFFSET
,
file_id
);
return
my_b_write
(
file
,
buf
,
CREATE_FILE_HEADER_LEN
);
}
...
...
@@ -1321,10 +1322,10 @@ Append_block_log_event::Append_block_log_event(const char* buf, int len):
int
Append_block_log_event
::
write_data
(
IO_CACHE
*
file
)
{
char
buf
[
APPEND_BLOCK_HEADER_LEN
];
byte
buf
[
APPEND_BLOCK_HEADER_LEN
];
int4store
(
buf
+
AB_FILE_ID_OFFSET
,
file_id
);
return
my_b_write
(
file
,
buf
,
APPEND_BLOCK_HEADER_LEN
)
||
my_b_write
(
file
,
block
,
block_len
);
return
(
my_b_write
(
file
,
buf
,
APPEND_BLOCK_HEADER_LEN
)
||
my_b_write
(
file
,
(
byte
*
)
block
,
block_len
)
);
}
#ifdef MYSQL_CLIENT
...
...
@@ -1371,7 +1372,7 @@ Delete_file_log_event::Delete_file_log_event(const char* buf, int len):
int
Delete_file_log_event
::
write_data
(
IO_CACHE
*
file
)
{
char
buf
[
DELETE_FILE_HEADER_LEN
];
byte
buf
[
DELETE_FILE_HEADER_LEN
];
int4store
(
buf
+
DF_FILE_ID_OFFSET
,
file_id
);
return
my_b_write
(
file
,
buf
,
DELETE_FILE_HEADER_LEN
);
}
...
...
@@ -1418,7 +1419,7 @@ Execute_load_log_event::Execute_load_log_event(const char* buf,int len):
int
Execute_load_log_event
::
write_data
(
IO_CACHE
*
file
)
{
char
buf
[
EXEC_LOAD_HEADER_LEN
];
byte
buf
[
EXEC_LOAD_HEADER_LEN
];
int4store
(
buf
+
EL_FILE_ID_OFFSET
,
file_id
);
return
my_b_write
(
file
,
buf
,
EXEC_LOAD_HEADER_LEN
);
}
...
...
@@ -1711,13 +1712,14 @@ int Slave_log_event::exec_event(struct st_master_info* mi)
int
Create_file_log_event
::
exec_event
(
struct
st_master_info
*
mi
)
{
char
fname_buf
[
FN_REFLEN
+
10
];
char
*
p
,
*
p1
;
char
*
p
;
int
fd
=
-
1
;
IO_CACHE
file
;
int
error
=
1
;
p
=
slave_load_file_stem
(
fname_buf
,
file_id
,
server_id
);
memcpy
(
p
,
".info"
,
6
);
bzero
((
char
*
)
&
file
,
sizeof
(
file
));
p
=
slave_load_file_stem
(
fname_buf
,
file_id
,
server_id
);
strmov
(
p
,
".info"
);
// strmov takes less code than memcpy
if
((
fd
=
my_open
(
fname_buf
,
O_WRONLY
|
O_CREAT
|
O_BINARY
|
O_TRUNC
,
MYF
(
MY_WME
)))
<
0
||
init_io_cache
(
&
file
,
fd
,
IO_SIZE
,
WRITE_CACHE
,
(
my_off_t
)
0
,
0
,
...
...
@@ -1728,12 +1730,12 @@ int Create_file_log_event::exec_event(struct st_master_info* mi)
}
// a trick to avoid allocating another buffer
memcpy
(
p
,
".data"
,
6
);
strmov
(
p
,
".data"
);
fname
=
fname_buf
;
fname_len
=
(
uint
)(
p
-
fname
)
+
5
;
if
(
write_base
(
&
file
))
{
memcpy
(
p
,
".info"
,
6
);
// to have it right in the error message
strmov
(
p
,
".info"
);
// to have it right in the error message
slave_print_error
(
my_errno
,
"Could not write to file '%s'"
,
fname_buf
);
goto
err
;
}
...
...
@@ -1747,7 +1749,7 @@ int Create_file_log_event::exec_event(struct st_master_info* mi)
slave_print_error
(
my_errno
,
"Could not open file '%s'"
,
fname_buf
);
goto
err
;
}
if
(
my_write
(
fd
,
block
,
block_len
,
MYF
(
MY_WME
+
MY_NABP
)))
if
(
my_write
(
fd
,
(
byte
*
)
block
,
block_len
,
MYF
(
MY_WME
+
MY_NABP
)))
{
slave_print_error
(
my_errno
,
"Write to '%s' failed"
,
fname_buf
);
goto
err
;
...
...
@@ -1790,7 +1792,7 @@ int Append_block_log_event::exec_event(struct st_master_info* mi)
slave_print_error
(
my_errno
,
"Could not open file '%s'"
,
fname
);
goto
err
;
}
if
(
my_write
(
fd
,
block
,
block_len
,
MYF
(
MY_WME
+
MY_NABP
)))
if
(
my_write
(
fd
,
(
byte
*
)
block
,
block_len
,
MYF
(
MY_WME
+
MY_NABP
)))
{
slave_print_error
(
my_errno
,
"Write to '%s' failed"
,
fname
);
goto
err
;
...
...
@@ -1810,7 +1812,7 @@ int Execute_load_log_event::exec_event(struct st_master_info* mi)
char
*
p
;
int
fd
=
-
1
;
int
error
=
1
;
int
save_options
;
ulong
save_options
;
IO_CACHE
file
;
Load_log_event
*
lev
=
0
;
p
=
slave_load_file_stem
(
fname
,
file_id
,
server_id
);
...
...
@@ -1835,7 +1837,7 @@ int Execute_load_log_event::exec_event(struct st_master_info* mi)
// can preserve ascending order of log sequence numbers - needed
// to handle failover
save_options
=
thd
->
options
;
thd
->
options
&=
~
(
ulong
)
OPTION_BIN_LOG
;
thd
->
options
&=
~
(
ulong
)
(
OPTION_BIN_LOG
)
;
lev
->
thd
=
thd
;
if
(
lev
->
exec_event
(
0
,
0
))
{
...
...
sql/log_event.h
View file @
7dc2f1a6
...
...
@@ -72,7 +72,7 @@ struct sql_ex_info
char
*
line_term
;
char
*
line_start
;
char
*
escaped
;
u
char
field_term_len
,
enclosed_len
,
line_term_len
,
line_start_len
,
u
int8
field_term_len
,
enclosed_len
,
line_term_len
,
line_start_len
,
escaped_len
;
char
opt_flags
;
char
empty_flags
;
...
...
@@ -280,7 +280,7 @@ class Log_event
pthread_mutex_t
*
log_lock
);
void
set_log_seq
(
THD
*
thd
,
MYSQL_LOG
*
log
);
virtual
void
pack_info
(
String
*
packet
);
int
net_send
(
THD
*
thd
,
const
char
*
log_name
,
ulong
pos
);
int
net_send
(
THD
*
thd
,
const
char
*
log_name
,
my_off_t
pos
);
static
void
init_show_field_list
(
List
<
Item
>*
field_list
);
virtual
int
exec_event
(
struct
st_master_info
*
mi
);
virtual
const
char
*
get_db
()
...
...
sql/mini_client.cc
View file @
7dc2f1a6
...
...
@@ -1076,7 +1076,7 @@ static int mc_send_file_to_server(MYSQL *mysql, const char *filename)
DBUG_RETURN
(
-
1
);
}
while
((
readcount
=
(
int
)
my_read
(
fd
,
buf
,
sizeof
(
buf
),
MYF
(
0
)))
>
0
)
while
((
readcount
=
(
int
)
my_read
(
fd
,
(
byte
*
)
buf
,
sizeof
(
buf
),
MYF
(
0
)))
>
0
)
{
if
(
my_net_write
(
&
mysql
->
net
,
buf
,
readcount
))
{
...
...
sql/net_serv.cc
View file @
7dc2f1a6
...
...
@@ -42,8 +42,6 @@
#include <sys/types.h>
#include <assert.h>
extern
"C"
{
#ifdef MYSQL_SERVER
ulong
max_allowed_packet
=
65536
;
extern
ulong
net_read_timeout
,
net_write_timeout
;
...
...
@@ -832,5 +830,3 @@ my_net_read(NET *net)
#endif
/* HAVE_COMPRESS */
return
len
;
}
}
sql/opt_range.cc
View file @
7dc2f1a6
...
...
@@ -2534,7 +2534,9 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
:
QUICK_SELECT
(
*
q
),
rev_it
(
rev_ranges
)
{
bool
not_read_after_key
=
file
->
option_flag
()
&
HA_NOT_READ_AFTER_KEY
;
for
(
QUICK_RANGE
*
r
=
it
++
;
r
;
r
=
it
++
)
QUICK_RANGE
*
r
;
for
(
r
=
it
++
;
r
;
r
=
it
++
)
{
rev_ranges
.
push_front
(
r
);
if
(
not_read_after_key
&&
range_reads_after_key
(
r
)
||
...
...
@@ -2547,7 +2549,7 @@ QUICK_SELECT_DESC::QUICK_SELECT_DESC(QUICK_SELECT *q, uint used_key_parts)
}
}
/* Remove EQ_RANGE flag for keys that are not using the full key */
for
(
QUICK_RANGE
*
r
=
rev_it
++
;
r
;
r
=
rev_it
++
)
for
(
r
=
rev_it
++
;
r
;
r
=
rev_it
++
)
{
if
((
r
->
flag
&
EQ_RANGE
)
&&
head
->
key_info
[
index
].
key_length
!=
r
->
max_length
)
...
...
sql/slave.cc
View file @
7dc2f1a6
...
...
@@ -593,7 +593,6 @@ int init_master_info(MASTER_INFO* mi)
int
register_slave_on_master
(
MYSQL
*
mysql
)
{
String
packet
;
uint
len
;
char
buf
[
4
];
if
(
!
report_host
)
...
...
@@ -937,8 +936,6 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{
Log_event
*
ev
=
Log_event
::
read_log_event
((
const
char
*
)
net
->
read_pos
+
1
,
event_len
);
char
llbuff
[
22
];
if
(
ev
)
{
int
type_code
=
ev
->
get_type_code
();
...
...
sql/sql_base.cc
View file @
7dc2f1a6
...
...
@@ -412,7 +412,6 @@ void close_thread_tables(THD *thd, bool locked)
DBUG_VOID_RETURN
;
// LOCK TABLES in use
}
TABLE
*
table
,
*
next
;
bool
found_old_table
=
0
;
if
(
thd
->
lock
)
...
...
sql/sql_class.h
View file @
7dc2f1a6
...
...
@@ -606,7 +606,7 @@ class Unique :public Sql_alloc
ulong
max_elements
,
max_in_memory_size
;
IO_CACHE
file
;
TREE
tree
;
char
*
record_pointers
;
byte
*
record_pointers
;
bool
flush
();
public:
...
...
sql/sql_db.cc
View file @
7dc2f1a6
...
...
@@ -241,7 +241,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
continue
;
}
strxmov
(
filePath
,
org_path
,
"/"
,
file
->
name
,
NullS
);
if
(
db
&&
!
strcasecmp
(
fn_ext
(
file
->
name
),
reg_ext
))
if
(
db
&&
!
my_
strcasecmp
(
fn_ext
(
file
->
name
),
reg_ext
))
{
/* Drop the table nicely */
*
fn_ext
(
file
->
name
)
=
0
;
// Remove extension
...
...
sql/sql_delete.cc
View file @
7dc2f1a6
...
...
@@ -324,7 +324,7 @@ bool multi_delete::send_data(List<Item> &values)
}
else
{
error
=
tempfiles
[
secure_counter
]
->
unique_add
(
table
->
file
->
ref
);
error
=
tempfiles
[
secure_counter
]
->
unique_add
(
(
char
*
)
table
->
file
->
ref
);
if
(
error
)
{
error
=-
1
;
...
...
@@ -378,7 +378,7 @@ void multi_delete::send_error(uint errcode,const char *err)
int
multi_delete
::
do_deletes
(
bool
from_send_error
)
{
int
error
=
0
,
counter
=
0
,
count
;
int
error
=
0
,
counter
=
0
;
if
(
from_send_error
)
{
...
...
sql/sql_parse.cc
View file @
7dc2f1a6
...
...
@@ -2913,7 +2913,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
{
/* Add not used table to the total table list */
aux
->
lock_type
=
lex
->
lock_option
;
if
(
!
(
cursor
=
(
TABLE_LIST
*
)
thd
->
memdup
((
byte
*
)
aux
,
if
(
!
(
cursor
=
(
TABLE_LIST
*
)
thd
->
memdup
((
char
*
)
aux
,
sizeof
(
*
aux
))))
{
send_error
(
&
thd
->
net
,
0
);
...
...
sql/sql_repl.cc
View file @
7dc2f1a6
...
...
@@ -51,7 +51,7 @@ static uint32* slave_list_key(SLAVE_INFO* si, uint* len,
static
void
slave_info_free
(
void
*
s
)
{
my_free
((
byte
*
)
s
,
MYF
(
MY_WME
));
my_free
((
gptr
)
s
,
MYF
(
MY_WME
));
}
void
init_slave_list
()
...
...
@@ -109,7 +109,6 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name,
int
register_slave
(
THD
*
thd
,
uchar
*
packet
,
uint
packet_length
)
{
uint
len
;
SLAVE_INFO
*
si
,
*
old_si
;
int
res
=
1
;
uchar
*
p
=
packet
,
*
p_end
=
packet
+
packet_length
;
...
...
@@ -138,7 +137,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length)
err:
if
(
si
)
my_free
((
byte
*
)
si
,
MYF
(
MY_WME
));
my_free
((
gptr
)
si
,
MYF
(
MY_WME
));
return
res
;
}
...
...
@@ -935,7 +934,7 @@ int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg)
{
LOG_INFO
linfo
;
char
search_file_name
[
FN_REFLEN
],
last_log_name
[
FN_REFLEN
];
IO_CACHE
log
,
last_log
;
IO_CACHE
log
;
File
file
=
-
1
,
last_file
=
-
1
;
pthread_mutex_t
*
log_lock
;
const
char
*
errmsg_p
;
...
...
@@ -1149,7 +1148,7 @@ int show_binlog_events(THD* thd)
uint
event_count
,
limit_start
,
limit_end
;
const
char
*
log_file_name
=
lex_mi
->
log_file_name
;
Log_event
*
ev
;
ulong
pos
=
(
ulong
)
lex_mi
->
pos
;
my_off_t
pos
=
lex_mi
->
pos
;
limit_start
=
thd
->
lex
.
select
->
offset_limit
;
limit_end
=
thd
->
lex
.
select
->
select_limit
+
limit_start
;
...
...
@@ -1258,7 +1257,7 @@ int show_slave_hosts(THD* thd)
net_store_data
(
packet
,
si
->
user
);
net_store_data
(
packet
,
si
->
password
);
}
net_store_data
(
packet
,
(
uint
)
si
->
port
);
net_store_data
(
packet
,
(
uint
32
)
si
->
port
);
if
(
my_net_write
(
net
,
(
char
*
)
packet
->
ptr
(),
packet
->
length
()))
{
pthread_mutex_unlock
(
&
LOCK_slave_list
);
...
...
@@ -1466,7 +1465,6 @@ int load_master_data(THD* thd)
{
MYSQL_RES
*
db_res
,
**
table_res
,
**
table_res_end
,
**
cur_table_res
;
uint
num_dbs
;
MYSQL_ROW
row
;
if
(
mc_mysql_query
(
&
mysql
,
"show databases"
,
0
)
||
!
(
db_res
=
mc_mysql_store_result
(
&
mysql
)))
...
...
@@ -1476,7 +1474,7 @@ int load_master_data(THD* thd)
goto
err
;
}
if
(
!
(
num_dbs
=
mc_mysql_num_rows
(
db_res
)))
if
(
!
(
num_dbs
=
(
uint
)
mc_mysql_num_rows
(
db_res
)))
goto
err
;
// in theory, the master could have no databases at all
// and run with skip-grant
...
...
@@ -1511,7 +1509,6 @@ int load_master_data(THD* thd)
// since we know how many rows we have, this can never be NULL
MYSQL_ROW
row
=
mc_mysql_fetch_row
(
db_res
);
char
*
db
=
row
[
0
];
int
drop_error
;
/*
Do not replicate databases excluded by rules
...
...
@@ -1615,14 +1612,14 @@ int log_loaded_block(IO_CACHE* file)
lf_info
->
last_pos_in_file
=
file
->
pos_in_file
;
if
(
lf_info
->
wrote_create_file
)
{
Append_block_log_event
a
(
lf_info
->
thd
,
file
->
buffer
,
block_len
);
Append_block_log_event
a
(
lf_info
->
thd
,
(
char
*
)
file
->
buffer
,
block_len
);
mysql_bin_log
.
write
(
&
a
);
}
else
{
Create_file_log_event
c
(
lf_info
->
thd
,
lf_info
->
ex
,
lf_info
->
db
,
lf_info
->
table_name
,
*
lf_info
->
fields
,
lf_info
->
handle_dup
,
file
->
buffer
,
lf_info
->
handle_dup
,
(
char
*
)
file
->
buffer
,
block_len
);
mysql_bin_log
.
write
(
&
c
);
lf_info
->
wrote_create_file
=
1
;
...
...
sql/sql_select.cc
View file @
7dc2f1a6
...
...
@@ -4859,7 +4859,7 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
DBUG_RETURN
(
1
);
// Not a table_is_full error
table
->
uniques
=
0
;
// To ensure rows are the same
}
if
(
++
join
->
send_records
>=
join
->
tmp_table_param
.
end_write_records
&
if
(
++
join
->
send_records
>=
join
->
tmp_table_param
.
end_write_records
&
&
join
->
do_send_rows
)
{
if
(
!
(
join
->
select_options
&
OPTION_FOUND_ROWS
))
...
...
sql/sql_union.cc
View file @
7dc2f1a6
...
...
@@ -211,9 +211,8 @@ bool select_union::send_eof()
bool
select_union
::
flush
()
{
int
error
,
error2
;
error
=
table
->
file
->
extra
(
HA_EXTRA_NO_CACHE
);
if
(
error
)
int
error
;
if
((
error
=
table
->
file
->
extra
(
HA_EXTRA_NO_CACHE
)))
{
table
->
file
->
print_error
(
error
,
MYF
(
0
));
::
send_error
(
&
thd
->
net
);
...
...
sql/sql_yacc.yy
View file @
7dc2f1a6
...
...
@@ -2053,14 +2053,14 @@ delete_limit_clause:
ULONG_NUM:
NUM { $$= strtoul($1.str,NULL,10); }
| ULONGLONG_NUM { $$= (ulong
long) strtou
l($1.str,NULL,10); }
| ULONGLONG_NUM { $$= (ulong
) strtoul
l($1.str,NULL,10); }
| REAL_NUM { $$= strtoul($1.str,NULL,10); }
| FLOAT_NUM { $$= strtoul($1.str,NULL,10); }
ulonglong_num:
NUM { $$= (ulonglong) strtoul($1.str,NULL,10); }
| ULONGLONG_NUM { $$=
(ulonglong) strtou
l($1.str,NULL,10); }
| LONG_NUM { $$=
strtoul
l($1.str,NULL,10); }
| ULONGLONG_NUM { $$=
strtoul
l($1.str,NULL,10); }
| LONG_NUM { $$=
(ulonglong) strtou
l($1.str,NULL,10); }
| REAL_NUM { $$= strtoull($1.str,NULL,10); }
| FLOAT_NUM { $$= strtoull($1.str,NULL,10); }
...
...
sql/uniques.cc
View file @
7dc2f1a6
...
...
@@ -75,7 +75,8 @@ bool Unique::flush()
int
unique_write_to_file
(
gptr
key
,
element_count
count
,
Unique
*
unique
)
{
return
my_b_write
(
&
unique
->
file
,
key
,
unique
->
tree
.
size_of_element
)
?
1
:
0
;
return
my_b_write
(
&
unique
->
file
,
(
byte
*
)
key
,
unique
->
tree
.
size_of_element
)
?
1
:
0
;
}
int
unique_write_to_ptrs
(
gptr
key
,
element_count
count
,
Unique
*
unique
)
...
...
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