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
3764d3da
Commit
3764d3da
authored
Feb 21, 2006
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge neptunus.(none):/home/msvensson/mysql/bug16795/my50-bug16795
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
parents
e919f8e8
47257f13
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
18 deletions
+99
-18
client/mysqltest.c
client/mysqltest.c
+45
-4
mysql-test/r/mysqltest.result
mysql-test/r/mysqltest.result
+3
-0
mysql-test/r/ndb_cache_multi2.result
mysql-test/r/ndb_cache_multi2.result
+2
-5
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+30
-1
mysql-test/t/ndb_cache_multi2.test
mysql-test/t/ndb_cache_multi2.test
+19
-8
No files found.
client/mysqltest.c
View file @
3764d3da
...
@@ -2353,12 +2353,41 @@ int do_done(struct st_query *q)
...
@@ -2353,12 +2353,41 @@ int do_done(struct st_query *q)
}
}
/*
Process start of a "if" or "while" statement
SYNOPSIS
do_block()
cmd Type of block
q called command
DESCRIPTION
if ([!]<expr>)
{
<block statements>
}
while ([!]<expr>)
{
<block statements>
}
Evaluates the <expr> and if it evaluates to
greater than zero executes the following code block.
A '!' can be used before the <expr> to indicate it should
be executed if it evaluates to zero.
*/
int
do_block
(
enum
block_cmd
cmd
,
struct
st_query
*
q
)
int
do_block
(
enum
block_cmd
cmd
,
struct
st_query
*
q
)
{
{
char
*
p
=
q
->
first_argument
;
char
*
p
=
q
->
first_argument
;
const
char
*
expr_start
,
*
expr_end
;
const
char
*
expr_start
,
*
expr_end
;
VAR
v
;
VAR
v
;
const
char
*
cmd_name
=
(
cmd
==
cmd_while
?
"while"
:
"if"
);
const
char
*
cmd_name
=
(
cmd
==
cmd_while
?
"while"
:
"if"
);
my_bool
not_expr
=
FALSE
;
DBUG_ENTER
(
"do_block"
);
DBUG_PRINT
(
"enter"
,
(
"%s"
,
cmd_name
));
/* Check stack overflow */
/* Check stack overflow */
if
(
cur_block
==
block_stack_end
)
if
(
cur_block
==
block_stack_end
)
...
@@ -2379,8 +2408,16 @@ int do_block(enum block_cmd cmd, struct st_query* q)
...
@@ -2379,8 +2408,16 @@ int do_block(enum block_cmd cmd, struct st_query* q)
/* Parse and evaluate test expression */
/* Parse and evaluate test expression */
expr_start
=
strchr
(
p
,
'('
);
expr_start
=
strchr
(
p
,
'('
);
if
(
!
expr_start
)
if
(
!
expr_start
++
)
die
(
"missing '(' in %s"
,
cmd_name
);
die
(
"missing '(' in %s"
,
cmd_name
);
/* Check for !<expr> */
if
(
*
expr_start
==
'!'
)
{
not_expr
=
TRUE
;
expr_start
++
;
/* Step past the '!' */
}
/* Find ending ')' */
expr_end
=
strrchr
(
expr_start
,
')'
);
expr_end
=
strrchr
(
expr_start
,
')'
);
if
(
!
expr_end
)
if
(
!
expr_end
)
die
(
"missing ')' in %s"
,
cmd_name
);
die
(
"missing ')' in %s"
,
cmd_name
);
...
@@ -2394,14 +2431,20 @@ int do_block(enum block_cmd cmd, struct st_query* q)
...
@@ -2394,14 +2431,20 @@ int do_block(enum block_cmd cmd, struct st_query* q)
die
(
"Missing '{' after %s. Found
\"
%s
\"
"
,
cmd_name
,
p
);
die
(
"Missing '{' after %s. Found
\"
%s
\"
"
,
cmd_name
,
p
);
var_init
(
&
v
,
0
,
0
,
0
,
0
);
var_init
(
&
v
,
0
,
0
,
0
,
0
);
eval_expr
(
&
v
,
++
expr_start
,
&
expr_end
);
eval_expr
(
&
v
,
expr_start
,
&
expr_end
);
/* Define inner block */
/* Define inner block */
cur_block
++
;
cur_block
++
;
cur_block
->
cmd
=
cmd
;
cur_block
->
cmd
=
cmd
;
cur_block
->
ok
=
(
v
.
int_val
?
TRUE
:
FALSE
);
cur_block
->
ok
=
(
v
.
int_val
?
TRUE
:
FALSE
);
if
(
not_expr
)
cur_block
->
ok
=
!
cur_block
->
ok
;
DBUG_PRINT
(
"info"
,
(
"OK: %d"
,
cur_block
->
ok
));
var_free
(
&
v
);
var_free
(
&
v
);
DBUG_VOID_RETURN
;
return
0
;
return
0
;
}
}
...
@@ -3037,8 +3080,6 @@ static void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val)
...
@@ -3037,8 +3080,6 @@ static void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val)
static
void
append_field
(
DYNAMIC_STRING
*
ds
,
uint
col_idx
,
MYSQL_FIELD
*
field
,
static
void
append_field
(
DYNAMIC_STRING
*
ds
,
uint
col_idx
,
MYSQL_FIELD
*
field
,
const
char
*
val
,
ulonglong
len
,
bool
is_null
)
const
char
*
val
,
ulonglong
len
,
bool
is_null
)
{
{
char
buf
[
256
];
if
(
col_idx
<
max_replace_column
&&
replace_column
[
col_idx
])
if
(
col_idx
<
max_replace_column
&&
replace_column
[
col_idx
])
{
{
val
=
replace_column
[
col_idx
];
val
=
replace_column
[
col_idx
];
...
...
mysql-test/r/mysqltest.result
View file @
3764d3da
...
@@ -324,7 +324,10 @@ test
...
@@ -324,7 +324,10 @@ test
test2
test2
test3
test3
test4
test4
Counter is greater than 0, (counter=10)
Counter is not 0, (counter=0)
1
1
Testing while with not
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: In included file "./include/mysqltest_while.inc": At line 64: Nesting too deeply
mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing '(' in while
mysqltest: At line 1: missing ')' in while
mysqltest: At line 1: missing ')' in while
...
...
mysql-test/r/ndb_cache_multi2.result
View file @
3764d3da
...
@@ -64,13 +64,10 @@ a
...
@@ -64,13 +64,10 @@ a
3
3
show status like "Qcache_queries_in_cache";
show status like "Qcache_queries_in_cache";
Variable_name Value
Variable_name Value
Qcache_queries_in_cache
2
Qcache_queries_in_cache
3
show status like "Qcache_inserts";
show status like "Qcache_inserts";
Variable_name Value
Variable_name Value
Qcache_inserts 3
Qcache_inserts 4
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
drop table t1, t2;
drop table t1, t2;
set GLOBAL query_cache_size=0;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
set GLOBAL ndb_cache_check_time=0;
...
...
mysql-test/t/mysqltest.test
View file @
3764d3da
...
@@ -755,6 +755,30 @@ echo test3stop
...
@@ -755,6 +755,30 @@ echo test3stop
--
delimiter
;
--
delimiter
;
echo
test4
;
echo
test4
;
# ----------------------------------------------------------------------------
# Test if
# ----------------------------------------------------------------------------
let
$counter
=
10
;
if
(
$counter
)
{
echo
Counter
is
greater
than
0
,
(
counter
=
10
);
}
if
(
!
$counter
)
{
echo
Counter
is
not
0
,
(
counter
=
10
);
}
let
$counter
=
0
;
if
(
$counter
)
{
echo
Counter
is
greater
than
0
,
(
counter
=
0
);
}
if
(
!
$counter
)
{
echo
Counter
is
not
0
,
(
counter
=
0
);
}
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Test while, { and }
# Test while, { and }
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
...
@@ -768,7 +792,12 @@ while ($i)
...
@@ -768,7 +792,12 @@ while ($i)
# One liner
# One liner
#let $i=1;while ($i){echo $i;dec $i;}
#let $i=1;while ($i){echo $i;dec $i;}
let
$i
=
0
;
while
(
!
$i
)
{
echo
Testing
while
with
not
;
inc
$i
;
}
# Exceed max nesting level
# Exceed max nesting level
--
error
1
--
error
1
...
...
mysql-test/t/ndb_cache_multi2.test
View file @
3764d3da
...
@@ -24,10 +24,6 @@ set GLOBAL ndb_cache_check_time=1;
...
@@ -24,10 +24,6 @@ set GLOBAL ndb_cache_check_time=1;
reset
query
cache
;
reset
query
cache
;
flush
status
;
flush
status
;
# Sleep so that the query cache check thread has time to start
sleep
15
;
# Create test tables in NDB and load them into cache
# Create test tables in NDB and load them into cache
# on server1
# on server1
connection
server1
;
connection
server1
;
...
@@ -53,19 +49,34 @@ show status like "Qcache_inserts";
...
@@ -53,19 +49,34 @@ show status like "Qcache_inserts";
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_hits"
;
update
t1
set
a
=
3
where
a
=
2
;
update
t1
set
a
=
3
where
a
=
2
;
# Sleep so that the query cache check thread has time to run
sleep
5
;
# Connect to server1 and check that cache is invalidated
# Connect to server1 and check that cache is invalidated
# and correct data is returned
# and correct data is returned
connection
server1
;
connection
server1
;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_hits"
;
# Loop and wait for max 10 seconds until query cache thread
# has invalidated the cache and the column a in t1 is equal to 3
let
$retries
=
20
;
while
(
`select a != 3 from t1`
)
{
dec
$retries
;
if
(
!
$retries
)
{
The
query_cache
thread
failed
to
invalidate
query_cache
in
10
seconds
;
}
sleep
0.5
;
}
# Select from t1 one last time for the result file
# Column a should be 3
select
*
from
t1
;
select
*
from
t1
;
# There should now be three queries in the cache
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_queries_in_cache"
;
# And inserts should be four
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
...
...
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