streamStartBatched method
int
streamStartBatched(
- int connectionId,
- String sql, {
- int fetchSize = 1000,
- int chunkSize = 64 * 1024,
- int resultEncodingWire = 0,
- Uint8List? paramsBuffer,
inherited
Starts a batched streaming query.
The connectionId must be a valid active connection.
The sql should be a valid SQL SELECT statement.
The fetchSize specifies how many rows to fetch per batch.
The chunkSize specifies the buffer size in bytes.
Returns a stream ID on success, 0 on failure.
Implementation
int streamStartBatched(
int connectionId,
String sql, {
int fetchSize = 1000,
int chunkSize = 64 * 1024,
int resultEncodingWire = 0,
Uint8List? paramsBuffer,
}) {
_requireResultEncodingWireSupport(
resultEncodingWire: resultEncodingWire,
supported: paramsBuffer != null && paramsBuffer.isNotEmpty
? _bindings.supportsStreamStartParamsOptions
: _bindings.supportsStreamResultEncodingOptions,
symbol: paramsBuffer != null && paramsBuffer.isNotEmpty
? 'odbc_stream_start_batched_params_options'
: 'odbc_stream_start_batched_options',
);
return _withSql<int>(
sql,
(sqlPtr) {
final hasParams = paramsBuffer != null && paramsBuffer.isNotEmpty;
if (hasParams) {
if (!_bindings.supportsStreamStartParams) {
return 0;
}
final paramsLen = paramsBuffer.length;
return _withParamsBuffer(
paramsBuffer,
(paramsPtr) {
if (resultEncodingWire != 0) {
return _bindings
.odbc_stream_start_batched_params_options(
connectionId,
sqlPtr,
paramsPtr,
paramsLen,
fetchSize,
chunkSize,
resultEncodingWire,
) ??
0;
}
return _bindings.odbc_stream_start_batched_params(
connectionId,
sqlPtr,
paramsPtr,
paramsLen,
fetchSize,
chunkSize,
) ??
0;
},
) ??
0;
}
if (resultEncodingWire != 0) {
return _bindings.odbc_stream_start_batched_options(
connectionId,
sqlPtr,
fetchSize,
chunkSize,
resultEncodingWire,
) ??
0;
}
return _bindings.odbc_stream_start_batched(
connectionId,
sqlPtr,
fetchSize,
chunkSize,
);
},
) ??
0;
}