Skip to content

Commit 4dec9f2

Browse files
committed
Fix bad calls to columnEscaped
Remove duplicate call to escapeName
1 parent 1441859 commit 4dec9f2

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

lib/ibmdb.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -289,20 +289,6 @@ IBMDB.prototype.executeSQL = function(sql, params, options, callback) {
289289
}
290290
};
291291

292-
/**
293-
* Escape an identifier such as the column name
294-
* IBMDB requires double quotes for case-sensitivity
295-
*
296-
* @param {string} name A database identifier
297-
* @returns {string} The escaped database identifier
298-
*/
299-
IBMDB.prototype.escapeName = function(name) {
300-
debug('IBMDB.prototype.escapeName name=%j', name);
301-
if (!name) return name;
302-
name.replace(/["]/g, '""');
303-
return '"' + name + '"';
304-
};
305-
306292
function dateToIBMDB(val) {
307293
var dateStr = val.getFullYear() + '-'
308294
+ fillZeros(val.getMonth() + 1) + '-'

lib/migration.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ module.exports = function(IBMDB) {
6868
if (found) {
6969
actualize(propName, found);
7070
} else {
71-
operations.push('ADD COLUMN ' + self.columnEscaped(propName) + ' ' +
72-
self.buildColumnDefinition(model, propName));
71+
operations.push('ADD COLUMN ' + self.columnEscaped(model, propName) +
72+
' ' + self.buildColumnDefinition(model, propName));
7373
}
7474
});
7575

7676
function actualize(propName, oldSettings) {
7777
var newSettings = m.properties[propName];
7878
if (newSettings && changed(newSettings, oldSettings)) {
7979
// TODO: NO TESTS EXECUTE THIS CODE PATH
80-
operations.push('CHANGE COLUMN ' + self.columnEscaped(propName) + ' ' +
81-
self.columnEscaped(propName) + ' ' +
80+
operations.push('CHANGE COLUMN ' + self.columnEscaped(model, propName) +
81+
' ' + self.columnEscaped(model, propName) + ' ' +
8282
self.buildColumnDefinition(model, propName));
8383
}
8484
}
@@ -116,7 +116,7 @@ module.exports = function(IBMDB) {
116116
var notFound = !~propNames.indexOf(f.NAME);
117117
if (m.properties[f.NAME] && self.id(model, f.NAME)) return;
118118
if (notFound || !m.properties[f.NAME]) {
119-
operations.push('DROP COLUMN ' + self.columnEscaped(f.NAME));
119+
operations.push('DROP COLUMN ' + self.columnEscaped(model, f.NAME));
120120
}
121121
});
122122
}

0 commit comments

Comments
 (0)