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
77fb94a2
Commit
77fb94a2
authored
Apr 18, 2001
by
monty@donna.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bugs in mysqltest
parent
0bd30233
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
43 deletions
+49
-43
client/mysqltest.c
client/mysqltest.c
+43
-37
mysql-test/t/rpl000001.test
mysql-test/t/rpl000001.test
+1
-1
mysql-test/t/rpl000015.test
mysql-test/t/rpl000015.test
+5
-5
No files found.
client/mysqltest.c
View file @
77fb94a2
...
@@ -141,6 +141,26 @@ VAR var_reg[10];
...
@@ -141,6 +141,26 @@ VAR var_reg[10];
struct
connection
cons
[
MAX_CONS
];
struct
connection
cons
[
MAX_CONS
];
struct
connection
*
cur_con
,
*
next_con
,
*
cons_end
;
struct
connection
*
cur_con
,
*
next_con
,
*
cons_end
;
/* Add new commands before Q_UNKNOWN !*/
enum
enum_commands
{
Q_CONNECTION
=
1
,
Q_QUERY
,
Q_CONNECT
,
Q_SLEEP
,
Q_INC
,
Q_DEC
,
Q_SOURCE
,
Q_DISCONNECT
,
Q_LET
,
Q_ECHO
,
Q_WHILE
,
Q_END_BLOCK
,
Q_SYSTEM
,
Q_RESULT
,
Q_REQUIRE
,
Q_SAVE_MASTER_POS
,
Q_SYNC_WITH_MASTER
,
Q_ERROR
,
Q_SEND
,
Q_REAP
,
Q_DIRTY_CLOSE
,
Q_REPLACE
,
Q_PING
,
Q_EVAL
,
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
Q_COMMENT_WITH_COMMAND
};
/* this should really be called command */
/* this should really be called command */
struct
st_query
struct
st_query
{
{
...
@@ -149,23 +169,7 @@ struct st_query
...
@@ -149,23 +169,7 @@ struct st_query
my_bool
abort_on_error
,
require_file
;
my_bool
abort_on_error
,
require_file
;
uint
expected_errno
[
MAX_EXPECTED_ERRORS
];
uint
expected_errno
[
MAX_EXPECTED_ERRORS
];
char
record_file
[
FN_REFLEN
];
char
record_file
[
FN_REFLEN
];
/* Add new commands before Q_UNKNOWN */
enum
enum_commands
type
;
enum
{
Q_CONNECTION
=
1
,
Q_QUERY
,
Q_CONNECT
,
Q_SLEEP
,
Q_INC
,
Q_DEC
,
Q_SOURCE
,
Q_DISCONNECT
,
Q_LET
,
Q_ECHO
,
Q_WHILE
,
Q_END_BLOCK
,
Q_SYSTEM
,
Q_RESULT
,
Q_REQUIRE
,
Q_SAVE_MASTER_POS
,
Q_SYNC_WITH_MASTER
,
Q_ERROR
,
Q_SEND
,
Q_REAP
,
Q_DIRTY_CLOSE
,
Q_REPLACE
,
Q_PING
,
Q_EVAL
,
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
Q_COMMENT_WITH_COMMAND
}
type
;
};
};
const
char
*
command_names
[]
=
{
const
char
*
command_names
[]
=
{
...
@@ -475,10 +479,12 @@ int var_set(char* var_name, char* var_name_end, char* var_val,
...
@@ -475,10 +479,12 @@ int var_set(char* var_name, char* var_name_end, char* var_val,
my_malloc
(
v
->
alloced_len
,
MYF
(
MY_WME
))))
my_malloc
(
v
->
alloced_len
,
MYF
(
MY_WME
))))
die
(
"Out of memory"
);
die
(
"Out of memory"
);
}
}
memcpy
(
v
->
str_val
,
var_val
,
val_len
-
1
);
val_len
--
;
v
->
str_val_len
=
val_len
-
1
;
memcpy
(
v
->
str_val
,
var_val
,
val_len
);
v
->
str_val_len
=
val_len
;
v
->
str_val
[
val_len
]
=
0
;
v
->
str_val
[
val_len
]
=
0
;
v
->
int_val
=
atoi
(
v
->
str_val
);
v
->
int_val
=
atoi
(
v
->
str_val
);
v
->
int_dirty
=
0
;
return
0
;
return
0
;
}
}
...
@@ -515,7 +521,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
...
@@ -515,7 +521,7 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
{
{
if
((
vp
=
var_get
(
p
,
p_end
,
0
)))
if
((
vp
=
var_get
(
p
,
p_end
,
0
)))
{
{
memcpy
(
v
,
vp
,
sizeof
(
VAR
));
memcpy
(
v
,
vp
,
sizeof
(
*
v
));
return
0
;
return
0
;
}
}
}
}
...
@@ -523,6 +529,8 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
...
@@ -523,6 +529,8 @@ int eval_expr(VAR* v, const char* p, const char** p_end)
{
{
v
->
str_val
=
(
char
*
)
p
;
v
->
str_val
=
(
char
*
)
p
;
v
->
str_val_len
=
(
p_end
&&
*
p_end
)
?
*
p_end
-
p
:
strlen
(
p
);
v
->
str_val_len
=
(
p_end
&&
*
p_end
)
?
*
p_end
-
p
:
strlen
(
p
);
v
->
int_val
=
atoi
(
p
);
v
->
int_dirty
=
0
;
return
0
;
return
0
;
}
}
...
@@ -557,7 +565,7 @@ int do_system(struct st_query* q)
...
@@ -557,7 +565,7 @@ int do_system(struct st_query* q)
char
*
p
=
q
->
first_argument
;
char
*
p
=
q
->
first_argument
;
VAR
v
;
VAR
v
;
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
if
(
v
.
str_val_len
>
1
)
if
(
v
.
str_val_len
)
{
{
char
expr_buf
[
512
];
char
expr_buf
[
512
];
if
((
uint
)
v
.
str_val_len
>
sizeof
(
expr_buf
)
-
1
)
if
((
uint
)
v
.
str_val_len
>
sizeof
(
expr_buf
)
-
1
)
...
@@ -576,10 +584,10 @@ int do_echo(struct st_query* q)
...
@@ -576,10 +584,10 @@ int do_echo(struct st_query* q)
char
*
p
=
q
->
first_argument
;
char
*
p
=
q
->
first_argument
;
VAR
v
;
VAR
v
;
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
if
(
v
.
str_val_len
>
1
)
if
(
v
.
str_val_len
)
{
{
fflush
(
stdout
);
fflush
(
stdout
);
write
(
1
,
v
.
str_val
,
v
.
str_val_len
-
1
);
write
(
1
,
v
.
str_val
,
v
.
str_val_len
);
}
}
write
(
1
,
"
\n
"
,
1
);
write
(
1
,
"
\n
"
,
1
);
return
0
;
return
0
;
...
@@ -671,15 +679,15 @@ int do_sleep(struct st_query* q)
...
@@ -671,15 +679,15 @@ int do_sleep(struct st_query* q)
p
++
;
p
++
;
if
(
*
p
==
'.'
)
if
(
*
p
==
'.'
)
{
{
char
c
;
int
c
;
char
*
p_end
;
char
*
p_end
;
p
++
;
p
++
;
p_end
=
p
+
6
;
p_end
=
p
+
6
;
for
(;
p
<=
p_end
;
++
p
)
for
(;
p
<=
p_end
;
++
p
)
{
{
c
=
*
p
-
'0'
;
c
=
(
int
)
(
*
p
-
'0'
)
;
if
(
c
<
10
&&
c
>=
0
)
if
(
c
<
10
&&
(
int
)
c
>=
0
)
{
{
t
.
tv_usec
=
t
.
tv_usec
*
10
+
c
;
t
.
tv_usec
=
t
.
tv_usec
*
10
+
c
;
dec_mul
/=
10
;
dec_mul
/=
10
;
...
@@ -1228,7 +1236,7 @@ static char read_query_buf[MAX_QUERY];
...
@@ -1228,7 +1236,7 @@ static char read_query_buf[MAX_QUERY];
int
read_query
(
struct
st_query
**
q_ptr
)
int
read_query
(
struct
st_query
**
q_ptr
)
{
{
char
*
p
=
read_query_buf
,
*
p1
;
char
*
p
=
read_query_buf
,
*
p1
;
int
c
,
expected_errno
;
int
expected_errno
;
struct
st_query
*
q
;
struct
st_query
*
q
;
if
(
parser
.
current_line
<
parser
.
read_lines
)
if
(
parser
.
current_line
<
parser
.
read_lines
)
...
@@ -1283,7 +1291,7 @@ int read_query(struct st_query** q_ptr)
...
@@ -1283,7 +1291,7 @@ int read_query(struct st_query** q_ptr)
{
{
p
++
;
p
++
;
p1
=
q
->
record_file
;
p1
=
q
->
record_file
;
while
(
!
isspace
(
c
=
*
p
)
&&
while
(
!
isspace
(
*
p
)
&&
p1
<
q
->
record_file
+
sizeof
(
q
->
record_file
)
-
1
)
p1
<
q
->
record_file
+
sizeof
(
q
->
record_file
)
-
1
)
*
p1
++
=
*
p
++
;
*
p1
++
=
*
p
++
;
*
p1
=
0
;
*
p1
=
0
;
...
@@ -1487,7 +1495,6 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
...
@@ -1487,7 +1495,6 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
unsigned
long
*
lengths
;
unsigned
long
*
lengths
;
char
*
val
;
char
*
val
;
int
len
;
int
len
;
int
q_error
=
0
;
DYNAMIC_STRING
*
ds
;
DYNAMIC_STRING
*
ds
;
DYNAMIC_STRING
ds_tmp
;
DYNAMIC_STRING
ds_tmp
;
DYNAMIC_STRING
eval_query
;
DYNAMIC_STRING
eval_query
;
...
@@ -1516,8 +1523,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
...
@@ -1516,8 +1523,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
else
else
ds
=
&
ds_res
;
ds
=
&
ds_res
;
if
((
flags
&
QUERY_SEND
)
&&
if
((
flags
&
QUERY_SEND
)
&&
mysql_send_query
(
mysql
,
query
,
query_len
))
(
q_error
=
mysql_send_query
(
mysql
,
query
,
query_len
)))
die
(
"At line %u: unable to send query '%s'"
,
start_lineno
,
query
);
die
(
"At line %u: unable to send query '%s'"
,
start_lineno
,
query
);
if
(
!
(
flags
&
QUERY_REAP
))
if
(
!
(
flags
&
QUERY_REAP
))
return
0
;
return
0
;
...
@@ -1660,7 +1666,7 @@ void get_query_type(struct st_query* q)
...
@@ -1660,7 +1666,7 @@ void get_query_type(struct st_query* q)
type
=
find_type
(
q
->
query
,
&
command_typelib
,
1
+
2
);
type
=
find_type
(
q
->
query
,
&
command_typelib
,
1
+
2
);
q
->
query
[
q
->
first_word_len
]
=
save
;
q
->
query
[
q
->
first_word_len
]
=
save
;
if
(
type
>
0
)
if
(
type
>
0
)
q
->
type
=
type
;
/* Found command */
q
->
type
=
(
enum
enum_commands
)
type
;
/* Found command */
}
}
...
@@ -1784,7 +1790,7 @@ int main(int argc, char** argv)
...
@@ -1784,7 +1790,7 @@ int main(int argc, char** argv)
case
Q_REPLACE
:
case
Q_REPLACE
:
get_replace
(
q
);
get_replace
(
q
);
break
;
break
;
case
Q_SAVE_MASTER_POS
:
do_save_master_pos
(
q
);
break
;
case
Q_SAVE_MASTER_POS
:
do_save_master_pos
();
break
;
case
Q_SYNC_WITH_MASTER
:
do_sync_with_master
(
q
);
break
;
case
Q_SYNC_WITH_MASTER
:
do_sync_with_master
(
q
);
break
;
case
Q_COMMENT
:
/* Ignore row */
case
Q_COMMENT
:
/* Ignore row */
case
Q_COMMENT_WITH_COMMAND
:
case
Q_COMMENT_WITH_COMMAND
:
...
...
mysql-test/t/rpl000001.test
View file @
77fb94a2
...
@@ -60,7 +60,7 @@ sync_with_master ;
...
@@ -60,7 +60,7 @@ sync_with_master ;
sleep
0.5
;
sleep
0.5
;
# The following test can't be done because the result of Pos will differ
# The following test can't be done because the result of Pos will differ
# on different computes
# on different compute
r
s
# --replace_result 9306 9999 3334 9999 3335 9999
# --replace_result 9306 9999 3334 9999 3335 9999
# show slave status;
# show slave status;
...
...
mysql-test/t/rpl000015.test
View file @
77fb94a2
...
@@ -17,15 +17,15 @@ slave start;
...
@@ -17,15 +17,15 @@ slave start;
sync_with_master
;
sync_with_master
;
show
slave
status
;
show
slave
status
;
connection
master
;
connection
master
;
drop
table
if
exists
foo
;
drop
table
if
exists
t1
;
create
table
foo
(
n
int
);
create
table
t1
(
n
int
);
insert
into
foo
values
(
10
),(
45
),(
90
);
insert
into
t1
values
(
10
),(
45
),(
90
);
save_master_pos
;
save_master_pos
;
connection
slave
;
connection
slave
;
sync_with_master
;
sync_with_master
;
select
*
from
foo
;
select
*
from
t1
;
connection
master
;
connection
master
;
drop
table
foo
;
drop
table
t1
;
save_master_pos
;
save_master_pos
;
connection
slave
;
connection
slave
;
sync_with_master
;
sync_with_master
;
...
...
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