Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Add CROSS JOIN functionality (issue #124)
Browse files Browse the repository at this point in the history
  • Loading branch information
pcothenet committed Jan 29, 2015
1 parent c5e6e13 commit d7cb984
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
10 changes: 10 additions & 0 deletions squel-basic.js
Expand Up @@ -1605,6 +1605,16 @@ OTHER DEALINGS IN THE SOFTWARE.
return this.join(table, alias, condition, 'FULL');
};

JoinBlock.prototype.cross_join = function(table, alias, condition) {
if (alias == null) {
alias = null;
}
if (condition == null) {
condition = null;
}
return this.join(table, alias, condition, 'CROSS');
};

JoinBlock.prototype.buildStr = function(queryBuilder) {
var j, joins, _i, _len, _ref5;
joins = "";
Expand Down
2 changes: 1 addition & 1 deletion squel-basic.min.js

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions squel.js
Expand Up @@ -1605,6 +1605,16 @@ OTHER DEALINGS IN THE SOFTWARE.
return this.join(table, alias, condition, 'FULL');
};

JoinBlock.prototype.cross_join = function(table, alias, condition) {
if (alias == null) {
alias = null;
}
if (condition == null) {
condition = null;
}
return this.join(table, alias, condition, 'CROSS');
};

JoinBlock.prototype.buildStr = function(queryBuilder) {
var j, joins, _i, _len, _ref5;
joins = "";
Expand Down
4 changes: 2 additions & 2 deletions squel.min.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/squel.coffee
Expand Up @@ -199,7 +199,7 @@ class cls.BaseBuilder extends cls.Cloneable
if allowNested
if "string" is typeof item
sanitized = item
else
else
try
sanitized = @_sanitizeNestableQuery(item)
catch e
Expand Down Expand Up @@ -1222,12 +1222,10 @@ class cls.JoinBlock extends cls.Block
left_join: (table, alias = null, condition = null) ->
@join table, alias, condition, 'LEFT'


# Add a RIGHT JOIN with the given table.
right_join: (table, alias = null, condition = null) ->
@join table, alias, condition, 'RIGHT'


# Add an OUTER JOIN with the given table.
outer_join: (table, alias = null, condition = null) ->
@join table, alias, condition, 'OUTER'
Expand All @@ -1240,6 +1238,10 @@ class cls.JoinBlock extends cls.Block
full_join: (table, alias = null, condition = null) ->
@join table, alias, condition, 'FULL'

# Add an CROSS JOIN with the given table.
cross_join: (table, alias = null, condition = null) ->
@join table, alias, condition, 'CROSS'

buildStr: (queryBuilder) ->
joins = ""

Expand Down

0 comments on commit d7cb984

Please sign in to comment.