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
c1caada8
Commit
c1caada8
authored
Dec 13, 2018
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-16278: Missing DELETE operation in COM_STMT_BULK_STMT
Allow array binding for DELETE, test it.
parent
e3dda3d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletion
+66
-1
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
tests/mysql_client_test.c
tests/mysql_client_test.c
+64
-0
No files found.
sql/sql_parse.cc
View file @
c1caada8
...
...
@@ -596,7 +596,8 @@ void init_update_queries(void)
sql_command_flags
[
SQLCOM_DELETE
]
=
CF_CHANGES_DATA
|
CF_REEXECUTION_FRAGILE
|
CF_CAN_GENERATE_ROW_EVENTS
|
CF_OPTIMIZER_TRACE
|
CF_CAN_BE_EXPLAINED
;
CF_CAN_BE_EXPLAINED
|
CF_SP_BULK_SAFE
;
sql_command_flags
[
SQLCOM_DELETE_MULTI
]
=
CF_CHANGES_DATA
|
CF_REEXECUTION_FRAGILE
|
CF_CAN_GENERATE_ROW_EVENTS
|
CF_OPTIMIZER_TRACE
|
...
...
tests/mysql_client_test.c
View file @
c1caada8
...
...
@@ -19683,6 +19683,67 @@ static void test_mdev12579()
myquery
(
rc
);
}
#ifndef EMBEDDED_LIBRARY
static
void
test_bulk_delete
()
{
int
rc
;
MYSQL_STMT
*
stmt
;
MYSQL_BIND
bind
[
1
];
MYSQL_ROW
row
;
char
indicator
[]
=
{
0
,
0
,
0
};
my_bool
error
[
1
];
int
i
,
id
[]
=
{
1
,
2
,
4
},
count
=
sizeof
(
id
)
/
sizeof
(
id
[
0
]);
MYSQL_RES
*
result
;
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS t1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE t1 (id int not null primary key)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"INSERT INTO t1 VALUES (1),(2),(3),(4)"
);
myquery
(
rc
);
verify_affected_rows
(
4
);
stmt
=
mysql_stmt_init
(
mysql
);
rc
=
mysql_stmt_prepare
(
stmt
,
"DELETE FROM t1 where id=?"
,
-
1
);
check_execute
(
stmt
,
rc
);
memset
(
bind
,
0
,
sizeof
(
bind
));
bind
[
0
].
buffer_type
=
MYSQL_TYPE_LONG
;
bind
[
0
].
buffer
=
(
void
*
)
id
;
bind
[
0
].
buffer_length
=
0
;
bind
[
0
].
is_null
=
NULL
;
bind
[
0
].
length
=
NULL
;
bind
[
0
].
error
=
error
;
bind
[
0
].
u
.
indicator
=
indicator
;
mysql_stmt_attr_set
(
stmt
,
STMT_ATTR_ARRAY_SIZE
,
(
void
*
)
&
count
);
rc
=
mysql_stmt_bind_param
(
stmt
,
bind
);
check_execute
(
stmt
,
rc
);
rc
=
mysql_stmt_execute
(
stmt
);
check_execute
(
stmt
,
rc
);
verify_affected_rows
(
3
);
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"SELECT id FROM t1"
);
myquery
(
rc
);
result
=
mysql_store_result
(
mysql
);
mytest
(
result
);
i
=
0
;
while
((
row
=
mysql_fetch_row
(
result
)))
{
i
++
;
DIE_IF
(
atoi
(
row
[
0
])
!=
3
);
}
DIE_IF
(
i
!=
1
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE t1"
);
myquery
(
rc
);
}
#endif
static
struct
my_tests_st
my_tests
[]
=
{
{
"disable_query_logs"
,
disable_query_logs
},
...
...
@@ -19963,6 +20024,9 @@ static struct my_tests_st my_tests[]= {
{
"test_big_packet"
,
test_big_packet
},
{
"test_prepare_analyze"
,
test_prepare_analyze
},
{
"test_mdev12579"
,
test_mdev12579
},
#ifndef EMBEDDED_LIBRARY
{
"test_bulk_delete"
,
test_bulk_delete
},
#endif
{
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