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
064d1a48
Commit
064d1a48
authored
Jun 22, 2017
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12579: Incorrect arguments to mysqld_stmt_execute when using LOBs
Parameters can be MYSQL_TYPE_VARCHAR for long data load.
parent
557e1bd4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
sql/sql_prepare.cc
sql/sql_prepare.cc
+4
-2
tests/mysql_client_test.c
tests/mysql_client_test.c
+35
-0
No files found.
sql/sql_prepare.cc
View file @
064d1a48
...
@@ -825,8 +825,10 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
...
@@ -825,8 +825,10 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
*/
*/
inline
bool
is_param_long_data_type
(
Item_param
*
param
)
inline
bool
is_param_long_data_type
(
Item_param
*
param
)
{
{
return
((
param
->
field_type
()
>=
MYSQL_TYPE_TINY_BLOB
)
&&
enum_field_types
field_type
=
param
->
field_type
();
(
param
->
field_type
()
<=
MYSQL_TYPE_STRING
));
return
(((
field_type
>=
MYSQL_TYPE_TINY_BLOB
)
&&
(
field_type
<=
MYSQL_TYPE_STRING
))
||
field_type
==
MYSQL_TYPE_VARCHAR
);
}
}
...
...
tests/mysql_client_test.c
View file @
064d1a48
...
@@ -19531,6 +19531,40 @@ static void test_prepare_analyze()
...
@@ -19531,6 +19531,40 @@ static void test_prepare_analyze()
check_execute
(
stmt
,
rc
);
check_execute
(
stmt
,
rc
);
}
}
static
void
test_mdev12579
()
{
MYSQL_STMT
*
stmt
=
mysql_stmt_init
(
mysql
);
MYSQL_BIND
bind
[
2
];
int
rc
;
long
l
=
3
;
const
char
*
data
=
"123456"
;
rc
=
mysql_query
(
mysql
,
"CREATE TABLE mdev12579 (k integer,t LONGTEXT,b LONGBLOB,x integer)"
);
myquery
(
rc
);
rc
=
mysql_stmt_prepare
(
stmt
,
"INSERT INTO mdev12579 VALUES (1,?,NULL,?)"
,
-
1
);
myquery
(
rc
);
rc
=
mysql_stmt_send_long_data
(
stmt
,
0
,
data
,
6
);
rc
=
mysql_stmt_send_long_data
(
stmt
,
0
,
data
,
6
);
rc
=
mysql_stmt_send_long_data
(
stmt
,
0
,
data
,
6
);
memset
(
bind
,
0
,
sizeof
(
MYSQL_BIND
)
*
2
);
bind
[
0
].
buffer_type
=
MYSQL_TYPE_VAR_STRING
;
bind
[
1
].
buffer_type
=
MYSQL_TYPE_LONG
;
bind
[
1
].
buffer
=
&
l
;
mysql_stmt_bind_param
(
stmt
,
bind
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE mdev12579"
);
myquery
(
rc
);
}
static
struct
my_tests_st
my_tests
[]
=
{
static
struct
my_tests_st
my_tests
[]
=
{
{
"disable_query_logs"
,
disable_query_logs
},
{
"disable_query_logs"
,
disable_query_logs
},
{
"test_view_sp_list_fields"
,
test_view_sp_list_fields
},
{
"test_view_sp_list_fields"
,
test_view_sp_list_fields
},
...
@@ -19808,6 +19842,7 @@ static struct my_tests_st my_tests[]= {
...
@@ -19808,6 +19842,7 @@ static struct my_tests_st my_tests[]= {
{
"test_compressed_protocol"
,
test_compressed_protocol
},
{
"test_compressed_protocol"
,
test_compressed_protocol
},
{
"test_big_packet"
,
test_big_packet
},
{
"test_big_packet"
,
test_big_packet
},
{
"test_prepare_analyze"
,
test_prepare_analyze
},
{
"test_prepare_analyze"
,
test_prepare_analyze
},
{
"test_mdev12579"
,
test_mdev12579
},
{
0
,
0
}
{
0
,
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