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
78f477c9
Commit
78f477c9
authored
Jun 14, 2007
by
gkodinov/kgeorge@magare.gmz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrected valgrind problems for bug 28505 and 28934
parent
20ad5150
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
108 deletions
+21
-108
tests/mysql_client_test.c
tests/mysql_client_test.c
+21
-108
No files found.
tests/mysql_client_test.c
View file @
78f477c9
...
@@ -15627,62 +15627,19 @@ static void test_bug27876()
...
@@ -15627,62 +15627,19 @@ static void test_bug27876()
Bug#28505: mysql_affected_rows() returns wrong value if CLIENT_FOUND_ROWS
Bug#28505: mysql_affected_rows() returns wrong value if CLIENT_FOUND_ROWS
flag is set.
flag is set.
*/
*/
static
void
test_bug28505
()
static
void
test_bug28505
()
{
{
MYSQL
*
l_mysql
;
my_bool
error
=
0
;
my_ulonglong
res
;
my_ulonglong
res
;
if
(
!
(
l_mysql
=
mysql_init
(
NULL
)))
myquery
(
mysql_query
(
mysql
,
"drop table if exists t1"
));
{
myquery
(
mysql_query
(
mysql
,
"create table t1(f1 int primary key)"
));
myerror
(
"mysql_init() failed"
);
myquery
(
mysql_query
(
mysql
,
"insert into t1 values(1)"
));
DIE_UNLESS
(
1
);
myquery
(
mysql_query
(
mysql
,
}
"insert into t1 values(1) on duplicate key update f1=1"
));
if
(
!
(
mysql_real_connect
(
l_mysql
,
opt_host
,
opt_user
,
res
=
mysql_affected_rows
(
mysql
);
opt_password
,
current_db
,
opt_port
,
DIE_UNLESS
(
!
res
);
opt_unix_socket
,
CLIENT_FOUND_ROWS
)))
myquery
(
mysql_query
(
mysql
,
"drop table t1"
));
{
myerror
(
"connection failed"
);
error
=
1
;
goto
end
;
}
l_mysql
->
reconnect
=
1
;
if
(
mysql_query
(
l_mysql
,
"drop table if exists t1"
))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
if
(
mysql_query
(
l_mysql
,
"create table t1(f1 int primary key)"
))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
if
(
mysql_query
(
l_mysql
,
"insert into t1 values(1)"
))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
if
(
mysql_query
(
l_mysql
,
"insert into t1 values(1) on duplicate key update f1=1"
))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
res
=
mysql_affected_rows
(
l_mysql
);
if
(
!
res
)
error
=
1
;
if
(
mysql_query
(
l_mysql
,
"drop table t1"
))
{
myerror
(
NULL
);
error
=
1
;
}
end:
mysql_close
(
l_mysql
);
DIE_UNLESS
(
error
==
0
);
}
}
...
@@ -15692,51 +15649,17 @@ end:
...
@@ -15692,51 +15649,17 @@ end:
static
void
test_bug28934
()
static
void
test_bug28934
()
{
{
MYSQL
*
l_mysql
;
my_bool
error
=
0
;
my_bool
error
=
0
;
MYSQL_BIND
bind
[
5
];
MYSQL_BIND
bind
[
5
];
MYSQL_STMT
*
stmt
;
MYSQL_STMT
*
stmt
;
int
cnt
;
int
cnt
;
if
(
!
(
l_mysql
=
mysql_init
(
NULL
)))
myquery
(
mysql_query
(
mysql
,
"drop table if exists t1"
));
{
myquery
(
mysql_query
(
mysql
,
"create table t1(id int)"
));
myerror
(
"mysql_init() failed"
);
DIE_UNLESS
(
1
);
myquery
(
mysql_query
(
mysql
,
"insert into t1 values(1),(2),(3),(4),(5)"
));
}
stmt
=
mysql_simple_prepare
(
mysql
,
"select * from t1 where id in(?,?,?,?,?)"
);
if
(
!
(
mysql_real_connect
(
l_mysql
,
opt_host
,
opt_user
,
check_stmt
(
stmt
);
opt_password
,
current_db
,
opt_port
,
opt_unix_socket
,
CLIENT_FOUND_ROWS
)))
{
myerror
(
"connection failed"
);
error
=
1
;
goto
end
;
}
l_mysql
->
reconnect
=
1
;
if
(
mysql_query
(
l_mysql
,
"drop table if exists t1"
))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
if
(
mysql_query
(
l_mysql
,
"create table t1(id int)"
))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
if
(
mysql_query
(
l_mysql
,
"insert into t1 values(1),(2),(3),(4),(5)"
))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
if
(
!
(
stmt
=
mysql_simple_prepare
(
l_mysql
,
"select * from t1 where id in(?,?,?,?,?)"
)))
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
memset
(
&
bind
,
0
,
sizeof
(
bind
));
memset
(
&
bind
,
0
,
sizeof
(
bind
));
for
(
cnt
=
0
;
cnt
<
5
;
cnt
++
)
for
(
cnt
=
0
;
cnt
<
5
;
cnt
++
)
...
@@ -15745,25 +15668,15 @@ static void test_bug28934()
...
@@ -15745,25 +15668,15 @@ static void test_bug28934()
bind
[
cnt
].
buffer
=
(
char
*
)
&
cnt
;
bind
[
cnt
].
buffer
=
(
char
*
)
&
cnt
;
bind
[
cnt
].
buffer_length
=
0
;
bind
[
cnt
].
buffer_length
=
0
;
}
}
if
(
mysql_stmt_bind_param
(
stmt
,
bind
))
myquery
(
mysql_stmt_bind_param
(
stmt
,
bind
));
{
myerror
(
NULL
);
error
=
1
;
goto
end
;
}
stmt
->
param_count
=
2
;
stmt
->
param_count
=
2
;
error
=
mysql_stmt_execute
(
stmt
);
error
=
mysql_stmt_execute
(
stmt
);
DIE_UNLESS
(
error
!=
0
);
DIE_UNLESS
(
error
!=
0
);
myerror
(
NULL
);
error
=
0
;
if
(
mysql_query
(
l_mysql
,
"drop table t1"
))
{
myerror
(
NULL
);
myerror
(
NULL
);
error
=
1
;
mysql_stmt_close
(
stmt
);
}
end:
myquery
(
mysql_query
(
mysql
,
"drop table t1"
));
mysql_close
(
l_mysql
);
DIE_UNLESS
(
error
==
0
);
}
}
...
...
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