Skip to content

Commit

Permalink
Más tests para #23
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Nov 7, 2016
1 parent 7576e03 commit 289bb91
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,12 @@ function finalizeStats(info) {
info.stats.columns = info.columnsInfo.length;
info.stats.textColumns = 0;
info.stats.nullColumns = 0;
info.columnsInfo.forEach(function(column) {
//console.log("column", column)
info.stats.primaryKey = [];
var names = info.headers.split(info.opts.separator);
info.columnsInfo.forEach(function(column, index) {
if(column.typeInfo.isTextColumn) { ++info.stats.textColumns; }
if(column.hasNullValues) { ++info.stats.nullColumns; }
if(column.inPrimaryKey) { info.stats.primaryKey.push(names[index]); }
});
return info;
}
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/pk-custom.result.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ stats:
columns: 4
textColumns: 4
nullColumns: 0
primaryKey: [X,Y]
6 changes: 4 additions & 2 deletions web/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,12 @@ function finalizeStats(info) {
info.stats.columns = info.columnsInfo.length;
info.stats.textColumns = 0;
info.stats.nullColumns = 0;
info.columnsInfo.forEach(function(column) {
//console.log("column", column)
info.stats.primaryKey = [];
var names = info.headers.split(info.opts.separator);
info.columnsInfo.forEach(function(column, index) {
if(column.typeInfo.isTextColumn) { ++info.stats.textColumns; }
if(column.hasNullValues) { ++info.stats.nullColumns; }
if(column.inPrimaryKey) { info.stats.primaryKey.push(names[index]); }
});
return info;
}
Expand Down

0 comments on commit 289bb91

Please sign in to comment.