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
2aa0927d
Commit
2aa0927d
authored
Feb 26, 2008
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the remaining memory leaks (mysql_client_test).
tests/mysql_client_test.c: Fix the remaining memory leaks.
parent
6b9db6d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
tests/mysql_client_test.c
tests/mysql_client_test.c
+22
-22
No files found.
tests/mysql_client_test.c
View file @
2aa0927d
...
...
@@ -2423,7 +2423,7 @@ static uint query_cache_hits(MYSQL *conn)
*/
static
void
test_ps_query_cache
()
{
MYSQL
*
lmysql
;
MYSQL
*
lmysql
=
mysql
;
MYSQL_STMT
*
stmt
;
int
rc
;
MYSQL_BIND
p_bind
[
2
],
r_bind
[
2
];
/* p: param bind; r: result bind */
...
...
@@ -2458,7 +2458,6 @@ static void test_ps_query_cache()
TEST_QCACHE_ON_OFF
};
enum
enum_test_ps_query_cache
iteration
;
LINT_INIT
(
lmysql
);
myheader
(
"test_ps_query_cache"
);
...
...
@@ -2478,15 +2477,14 @@ static void test_ps_query_cache()
for
(
iteration
=
TEST_QCACHE_ON
;
iteration
<=
TEST_QCACHE_ON_OFF
;
iteration
++
)
{
switch
(
iteration
)
{
switch
(
iteration
)
{
case
TEST_QCACHE_ON
:
case
TEST_QCACHE_ON_OFF
:
rc
=
mysql_query
(
mysql
,
"set global query_cache_size=1000000"
);
rc
=
mysql_query
(
l
mysql
,
"set global query_cache_size=1000000"
);
myquery
(
rc
);
break
;
case
TEST_QCACHE_OFF_ON
:
rc
=
mysql_query
(
mysql
,
"set global query_cache_size=0"
);
rc
=
mysql_query
(
l
mysql
,
"set global query_cache_size=0"
);
myquery
(
rc
);
break
;
case
TEST_QCACHE_ON_WITH_OTHER_CONN
:
...
...
@@ -2494,37 +2492,35 @@ static void test_ps_query_cache()
fprintf
(
stdout
,
"
\n
Establishing a test connection ..."
);
if
(
!
(
lmysql
=
mysql_init
(
NULL
)))
{
myerror
(
"mysql_init() failed"
);
exit
(
1
);
printf
(
"mysql_init() failed"
);
DIE_UNLESS
(
0
);
}
if
(
!
(
mysql_real_connect
(
lmysql
,
opt_host
,
opt_user
,
opt_password
,
current_db
,
opt_port
,
opt_unix_socket
,
0
)))
{
myerror
(
"connection failed"
);
printf
(
"connection failed"
);
mysql_close
(
lmysql
);
exit
(
1
);
DIE_UNLESS
(
0
);
}
if
(
!
opt_silent
)
fprintf
(
stdout
,
"OK"
);
mysql
=
lmysql
;
}
strmov
(
query
,
"select id1, value1 from t1 where id1= ? or "
"CONVERT(value1 USING utf8)= ?"
);
stmt
=
mysql_simple_prepare
(
mysql
,
query
);
stmt
=
mysql_simple_prepare
(
l
mysql
,
query
);
check_stmt
(
stmt
);
verify_param_count
(
stmt
,
2
);
switch
(
iteration
)
{
switch
(
iteration
)
{
case
TEST_QCACHE_OFF_ON
:
rc
=
mysql_query
(
mysql
,
"set global query_cache_size=1000000"
);
rc
=
mysql_query
(
l
mysql
,
"set global query_cache_size=1000000"
);
myquery
(
rc
);
break
;
case
TEST_QCACHE_ON_OFF
:
rc
=
mysql_query
(
mysql
,
"set global query_cache_size=0"
);
rc
=
mysql_query
(
l
mysql
,
"set global query_cache_size=0"
);
myquery
(
rc
);
default:
break
;
...
...
@@ -2562,11 +2558,11 @@ static void test_ps_query_cache()
test_ps_query_cache_result
(
1
,
"hh"
,
2
,
2
,
"hh"
,
2
,
1
,
"ii"
,
2
);
/* now retry with the same parameter values and see qcache hits */
hits1
=
query_cache_hits
(
mysql
);
hits1
=
query_cache_hits
(
l
mysql
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
test_ps_query_cache_result
(
1
,
"hh"
,
2
,
2
,
"hh"
,
2
,
1
,
"ii"
,
2
);
hits2
=
query_cache_hits
(
mysql
);
hits2
=
query_cache_hits
(
l
mysql
);
switch
(
iteration
)
{
case
TEST_QCACHE_ON_WITH_OTHER_CONN
:
case
TEST_QCACHE_ON
:
/* should have hit */
...
...
@@ -2584,7 +2580,7 @@ static void test_ps_query_cache()
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
test_ps_query_cache_result
(
1
,
"hh"
,
2
,
1
,
"ii"
,
2
,
2
,
"ii"
,
2
);
hits1
=
query_cache_hits
(
mysql
);
hits1
=
query_cache_hits
(
l
mysql
);
switch
(
iteration
)
{
case
TEST_QCACHE_ON
:
...
...
@@ -2601,7 +2597,7 @@ static void test_ps_query_cache()
check_execute
(
stmt
,
rc
);
test_ps_query_cache_result
(
1
,
"hh"
,
2
,
1
,
"ii"
,
2
,
2
,
"ii"
,
2
);
hits2
=
query_cache_hits
(
mysql
);
hits2
=
query_cache_hits
(
l
mysql
);
mysql_stmt_close
(
stmt
);
...
...
@@ -2620,9 +2616,11 @@ static void test_ps_query_cache()
}
/* for(iteration=...) */
if
(
lmysql
!=
mysql
)
mysql_close
(
lmysql
);
rc
=
mysql_query
(
mysql
,
"set global query_cache_size=0"
);
myquery
(
rc
);
}
...
...
@@ -16262,6 +16260,7 @@ static void test_bug27876()
myquery
(
rc
);
result
=
mysql_store_result
(
mysql
);
mytest
(
result
);
mysql_free_result
(
result
);
sprintf
(
query
,
"DROP FUNCTION IF EXISTS %s"
,
(
char
*
)
utf8_func
);
rc
=
mysql_query
(
mysql
,
query
);
...
...
@@ -16278,6 +16277,7 @@ static void test_bug27876()
myquery
(
rc
);
result
=
mysql_store_result
(
mysql
);
mytest
(
result
);
mysql_free_result
(
result
);
sprintf
(
query
,
"DROP FUNCTION %s"
,
(
char
*
)
utf8_func
);
rc
=
mysql_query
(
mysql
,
query
);
...
...
@@ -16915,7 +16915,7 @@ static void test_bug30472()
/* Change connection-default character set in the client. */
con
.
options
.
charset_name
=
my_strdup
(
"utf8"
,
MYF
(
MY_FAE
)
);
mysql_options
(
&
con
,
MYSQL_SET_CHARSET_NAME
,
"utf8"
);
/*
Call mysql_change_user() in order to check that new connection will
...
...
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