Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adjusted escaping to deal with MSSQL's insano dialect for nested brac…
…kets. :P
  • Loading branch information
rdhammond committed Aug 9, 2013
commit a00799fb666a880f2ac4285beb39e74f6c97547e
2 changes: 1 addition & 1 deletion lib/Dialects/tds.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.escapeId = function () {
return exports.escapeVal(el.escapes.shift());
});
}
return "[" + el.replace(/\[/g, '[[').replace(/\]/g, ']]') + "]";
return "[" + el.replace(/\[/g, '[[]').replace(/(^|[^\[])\]/g, '[]]') + "]";
}).join(".");
};

Expand Down
2 changes: 1 addition & 1 deletion test/integration/test-dialect-tds.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ assert.equal(

assert.equal(
dialect.escapeId('table', 'co[l'),
"[table].[co[[l]"
"[table].[co[[]l]"
);

assert.equal(
Expand Down