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
3640843a
Commit
3640843a
authored
Sep 08, 2004
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix and test case for bug#5399 "Wrong statement executed by MySQL
server" (use my_charset_bin for stmt id hash).
parent
dab89186
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
1 deletion
+49
-1
sql/sql_class.cc
sql/sql_class.cc
+1
-1
tests/client_test.c
tests/client_test.c
+48
-0
No files found.
sql/sql_class.cc
View file @
3640843a
...
@@ -1502,7 +1502,7 @@ Statement_map::Statement_map() :
...
@@ -1502,7 +1502,7 @@ Statement_map::Statement_map() :
START_STMT_HASH_SIZE
=
16
,
START_STMT_HASH_SIZE
=
16
,
START_NAME_HASH_SIZE
=
16
START_NAME_HASH_SIZE
=
16
};
};
hash_init
(
&
st_hash
,
default_charset_info
,
START_STMT_HASH_SIZE
,
0
,
0
,
hash_init
(
&
st_hash
,
&
my_charset_bin
,
START_STMT_HASH_SIZE
,
0
,
0
,
get_statement_id_as_hash_key
,
get_statement_id_as_hash_key
,
delete_statement_as_hash_key
,
MYF
(
0
));
delete_statement_as_hash_key
,
MYF
(
0
));
hash_init
(
&
names_hash
,
system_charset_info
,
START_NAME_HASH_SIZE
,
0
,
0
,
hash_init
(
&
names_hash
,
system_charset_info
,
START_NAME_HASH_SIZE
,
0
,
0
,
...
...
tests/client_test.c
View file @
3640843a
...
@@ -10163,6 +10163,52 @@ static void test_bug4231()
...
@@ -10163,6 +10163,52 @@ static void test_bug4231()
myquery
(
rc
);
myquery
(
rc
);
}
}
static
void
test_bug5399
()
{
/*
Ascii 97 is 'a', which gets mapped to Ascii 65 'A' unless internal
statement id hash in the server uses binary collation.
*/
#define NUM_OF_USED_STMT 97
MYSQL_STMT
*
stmt
[
NUM_OF_USED_STMT
];
MYSQL_BIND
bind
[
1
];
char
buff
[
500
];
int
rc
,
i
;
int32
no
;
myheader
(
"test_bug5399"
);
bzero
(
bind
,
sizeof
(
bind
));
bind
[
0
].
buffer_type
=
MYSQL_TYPE_LONG
;
bind
[
0
].
buffer
=
&
no
;
for
(
i
=
0
;
i
<
NUM_OF_USED_STMT
;
++
i
)
{
stmt
[
i
]
=
mysql_stmt_init
(
mysql
);
sprintf
(
buff
,
"select %d"
,
i
);
rc
=
mysql_stmt_prepare
(
stmt
[
i
],
buff
,
strlen
(
buff
));
check_execute
(
stmt
[
i
],
rc
);
mysql_stmt_bind_result
(
stmt
[
i
],
bind
);
}
printf
(
"%d statements prepared.
\n
"
,
NUM_OF_USED_STMT
);
for
(
i
=
0
;
i
<
NUM_OF_USED_STMT
;
++
i
)
{
rc
=
mysql_stmt_execute
(
stmt
[
i
]);
check_execute
(
stmt
[
i
],
rc
);
rc
=
mysql_stmt_store_result
(
stmt
[
i
]);
check_execute
(
stmt
[
i
],
rc
);
rc
=
mysql_stmt_fetch
(
stmt
[
i
]);
assert
(
rc
==
0
);
assert
((
int32
)
i
==
no
);
}
for
(
i
=
0
;
i
<
NUM_OF_USED_STMT
;
++
i
)
mysql_stmt_close
(
stmt
[
i
]);
#undef NUM_OF_USED_STMT
}
/*
/*
Read and parse arguments and MySQL options from my.cnf
Read and parse arguments and MySQL options from my.cnf
*/
*/
...
@@ -10463,6 +10509,8 @@ int main(int argc, char **argv)
...
@@ -10463,6 +10509,8 @@ int main(int argc, char **argv)
test_bug5126
();
/* support for mediumint type in libmysql */
test_bug5126
();
/* support for mediumint type in libmysql */
test_bug4231
();
/* proper handling of all-zero times and
test_bug4231
();
/* proper handling of all-zero times and
dates in the server */
dates in the server */
test_bug5399
();
/* check that statement id uniquely identifies
statement */
/*
/*
XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST
XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST
DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH.
DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH.
...
...
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