Skip to content

Commit

Permalink
Limpio código, warnings y subo versión.
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Oct 17, 2016
1 parent 78981ab commit bcb0a22
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
17 changes: 3 additions & 14 deletions bin/txt-to-sql-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,11 @@ function collectExistentFiles(files) {
});
};

function readConfigData(configFile) {
return Promises.start(function() {
return fs.exists(configFile);
}).then(function(exists) {
if(exists) {
return miniTools.readConfig([configFile]);
}
return {invalid:true};
});
};

function createParams(params, preparedParams) {
var res = {
tableName:params.tableName,
rawTable:params.rawTable,
opts: changing(params.opts, preparedParams.opts),
tableName:params.tableName,
rawTable:params.rawTable,
opts: changing(params.opts, preparedParams.opts),
};
res.opts.columns = preparedParams.columns;
return res;
Expand Down
6 changes: 3 additions & 3 deletions lib/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ function mapTypes(typeNames) {
return typeNames.map(function(type, index) { return Object.assign({typeName:type}, types[index]); });
}

function quoteBackTick(objectName) { return '`'+objectName.replace(/`/g,'``')+'`'; };
function quoteBackTick(objectName) { return '`'+objectName.replace(/`/g,'``')+'`'; }
// Solo hay que escapar ']' de acuerdo con: https://technet.microsoft.com/en-us/library/ms176027(v=sql.105).aspx
function quoteBracket(objectName) { return '['+objectName.replace(/]/g,']]')+']'; };
function quoteDouble(objectName) { return '"'+objectName.replace(/"/g,'""')+'"'; };
function quoteBracket(objectName) { return '['+objectName.replace(/]/g,']]')+']'; }
function quoteDouble(objectName) { return '"'+objectName.replace(/"/g,'""')+'"'; }

function dropTableIfExists(tableName) { return "drop table if exists "+tableName; }
function dropTable(tableName) { return "drop table "+tableName; }
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "txt-to-sql",
"description": "Tools for convert text data to SQL sentences",
"version": "0.0.9",
"version": "0.0.10",
"author": "Codenautas <codenautas@googlegroups.com>",
"repository": "codenautas/txt-to-sql",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions web/txt-to-sql.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ function mapTypes(typeNames) {
return typeNames.map(function(type, index) { return Object.assign({typeName:type}, types[index]); });
}

function quoteBackTick(objectName) { return '`'+objectName.replace(/`/g,'``')+'`'; };
function quoteBackTick(objectName) { return '`'+objectName.replace(/`/g,'``')+'`'; }
// Solo hay que escapar ']' de acuerdo con: https://technet.microsoft.com/en-us/library/ms176027(v=sql.105).aspx
function quoteBracket(objectName) { return '['+objectName.replace(/]/g,']]')+']'; };
function quoteDouble(objectName) { return '"'+objectName.replace(/"/g,'""')+'"'; };
function quoteBracket(objectName) { return '['+objectName.replace(/]/g,']]')+']'; }
function quoteDouble(objectName) { return '"'+objectName.replace(/"/g,'""')+'"'; }

function dropTableIfExists(tableName) { return "drop table if exists "+tableName; }
function dropTable(tableName) { return "drop table "+tableName; }
Expand Down

0 comments on commit bcb0a22

Please sign in to comment.