Comparing version 1.4.3 to 1.4.4
{ | ||
"name": "xql", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"license": "Unlicense", | ||
@@ -26,5 +26,5 @@ "engines": { | ||
], | ||
"homepage": "https://github.com/exjs/xql", | ||
"homepage": "https://github.com/jsstuff/xql", | ||
"bugs": { | ||
"url": "https://github.com/exjs/xql/issues" | ||
"url": "https://github.com/jsstuff/xql/issues" | ||
}, | ||
@@ -37,3 +37,3 @@ "contributors": [ | ||
"type": "git", | ||
"url": "https://github.com/exjs/xql.git" | ||
"url": "https://github.com/jsstuff/xql.git" | ||
}, | ||
@@ -40,0 +40,0 @@ "scripts": { |
@@ -6,4 +6,3 @@ xql.js | ||
* [Official Repository (exjs/xql)](https://github.com/exjs/xql) | ||
* [Official Chat (gitter)](https://gitter.im/exjs/exjs) | ||
* [Official Repository (jsstuff/xql)](https://github.com/jsstuff/xql) | ||
* [Official Fiddler](https://kobalicek.com/fiddle-xql.html) | ||
@@ -25,3 +24,3 @@ * [Public Domain (https://unlicense.org)](https://unlicense.org) | ||
1. Full support and focus on PostgreSQL (PG is the primary engine, but xql is getting support for MySQL and SQLite3 as well). | ||
2. High performance and low memory footprint, see [exjs/xql-bench](https://github.com/exjs/xql-bench) that compares with other engines. | ||
2. High performance and low memory footprint, see [jsstuff/xql-bench](https://github.com/jsstuff/xql-bench) that compares with other engines. | ||
3. Schemaless by design, but allows to specify type-mapping so the input data can be properly escaped. | ||
@@ -28,0 +27,0 @@ 4. Control of SQL parameters and the way they are formatted / escaped. |
@@ -1,2 +0,2 @@ | ||
// xql.js <https://github.com/exjs/xql> | ||
// xql.js <https://github.com/jsstuff/xql> | ||
"use strict"; | ||
@@ -32,2 +32,4 @@ | ||
const MAX = xql.MAX; | ||
const IN = xql.IN; | ||
const NOT_IN = xql.NOT_IN; | ||
const BETWEEN = xql.BETWEEN; | ||
@@ -152,7 +154,7 @@ const NOT_BETWEEN = xql.NOT_BETWEEN; | ||
// {} defaults to JSON. | ||
shouldMatch(ctx.escapeValue({}) , "'{}'"); | ||
shouldMatch(ctx.escapeValue({a:1}) , "'{\"a\":1}'"); | ||
shouldMatch(ctx.escapeValue({a:1,b:2}) , "'{\"a\":1,\"b\":2}'"); | ||
shouldMatch(ctx.escapeValue({a:"a",b:"b"}) , "'{\"a\":\"a\",\"b\":\"b\"}'"); | ||
shouldMatch(ctx.escapeValue({a:["a","b"]}) , "'{\"a\":[\"a\",\"b\"]}'"); | ||
shouldMatch(ctx.escapeValue({}) , "'{}'::json"); | ||
shouldMatch(ctx.escapeValue({a:1}) , "'{\"a\":1}'::json"); | ||
shouldMatch(ctx.escapeValue({a:1,b:2}) , "'{\"a\":1,\"b\":2}'::json"); | ||
shouldMatch(ctx.escapeValue({a:"a",b:"b"}) , "'{\"a\":\"a\",\"b\":\"b\"}'::json"); | ||
shouldMatch(ctx.escapeValue({a:["a","b"]}) , "'{\"a\":[\"a\",\"b\"]}'::json"); | ||
@@ -204,2 +206,4 @@ shouldThrow(function() { ctx.escapeValue('\0'); }); | ||
shouldMatch(NOT_BETWEEN(0, 1, 2), '0 NOT BETWEEN 1 AND 2'); | ||
shouldMatch(IN(COL("a"), [1, 2]), '"a" IN (1, 2)'); | ||
shouldMatch(NOT_IN(COL("a"), [1, 2]), '"a" NOT IN (1, 2)'); | ||
}); | ||
@@ -406,2 +410,9 @@ | ||
it("should test SELECT ... with nested SELECT", function() { | ||
shouldMatch( | ||
SELECT(["a", "b", "c"]).FROM("x") | ||
.WHERE("c", "=", SELECT(MAX(COL("c"))).FROM("x")), | ||
'SELECT "a", "b", "c" FROM "x" WHERE "c" = (SELECT MAX("c") FROM "x")'); | ||
}); | ||
// INSERT. | ||
@@ -512,3 +523,3 @@ it("should test INSERT INTO ... () VALUES (...)", function() { | ||
// Multiple combined queries in the same group. | ||
// Multiple combined queries. | ||
it("should test ... UNION ... UNION ...", function() { | ||
@@ -521,6 +532,3 @@ shouldMatch( | ||
'SELECT "a" FROM "x" UNION SELECT "a" FROM "y" UNION SELECT "a" FROM "z"'); | ||
}); | ||
// Multiple combined queries in nested groups. | ||
it("should test ... UNION (... UNION ...)", function() { | ||
shouldMatch( | ||
@@ -533,6 +541,4 @@ UNION( | ||
), | ||
'SELECT "a" FROM "x" UNION (SELECT "a" FROM "y" UNION SELECT "a" FROM "z")'); | ||
}); | ||
'SELECT "a" FROM "x" UNION SELECT "a" FROM "y" UNION SELECT "a" FROM "z"'); | ||
it("should test ... UNION (... UNION ...)", function() { | ||
shouldMatch( | ||
@@ -545,4 +551,16 @@ UNION( | ||
), | ||
'(SELECT "a" FROM "x" UNION SELECT "a" FROM "y") UNION SELECT "a" FROM "z"'); | ||
'SELECT "a" FROM "x" UNION SELECT "a" FROM "y" UNION SELECT "a" FROM "z"'); | ||
}); | ||
// Multiple combined queries of different kinds | ||
it("should test ... UNION ... INTERSECT ...", function() { | ||
shouldMatch( | ||
UNION( | ||
INTERSECT( | ||
SELECT("a").FROM("x"), | ||
SELECT("a").FROM("y")), | ||
SELECT("a").FROM("z") | ||
), | ||
'(SELECT "a" FROM "x" INTERSECT SELECT "a" FROM "y") UNION SELECT "a" FROM "z"'); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
195671
4905
439