Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ node_js:
- "4.2"
- "0.10"
- "0.11"

matrix:
allow_failures:
- node_js: "0.10"
- node_js: "0.11"
4 changes: 4 additions & 0 deletions lib/dialect/mssql.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ Mssql.prototype.visitBinary = function(binary) {
return [text];
}

if(binary.operator === '||'){
return ['(' + this.visit(binary.left) + ' + ' + this.visit(binary.right) + ')'];
}

if (!isRightSideArray(binary)){
return Mssql.super_.prototype.visitBinary.call(this, binary);
}
Expand Down
34 changes: 30 additions & 4 deletions test/dialects/value-expression-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,46 @@ Harness.test({
query: post.select(post.id).where(post.content.equals(new Buffer('test'))),
pg: {
text : 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = $1)',
string: 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = \'\\x74657374\')',
string: 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = \'\\x74657374\')'
},
sqlite: {
text : 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = $1)',
string: 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = x\'74657374\')',
string: 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = x\'74657374\')'
},
mysql: {
text : 'SELECT `post`.`id` FROM `post` WHERE (`post`.`content` = ?)',
string: 'SELECT `post`.`id` FROM `post` WHERE (`post`.`content` = x\'74657374\')',
string: 'SELECT `post`.`id` FROM `post` WHERE (`post`.`content` = x\'74657374\')'
},
oracle: {
text : 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = :1)',
string: 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = utl_raw.cast_to_varchar2(hextoraw(\'74657374\')))',
string: 'SELECT "post"."id" FROM "post" WHERE ("post"."content" = utl_raw.cast_to_varchar2(hextoraw(\'74657374\')))'
},
params: [new Buffer('test')]
});

// concat tests
Harness.test({
query: post.select(post.content.concat(post.tags)),
pg: {
text : 'SELECT ("post"."content" || "post"."tags") FROM "post"',
string: 'SELECT ("post"."content" || "post"."tags") FROM "post"'
},
sqlite: {
text : 'SELECT ("post"."content" || "post"."tags") FROM "post"',
string: 'SELECT ("post"."content" || "post"."tags") FROM "post"'
},
mysql: {
text : 'SELECT (`post`.`content` || `post`.`tags`) FROM `post`',
string: 'SELECT (`post`.`content` || `post`.`tags`) FROM `post`'
},
mssql: {
text : 'SELECT ([post].[content] + [post].[tags]) FROM [post]',
string: 'SELECT ([post].[content] + [post].[tags]) FROM [post]'
},
oracle: {
text : 'SELECT ("post"."content" || "post"."tags") FROM "post"',
string: 'SELECT ("post"."content" || "post"."tags") FROM "post"'
},
params: []
});