Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
BULK Command
Protocol
- byte<1> (250) COM_STMT_BULK_EXECUTE
- int<4> stmt id
- byte<2> bulk_flags
- if BIT_IS_SET(bulk_flags,SEND_TYPES_TO_SERVER)
- for each parameter :
- byte<1>: field type
- byte<1>: parameter flag (128 = unsigned)
- for each parameter :
- until end of packet :
- for each parameter :
- byte<1>: parameter indicator (see after)
- if indicator == NONE
- byte<n>: binary parameter value
- for each parameter :
BULK response:
- OK_PACKET (with MORE_RESULT_EXISTS if NEED_GENERATED_IDS)
- if BIT_IS_SET(bulk_flags,NEED_GENERATED_IDS)
- insert ids resultset encoded in binary
- ERROR_PACKET something bad happened, also if stmt would return result set
Flags
Bulk flags:
64 | Return generated auto-increment IDs |
128 | Send types to server |
Indicator parameter:
0 | NONE | Value follow |
1 | NULL | Value is null |
2 | DEFAULT | For INSERT/UPDATE, value is default |
3 | IGNORE | Value is default one for insert, Is ignored for update |
Generated IDs result-set :
result-set encoded in binary format.
Columns
Column name | type | meaning |
---|---|---|
“Id” | Unsigned 8 byte numeric | Start ID of the sequence |
“Len” | Unsigned 8 byte numeric | Sequence length (number of sequential Ids) |
“Inc” | Signed 8 byte numeric | Increment of the sequence (same for all records of this row) |
Example
The following result set
Id Len Inc
1 2 1
4 3 2
15 1 1
Is returned if generated ids are 1,2, 4,6 ,8, 15
Attachments
Issue Links
- blocks
-
CONC-240 Bulk Insert (Row-wise Binding) inserts wrong data in db when array_size= 1
- Closed
- relates to
-
MDEV-16278 Missing DELETE operation in COM_STMT_BULK_STMT
- Closed
-
CONJ-389 implement bulk operation 10.2
- Closed
-
MDEV-9114 Bulk operations (Array binding)
- Closed
-
MDEV-11419 Report all INSERT ID for bulk operation INSERT
- Closed