sagiegurari / simple-oracledb

Extend capabilities of oracledb with simplified API for quicker development.
Apache License 2.0
36 stars 4 forks source link

change object streams into text stream #16

Closed behroozshafiabadi closed 7 years ago

behroozshafiabadi commented 7 years ago

Problem Description

Hi i have a big data results that make me to recieve results by stream mode but when i pipe stream to server response i get 'first argument must be a string or Buffer' error that mades by type of stream now my question is there any way to change the type of node oeacle given streams to text stream that able to pipe to server response ? thank you

Code Example

dbi.getConnection(c.dbConfig, function (err, connection) {
            if (err) {
                done(err);
                log.error(config.e[1], err);
            } else {
                var stream = connection.query(input.query, [], {streamResults: true});
                stream.pipe(response)
            }
        });

Error Stack/Info (if any)

sagiegurari commented 7 years ago

The stream output is basically a 'row' object with field and value for each column. for example

{
  name: 'my name',
  age: 25
}

I'm not sure exactly how you would like to transform that object into string, but you do know that you can do pipe my output to your stream that will format it to string however you want and than pipe that to the response object you have there which expects strings.