Feature request: array binding support for CommandInfo and/or BulkCopy
See original GitHub issueSome data providers like Oracle and DB2 provide array binding feature (supported by BLToolkit).
It works like this: the command is sent to the database server in one roundtrip, but is executed multiple times as needed. Scalar parameters are sent as arrays, and each command execution takes the next set of parameters.
Pseudocode:
var cmd = new OracleCommand();
cmd.CommantText = @"INSERT INTO MY_TABLE(ID, NAME, COMMENT) VALUES(:ID, :NAME, :COMMENT)";
cmd.ArrayBindCount = 5;
cmd.Parameters.Add("ID", new[] { 1, 2, 3, 4, 5 }); // each array has ArrayBindCount elements
cmd.Parameters.Add("NAME", new[] { "1", "2", "3", "4", "5" });
cmd.Parameters.Add("COMMENT", new[] { "One", "Two", "Three", "Four", "Five" });
On the database side, it’s equivalent to repeating the same INSERT statement 5 times, with parameters (1, “1”, “One”), then (2, “2”, “Two”), and so on. But it’s executed much faster than individual INSERTs and with less traffic.
Can we add support for this execution mode to CommandInfo and/or BulkCopy? The default implementation for data providers that don’t support array binding would fall back to multiple execution of the same statement.
Related issue: #1880
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
@yallie, looks like it is already implemented. Try to set
OracleTools.UseAlternativeBulkCopy = true
and BulkCopy should switch to this implementation.@jods4, thanks for confirming that!