Comparing version 0.0.11 to 0.0.12
@@ -100,2 +100,15 @@ var Where = require("./Where"); | ||
}, | ||
whereExists: function (table, table_link, link, conditions) { | ||
var where = [{ | ||
t: (sql.from.length ? sql.from[sql.from.length - 1].a : null), | ||
w: conditions, | ||
e: { t: table, tl: get_table_alias(table_link), l: link } | ||
}]; | ||
if (sql.where.length) { | ||
sql.where[sql.where.length - 1] = sql.where[sql.where.length - 1].concat(where); | ||
} else { | ||
sql.where.push(where); | ||
} | ||
return this; | ||
}, | ||
offset: function (offset) { | ||
@@ -102,0 +115,0 @@ sql.offset = offset; |
@@ -26,2 +26,13 @@ exports.build = function (Dialect, where) { | ||
for (var i = 0; i < where.length; i++) { | ||
if (where[i].e) { | ||
// EXISTS | ||
query.push( | ||
"EXISTS (" + | ||
"SELECT * FROM " + Dialect.escapeId(where[i].e.t) + " " + | ||
"WHERE " + Dialect.escapeId(where[i].e.l[0]) + " = " + Dialect.escapeId(where[i].e.tl, where[i].e.l[1]) + " " + | ||
"AND " + buildOrGroup(Dialect, [{ t: null, w: where[i].w }]) + | ||
")" | ||
); | ||
continue; | ||
} | ||
for (var k in where[i].w) { | ||
@@ -28,0 +39,0 @@ if (where[i].w[k] === null) { |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"license": "MIT", | ||
@@ -12,0 +12,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30020
1066