From 7906707130490318f569beef659417fabc0a9fea Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Wed, 4 Jun 2014 20:57:11 +0200 Subject: [PATCH] Revert "Stream JSON responses" This reverts commit 49ef1bc0c776fc330ff5c575f7115e5d76f55f09. Conflicts: NEWS.md --- NEWS.md | 3 ++ app/models/formats/json.js | 92 ++++---------------------------------- 2 files changed, 12 insertions(+), 83 deletions(-) diff --git a/NEWS.md b/NEWS.md index c3819160..314097b9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ 1.10.1 - 2014-mm-dd ------------------- +Bug fixes: + + * Backing out Stream JSON responses 1.10.0 - 2014-06-04 ------------------- diff --git a/app/models/formats/json.js b/app/models/formats/json.js index 16c4817b..f30eff27 100644 --- a/app/models/formats/json.js +++ b/app/models/formats/json.js @@ -1,5 +1,4 @@ var pg = require('./pg'); -var util = require('util'); function json() {} @@ -43,96 +42,23 @@ p.formatResultFields = function(flds) { return nfields; } -p.startStreaming = function() { - if ( this.opts.profiler ) this.opts.profiler.done('startStreaming'); - this.total_rows = 0; - if ( this.opts.beforeSink ) { - this.opts.beforeSink(); - delete this.opts.beforeSink; + +p.transform = function(result, options, callback) { + var j = { + time: options.total_time, + fields: this.formatResultFields(result.fields), + total_rows: result.rowCount, + rows: result.rows } - var out = '{"rows":['; - this.opts.sink.write(out); - this._streamingStarted = true; -}; - -p.handleQueryRow = function(row) { - if ( ! this._streamingStarted ) { - this.startStreaming(); - } - var sf = this.opts.skipfields; - if ( sf.length ){ - for ( var j=0; j