You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following example
var datapumps = require('datapumps');
var mssql = require('mssql');
Promise = require('bluebird');
var config = {
user: 'use',
password: 'pw',
server: 'svrp', // You can use 'localhost\instance' to connect to named instance
database: 'db',
stream: true, // You can enable streaming globally
requestTimeout: 60000,
options: {
encrypt: false // Use this if you're on Windows Azure
}
}
var connection = new mssql.Connection(config, function (err) {
if (err) {
console.log(err);
return;
}
var request = connection.request();
//Only executed if not streaming i.e streaming = false
request.query('somequery', function (err, recordset) {
// ... error checks
if (err) {
console.log(err);
}
});
//All Event Emitters are used when streaming i.e streaming = true
request.on('recordset', function (columns) {
// Emitted once for each recordset in a query
});
request.on('row', function (row) {
// Emitted for each row
extract_input_buffer.writeAsync(row);
console.log(extract_input_buffer.content.length);
});
request.on('error', function (err) {
// May be emitted multiple times
});
request.on('done', function (returnValue) {
// Always emitted as the last one
connection.close();
extract_input_buffer.seal();
});
});
var extract_pump = new datapumps.Pump();
var extract_input_buffer = new datapumps.Buffer({size: 100});
transform_pump
.logErrorsToConsole()
.run()
.then(function () {
var from1buffer = extract_pump.from();
var output1buffer = extract_pump.buffer('test_output_buffer');
var from2buffer = transform_pump.from();
var output2buffer = transform_pump.buffer('output');
console.log(from1buffer.content.length);
console.log(output1buffer.content.length);
console.log(from2buffer.content.length);
console.log(output2buffer.content.length);
});
I create a custom buffer in the extract pump, however it appears when using "run()", it cannot find the 'output' buffer in the extract_pump and reports an error:
{ error: [Error: No such buffer: output], pump: null }
Error in pump (root): Error: No such buffer: output
Can you create custom buffers and use the default execution of "run()", or do you have to override the process() function and use start() when creating custom buffers?
The text was updated successfully, but these errors were encountered:
In the following example
var datapumps = require('datapumps');
var mssql = require('mssql');
Promise = require('bluebird');
var config = {
user: 'use',
password: 'pw',
server: 'svrp', // You can use 'localhost\instance' to connect to named instance
database: 'db',
stream: true, // You can enable streaming globally
requestTimeout: 60000,
options: {
encrypt: false // Use this if you're on Windows Azure
}
}
var connection = new mssql.Connection(config, function (err) {
});
var extract_pump = new datapumps.Pump();
var extract_input_buffer = new datapumps.Buffer({size: 100});
extract_pump.buffers(
{test_output_buffer: extract_pump.createBuffer()}
);
test_output_buffer = extract_pump.buffer('test_output_buffer');
extract_pump.errorBuffer().on('write', function (data) {
console.log(data);
});
extract_pump.buffer('test_output_buffer').on('write', function (data) {
console.log(test_output_buffer.content.length);
});
extract_pump.buffer('test_output_buffer').on('end', function (data) {
console.log("output buffer has ended")
});
var transform_pump = new datapumps.Pump();
extract_pump
.from(extract_input_buffer)
.to(transform_pump, 'test_output_buffer')
.logErrorsToConsole()
.run()
.then(function(){
transform_pump
.logErrorsToConsole()
.run()
.then(function () {
var from1buffer = extract_pump.from();
var output1buffer = extract_pump.buffer('test_output_buffer');
var from2buffer = transform_pump.from();
var output2buffer = transform_pump.buffer('output');
console.log(from1buffer.content.length);
console.log(output1buffer.content.length);
console.log(from2buffer.content.length);
console.log(output2buffer.content.length);
});
I create a custom buffer in the extract pump, however it appears when using "run()", it cannot find the 'output' buffer in the extract_pump and reports an error:
{ error: [Error: No such buffer: output], pump: null }
Error in pump (root): Error: No such buffer: output
Can you create custom buffers and use the default execution of "run()", or do you have to override the process() function and use start() when creating custom buffers?
The text was updated successfully, but these errors were encountered: