Skip to content

Commit

Permalink
Pasa fast 'mssql-with-drop-table'
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Oct 31, 2016
1 parent 5664618 commit 1722d50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion bin/fast.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ function fastFinalize(info, outStream) {
//txtToSql.removeIgnoredLines(info);
txtToSql.generateInsertScript(info);
//console.log("info", info.scripts)
info.scripts.forEach(function(script) {
info.scripts.forEach(function(script, index) {
outStream.write(script.sql);
if((index+1)<info.scripts.length) {
outStream.write('\n');
}
});
}

Expand Down Expand Up @@ -101,6 +104,7 @@ function doFast(params, inputBase, fastBufferingThreshold, outputStream) {
fastProcessLine(info, line);
if(info.lines) {
if(info.lines.length===info.fastMaxLines) {
// console.log(" fast-create");
preparedResult = fastAnalyzeLines(info);
fastCreateCreate(info);
// deben estar drop y create
Expand All @@ -120,6 +124,7 @@ function doFast(params, inputBase, fastBufferingThreshold, outputStream) {
});
rl.on('close', function() {
if(info.lines && info.lines.length<info.fastMaxLines) {
// console.log(" fast-finalize");
fastProcessLine(info);
preparedResult = fastAnalyzeLines(info);
fastFinalize(info, outStream);
Expand Down
11 changes: 7 additions & 4 deletions test/test-fast.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ describe("fast-fixtures", function(){
[
{name:'mssql-example-one'},
{name:'oracle-example-one'},
{name:'mssql-comma-align', skip:true},
{name:'mssql-with-drop-table', skip:true},
{name:'mssql-comma-align', skip:true, customThreshold:true},
{name:'mssql-with-drop-table', customThreshold:true},
{name:'oracle-with-drop-table', skip:true},
].forEach(function(fixture){
if(fixture.skip) {
Expand Down Expand Up @@ -77,11 +77,14 @@ describe("fast-fixtures", function(){
}).then(function() {
if(fixture.changeExpected) { fixture.changeExpected(expected); }
}).then(function() {
return txtToSqlFast.doFast(param, basePath, fastBufferingThreshold, generated);
var threshold = fixture.customThreshold ?
param.rawTable.toString().split(/\r?\n/).length :
fastBufferingThreshold;
return txtToSqlFast.doFast(param, basePath, threshold, generated);
}).then(function(){
var gen = generated.lines.join('');
var exp = expected.rawSql.toString();
//console.log("GEN '"+gen+"'"); console.log("EXP '"+exp+"'")
// console.log("GEN '"+gen+"'"); console.log("EXP '"+exp+"'")
expect(gen).to.eql(exp);
}).then(done,done);
});
Expand Down

0 comments on commit 1722d50

Please sign in to comment.