diff --git a/javascript/frameworks/cap/ext/codeql-pack.lock.yml b/javascript/frameworks/cap/ext/codeql-pack.lock.yml new file mode 100644 index 000000000..530042745 --- /dev/null +++ b/javascript/frameworks/cap/ext/codeql-pack.lock.yml @@ -0,0 +1,4 @@ +--- +lockVersion: 1.0.0 +dependencies: {} +compiled: false diff --git a/javascript/frameworks/cap/ext/qlpack.yml b/javascript/frameworks/cap/ext/qlpack.yml new file mode 100644 index 000000000..ba988c804 --- /dev/null +++ b/javascript/frameworks/cap/ext/qlpack.yml @@ -0,0 +1,9 @@ +--- +library: true +name: advanced-security/javascript-sap-cap-models +version: 0.3.0 +extensionTargets: + codeql/javascript-all: "^0.8.1" + codeql/javascript-queries: "^0.8.1" +dataExtensions: + - "*.model.yml" \ No newline at end of file diff --git a/javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CDS.qll b/javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CDS.qll new file mode 100644 index 000000000..d1e3a0d11 --- /dev/null +++ b/javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CDS.qll @@ -0,0 +1,134 @@ +import javascript +import DataFlow + +module CDS { + // TODO: should this base type be more specific? + abstract class ServiceInstance extends DataFlow::Node { } + + /** + * Call to`cds.serve` + */ + class CdsServeCall extends ServiceInstance { + CdsServeCall() { this = any(CdsFacade cds).getMember("serve").getACall() } + } + + /** + * call to: + * `new cds.ApplicationService` or `new cds.Service` + */ + class ServiceConstructor extends ServiceInstance { + ServiceConstructor() { this = any(ApplicationService cds).getAnInstantiation() } + } + + /** + * return value of `cds.connect.to` + */ + class ConnectTo extends ServiceInstance { + ConnectTo() { this = any(CdsFacade cds).getMember("connect").getMember("to").getACall() } + } + + /** Last argument to the service methods `srv.before`, `srv.on`, and `srv.after` */ + private class RequestHandler extends FunctionNode { } + + private class ErrorHandler extends RequestHandler { } + + /** + * Subclassing ApplicationService via `extends`: + * ```js + * class SomeService extends cds.ApplicationService + * ``` + */ + class UserDefinedApplicationService extends ClassNode { + UserDefinedApplicationService() { + exists(ApplicationService cdsApplicationService | + this.getASuperClassNode() = cdsApplicationService.asSource() + ) + } + } + + /** + * Subclassing ApplicationService via `cds.service.impl`: + * ```js + * const cds = require('@sap/cds') + * module.exports = cds.service.impl (function() { ... }) + * ``` + */ + class OldStyleUserDefinedApplicationService extends MethodCallNode { + OldStyleUserDefinedApplicationService() { + exists(CdsFacade cds | this = cds.getMember("service").getMember("impl").getACall()) + } + } + + /** + * Parameter of a `srv.with` method call: + * ```js + * cds.serve('./srv/cat-service') .with ((srv) => { + * srv.on ('READ','Books', (req) => req.reply([...])) + * }) + * ``` + * + * TODO expand this to capture request handlers registered inside the function + */ + class WithCallParameter extends RequestHandler { + WithCallParameter() { + exists(MethodCallNode withCall, ServiceInstance svc | + withCall.getArgument(0) = this and + withCall.getMethodName() = "with" and + withCall.getReceiver() = svc + ) + } + } + + /** + * Parameter of request handler of `_.on`: + * ```js + * _.on ('READ','Books', (req) => req.reply([...])) + * ``` + */ + class OnNodeParam extends ValueNode, ParameterNode { + MethodCallNode on; + + OnNodeParam() { + exists(FunctionNode handler | + on.getMethodName() = "on" and + on.getLastArgument() = handler and + handler.getLastParameter() = this + ) + } + + MethodCallNode getOnNode() { result = on } + } + + /** + * Parameter of request handler of `srv.on`: + * ```js + * this.on ('READ','Books', (req) => req.reply([...])) + * ``` + * not sure how else to know which service is registering the handler + */ + class RequestSource extends OnNodeParam { + RequestSource() { + // TODO : consider - do we need to actually ever know which service the handler is associated to? + exists(UserDefinedApplicationService svc, FunctionNode init | + svc.getAnInstanceMember() = init and + init.getName() = "init" and + this.getOnNode().getEnclosingFunction() = init.getAstNode() + ) + or + exists(WithCallParameter pa | this.getOnNode().getEnclosingFunction() = pa.getFunction()) + } + } + + class ApplicationService extends API::Node { + ApplicationService() { exists(CdsFacade c | this = c.getMember("ApplicationService")) } + } + + /** + * ```js + * const cds = require('@sap/cds') + * ``` + */ + class CdsFacade extends API::Node { + CdsFacade() { this = API::moduleImport("@sap/cds") } + } +} diff --git a/javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CQL.qll b/javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CQL.qll new file mode 100644 index 000000000..1dde91599 --- /dev/null +++ b/javascript/frameworks/cap/lib/advanced_security/javascript/frameworks/cap/CQL.qll @@ -0,0 +1,261 @@ +import javascript +import DataFlow +import CDS::CDS + +module CQL { + /** + * Objects from the SQL-like fluent API + * this is the set of clauses that acts as the base of a statement + */ + class CqlQueryBase extends VarRef { + CqlQueryBase() { + exists(string name | + this.getName() = name and + name in ["SELECT", "INSERT", "DELETE", "UPDATE", "UPSERT"] and + // Made available as a global variable + exists(GlobalVariable queryBase | this = queryBase.getAReference()) + or + // Imported from `cds.ql` */ + exists(CdsFacade cds | + cds.getMember("ql").getMember(name).getAValueReachableFromSource().asExpr() = this + ) + ) + } + } + + class CqlSelectBase extends CqlQueryBase { + CqlSelectBase() { this.getName() = "SELECT" } + } + + class CqlInsertBase extends CqlQueryBase { + CqlInsertBase() { this.getName() = "INSERT" } + } + + class CqlDeleteBase extends CqlQueryBase { + CqlDeleteBase() { this.getName() = "DELETE" } + } + + class CqlUpdateBase extends CqlQueryBase { + CqlUpdateBase() { this.getName() = "UPDATE" } + } + + class CqlUpsertBase extends CqlQueryBase { + CqlUpsertBase() { this.getName() = "UPSERT" } + } + + /** + * The cds-ql docs do not mention DELETE being a function acting as a shortcut to any underlying clause + */ + abstract class CqlQueryBaseCall extends CallExpr { + // TODO: Express "It's a global function or a local function imported from cds.ql" + } + + class CqlSelectBaseCall extends CqlQueryBaseCall { + CqlSelectBaseCall() { this.getCalleeName() = "SELECT" } + } + + class CqlInsertBaseCall extends CqlQueryBaseCall { + CqlInsertBaseCall() { this.getCalleeName() = "INSERT" } + } + + class CqlUpdateBaseCall extends CqlQueryBaseCall { + CqlUpdateBaseCall() { this.getCalleeName() = "UPDATE" } + } + + class CqlUpsertBaseCall extends CqlQueryBaseCall { + CqlUpsertBaseCall() { this.getCalleeName() = "UPSERT" } + } + + /** + * Obtains the receiver across a variety of types of accesses + */ + Expr getRootReceiver(Expr e) { + result = e and + ( + e instanceof VarRef + or + e instanceof CallExpr and not exists(e.(CallExpr).getReceiver()) + ) + or + result = getRootReceiver(e.(DotExpr).getBase()) + or + result = getRootReceiver(e.(MethodCallExpr).getReceiver()) + or + result = getRootReceiver(e.(PropAccess).getBase()) + or + result = getRootReceiver(e.(TaggedTemplateExpr).getTag()) + } + + /** + * An aggregation type for the two ways to access the fluent API + * provided by the module cds.ql + */ + newtype TCqlClause = + MethodCall(MethodCallExpr callExpr) { + exists(CqlQueryBase base | base = getRootReceiver(callExpr)) or + exists(CqlQueryBaseCall call | call = getRootReceiver(callExpr)) + } or + ShortcutCall(CqlQueryBaseCall callExpr) + + class CqlClause extends TCqlClause { + Expr asExpr() { + result = this.asMethodCall() + or + result = this.asShortcutCall() + } + + Expr getArgument() { + result = this.asMethodCall().getAnArgument() + or + result = this.asShortcutCall().getAnArgument() + } + + string getClauseName() { + result = this.asMethodCall().getMethodName() + or + this.asShortcutCall().getCalleeName() = "SELECT" and + result = "columns" + or + this.asShortcutCall().getCalleeName() in ["INSERT", "UPSERT"] and + result = "entries" + or + this.asShortcutCall().getCalleeName() = "UPDATE" and + result = "entity" + } + + MethodCallExpr asMethodCall() { this = MethodCall(result) } + + CallExpr asShortcutCall() { this = ShortcutCall(result) } + + /** + * Convert this `CqlClause` into a `DotExpr`, i.e. + * `Get SELECT.from'Table' when given SELECT.from'Table'.wherecond`, + */ + DotExpr asDotExpr() { result = this.asMethodCall().getCallee().(DotExpr) } + + string toString() { + result = this.asMethodCall().toString() or + result = this.asShortcutCall().toString() + } + + Location getLocation() { + result = this.asMethodCall().getLocation() or + result = this.asShortcutCall().getLocation() + } + + CqlQueryBase getCqlBase() { result = getRootReceiver(this.asMethodCall()) } + + CqlQueryBaseCall getCqlBaseCall() { + result = getRootReceiver(this.asMethodCall()).(CqlQueryBaseCall) + } + + /** Describes a parent expression relation */ + Expr getParentExpr() { + result = this.asMethodCall().getParentExpr() or + result = this.asShortcutCall().getParentExpr() + } + + /** + * Possible cases for constructing a chain of clauses: + * + * (looking at the terminal clause and its possible parent types as tuples: (this, parent)) + * 1) MethodCall.MethodCall + * - example `(SELECT.from(Table), SELECT.from(Table).where("col1='*'"))` + * 2) ShortcutCall.MethodCall + * - example `(SELECT("col1, col2"), SELECT("col1, col2").from("Table"))` + * + * ShortcutCalls cannot be added to any clause chain other than the first position + * example - `SELECT("col1, col2").INSERT(col2)` is not valid + */ + CqlClause getCqlParentExpr() { + result.asMethodCall() = this.asMethodCall().getParentExpr().getParentExpr() + or + result.asMethodCall() = this.asShortcutCall().getParentExpr().getParentExpr() + } + + Expr getAnAncestorExpr() { + result = this.asMethodCall().getParentExpr+() or + result = this.asShortcutCall().getParentExpr+() + } + + CqlClause getAnAncestorCqlClause() { + result.asMethodCall() = this.getAnAncestorExpr() or + result.asShortcutCall() = this.getAnAncestorExpr() + } + + /** Describes a child expression relation */ + Expr getAChildExpr() { + result = this.asMethodCall().getAChildExpr() or + result = this.asShortcutCall().getAChildExpr() + } + + /** + * the same chain order logic as `getCqlParentExpr` but reversed + */ + CqlClause getAChildCqlClause() { + result.asMethodCall() = this.asMethodCall().getAChildExpr().getAChildExpr() or + result.asShortcutCall() = this.asMethodCall().getAChildExpr().getAChildExpr() + } + + Expr getADescendantExpr() { + result = this.asMethodCall().getAChildExpr+() or + result = this.asShortcutCall().getAChildExpr+() + } + + CqlClause getADescendantCqlClause() { + result.asMethodCall() = this.getADescendantExpr() or + result.asShortcutCall() = this.getADescendantExpr() + } + + /** + * Matches the given `CqlClause` to its method/property name, nested at arbitrary depth. + */ + string getAnAPIName() { + result = this.asDotExpr().getPropertyName() or + result = this.getADescendantCqlClause().getAnAPIName() + } + } + + /** + * A possibly tainted clause + * any clause with a string concatenation in it + * regardless of where that operand came from + */ + class TaintedClause extends CqlClause { + TaintedClause() { exists(StringConcatenation::getAnOperand(this.getArgument().flow())) } + } + + /** + * Call to`cds.db.run` + * or + * an await surrounding a sql statement + */ + class CQLSink extends DataFlow::Node { + CQLSink() { + this = any(CdsFacade cds).getMember("db").getMember("run").getACall().getAnArgument() + or + exists(AwaitExpr a, CQL::CqlClause clause | + a.getAChildExpr() = clause.asExpr() and this.asExpr() = clause.asExpr() + ) + } + } + + /** + * a more heurisitic based taint step + * captures one of the alternative ways to construct query strings: + * `cds.parse.cql(`string`+userInput)` + * and considers them tainted if they've been concatenated against + * in any manner + */ + class ParseCQLTaintedClause extends CallNode { + ParseCQLTaintedClause() { + this = any(CdsFacade cds).getMember("parse").getMember("cql").getACall() and + exists(DataFlow::Node n | + n = StringConcatenation::getAnOperand(this.getAnArgument()) and + //omit the fact that the arg of cds.parse.cql (`SELECT * from Foo`) + //is technically a string concat + not n.asExpr() instanceof TemplateElement + ) + } + } +} diff --git a/javascript/frameworks/cap/lib/codeql-pack.lock.yml b/javascript/frameworks/cap/lib/codeql-pack.lock.yml new file mode 100644 index 000000000..fad4fb67b --- /dev/null +++ b/javascript/frameworks/cap/lib/codeql-pack.lock.yml @@ -0,0 +1,16 @@ +--- +lockVersion: 1.0.0 +dependencies: + codeql/javascript-all: + version: 0.8.5 + codeql/mad: + version: 0.2.5 + codeql/regex: + version: 0.2.5 + codeql/tutorial: + version: 0.2.5 + codeql/util: + version: 0.2.5 + codeql/yaml: + version: 0.2.5 +compiled: false diff --git a/javascript/frameworks/cap/lib/qlpack.yml b/javascript/frameworks/cap/lib/qlpack.yml new file mode 100644 index 000000000..7c18b0734 --- /dev/null +++ b/javascript/frameworks/cap/lib/qlpack.yml @@ -0,0 +1,9 @@ +--- +library: true +name: advanced-security/javascript-sap-cap-all +version: 0.1.1 +suites: codeql-suites +extractor: javascript +dependencies: + codeql/javascript-all: "^0.8.1" + advanced-security/javascript-sap-cap-models: "^0.3.0" diff --git a/javascript/frameworks/cap/src/codeql-pack.lock.yml b/javascript/frameworks/cap/src/codeql-pack.lock.yml new file mode 100644 index 000000000..fad4fb67b --- /dev/null +++ b/javascript/frameworks/cap/src/codeql-pack.lock.yml @@ -0,0 +1,16 @@ +--- +lockVersion: 1.0.0 +dependencies: + codeql/javascript-all: + version: 0.8.5 + codeql/mad: + version: 0.2.5 + codeql/regex: + version: 0.2.5 + codeql/tutorial: + version: 0.2.5 + codeql/util: + version: 0.2.5 + codeql/yaml: + version: 0.2.5 +compiled: false diff --git a/javascript/frameworks/cap/src/qlpack.yml b/javascript/frameworks/cap/src/qlpack.yml new file mode 100644 index 000000000..112b503ba --- /dev/null +++ b/javascript/frameworks/cap/src/qlpack.yml @@ -0,0 +1,10 @@ +--- +library: false +name: advanced-security/javascript-sap-cap-queries +version: 0.3.0 +suites: codeql-suites +extractor: javascript +dependencies: + codeql/javascript-all: "^0.8.1" + advanced-security/javascript-sap-cap-models: "^0.3.0" + advanced-security/javascript-sap-cap-all: "^0.1.1" \ No newline at end of file diff --git a/javascript/frameworks/cap/src/sqlinjection/SqlInjection.ql b/javascript/frameworks/cap/src/sqlinjection/SqlInjection.ql new file mode 100644 index 000000000..3ca9c8cc6 --- /dev/null +++ b/javascript/frameworks/cap/src/sqlinjection/SqlInjection.ql @@ -0,0 +1,48 @@ +/** + * @name Uncontrolled data in SQL query + * @description Including user-supplied data in a SQL query without + * neutralizing special elements can make code vulnerable + * to SQL Injection. + * @kind problem + * @problem.severity error + * @id javascript/sql-injection-custom + * @tags security + * external/cwe/cwe-089 + */ + +import javascript +import advanced_security.javascript.frameworks.cap.CDS +import advanced_security.javascript.frameworks.cap.CQL + +class SqlInjectionConfiguration extends TaintTracking::Configuration { + SqlInjectionConfiguration(){ + this = "" + } + override predicate isSource(DataFlow::Node source) { + exists(CDS::RequestSource src | + source = src ) + } + + override predicate isSink(DataFlow::Node sink) { + exists(CQL::CQLSink snk | + sink = snk ) + } + + override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) { + //string concatenation in a clause arg taints the clause + exists(CQL::TaintedClause clause | + clause.getArgument() = pred.asExpr() + and clause.asExpr() = succ.asExpr() + ) + or + //less precise, any concat in the alternative sql stmt construction techniques + exists(CQL::ParseCQLTaintedClause parse | + parse.getAnArgument() = pred + and parse = succ + ) + } +} + +from SqlInjectionConfiguration sql , DataFlow::Node source, DataFlow::Node sink +where sql.hasFlow(source, sink) +select sink, "Injection vulnerability found." \ No newline at end of file diff --git a/javascript/frameworks/cap/test/codeql-pack.lock.yml b/javascript/frameworks/cap/test/codeql-pack.lock.yml new file mode 100644 index 000000000..b731a4d91 --- /dev/null +++ b/javascript/frameworks/cap/test/codeql-pack.lock.yml @@ -0,0 +1,22 @@ +--- +lockVersion: 1.0.0 +dependencies: + codeql/javascript-all: + version: 0.8.5 + codeql/javascript-queries: + version: 0.8.5 + codeql/mad: + version: 0.2.5 + codeql/regex: + version: 0.2.5 + codeql/suite-helpers: + version: 0.7.5 + codeql/tutorial: + version: 0.2.5 + codeql/typos: + version: 0.2.5 + codeql/util: + version: 0.2.5 + codeql/yaml: + version: 0.2.5 +compiled: false diff --git a/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.expected b/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.expected new file mode 100644 index 000000000..c79d16090 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.expected @@ -0,0 +1,6 @@ +| applicationserviceinstance.js:2:11:2:61 | new cds ... ptions) | +| applicationserviceinstance.js:3:18:3:68 | new cds ... ptions) | +| applicationserviceinstance.js:4:14:4:44 | cds.con ... rvice') | +| applicationserviceinstance.js:5:20:5:50 | cds.con ... rvice') | +| applicationserviceinstance.js:6:18:6:43 | cds.ser ... rvice') | +| applicationserviceinstance.js:7:24:7:49 | cds.ser ... rvice') | diff --git a/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.js b/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.js new file mode 100644 index 000000000..07e86d7bc --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.js @@ -0,0 +1,7 @@ +const cds = require("@sap/cds"); +let svc = new cds.ApplicationService ("", cds.model, options) +let svc1 = await new cds.ApplicationService ("", cds.model, options) +const svc2 = cds.connect.to ('some-service') +const svc3 = await cds.connect.to ('some-service') +const { svc5 } = cds.serve ('some-service') +const { svc4 } = await cds.serve ('some-service') diff --git a/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.ql b/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.ql new file mode 100644 index 000000000..ae7c7152f --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/applicationserviceinstance/applicationserviceinstance.ql @@ -0,0 +1,5 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CDS + +from CDS::ServiceInstance svc +select svc \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.expected b/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.expected new file mode 100644 index 000000000..f849b37d9 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.expected @@ -0,0 +1 @@ +| oldstyleuserdefined.js:3:18:3:49 | cds.ser ... n(){ }) | diff --git a/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.js b/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.js new file mode 100644 index 000000000..f27d66ba0 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.js @@ -0,0 +1,3 @@ +const cds = require("@sap/cds"); + +module.exports = cds.service.impl (function(){ }) \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.ql b/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.ql new file mode 100644 index 000000000..9d3229dcb --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/oldstyleuserdefined/oldstyleuserdefined.ql @@ -0,0 +1,5 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CDS + +from CDS::OldStyleUserDefinedApplicationService svc +select svc \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.expected b/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.expected new file mode 100644 index 000000000..04bc1e540 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.expected @@ -0,0 +1,3 @@ +| requesthandler.js:5:42:5:44 | req | +| requesthandler.js:6:34:6:36 | req | +| requesthandler.js:16:34:16:36 | req | diff --git a/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.js b/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.js new file mode 100644 index 000000000..369878a17 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.js @@ -0,0 +1,17 @@ +const cds = require("@sap/cds"); +class BooksService extends cds.ApplicationService { + init(){ + const { Books, Authors } = this.entities + this.on ('READ',[Books,Authors], req => req.target.data) + this.on ('UPDATE',Books, req => { + let [ ID ] = req.params + return Object.assign (Books.data[ID], req.data) + }) + return super.init() + } +} +module.exports = BooksService + +cds.serve('./test-service').with ((srv) => { + srv.on ('READ','Books', (req) => req.reply([])) + }) \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.ql b/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.ql new file mode 100644 index 000000000..2b9e269f9 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/requesthandler/requesthandler.ql @@ -0,0 +1,5 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CDS + +from CDS::RequestSource src +select src \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.expected b/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.expected new file mode 100644 index 000000000..f4f448a52 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.expected @@ -0,0 +1 @@ +| userdefinedservice.js:3:1:7:1 | class B ... )\\n }\\n} | diff --git a/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.js b/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.js new file mode 100644 index 000000000..684351cf1 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.js @@ -0,0 +1,8 @@ +const cds = require("@sap/cds"); + +class BooksService extends cds.ApplicationService { + init() { + return super.init() + } +} +module.exports = BooksService \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.ql b/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.ql new file mode 100644 index 000000000..0a3adf59d --- /dev/null +++ b/javascript/frameworks/cap/test/models/cds/userdefinedservice/userdefinedservice.ql @@ -0,0 +1,5 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CDS + +from CDS::UserDefinedApplicationService svc +select svc \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cql/delete/delete.expected b/javascript/frameworks/cap/test/models/cql/delete/delete.expected new file mode 100644 index 000000000..c879ee912 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/delete/delete.expected @@ -0,0 +1,18 @@ +| delete.js:1:15:1:53 | delete.js:1 | delete.js:1:15:1:53 | DELETE. ... "*" }) | +| delete.js:2:15:2:50 | delete.js:2 | delete.js:2:15:2:50 | DELETE. ... 1='*'") | +| delete.js:4:15:4:52 | delete.js:4 | delete.js:4:15:4:52 | DELETE. ... ", "*") | +| delete.js:6:15:6:59 | delete.js:6 | delete.js:6:15:6:59 | DELETE. ... , 10)") | +| delete.js:8:15:8:71 | delete.js:8 | delete.js:8:15:8:71 | DELETE. ... 11 } }) | +| delete.js:10:15:10:32 | delete.js:10 | delete.js:10:15:10:32 | DELETE.from(Table) | +| delete.js:10:15:10:53 | delete.js:10 | delete.js:10:15:10:53 | DELETE. ... "*" }) | +| delete.js:11:15:11:32 | delete.js:11 | delete.js:11:15:11:32 | DELETE.from(Table) | +| delete.js:11:15:11:50 | delete.js:11 | delete.js:11:15:11:50 | DELETE. ... 1='*'") | +| delete.js:12:15:12:32 | delete.js:12 | delete.js:12:15:12:32 | DELETE.from(Table) | +| delete.js:13:15:13:32 | delete.js:13 | delete.js:13:15:13:32 | DELETE.from(Table) | +| delete.js:13:15:13:52 | delete.js:13 | delete.js:13:15:13:52 | DELETE. ... ", "*") | +| delete.js:14:15:14:32 | delete.js:14 | delete.js:14:15:14:32 | DELETE.from(Table) | +| delete.js:15:15:15:32 | delete.js:15 | delete.js:15:15:15:32 | DELETE.from(Table) | +| delete.js:15:15:15:59 | delete.js:15 | delete.js:15:15:15:59 | DELETE. ... , 10)") | +| delete.js:16:15:16:32 | delete.js:16 | delete.js:16:15:16:32 | DELETE.from(Table) | +| delete.js:17:15:17:32 | delete.js:17 | delete.js:17:15:17:32 | DELETE.from(Table) | +| delete.js:17:15:17:71 | delete.js:17 | delete.js:17:15:17:71 | DELETE. ... 11 } }) | diff --git a/javascript/frameworks/cap/test/models/cql/delete/delete.js b/javascript/frameworks/cap/test/models/cql/delete/delete.js new file mode 100644 index 000000000..4ae15ae94 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/delete/delete.js @@ -0,0 +1,17 @@ +var delete_ = DELETE.from`Table`.where({ col1: "*" }); +var delete_ = DELETE.from`Table`.where("col1='*'"); +var delete_ = DELETE.from`Table`.where`col1=${"*"}`; +var delete_ = DELETE.from`Table`.where("col1=", "*"); +var delete_ = DELETE.from`Table`.where`col = ${"*"}`; +var delete_ = DELETE.from`Table`.where("col1 in ('*', 10)"); +var delete_ = DELETE.from`Table`.where`col1 in ${[("*", 10)]}`; +var delete_ = DELETE.from`Table`.where({ col1: 10, and: { col2: 11 } }); + +var delete_ = DELETE.from(Table).where({ col1: "*" }); +var delete_ = DELETE.from(Table).where("col1='*'"); +var delete_ = DELETE.from(Table).where`col1=${"*"}`; +var delete_ = DELETE.from(Table).where("col1=", "*"); +var delete_ = DELETE.from(Table).where`col = ${"*"}`; +var delete_ = DELETE.from(Table).where("col1 in ('*', 10)"); +var delete_ = DELETE.from(Table).where`col1 in ${[("*", 10)]}`; +var delete_ = DELETE.from(Table).where({ col1: 10, and: { col2: 11 } }); \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cql/delete/delete.ql b/javascript/frameworks/cap/test/models/cql/delete/delete.ql new file mode 100644 index 000000000..2c7551107 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/delete/delete.ql @@ -0,0 +1,6 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CQL + +from CQL::CqlClause s +select s.getLocation(), s + diff --git a/javascript/frameworks/cap/test/models/cql/insert/insert.expected b/javascript/frameworks/cap/test/models/cql/insert/insert.expected new file mode 100644 index 000000000..d82dfe113 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/insert/insert.expected @@ -0,0 +1,50 @@ +| insert.js:2:14:5:2 | insert.js:2 | insert.js:2:14:5:2 | INSERT( ... " },\\n]) | +| insert.js:2:14:5:14 | insert.js:2 | insert.js:2:14:5:14 | INSERT( ... (Table) | +| insert.js:6:14:9:2 | insert.js:6 | insert.js:6:14:9:2 | INSERT( ... " },\\n]) | +| insert.js:6:14:9:16 | insert.js:6 | insert.js:6:14:9:16 | INSERT( ... Table") | +| insert.js:11:14:14:2 | insert.js:11 | insert.js:11:14:14:2 | INSERT. ... " },\\n]) | +| insert.js:15:14:18:2 | insert.js:15 | insert.js:15:14:18:2 | INSERT. ... " },\\n]) | +| insert.js:21:14:21:31 | insert.js:21 | insert.js:21:14:21:31 | INSERT.into(Table) | +| insert.js:21:14:24:1 | insert.js:21 | insert.js:21:14:24:1 | INSERT. ... 22" }\\n) | +| insert.js:25:14:25:31 | insert.js:25 | insert.js:25:14:25:31 | INSERT.into(Table) | +| insert.js:25:14:28:2 | insert.js:25 | insert.js:25:14:28:2 | INSERT. ... " },\\n]) | +| insert.js:29:14:29:33 | insert.js:29 | insert.js:29:14:29:33 | INSERT.into("Table") | +| insert.js:29:14:32:2 | insert.js:29 | insert.js:29:14:32:2 | INSERT. ... " },\\n]) | +| insert.js:33:14:33:33 | insert.js:33 | insert.js:33:14:33:33 | INSERT.into("Table") | +| insert.js:33:14:36:2 | insert.js:33 | insert.js:33:14:36:2 | INSERT. ... " },\\n]) | +| insert.js:37:14:40:2 | insert.js:37 | insert.js:37:14:40:2 | INSERT. ... " },\\n]) | +| insert.js:41:14:44:2 | insert.js:41 | insert.js:41:14:44:2 | INSERT. ... " },\\n]) | +| insert.js:47:14:47:31 | insert.js:47 | insert.js:47:14:47:31 | INSERT.into(Table) | +| insert.js:47:14:48:26 | insert.js:47 | insert.js:47:14:48:26 | INSERT. ... "col2") | +| insert.js:47:14:49:27 | insert.js:47 | insert.js:47:14:49:27 | INSERT. ... val12") | +| insert.js:50:14:50:33 | insert.js:50 | insert.js:50:14:50:33 | INSERT.into("Table") | +| insert.js:50:14:51:26 | insert.js:50 | insert.js:50:14:51:26 | INSERT. ... "col2") | +| insert.js:50:14:52:27 | insert.js:50 | insert.js:50:14:52:27 | INSERT. ... val12") | +| insert.js:53:14:54:26 | insert.js:53 | insert.js:53:14:54:26 | INSERT. ... "col2") | +| insert.js:53:14:55:27 | insert.js:53 | insert.js:53:14:55:27 | INSERT. ... val12") | +| insert.js:58:14:58:31 | insert.js:58 | insert.js:58:14:58:31 | INSERT.into(Table) | +| insert.js:58:14:59:26 | insert.js:58 | insert.js:58:14:59:26 | INSERT. ... "col2") | +| insert.js:58:14:63:4 | insert.js:58 | insert.js:58:14:63:4 | INSERT. ... ],\\n ]) | +| insert.js:64:14:64:33 | insert.js:64 | insert.js:64:14:64:33 | INSERT.into("Table") | +| insert.js:64:14:65:26 | insert.js:64 | insert.js:64:14:65:26 | INSERT. ... "col2") | +| insert.js:64:14:69:4 | insert.js:64 | insert.js:64:14:69:4 | INSERT. ... ],\\n ]) | +| insert.js:70:14:70:55 | insert.js:70 | insert.js:70:14:70:55 | INSERT. ... "col2") | +| insert.js:70:14:73:2 | insert.js:70 | insert.js:70:14:73:2 | INSERT. ... 2"],\\n]) | +| insert.js:76:14:76:31 | insert.js:76 | insert.js:76:14:76:31 | INSERT.into(Table) | +| insert.js:76:14:76:74 | insert.js:76 | insert.js:76:14:76:74 | INSERT. ... col2`) | +| insert.js:77:14:77:31 | insert.js:77 | insert.js:77:14:77:31 | INSERT.into(Table) | +| insert.js:77:14:77:73 | insert.js:77 | insert.js:77:14:77:73 | INSERT. ... {"*"}`) | +| insert.js:78:14:78:31 | insert.js:78 | insert.js:78:14:78:31 | INSERT.into(Table) | +| insert.js:78:14:80:1 | insert.js:78 | insert.js:78:14:80:1 | INSERT. ... "*"}`\\n) | +| insert.js:79:3:79:44 | insert.js:79 | insert.js:79:3:79:44 | SELECT. ... "col2") | +| insert.js:82:14:82:33 | insert.js:82 | insert.js:82:14:82:33 | INSERT.into("Table") | +| insert.js:82:14:82:76 | insert.js:82 | insert.js:82:14:82:76 | INSERT. ... col2`) | +| insert.js:83:14:83:33 | insert.js:83 | insert.js:83:14:83:33 | INSERT.into("Table") | +| insert.js:83:14:83:75 | insert.js:83 | insert.js:83:14:83:75 | INSERT. ... {"*"}`) | +| insert.js:84:14:84:33 | insert.js:84 | insert.js:84:14:84:33 | INSERT.into("Table") | +| insert.js:84:14:86:1 | insert.js:84 | insert.js:84:14:86:1 | INSERT. ... "*"}`\\n) | +| insert.js:85:3:85:44 | insert.js:85 | insert.js:85:3:85:44 | SELECT. ... "col2") | +| insert.js:88:14:88:74 | insert.js:88 | insert.js:88:14:88:74 | INSERT. ... col2`) | +| insert.js:89:14:89:73 | insert.js:89 | insert.js:89:14:89:73 | INSERT. ... {"*"}`) | +| insert.js:90:14:92:1 | insert.js:90 | insert.js:90:14:92:1 | INSERT. ... "*"}`\\n) | +| insert.js:91:3:91:44 | insert.js:91 | insert.js:91:3:91:44 | SELECT. ... "col2") | diff --git a/javascript/frameworks/cap/test/models/cql/insert/insert.js b/javascript/frameworks/cap/test/models/cql/insert/insert.js new file mode 100644 index 000000000..7be1090e1 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/insert/insert.js @@ -0,0 +1,92 @@ +/* ========== into ========== */ +var insert = INSERT([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]).into(Table); +var insert = INSERT([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]).into("Table"); + +var insert = INSERT.into(Table, [ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var insert = INSERT.into("Table", [ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); + +/* ========== into, entries ========== */ +var insert = INSERT.into(Table).entries( + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" } +); +var insert = INSERT.into(Table).entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var insert = INSERT.into("Table").entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var insert = INSERT.into("Table").entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var insert = INSERT.into`Table`.entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var insert = INSERT.into`Table`.entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); + +/* ========== into, columns, values ========== */ +var insert = INSERT.into(Table) + .columns("col1", "col2") + .values("val11", "val12"); +var insert = INSERT.into("Table") + .columns("col1", "col2") + .values("val11", "val12"); +var insert = INSERT.into`Table` + .columns("col1", "col2") + .values("val11", "val12"); + +/* ========== into, columns, rows ========== */ +var insert = INSERT.into(Table) + .columns("col1", "col2") + .rows([ + ["val11", "val12"], + ["val21", "val22"], + ]); +var insert = INSERT.into("Table") + .columns("col1", "col2") + .rows([ + ["val11", "val12"], + ["val21", "val22"], + ]); +var insert = INSERT.into`Table`.columns("col1", "col2").rows([ + ["val11", "val12"], + ["val21", "val22"], +]); + +/* ========== into, as ========== */ +var insert = INSERT.into(Table).as(SELECT.from`Table`.columns`col1, col2`); +var insert = INSERT.into(Table).as(SELECT.from`Table`.where`col1=${"*"}`); +var insert = INSERT.into(Table).as( + SELECT.from`Table`.groupBy("col1", "col2").having`col1=${"*"}` +); + +var insert = INSERT.into("Table").as(SELECT.from`Table`.columns`col1, col2`); +var insert = INSERT.into("Table").as(SELECT.from`Table`.where`col1=${"*"}`); +var insert = INSERT.into("Table").as( + SELECT.from`Table`.groupBy("col1", "col2").having`col1=${"*"}` +); + +var insert = INSERT.into`Table`.as(SELECT.from`Table`.columns`col1, col2`); +var insert = INSERT.into`Table`.as(SELECT.from`Table`.where`col1=${"*"}`); +var insert = INSERT.into`Table`.as( + SELECT.from`Table`.groupBy("col1", "col2").having`col1=${"*"}` +); diff --git a/javascript/frameworks/cap/test/models/cql/insert/insert.ql b/javascript/frameworks/cap/test/models/cql/insert/insert.ql new file mode 100644 index 000000000..3f53113e1 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/insert/insert.ql @@ -0,0 +1,5 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CQL + +from CQL::CqlClause s +select s.getLocation(), s diff --git a/javascript/frameworks/cap/test/models/cql/select/select.expected b/javascript/frameworks/cap/test/models/cql/select/select.expected new file mode 100644 index 000000000..2b04cdd57 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/select/select.expected @@ -0,0 +1,188 @@ +| select2.js:4:14:4:35 | select2.js:4 | select2.js:4:14:4:35 | SELECT. ... (Table) | +| select.js:3:14:3:43 | select.js:3 | select.js:3:14:3:43 | SELECT` ... (Table) | +| select.js:4:14:4:45 | select.js:4 | select.js:4:14:4:45 | SELECT` ... Table") | +| select.js:5:14:5:33 | select.js:5 | select.js:5:14:5:33 | SELECT("col1, col2") | +| select.js:6:14:6:33 | select.js:6 | select.js:6:14:6:33 | SELECT("col1, col2") | +| select.js:6:14:6:45 | select.js:6 | select.js:6:14:6:45 | SELECT( ... (Table) | +| select.js:7:14:7:33 | select.js:7 | select.js:7:14:7:33 | SELECT("col1, col2") | +| select.js:7:14:7:47 | select.js:7 | select.js:7:14:7:47 | SELECT( ... Table") | +| select.js:11:14:11:35 | select.js:11 | select.js:11:14:11:35 | SELECT. ... (Table) | +| select.js:13:14:13:40 | select.js:13 | select.js:13:14:13:40 | SELECT. ... (Table) | +| select.js:14:14:14:54 | select.js:14 | select.js:14:14:14:54 | SELECT. ... (Table) | +| select.js:20:14:22:2 | select.js:20 | select.js:20:14:22:2 | SELECT. ... ol2;\\n}) | +| select.js:24:14:24:68 | select.js:24 | select.js:24:14:24:68 | SELECT. ... Alias") | +| select.js:25:14:28:2 | select.js:25 | select.js:25:14:28:2 | SELECT. ... " },\\n]) | +| select.js:29:14:32:2 | select.js:29 | select.js:29:14:32:2 | SELECT. ... ty",\\n}) | +| select.js:34:14:34:31 | select.js:34 | select.js:34:14:34:31 | SELECT.from(Table) | +| select.js:35:14:35:31 | select.js:35 | select.js:35:14:35:31 | SELECT.from(Table) | +| select.js:35:14:37:2 | select.js:35 | select.js:35:14:37:2 | SELECT. ... ol2;\\n}) | +| select.js:38:14:38:31 | select.js:38 | select.js:38:14:38:31 | SELECT.from(Table) | +| select.js:39:14:39:31 | select.js:39 | select.js:39:14:39:31 | SELECT.from(Table) | +| select.js:39:14:39:68 | select.js:39 | select.js:39:14:39:68 | SELECT. ... Alias") | +| select.js:40:14:40:31 | select.js:40 | select.js:40:14:40:31 | SELECT.from(Table) | +| select.js:40:14:43:2 | select.js:40 | select.js:40:14:43:2 | SELECT. ... " },\\n]) | +| select.js:44:14:44:31 | select.js:44 | select.js:44:14:44:31 | SELECT.from(Table) | +| select.js:44:14:47:2 | select.js:44 | select.js:44:14:47:2 | SELECT. ... ty",\\n}) | +| select.js:50:14:50:52 | select.js:50 | select.js:50:14:50:52 | SELECT. ... "*" }) | +| select.js:51:14:51:49 | select.js:51 | select.js:51:14:51:49 | SELECT. ... 1='*'") | +| select.js:53:14:53:51 | select.js:53 | select.js:53:14:53:51 | SELECT. ... ", "*") | +| select.js:55:14:55:58 | select.js:55 | select.js:55:14:55:58 | SELECT. ... , 10)") | +| select.js:57:14:57:70 | select.js:57 | select.js:57:14:57:70 | SELECT. ... 11 } }) | +| select.js:59:14:59:31 | select.js:59 | select.js:59:14:59:31 | SELECT.from(Table) | +| select.js:59:14:59:52 | select.js:59 | select.js:59:14:59:52 | SELECT. ... "*" }) | +| select.js:60:14:60:31 | select.js:60 | select.js:60:14:60:31 | SELECT.from(Table) | +| select.js:60:14:60:49 | select.js:60 | select.js:60:14:60:49 | SELECT. ... 1='*'") | +| select.js:61:14:61:31 | select.js:61 | select.js:61:14:61:31 | SELECT.from(Table) | +| select.js:62:14:62:31 | select.js:62 | select.js:62:14:62:31 | SELECT.from(Table) | +| select.js:62:14:62:51 | select.js:62 | select.js:62:14:62:51 | SELECT. ... ", "*") | +| select.js:63:14:63:31 | select.js:63 | select.js:63:14:63:31 | SELECT.from(Table) | +| select.js:64:14:64:31 | select.js:64 | select.js:64:14:64:31 | SELECT.from(Table) | +| select.js:64:14:64:58 | select.js:64 | select.js:64:14:64:58 | SELECT. ... , 10)") | +| select.js:65:14:65:31 | select.js:65 | select.js:65:14:65:31 | SELECT.from(Table) | +| select.js:66:14:66:31 | select.js:66 | select.js:66:14:66:31 | SELECT.from(Table) | +| select.js:66:14:66:70 | select.js:66 | select.js:66:14:66:70 | SELECT. ... 11 } }) | +| select.js:69:14:69:55 | select.js:69 | select.js:69:14:69:55 | SELECT. ... "col2") | +| select.js:71:14:71:67 | select.js:71 | select.js:71:14:71:67 | SELECT. ... prop2") | +| select.js:73:14:76:1 | select.js:73 | select.js:73:14:76:1 | SELECT. ... 2"] }\\n) | +| select.js:78:14:78:31 | select.js:78 | select.js:78:14:78:31 | SELECT.from(Table) | +| select.js:78:14:78:55 | select.js:78 | select.js:78:14:78:55 | SELECT. ... "col2") | +| select.js:79:14:79:31 | select.js:79 | select.js:79:14:79:31 | SELECT.from(Table) | +| select.js:80:14:80:31 | select.js:80 | select.js:80:14:80:31 | SELECT.from(Table) | +| select.js:80:14:80:67 | select.js:80 | select.js:80:14:80:67 | SELECT. ... prop2") | +| select.js:81:14:81:31 | select.js:81 | select.js:81:14:81:31 | SELECT.from(Table) | +| select.js:82:14:82:31 | select.js:82 | select.js:82:14:82:31 | SELECT.from(Table) | +| select.js:82:14:85:1 | select.js:82 | select.js:82:14:85:1 | SELECT. ... 2"] }\\n) | +| select.js:88:14:88:53 | select.js:88 | select.js:88:14:88:53 | SELECT. ... "*" }) | +| select.js:89:14:89:50 | select.js:89 | select.js:89:14:89:50 | SELECT. ... 1='*'") | +| select.js:91:14:91:52 | select.js:91 | select.js:91:14:91:52 | SELECT. ... ", "*") | +| select.js:93:14:93:59 | select.js:93 | select.js:93:14:93:59 | SELECT. ... , 10)") | +| select.js:95:14:95:71 | select.js:95 | select.js:95:14:95:71 | SELECT. ... 11 } }) | +| select.js:97:14:97:31 | select.js:97 | select.js:97:14:97:31 | SELECT.from(Table) | +| select.js:97:14:97:53 | select.js:97 | select.js:97:14:97:53 | SELECT. ... "*" }) | +| select.js:98:14:98:31 | select.js:98 | select.js:98:14:98:31 | SELECT.from(Table) | +| select.js:98:14:98:50 | select.js:98 | select.js:98:14:98:50 | SELECT. ... 1='*'") | +| select.js:99:14:99:31 | select.js:99 | select.js:99:14:99:31 | SELECT.from(Table) | +| select.js:100:14:100:31 | select.js:100 | select.js:100:14:100:31 | SELECT.from(Table) | +| select.js:100:14:100:52 | select.js:100 | select.js:100:14:100:52 | SELECT. ... ", "*") | +| select.js:101:14:101:31 | select.js:101 | select.js:101:14:101:31 | SELECT.from(Table) | +| select.js:102:14:102:31 | select.js:102 | select.js:102:14:102:31 | SELECT.from(Table) | +| select.js:102:14:102:59 | select.js:102 | select.js:102:14:102:59 | SELECT. ... , 10)") | +| select.js:103:14:103:31 | select.js:103 | select.js:103:14:103:31 | SELECT.from(Table) | +| select.js:104:14:104:31 | select.js:104 | select.js:104:14:104:31 | SELECT.from(Table) | +| select.js:104:14:104:71 | select.js:104 | select.js:104:14:104:71 | SELECT. ... 11 } }) | +| select.js:106:14:106:55 | select.js:106 | select.js:106:14:106:55 | SELECT. ... "col2") | +| select.js:106:14:106:77 | select.js:106 | select.js:106:14:106:77 | SELECT. ... "*" }) | +| select.js:107:14:107:55 | select.js:107 | select.js:107:14:107:55 | SELECT. ... "col2") | +| select.js:107:14:107:74 | select.js:107 | select.js:107:14:107:74 | SELECT. ... 1='*'") | +| select.js:108:14:108:55 | select.js:108 | select.js:108:14:108:55 | SELECT. ... "col2") | +| select.js:109:14:109:55 | select.js:109 | select.js:109:14:109:55 | SELECT. ... "col2") | +| select.js:109:14:109:76 | select.js:109 | select.js:109:14:109:76 | SELECT. ... ", "*") | +| select.js:110:14:110:55 | select.js:110 | select.js:110:14:110:55 | SELECT. ... "col2") | +| select.js:111:14:112:26 | select.js:111 | select.js:111:14:112:26 | SELECT. ... "col2") | +| select.js:111:14:113:30 | select.js:111 | select.js:111:14:113:30 | SELECT. ... , 10)") | +| select.js:114:14:114:55 | select.js:114 | select.js:114:14:114:55 | SELECT. ... "col2") | +| select.js:117:14:118:26 | select.js:117 | select.js:117:14:118:26 | SELECT. ... "col2") | +| select.js:117:14:119:42 | select.js:117 | select.js:117:14:119:42 | SELECT. ... 11 } }) | +| select.js:121:14:121:31 | select.js:121 | select.js:121:14:121:31 | SELECT.from(Table) | +| select.js:121:14:121:55 | select.js:121 | select.js:121:14:121:55 | SELECT. ... "col2") | +| select.js:121:14:121:77 | select.js:121 | select.js:121:14:121:77 | SELECT. ... "*" }) | +| select.js:122:14:122:31 | select.js:122 | select.js:122:14:122:31 | SELECT.from(Table) | +| select.js:122:14:122:55 | select.js:122 | select.js:122:14:122:55 | SELECT. ... "col2") | +| select.js:122:14:122:74 | select.js:122 | select.js:122:14:122:74 | SELECT. ... 1='*'") | +| select.js:123:14:123:31 | select.js:123 | select.js:123:14:123:31 | SELECT.from(Table) | +| select.js:123:14:123:55 | select.js:123 | select.js:123:14:123:55 | SELECT. ... "col2") | +| select.js:124:14:124:31 | select.js:124 | select.js:124:14:124:31 | SELECT.from(Table) | +| select.js:124:14:124:55 | select.js:124 | select.js:124:14:124:55 | SELECT. ... "col2") | +| select.js:124:14:124:76 | select.js:124 | select.js:124:14:124:76 | SELECT. ... ", "*") | +| select.js:125:14:125:31 | select.js:125 | select.js:125:14:125:31 | SELECT.from(Table) | +| select.js:125:14:125:55 | select.js:125 | select.js:125:14:125:55 | SELECT. ... "col2") | +| select.js:126:14:126:31 | select.js:126 | select.js:126:14:126:31 | SELECT.from(Table) | +| select.js:126:14:127:26 | select.js:126 | select.js:126:14:127:26 | SELECT. ... "col2") | +| select.js:126:14:128:30 | select.js:126 | select.js:126:14:128:30 | SELECT. ... , 10)") | +| select.js:129:14:129:31 | select.js:129 | select.js:129:14:129:31 | SELECT.from(Table) | +| select.js:129:14:129:55 | select.js:129 | select.js:129:14:129:55 | SELECT. ... "col2") | +| select.js:132:14:132:31 | select.js:132 | select.js:132:14:132:31 | SELECT.from(Table) | +| select.js:132:14:133:26 | select.js:132 | select.js:132:14:133:26 | SELECT. ... "col2") | +| select.js:132:14:134:42 | select.js:132 | select.js:132:14:134:42 | SELECT. ... 11 } }) | +| select.js:136:14:136:73 | select.js:136 | select.js:136:14:136:73 | SELECT. ... "*" }) | +| select.js:137:14:137:70 | select.js:137 | select.js:137:14:137:70 | SELECT. ... 1='*'") | +| select.js:139:14:139:72 | select.js:139 | select.js:139:14:139:72 | SELECT. ... ", "*") | +| select.js:141:14:141:79 | select.js:141 | select.js:141:14:141:79 | SELECT. ... , 10)") | +| select.js:145:14:148:2 | select.js:145 | select.js:145:14:148:2 | SELECT. ... 1 },\\n}) | +| select.js:150:14:150:51 | select.js:150 | select.js:150:14:150:51 | SELECT. ... , col2) | +| select.js:150:14:150:73 | select.js:150 | select.js:150:14:150:73 | SELECT. ... "*" }) | +| select.js:151:14:151:51 | select.js:151 | select.js:151:14:151:51 | SELECT. ... , col2) | +| select.js:151:14:151:70 | select.js:151 | select.js:151:14:151:70 | SELECT. ... 1='*'") | +| select.js:152:14:152:51 | select.js:152 | select.js:152:14:152:51 | SELECT. ... , col2) | +| select.js:153:14:153:51 | select.js:153 | select.js:153:14:153:51 | SELECT. ... , col2) | +| select.js:153:14:153:72 | select.js:153 | select.js:153:14:153:72 | SELECT. ... ", "*") | +| select.js:154:14:154:51 | select.js:154 | select.js:154:14:154:51 | SELECT. ... , col2) | +| select.js:155:14:155:51 | select.js:155 | select.js:155:14:155:51 | SELECT. ... , col2) | +| select.js:155:14:155:79 | select.js:155 | select.js:155:14:155:79 | SELECT. ... , 10)") | +| select.js:156:14:156:51 | select.js:156 | select.js:156:14:156:51 | SELECT. ... , col2) | +| select.js:159:14:159:51 | select.js:159 | select.js:159:14:159:51 | SELECT. ... , col2) | +| select.js:159:14:162:2 | select.js:159 | select.js:159:14:162:2 | SELECT. ... 1 },\\n}) | +| select.js:164:14:165:38 | select.js:164 | select.js:164:14:165:38 | SELECT. ... prop2") | +| select.js:164:14:166:24 | select.js:164 | select.js:164:14:166:24 | SELECT. ... "*" }) | +| select.js:167:14:168:38 | select.js:167 | select.js:167:14:168:38 | SELECT. ... prop2") | +| select.js:167:14:169:21 | select.js:167 | select.js:167:14:169:21 | SELECT. ... 1='*'") | +| select.js:170:14:170:67 | select.js:170 | select.js:170:14:170:67 | SELECT. ... prop2") | +| select.js:172:14:173:38 | select.js:172 | select.js:172:14:173:38 | SELECT. ... prop2") | +| select.js:172:14:174:23 | select.js:172 | select.js:172:14:174:23 | SELECT. ... ", "*") | +| select.js:175:14:175:67 | select.js:175 | select.js:175:14:175:67 | SELECT. ... prop2") | +| select.js:177:14:178:38 | select.js:177 | select.js:177:14:178:38 | SELECT. ... prop2") | +| select.js:177:14:179:30 | select.js:177 | select.js:177:14:179:30 | SELECT. ... , 10)") | +| select.js:180:14:180:67 | select.js:180 | select.js:180:14:180:67 | SELECT. ... prop2") | +| select.js:182:14:183:38 | select.js:182 | select.js:182:14:183:38 | SELECT. ... prop2") | +| select.js:182:14:184:42 | select.js:182 | select.js:182:14:184:42 | SELECT. ... 11 } }) | +| select.js:186:14:188:2 | select.js:186 | select.js:186:14:188:2 | SELECT. ... "*",\\n}) | +| select.js:189:14:191:1 | select.js:189 | select.js:189:14:191:1 | SELECT. ... ='*'"\\n) | +| select.js:194:14:197:1 | select.js:194 | select.js:194:14:197:1 | SELECT. ... "*"\\n) | +| select.js:200:14:202:1 | select.js:200 | select.js:200:14:202:1 | SELECT. ... 10)"\\n) | +| select.js:205:14:208:2 | select.js:205 | select.js:205:14:208:2 | SELECT. ... 1 },\\n}) | +| select.js:210:14:211:66 | select.js:210 | select.js:210:14:211:66 | SELECT. ... p2"] }) | +| select.js:210:14:212:24 | select.js:210 | select.js:210:14:212:24 | SELECT. ... "*" }) | +| select.js:213:14:214:66 | select.js:213 | select.js:213:14:214:66 | SELECT. ... p2"] }) | +| select.js:213:14:215:21 | select.js:213 | select.js:213:14:215:21 | SELECT. ... 1='*'") | +| select.js:216:14:219:1 | select.js:216 | select.js:216:14:219:1 | SELECT. ... 2"] }\\n) | +| select.js:220:14:221:66 | select.js:220 | select.js:220:14:221:66 | SELECT. ... p2"] }) | +| select.js:220:14:222:23 | select.js:220 | select.js:220:14:222:23 | SELECT. ... ", "*") | +| select.js:223:14:226:1 | select.js:223 | select.js:223:14:226:1 | SELECT. ... 2"] }\\n) | +| select.js:227:14:228:66 | select.js:227 | select.js:227:14:228:66 | SELECT. ... p2"] }) | +| select.js:227:14:229:30 | select.js:227 | select.js:227:14:229:30 | SELECT. ... , 10)") | +| select.js:230:14:233:1 | select.js:230 | select.js:230:14:233:1 | SELECT. ... 2"] }\\n) | +| select.js:234:14:235:66 | select.js:234 | select.js:234:14:235:66 | SELECT. ... p2"] }) | +| select.js:234:14:236:42 | select.js:234 | select.js:234:14:236:42 | SELECT. ... 11 } }) | +| select.js:248:14:248:31 | select.js:248 | select.js:248:14:248:31 | SELECT.from(Table) | +| select.js:249:14:249:31 | select.js:249 | select.js:249:14:249:31 | SELECT.from(Table) | +| select.js:250:14:250:31 | select.js:250 | select.js:250:14:250:31 | SELECT.from(Table) | +| select.js:251:14:251:31 | select.js:251 | select.js:251:14:251:31 | SELECT.from(Table) | +| select.js:252:14:252:31 | select.js:252 | select.js:252:14:252:31 | SELECT.from(Table) | +| select.js:253:14:253:31 | select.js:253 | select.js:253:14:253:31 | SELECT.from(Table) | +| select.js:254:14:254:31 | select.js:254 | select.js:254:14:254:31 | SELECT.from(Table) | +| select.js:255:14:255:31 | select.js:255 | select.js:255:14:255:31 | SELECT.from(Table) | +| select.js:258:14:258:41 | select.js:258 | select.js:258:14:258:41 | SELECT. ... mit(10) | +| select.js:260:14:260:45 | select.js:260 | select.js:260:14:260:45 | SELECT. ... 10, 20) | +| select.js:261:14:261:50 | select.js:261 | select.js:261:14:261:50 | SELECT. ... : 10 }) | +| select.js:262:14:262:63 | select.js:262 | select.js:262:14:262:63 | SELECT. ... : 20 }) | +| select.js:263:14:263:60 | select.js:263 | select.js:263:14:263:60 | SELECT. ... al"] }) | +| select.js:264:14:266:2 | select.js:264 | select.js:264:14:266:2 | SELECT. ... }],\\n}) | +| select.js:268:14:268:31 | select.js:268 | select.js:268:14:268:31 | SELECT.from(Table) | +| select.js:268:14:268:41 | select.js:268 | select.js:268:14:268:41 | SELECT. ... mit(10) | +| select.js:269:14:269:31 | select.js:269 | select.js:269:14:269:31 | SELECT.from(Table) | +| select.js:270:14:270:31 | select.js:270 | select.js:270:14:270:31 | SELECT.from(Table) | +| select.js:270:14:270:45 | select.js:270 | select.js:270:14:270:45 | SELECT. ... 10, 20) | +| select.js:271:14:271:31 | select.js:271 | select.js:271:14:271:31 | SELECT.from(Table) | +| select.js:271:14:271:50 | select.js:271 | select.js:271:14:271:50 | SELECT. ... : 10 }) | +| select.js:272:14:272:31 | select.js:272 | select.js:272:14:272:31 | SELECT.from(Table) | +| select.js:272:14:272:63 | select.js:272 | select.js:272:14:272:63 | SELECT. ... : 20 }) | +| select.js:273:14:273:31 | select.js:273 | select.js:273:14:273:31 | SELECT.from(Table) | +| select.js:273:14:273:60 | select.js:273 | select.js:273:14:273:60 | SELECT. ... al"] }) | +| select.js:274:14:274:31 | select.js:274 | select.js:274:14:274:31 | SELECT.from(Table) | +| select.js:274:14:276:2 | select.js:274 | select.js:274:14:276:2 | SELECT. ... }],\\n}) | +| select.js:279:14:280:35 | select.js:279 | select.js:279:14:280:35 | SELECT. ... pdate() | +| select.js:283:14:284:38 | select.js:283 | select.js:283:14:284:38 | SELECT. ... eLock() | +| select.js:287:14:290:1 | select.js:287 | select.js:287:14:290:1 | SELECT. ... col2"\\n) | +| select.js:287:14:292:2 | select.js:287 | select.js:287:14:292:2 | SELECT. ... }],\\n}) | +| select.js:287:14:292:48 | select.js:287 | select.js:287:14:292:48 | SELECT. ... eLock() | +| select.js:325:10:325:28 | select.js:325 | select.js:325:10:325:28 | SELECT.from (Books) | diff --git a/javascript/frameworks/cap/test/models/cql/select/select.js b/javascript/frameworks/cap/test/models/cql/select/select.js new file mode 100644 index 000000000..6be706f4d --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/select/select.js @@ -0,0 +1,325 @@ +/* ========== SELECT acting as shortcut to SELECT.columns ========== */ +var select = SELECT`col1, col2`.from`Table`; +var select = SELECT`col1, col2`.from(Table); +var select = SELECT`col1, col2`.from("Table"); +var select = SELECT("col1, col2").from`Table`; +var select = SELECT("col1, col2").from(Table); +var select = SELECT("col1, col2").from("Table"); + +/* ========== SELECTs with property accesses ========== */ +var select = SELECT.one.from`Table`; +var select = SELECT.one.from(Table); +var select = SELECT.distinct.from`Table`; +var select = SELECT.distinct.from(Table); +var select = SELECT.one.two.three.distinct.from(Table); +var select = SELECT.one.two.three.distinct.from`Table`; + +/* ========== SELECTs with method calls ========== */ +// .columns() +var select = SELECT.from`Table`.columns`col1, col2`; +var select = SELECT.from`Table`.columns((data) => { + data.col1, data.col2; +}); +var select = SELECT.from`Table`.columns`{ col1, col2 as col2Alias }`; +var select = SELECT.from`Table`.columns("col1", "col2 as col2Alias"); +var select = SELECT.from`Table`.columns([ + "col1", + { ref: ["col2", "prop"], as: "property" }, +]); +var select = SELECT.from`Table`.columns("col1", { + ref: ["col2", "prop"], + as: "property", +}); + +var select = SELECT.from(Table).columns`col1, col2`; +var select = SELECT.from(Table).columns((data) => { + data.col1, data.col2; +}); +var select = SELECT.from(Table).columns`{ col1, col2 as col2Alias }`; +var select = SELECT.from(Table).columns("col1", "col2 as col2Alias"); +var select = SELECT.from(Table).columns([ + "col1", + { ref: ["col2", "prop"], as: "property" }, +]); +var select = SELECT.from(Table).columns("col1", { + ref: ["col2", "prop"], + as: "property", +}); + +// .where() +var select = SELECT.from`Table`.where({ col1: "*" }); +var select = SELECT.from`Table`.where("col1='*'"); +var select = SELECT.from`Table`.where`col1=${"*"}`; +var select = SELECT.from`Table`.where("col1=", "*"); +var select = SELECT.from`Table`.where`col = ${"*"}`; +var select = SELECT.from`Table`.where("col1 in ('*', 10)"); +var select = SELECT.from`Table`.where`col1 in ${[("*", 10)]}`; +var select = SELECT.from`Table`.where({ col1: 10, and: { col2: 11 } }); + +var select = SELECT.from(Table).where({ col1: "*" }); +var select = SELECT.from(Table).where("col1='*'"); +var select = SELECT.from(Table).where`col1=${"*"}`; +var select = SELECT.from(Table).where("col1=", "*"); +var select = SELECT.from(Table).where`col = ${"*"}`; +var select = SELECT.from(Table).where("col1 in ('*', 10)"); +var select = SELECT.from(Table).where`col1 in ${[("*", 10)]}`; +var select = SELECT.from(Table).where({ col1: 10, and: { col2: 11 } }); + +// .groupBy() +var select = SELECT.from`Table`.groupBy("col1", "col2"); +var select = SELECT.from`Table`.groupBy`col1, col2`; +var select = SELECT.from`Table`.groupBy("col1.prop1", "col2.prop2"); +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2`; +var select = SELECT.from`Table`.groupBy( + { ref: ["col1", "prop1"] }, + { ref: ["col2", "prop2"] } +); + +var select = SELECT.from(Table).groupBy("col1", "col2"); +var select = SELECT.from(Table).groupBy`col1, col2`; +var select = SELECT.from(Table).groupBy("col1.prop1", "col2.prop2"); +var select = SELECT.from(Table).groupBy`col1.prop1, col2.prop2`; +var select = SELECT.from(Table).groupBy( + { ref: ["col1", "prop1"] }, + { ref: ["col2", "prop2"] } +); + +// .having() +var select = SELECT.from`Table`.having({ col1: "*" }); +var select = SELECT.from`Table`.having("col1='*'"); +var select = SELECT.from`Table`.having`col1=${"*"}`; +var select = SELECT.from`Table`.having("col1=", "*"); +var select = SELECT.from`Table`.having`col = ${"*"}`; +var select = SELECT.from`Table`.having("col1 in ('*', 10)"); +var select = SELECT.from`Table`.having`col1 in ${[("*", 10)]}`; +var select = SELECT.from`Table`.having({ col1: 10, and: { col2: 11 } }); + +var select = SELECT.from(Table).having({ col1: "*" }); +var select = SELECT.from(Table).having("col1='*'"); +var select = SELECT.from(Table).having`col1=${"*"}`; +var select = SELECT.from(Table).having("col1=", "*"); +var select = SELECT.from(Table).having`col = ${"*"}`; +var select = SELECT.from(Table).having("col1 in ('*', 10)"); +var select = SELECT.from(Table).having`col1 in ${[("*", 10)]}`; +var select = SELECT.from(Table).having({ col1: 10, and: { col2: 11 } }); + +var select = SELECT.from`Table`.groupBy("col1", "col2").having({ col1: "*" }); +var select = SELECT.from`Table`.groupBy("col1", "col2").having("col1='*'"); +var select = SELECT.from`Table`.groupBy("col1", "col2").having`col1=${"*"}`; +var select = SELECT.from`Table`.groupBy("col1", "col2").having("col1=", "*"); +var select = SELECT.from`Table`.groupBy("col1", "col2").having`col = ${"*"}`; +var select = SELECT.from`Table` + .groupBy("col1", "col2") + .having("col1 in ('*', 10)"); +var select = SELECT.from`Table`.groupBy("col1", "col2").having`col1 in ${[ + ("*", 10), +]}`; +var select = SELECT.from`Table` + .groupBy("col1", "col2") + .having({ col1: 10, and: { col2: 11 } }); + +var select = SELECT.from(Table).groupBy("col1", "col2").having({ col1: "*" }); +var select = SELECT.from(Table).groupBy("col1", "col2").having("col1='*'"); +var select = SELECT.from(Table).groupBy("col1", "col2").having`col1=${"*"}`; +var select = SELECT.from(Table).groupBy("col1", "col2").having("col1=", "*"); +var select = SELECT.from(Table).groupBy("col1", "col2").having`col = ${"*"}`; +var select = SELECT.from(Table) + .groupBy("col1", "col2") + .having("col1 in ('*', 10)"); +var select = SELECT.from(Table).groupBy("col1", "col2").having`col1 in ${[ + ("*", 10), +]}`; +var select = SELECT.from(Table) + .groupBy("col1", "col2") + .having({ col1: 10, and: { col2: 11 } }); + +var select = SELECT.from`Table`.groupBy`col1, col2`.having({ col1: "*" }); +var select = SELECT.from`Table`.groupBy`col1, col2`.having("col1='*'"); +var select = SELECT.from`Table`.groupBy`col1, col2`.having`col1=${"*"}`; +var select = SELECT.from`Table`.groupBy`col1, col2`.having("col1=", "*"); +var select = SELECT.from`Table`.groupBy`col1, col2`.having`col = ${"*"}`; +var select = SELECT.from`Table`.groupBy`col1, col2`.having("col1 in ('*', 10)"); +var select = SELECT.from`Table`.groupBy`col1, col2`.having`col1 in ${[ + ("*", 10), +]}`; +var select = SELECT.from`Table`.groupBy`col1, col2`.having({ + col1: 10, + and: { col2: 11 }, +}); + +var select = SELECT.from`Table`.groupBy(col1, col2).having({ col1: "*" }); +var select = SELECT.from`Table`.groupBy(col1, col2).having("col1='*'"); +var select = SELECT.from`Table`.groupBy(col1, col2).having`col1=${"*"}`; +var select = SELECT.from`Table`.groupBy(col1, col2).having("col1=", "*"); +var select = SELECT.from`Table`.groupBy(col1, col2).having`col = ${"*"}`; +var select = SELECT.from`Table`.groupBy(col1, col2).having("col1 in ('*', 10)"); +var select = SELECT.from`Table`.groupBy(col1, col2).having`col1 in ${[ + ("*", 10), +]}`; +var select = SELECT.from`Table`.groupBy(col1, col2).having({ + col1: 10, + and: { col2: 11 }, +}); + +var select = SELECT.from`Table` + .groupBy("col1.prop1", "col2.prop2") + .having({ col1: "*" }); +var select = SELECT.from`Table` + .groupBy("col1.prop1", "col2.prop2") + .having("col1='*'"); +var select = SELECT.from`Table`.groupBy("col1.prop1", "col2.prop2") + .having`col1=${"*"}`; +var select = SELECT.from`Table` + .groupBy("col1.prop1", "col2.prop2") + .having("col1=", "*"); +var select = SELECT.from`Table`.groupBy("col1.prop1", "col2.prop2") + .having`col = ${"*"}`; +var select = SELECT.from`Table` + .groupBy("col1.prop1", "col2.prop2") + .having("col1 in ('*', 10)"); +var select = SELECT.from`Table`.groupBy("col1.prop1", "col2.prop2") + .having`col1 in ${[("*", 10)]}`; +var select = SELECT.from`Table` + .groupBy("col1.prop1", "col2.prop2") + .having({ col1: 10, and: { col2: 11 } }); + +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2`.having({ + col1: "*", +}); +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2`.having( + "col1='*'" +); +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2` + .having`col1=${"*"}`; +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2`.having( + "col1=", + "*" +); +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2` + .having`col = ${"*"}`; +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2`.having( + "col1 in ('*', 10)" +); +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2` + .having`col1 in ${[("*", 10)]}`; +var select = SELECT.from`Table`.groupBy`col1.prop1, col2.prop2`.having({ + col1: 10, + and: { col2: 11 }, +}); + +var select = SELECT.from`Table` + .groupBy({ ref: ["col1", "prop1"] }, { ref: ["col2", "prop2"] }) + .having({ col1: "*" }); +var select = SELECT.from`Table` + .groupBy({ ref: ["col1", "prop1"] }, { ref: ["col2", "prop2"] }) + .having("col1='*'"); +var select = SELECT.from`Table`.groupBy( + { ref: ["col1", "prop1"] }, + { ref: ["col2", "prop2"] } +).having`col1=${"*"}`; +var select = SELECT.from`Table` + .groupBy({ ref: ["col1", "prop1"] }, { ref: ["col2", "prop2"] }) + .having("col1=", "*"); +var select = SELECT.from`Table`.groupBy( + { ref: ["col1", "prop1"] }, + { ref: ["col2", "prop2"] } +).having`col = ${"*"}`; +var select = SELECT.from`Table` + .groupBy({ ref: ["col1", "prop1"] }, { ref: ["col2", "prop2"] }) + .having("col1 in ('*', 10)"); +var select = SELECT.from`Table`.groupBy( + { ref: ["col1", "prop1"] }, + { ref: ["col2", "prop2"] } +).having`col1 in ${[("*", 10)]}`; +var select = SELECT.from`Table` + .groupBy({ ref: ["col1", "prop1"] }, { ref: ["col2", "prop2"] }) + .having({ col1: 10, and: { col2: 11 } }); + +// .orderBy() +var select = SELECT.from`Table`.orderBy`col1.prop1, col2.prop2`; +var select = SELECT.from`Table`.orderBy`col1 asc, col2.prop2`; +var select = SELECT.from`Table`.orderBy`col1.prop1, col2 asc`; +var select = SELECT.from`Table`.orderBy`col1 asc col2 asc`; +var select = SELECT.from`Table`.orderBy`col1.prop1, col2.prop2`; +var select = SELECT.from`Table`.orderBy`col1 desc, col2.prop2`; +var select = SELECT.from`Table`.orderBy`col1.prop1, col2 desc`; +var select = SELECT.from`Table`.orderBy`col1 desc col2 desc`; + +var select = SELECT.from(Table).orderBy`col1.prop1, col2.prop2`; +var select = SELECT.from(Table).orderBy`col1 asc, col2.prop2`; +var select = SELECT.from(Table).orderBy`col1.prop1, col2 asc`; +var select = SELECT.from(Table).orderBy`col1 asc col2 asc`; +var select = SELECT.from(Table).orderBy`col1.prop1, col2.prop2`; +var select = SELECT.from(Table).orderBy`col1 desc, col2.prop2`; +var select = SELECT.from(Table).orderBy`col1.prop1, col2 desc`; +var select = SELECT.from(Table).orderBy`col1 desc col2 desc`; + +// .limit() +var select = SELECT.from`Table`.limit(10); +var select = SELECT.from`Table`.limit`${10}`; +var select = SELECT.from`Table`.limit(10, 20); +var select = SELECT.from`Table`.limit({ val: 10 }); +var select = SELECT.from`Table`.limit({ val: 10 }, { val: 20 }); +var select = SELECT.from`Table`.limit({ ref: ["limitVal"] }); +var select = SELECT.from`Table`.limit({ + ref: [{ id: "function", args: { p: { ref: ["arg1"] } } }], +}); + +var select = SELECT.from(Table).limit(10); +var select = SELECT.from(Table).limit`${10}`; +var select = SELECT.from(Table).limit(10, 20); +var select = SELECT.from(Table).limit({ val: 10 }); +var select = SELECT.from(Table).limit({ val: 10 }, { val: 20 }); +var select = SELECT.from(Table).limit({ ref: ["limitVal"] }); +var select = SELECT.from(Table).limit({ + ref: [{ id: "function", args: { p: { ref: ["arg1"] } } }], +}); + +// .forUpdate() +var select = SELECT.from`Table`.groupBy`col1, col2` + .having`col = ${"*"}`.forUpdate(); + +// .forShareLock() +var select = SELECT.from`Table`.groupBy`col1, col2` + .having`col = ${"*"}`.forShareLock(); + +/* ========== SELECTS with property access and method calls ========== */ +var select = SELECT.distinct.from`Table`.where`col1 in ${[("*", 10)]}`.groupBy( + "col1", + "col2" +).having`col1 in ${[("*", 10)]}`.limit({ + ref: [{ id: "function", args: { p: { ref: ["arg1"] } } }], +}).orderBy`col1 desc, col2.prop2`.forShareLock(); + +/* ========== JSON literal queries ========== */ + +var select = { + SELECT: { + from: { ref: ["Bar"] }, + }, +}; + +var select = { + SELECT: { + one: true, + columns: [{ ref: ["Foo"] }, { ref: ["Boo"] }, { ref: ["Moo"] }], + from: { ref: ["Bar"] }, + }, +}; + +var select = { + SELECT: { + distinct: true, + columns: [{ ref: ["Foo"] }, { ref: ["Boo"] }, { ref: ["Moo"] }], + from: { ref: ["Bar"] }, + limit: { + rows: { val: 7 }, + }, + where: [{ ref: ["col1"] }, ">", { val: 2 }], + groupBy: [{ ref: ["col1"] }, { ref: ["col2", "prop2"] }], + }, +}; + +/* ========== reflected definitions ========== */ +const { Books } = cds.entities; +let q1 = SELECT.from (Books) .where `ID=${201}`; \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cql/select/select.ql b/javascript/frameworks/cap/test/models/cql/select/select.ql new file mode 100644 index 000000000..d2961efff --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/select/select.ql @@ -0,0 +1,5 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CQL + +from CQL::CqlClause s +select s.getLocation(), s \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cql/select/select2.js b/javascript/frameworks/cap/test/models/cql/select/select2.js new file mode 100644 index 000000000..51aec5cc7 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/select/select2.js @@ -0,0 +1,8 @@ +/* ========== obtained through module ========== */ +const cds = require('@sap/cds'); +const { SELECT, INSERT, UPDATE, DELETE } = cds.ql; +var select = SELECT.one.from(Table); + +/* ========== not a use of the API ========== */ +foo.SELECT +require("SELECT")() \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.expected b/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.expected new file mode 100644 index 000000000..698109cb3 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.expected @@ -0,0 +1 @@ +| taintedclause.js:4:12:4:57 | cds.par ... rInput) | diff --git a/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.js b/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.js new file mode 100644 index 000000000..d9f124912 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.js @@ -0,0 +1,5 @@ +/* ========== CQL parse usages ========== */ +const cds = require('@sap/cds'); +let cqn = CQL`SELECT col1, col2, col3 from Table` + userInput //this is actually already captured by taint steps by default +let cqn1 = cds.parse.cql (`SELECT * from Foo`+ userInput) +let cqn2 = cds.parse.cql (`SELECT * from Foo`) + userInput //not valid diff --git a/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.ql b/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.ql new file mode 100644 index 000000000..1fc1dd1bc --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/taintedclause/taintedclause.ql @@ -0,0 +1,5 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CQL + +from CQL::ParseCQLTaintedClause clause +select clause \ No newline at end of file diff --git a/javascript/frameworks/cap/test/models/cql/update/update.expected b/javascript/frameworks/cap/test/models/cql/update/update.expected new file mode 100644 index 000000000..9b1218b8f --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/update/update.expected @@ -0,0 +1,372 @@ +| update.js:5:14:5:95 | update.js:5 | update.js:5:14:5:95 | UPDATE` ... ] }, }) | +| update.js:6:14:6:46 | update.js:6 | update.js:6:14:6:46 | UPDATE` ... diff }) | +| update.js:8:14:8:26 | update.js:8 | update.js:8:14:8:26 | UPDATE(Table) | +| update.js:9:14:9:26 | update.js:9 | update.js:9:14:9:26 | UPDATE(Table) | +| update.js:9:14:9:95 | update.js:9 | update.js:9:14:9:95 | UPDATE( ... ] }, }) | +| update.js:10:14:10:26 | update.js:10 | update.js:10:14:10:26 | UPDATE(Table) | +| update.js:10:14:10:46 | update.js:10 | update.js:10:14:10:46 | UPDATE( ... diff }) | +| update.js:12:14:12:28 | update.js:12 | update.js:12:14:12:28 | UPDATE("Table") | +| update.js:13:14:13:28 | update.js:13 | update.js:13:14:13:28 | UPDATE("Table") | +| update.js:13:14:13:97 | update.js:13 | update.js:13:14:13:97 | UPDATE( ... ] }, }) | +| update.js:14:14:14:28 | update.js:14 | update.js:14:14:14:28 | UPDATE("Table") | +| update.js:14:14:14:48 | update.js:14 | update.js:14:14:14:48 | UPDATE( ... diff }) | +| update.js:17:14:17:33 | update.js:17 | update.js:17:14:17:33 | UPDATE.entity(Table) | +| update.js:18:14:18:33 | update.js:18 | update.js:18:14:18:33 | UPDATE.entity(Table) | +| update.js:18:14:18:102 | update.js:18 | update.js:18:14:18:102 | UPDATE. ... ] }, }) | +| update.js:19:14:19:33 | update.js:19 | update.js:19:14:19:33 | UPDATE.entity(Table) | +| update.js:19:14:19:53 | update.js:19 | update.js:19:14:19:53 | UPDATE. ... diff }) | +| update.js:21:14:21:35 | update.js:21 | update.js:21:14:21:35 | UPDATE. ... Table") | +| update.js:22:14:22:35 | update.js:22 | update.js:22:14:22:35 | UPDATE. ... Table") | +| update.js:22:14:22:104 | update.js:22 | update.js:22:14:22:104 | UPDATE. ... ] }, }) | +| update.js:23:14:23:35 | update.js:23 | update.js:23:14:23:35 | UPDATE. ... Table") | +| update.js:23:14:23:55 | update.js:23 | update.js:23:14:23:55 | UPDATE. ... diff }) | +| update.js:26:14:26:102 | update.js:26 | update.js:26:14:26:102 | UPDATE. ... ] }, }) | +| update.js:27:14:27:53 | update.js:27 | update.js:27:14:27:53 | UPDATE. ... diff }) | +| update.js:33:14:33:96 | update.js:33 | update.js:33:14:33:96 | UPDATE` ... ] }, }) | +| update.js:34:14:34:47 | update.js:34 | update.js:34:14:34:47 | UPDATE` ... diff }) | +| update.js:38:14:38:103 | update.js:38 | update.js:38:14:38:103 | UPDATE. ... ] }, }) | +| update.js:39:14:39:54 | update.js:39 | update.js:39:14:39:54 | UPDATE. ... diff }) | +| update.js:44:14:44:74 | update.js:44 | update.js:44:14:44:74 | UPDATE` ... "*" }) | +| update.js:45:14:45:71 | update.js:45 | update.js:45:14:45:71 | UPDATE` ... 1='*'") | +| update.js:47:14:47:73 | update.js:47 | update.js:47:14:47:73 | UPDATE` ... ", "*") | +| update.js:49:14:49:80 | update.js:49 | update.js:49:14:49:80 | UPDATE` ... , 10)") | +| update.js:51:14:51:93 | update.js:51 | update.js:51:14:51:93 | UPDATE` ... 1 }, }) | +| update.js:53:14:53:94 | update.js:53 | update.js:53:14:53:94 | UPDATE` ... }] } }) | +| update.js:53:14:53:115 | update.js:53 | update.js:53:14:53:115 | UPDATE` ... "*" }) | +| update.js:54:14:54:94 | update.js:54 | update.js:54:14:54:94 | UPDATE` ... }] } }) | +| update.js:54:14:54:112 | update.js:54 | update.js:54:14:54:112 | UPDATE` ... 1='*'") | +| update.js:55:14:55:95 | update.js:55 | update.js:55:14:55:95 | UPDATE` ... ] }, }) | +| update.js:56:14:56:94 | update.js:56 | update.js:56:14:56:94 | UPDATE` ... }] } }) | +| update.js:56:14:56:114 | update.js:56 | update.js:56:14:56:114 | UPDATE` ... ", "*") | +| update.js:57:14:57:95 | update.js:57 | update.js:57:14:57:95 | UPDATE` ... ] }, }) | +| update.js:58:14:58:94 | update.js:58 | update.js:58:14:58:94 | UPDATE` ... }] } }) | +| update.js:58:14:58:121 | update.js:58 | update.js:58:14:58:121 | UPDATE` ... , 10)") | +| update.js:59:14:59:95 | update.js:59 | update.js:59:14:59:95 | UPDATE` ... ] }, }) | +| update.js:60:14:60:94 | update.js:60 | update.js:60:14:60:94 | UPDATE` ... }] } }) | +| update.js:60:14:60:133 | update.js:60 | update.js:60:14:60:133 | UPDATE` ... 11 } }) | +| update.js:62:14:62:46 | update.js:62 | update.js:62:14:62:46 | UPDATE` ... diff }) | +| update.js:62:14:62:67 | update.js:62 | update.js:62:14:62:67 | UPDATE` ... "*" }) | +| update.js:63:14:63:46 | update.js:63 | update.js:63:14:63:46 | UPDATE` ... diff }) | +| update.js:63:14:63:64 | update.js:63 | update.js:63:14:63:64 | UPDATE` ... 1='*'") | +| update.js:64:14:64:46 | update.js:64 | update.js:64:14:64:46 | UPDATE` ... diff }) | +| update.js:65:14:65:46 | update.js:65 | update.js:65:14:65:46 | UPDATE` ... diff }) | +| update.js:65:14:65:66 | update.js:65 | update.js:65:14:65:66 | UPDATE` ... ", "*") | +| update.js:66:14:66:46 | update.js:66 | update.js:66:14:66:46 | UPDATE` ... diff }) | +| update.js:67:14:67:46 | update.js:67 | update.js:67:14:67:46 | UPDATE` ... diff }) | +| update.js:67:14:67:73 | update.js:67 | update.js:67:14:67:73 | UPDATE` ... , 10)") | +| update.js:68:14:68:46 | update.js:68 | update.js:68:14:68:46 | UPDATE` ... diff }) | +| update.js:69:14:69:46 | update.js:69 | update.js:69:14:69:46 | UPDATE` ... diff }) | +| update.js:69:14:69:85 | update.js:69 | update.js:69:14:69:85 | UPDATE` ... 11 } }) | +| update.js:72:14:72:81 | update.js:72 | update.js:72:14:72:81 | UPDATE. ... "*" }) | +| update.js:73:14:73:78 | update.js:73 | update.js:73:14:73:78 | UPDATE. ... 1='*'") | +| update.js:75:14:75:80 | update.js:75 | update.js:75:14:75:80 | UPDATE. ... ", "*") | +| update.js:77:14:77:87 | update.js:77 | update.js:77:14:77:87 | UPDATE. ... , 10)") | +| update.js:79:14:79:100 | update.js:79 | update.js:79:14:79:100 | UPDATE. ... 1 }, }) | +| update.js:81:14:81:101 | update.js:81 | update.js:81:14:81:101 | UPDATE. ... }] } }) | +| update.js:81:14:81:122 | update.js:81 | update.js:81:14:81:122 | UPDATE. ... "*" }) | +| update.js:82:14:82:101 | update.js:82 | update.js:82:14:82:101 | UPDATE. ... }] } }) | +| update.js:82:14:82:119 | update.js:82 | update.js:82:14:82:119 | UPDATE. ... 1='*'") | +| update.js:83:14:83:102 | update.js:83 | update.js:83:14:83:102 | UPDATE. ... ] }, }) | +| update.js:84:14:84:101 | update.js:84 | update.js:84:14:84:101 | UPDATE. ... }] } }) | +| update.js:84:14:84:121 | update.js:84 | update.js:84:14:84:121 | UPDATE. ... ", "*") | +| update.js:85:14:85:102 | update.js:85 | update.js:85:14:85:102 | UPDATE. ... ] }, }) | +| update.js:86:14:86:101 | update.js:86 | update.js:86:14:86:101 | UPDATE. ... }] } }) | +| update.js:86:14:86:128 | update.js:86 | update.js:86:14:86:128 | UPDATE. ... , 10)") | +| update.js:87:14:87:102 | update.js:87 | update.js:87:14:87:102 | UPDATE. ... ] }, }) | +| update.js:88:14:88:101 | update.js:88 | update.js:88:14:88:101 | UPDATE. ... }] } }) | +| update.js:88:14:88:140 | update.js:88 | update.js:88:14:88:140 | UPDATE. ... 11 } }) | +| update.js:90:14:90:53 | update.js:90 | update.js:90:14:90:53 | UPDATE. ... diff }) | +| update.js:90:14:90:74 | update.js:90 | update.js:90:14:90:74 | UPDATE. ... "*" }) | +| update.js:91:14:91:53 | update.js:91 | update.js:91:14:91:53 | UPDATE. ... diff }) | +| update.js:91:14:91:71 | update.js:91 | update.js:91:14:91:71 | UPDATE. ... 1='*'") | +| update.js:92:14:92:53 | update.js:92 | update.js:92:14:92:53 | UPDATE. ... diff }) | +| update.js:93:14:93:53 | update.js:93 | update.js:93:14:93:53 | UPDATE. ... diff }) | +| update.js:93:14:93:73 | update.js:93 | update.js:93:14:93:73 | UPDATE. ... ", "*") | +| update.js:94:14:94:53 | update.js:94 | update.js:94:14:94:53 | UPDATE. ... diff }) | +| update.js:95:14:95:53 | update.js:95 | update.js:95:14:95:53 | UPDATE. ... diff }) | +| update.js:95:14:95:80 | update.js:95 | update.js:95:14:95:80 | UPDATE. ... , 10)") | +| update.js:96:14:96:53 | update.js:96 | update.js:96:14:96:53 | UPDATE. ... diff }) | +| update.js:97:14:97:53 | update.js:97 | update.js:97:14:97:53 | UPDATE. ... diff }) | +| update.js:97:14:97:92 | update.js:97 | update.js:97:14:97:92 | UPDATE. ... 11 } }) | +| update.js:99:14:99:33 | update.js:99 | update.js:99:14:99:33 | UPDATE.entity(Table) | +| update.js:99:14:99:81 | update.js:99 | update.js:99:14:99:81 | UPDATE. ... "*" }) | +| update.js:100:14:100:33 | update.js:100 | update.js:100:14:100:33 | UPDATE.entity(Table) | +| update.js:100:14:100:78 | update.js:100 | update.js:100:14:100:78 | UPDATE. ... 1='*'") | +| update.js:101:14:101:33 | update.js:101 | update.js:101:14:101:33 | UPDATE.entity(Table) | +| update.js:102:14:102:33 | update.js:102 | update.js:102:14:102:33 | UPDATE.entity(Table) | +| update.js:102:14:102:80 | update.js:102 | update.js:102:14:102:80 | UPDATE. ... ", "*") | +| update.js:103:14:103:33 | update.js:103 | update.js:103:14:103:33 | UPDATE.entity(Table) | +| update.js:104:14:104:33 | update.js:104 | update.js:104:14:104:33 | UPDATE.entity(Table) | +| update.js:104:14:104:87 | update.js:104 | update.js:104:14:104:87 | UPDATE. ... , 10)") | +| update.js:105:14:105:33 | update.js:105 | update.js:105:14:105:33 | UPDATE.entity(Table) | +| update.js:106:14:106:33 | update.js:106 | update.js:106:14:106:33 | UPDATE.entity(Table) | +| update.js:106:14:106:100 | update.js:106 | update.js:106:14:106:100 | UPDATE. ... 1 }, }) | +| update.js:108:14:108:33 | update.js:108 | update.js:108:14:108:33 | UPDATE.entity(Table) | +| update.js:108:14:108:101 | update.js:108 | update.js:108:14:108:101 | UPDATE. ... }] } }) | +| update.js:108:14:108:122 | update.js:108 | update.js:108:14:108:122 | UPDATE. ... "*" }) | +| update.js:109:14:109:33 | update.js:109 | update.js:109:14:109:33 | UPDATE.entity(Table) | +| update.js:109:14:109:101 | update.js:109 | update.js:109:14:109:101 | UPDATE. ... }] } }) | +| update.js:109:14:109:119 | update.js:109 | update.js:109:14:109:119 | UPDATE. ... 1='*'") | +| update.js:110:14:110:33 | update.js:110 | update.js:110:14:110:33 | UPDATE.entity(Table) | +| update.js:110:14:110:102 | update.js:110 | update.js:110:14:110:102 | UPDATE. ... ] }, }) | +| update.js:111:14:111:33 | update.js:111 | update.js:111:14:111:33 | UPDATE.entity(Table) | +| update.js:111:14:111:101 | update.js:111 | update.js:111:14:111:101 | UPDATE. ... }] } }) | +| update.js:111:14:111:121 | update.js:111 | update.js:111:14:111:121 | UPDATE. ... ", "*") | +| update.js:112:14:112:33 | update.js:112 | update.js:112:14:112:33 | UPDATE.entity(Table) | +| update.js:112:14:112:102 | update.js:112 | update.js:112:14:112:102 | UPDATE. ... ] }, }) | +| update.js:113:14:113:33 | update.js:113 | update.js:113:14:113:33 | UPDATE.entity(Table) | +| update.js:113:14:113:101 | update.js:113 | update.js:113:14:113:101 | UPDATE. ... }] } }) | +| update.js:113:14:113:128 | update.js:113 | update.js:113:14:113:128 | UPDATE. ... , 10)") | +| update.js:114:14:114:33 | update.js:114 | update.js:114:14:114:33 | UPDATE.entity(Table) | +| update.js:114:14:114:102 | update.js:114 | update.js:114:14:114:102 | UPDATE. ... ] }, }) | +| update.js:115:14:115:33 | update.js:115 | update.js:115:14:115:33 | UPDATE.entity(Table) | +| update.js:115:14:115:101 | update.js:115 | update.js:115:14:115:101 | UPDATE. ... }] } }) | +| update.js:115:14:115:140 | update.js:115 | update.js:115:14:115:140 | UPDATE. ... 11 } }) | +| update.js:117:14:117:33 | update.js:117 | update.js:117:14:117:33 | UPDATE.entity(Table) | +| update.js:117:14:117:53 | update.js:117 | update.js:117:14:117:53 | UPDATE. ... diff }) | +| update.js:117:14:117:74 | update.js:117 | update.js:117:14:117:74 | UPDATE. ... "*" }) | +| update.js:118:14:118:33 | update.js:118 | update.js:118:14:118:33 | UPDATE.entity(Table) | +| update.js:118:14:118:53 | update.js:118 | update.js:118:14:118:53 | UPDATE. ... diff }) | +| update.js:118:14:118:71 | update.js:118 | update.js:118:14:118:71 | UPDATE. ... 1='*'") | +| update.js:119:14:119:33 | update.js:119 | update.js:119:14:119:33 | UPDATE.entity(Table) | +| update.js:119:14:119:53 | update.js:119 | update.js:119:14:119:53 | UPDATE. ... diff }) | +| update.js:120:14:120:33 | update.js:120 | update.js:120:14:120:33 | UPDATE.entity(Table) | +| update.js:120:14:120:53 | update.js:120 | update.js:120:14:120:53 | UPDATE. ... diff }) | +| update.js:120:14:120:73 | update.js:120 | update.js:120:14:120:73 | UPDATE. ... ", "*") | +| update.js:121:14:121:33 | update.js:121 | update.js:121:14:121:33 | UPDATE.entity(Table) | +| update.js:121:14:121:53 | update.js:121 | update.js:121:14:121:53 | UPDATE. ... diff }) | +| update.js:122:14:122:33 | update.js:122 | update.js:122:14:122:33 | UPDATE.entity(Table) | +| update.js:122:14:122:53 | update.js:122 | update.js:122:14:122:53 | UPDATE. ... diff }) | +| update.js:122:14:122:80 | update.js:122 | update.js:122:14:122:80 | UPDATE. ... , 10)") | +| update.js:123:14:123:33 | update.js:123 | update.js:123:14:123:33 | UPDATE.entity(Table) | +| update.js:123:14:123:53 | update.js:123 | update.js:123:14:123:53 | UPDATE. ... diff }) | +| update.js:124:14:124:33 | update.js:124 | update.js:124:14:124:33 | UPDATE.entity(Table) | +| update.js:124:14:124:53 | update.js:124 | update.js:124:14:124:53 | UPDATE. ... diff }) | +| update.js:124:14:124:92 | update.js:124 | update.js:124:14:124:92 | UPDATE. ... 11 } }) | +| update.js:126:14:126:35 | update.js:126 | update.js:126:14:126:35 | UPDATE. ... Table") | +| update.js:126:14:126:83 | update.js:126 | update.js:126:14:126:83 | UPDATE. ... "*" }) | +| update.js:127:14:127:35 | update.js:127 | update.js:127:14:127:35 | UPDATE. ... Table") | +| update.js:127:14:127:80 | update.js:127 | update.js:127:14:127:80 | UPDATE. ... 1='*'") | +| update.js:128:14:128:35 | update.js:128 | update.js:128:14:128:35 | UPDATE. ... Table") | +| update.js:129:14:129:35 | update.js:129 | update.js:129:14:129:35 | UPDATE. ... Table") | +| update.js:129:14:129:82 | update.js:129 | update.js:129:14:129:82 | UPDATE. ... ", "*") | +| update.js:130:14:130:35 | update.js:130 | update.js:130:14:130:35 | UPDATE. ... Table") | +| update.js:131:14:131:35 | update.js:131 | update.js:131:14:131:35 | UPDATE. ... Table") | +| update.js:131:14:131:89 | update.js:131 | update.js:131:14:131:89 | UPDATE. ... , 10)") | +| update.js:132:14:132:35 | update.js:132 | update.js:132:14:132:35 | UPDATE. ... Table") | +| update.js:133:14:133:35 | update.js:133 | update.js:133:14:133:35 | UPDATE. ... Table") | +| update.js:133:14:133:102 | update.js:133 | update.js:133:14:133:102 | UPDATE. ... 1 }, }) | +| update.js:135:14:135:35 | update.js:135 | update.js:135:14:135:35 | UPDATE. ... Table") | +| update.js:135:14:135:103 | update.js:135 | update.js:135:14:135:103 | UPDATE. ... }] } }) | +| update.js:135:14:135:124 | update.js:135 | update.js:135:14:135:124 | UPDATE. ... "*" }) | +| update.js:136:14:136:35 | update.js:136 | update.js:136:14:136:35 | UPDATE. ... Table") | +| update.js:136:14:136:103 | update.js:136 | update.js:136:14:136:103 | UPDATE. ... }] } }) | +| update.js:136:14:136:121 | update.js:136 | update.js:136:14:136:121 | UPDATE. ... 1='*'") | +| update.js:137:14:137:35 | update.js:137 | update.js:137:14:137:35 | UPDATE. ... Table") | +| update.js:137:14:137:104 | update.js:137 | update.js:137:14:137:104 | UPDATE. ... ] }, }) | +| update.js:138:14:138:35 | update.js:138 | update.js:138:14:138:35 | UPDATE. ... Table") | +| update.js:138:14:138:103 | update.js:138 | update.js:138:14:138:103 | UPDATE. ... }] } }) | +| update.js:138:14:138:123 | update.js:138 | update.js:138:14:138:123 | UPDATE. ... ", "*") | +| update.js:139:14:139:35 | update.js:139 | update.js:139:14:139:35 | UPDATE. ... Table") | +| update.js:139:14:139:104 | update.js:139 | update.js:139:14:139:104 | UPDATE. ... ] }, }) | +| update.js:140:14:140:35 | update.js:140 | update.js:140:14:140:35 | UPDATE. ... Table") | +| update.js:140:14:140:103 | update.js:140 | update.js:140:14:140:103 | UPDATE. ... }] } }) | +| update.js:140:14:140:130 | update.js:140 | update.js:140:14:140:130 | UPDATE. ... , 10)") | +| update.js:141:14:141:35 | update.js:141 | update.js:141:14:141:35 | UPDATE. ... Table") | +| update.js:141:14:141:104 | update.js:141 | update.js:141:14:141:104 | UPDATE. ... ] }, }) | +| update.js:142:14:142:35 | update.js:142 | update.js:142:14:142:35 | UPDATE. ... Table") | +| update.js:142:14:142:103 | update.js:142 | update.js:142:14:142:103 | UPDATE. ... }] } }) | +| update.js:142:14:142:142 | update.js:142 | update.js:142:14:142:142 | UPDATE. ... 11 } }) | +| update.js:144:14:144:35 | update.js:144 | update.js:144:14:144:35 | UPDATE. ... Table") | +| update.js:144:14:144:55 | update.js:144 | update.js:144:14:144:55 | UPDATE. ... diff }) | +| update.js:144:14:144:76 | update.js:144 | update.js:144:14:144:76 | UPDATE. ... "*" }) | +| update.js:145:14:145:35 | update.js:145 | update.js:145:14:145:35 | UPDATE. ... Table") | +| update.js:145:14:145:55 | update.js:145 | update.js:145:14:145:55 | UPDATE. ... diff }) | +| update.js:145:14:145:73 | update.js:145 | update.js:145:14:145:73 | UPDATE. ... 1='*'") | +| update.js:146:14:146:35 | update.js:146 | update.js:146:14:146:35 | UPDATE. ... Table") | +| update.js:146:14:146:55 | update.js:146 | update.js:146:14:146:55 | UPDATE. ... diff }) | +| update.js:147:14:147:35 | update.js:147 | update.js:147:14:147:35 | UPDATE. ... Table") | +| update.js:147:14:147:55 | update.js:147 | update.js:147:14:147:55 | UPDATE. ... diff }) | +| update.js:147:14:147:75 | update.js:147 | update.js:147:14:147:75 | UPDATE. ... ", "*") | +| update.js:148:14:148:35 | update.js:148 | update.js:148:14:148:35 | UPDATE. ... Table") | +| update.js:148:14:148:55 | update.js:148 | update.js:148:14:148:55 | UPDATE. ... diff }) | +| update.js:149:14:149:35 | update.js:149 | update.js:149:14:149:35 | UPDATE. ... Table") | +| update.js:149:14:149:55 | update.js:149 | update.js:149:14:149:55 | UPDATE. ... diff }) | +| update.js:149:14:149:82 | update.js:149 | update.js:149:14:149:82 | UPDATE. ... , 10)") | +| update.js:150:14:150:35 | update.js:150 | update.js:150:14:150:35 | UPDATE. ... Table") | +| update.js:150:14:150:55 | update.js:150 | update.js:150:14:150:55 | UPDATE. ... diff }) | +| update.js:151:14:151:35 | update.js:151 | update.js:151:14:151:35 | UPDATE. ... Table") | +| update.js:151:14:151:55 | update.js:151 | update.js:151:14:151:55 | UPDATE. ... diff }) | +| update.js:151:14:151:94 | update.js:151 | update.js:151:14:151:94 | UPDATE. ... 11 } }) | +| update.js:156:14:156:75 | update.js:156 | update.js:156:14:156:75 | UPDATE` ... "*" }) | +| update.js:157:14:157:72 | update.js:157 | update.js:157:14:157:72 | UPDATE` ... 1='*'") | +| update.js:159:14:159:74 | update.js:159 | update.js:159:14:159:74 | UPDATE` ... ", "*") | +| update.js:161:14:161:81 | update.js:161 | update.js:161:14:161:81 | UPDATE` ... , 10)") | +| update.js:163:14:163:94 | update.js:163 | update.js:163:14:163:94 | UPDATE` ... 1 }, }) | +| update.js:165:14:165:95 | update.js:165 | update.js:165:14:165:95 | UPDATE` ... }] } }) | +| update.js:165:14:165:116 | update.js:165 | update.js:165:14:165:116 | UPDATE` ... "*" }) | +| update.js:166:14:166:95 | update.js:166 | update.js:166:14:166:95 | UPDATE` ... }] } }) | +| update.js:166:14:166:113 | update.js:166 | update.js:166:14:166:113 | UPDATE` ... 1='*'") | +| update.js:167:14:167:96 | update.js:167 | update.js:167:14:167:96 | UPDATE` ... ] }, }) | +| update.js:168:14:168:95 | update.js:168 | update.js:168:14:168:95 | UPDATE` ... }] } }) | +| update.js:168:14:168:115 | update.js:168 | update.js:168:14:168:115 | UPDATE` ... ", "*") | +| update.js:169:14:169:96 | update.js:169 | update.js:169:14:169:96 | UPDATE` ... ] }, }) | +| update.js:170:14:170:95 | update.js:170 | update.js:170:14:170:95 | UPDATE` ... }] } }) | +| update.js:170:14:170:122 | update.js:170 | update.js:170:14:170:122 | UPDATE` ... , 10)") | +| update.js:171:14:171:96 | update.js:171 | update.js:171:14:171:96 | UPDATE` ... ] }, }) | +| update.js:172:14:172:95 | update.js:172 | update.js:172:14:172:95 | UPDATE` ... }] } }) | +| update.js:172:14:172:134 | update.js:172 | update.js:172:14:172:134 | UPDATE` ... 11 } }) | +| update.js:174:14:174:47 | update.js:174 | update.js:174:14:174:47 | UPDATE` ... diff }) | +| update.js:174:14:174:68 | update.js:174 | update.js:174:14:174:68 | UPDATE` ... "*" }) | +| update.js:175:14:175:47 | update.js:175 | update.js:175:14:175:47 | UPDATE` ... diff }) | +| update.js:175:14:175:65 | update.js:175 | update.js:175:14:175:65 | UPDATE` ... 1='*'") | +| update.js:176:14:176:47 | update.js:176 | update.js:176:14:176:47 | UPDATE` ... diff }) | +| update.js:177:14:177:47 | update.js:177 | update.js:177:14:177:47 | UPDATE` ... diff }) | +| update.js:177:14:177:67 | update.js:177 | update.js:177:14:177:67 | UPDATE` ... ", "*") | +| update.js:178:14:178:47 | update.js:178 | update.js:178:14:178:47 | UPDATE` ... diff }) | +| update.js:179:14:179:47 | update.js:179 | update.js:179:14:179:47 | UPDATE` ... diff }) | +| update.js:179:14:179:74 | update.js:179 | update.js:179:14:179:74 | UPDATE` ... , 10)") | +| update.js:180:14:180:47 | update.js:180 | update.js:180:14:180:47 | UPDATE` ... diff }) | +| update.js:181:14:181:47 | update.js:181 | update.js:181:14:181:47 | UPDATE` ... diff }) | +| update.js:181:14:181:86 | update.js:181 | update.js:181:14:181:86 | UPDATE` ... 11 } }) | +| update.js:184:14:184:82 | update.js:184 | update.js:184:14:184:82 | UPDATE. ... "*" }) | +| update.js:185:14:185:79 | update.js:185 | update.js:185:14:185:79 | UPDATE. ... 1='*'") | +| update.js:187:14:187:81 | update.js:187 | update.js:187:14:187:81 | UPDATE. ... ", "*") | +| update.js:189:14:189:88 | update.js:189 | update.js:189:14:189:88 | UPDATE. ... , 10)") | +| update.js:191:14:191:101 | update.js:191 | update.js:191:14:191:101 | UPDATE. ... 1 }, }) | +| update.js:193:14:193:102 | update.js:193 | update.js:193:14:193:102 | UPDATE. ... }] } }) | +| update.js:193:14:193:123 | update.js:193 | update.js:193:14:193:123 | UPDATE. ... "*" }) | +| update.js:194:14:194:102 | update.js:194 | update.js:194:14:194:102 | UPDATE. ... }] } }) | +| update.js:194:14:194:120 | update.js:194 | update.js:194:14:194:120 | UPDATE. ... 1='*'") | +| update.js:195:14:195:103 | update.js:195 | update.js:195:14:195:103 | UPDATE. ... ] }, }) | +| update.js:196:14:196:102 | update.js:196 | update.js:196:14:196:102 | UPDATE. ... }] } }) | +| update.js:196:14:196:122 | update.js:196 | update.js:196:14:196:122 | UPDATE. ... ", "*") | +| update.js:197:14:197:103 | update.js:197 | update.js:197:14:197:103 | UPDATE. ... ] }, }) | +| update.js:198:14:198:102 | update.js:198 | update.js:198:14:198:102 | UPDATE. ... }] } }) | +| update.js:198:14:198:129 | update.js:198 | update.js:198:14:198:129 | UPDATE. ... , 10)") | +| update.js:199:14:199:103 | update.js:199 | update.js:199:14:199:103 | UPDATE. ... ] }, }) | +| update.js:200:14:200:102 | update.js:200 | update.js:200:14:200:102 | UPDATE. ... }] } }) | +| update.js:200:14:200:141 | update.js:200 | update.js:200:14:200:141 | UPDATE. ... 11 } }) | +| update.js:202:14:202:54 | update.js:202 | update.js:202:14:202:54 | UPDATE. ... diff }) | +| update.js:202:14:202:75 | update.js:202 | update.js:202:14:202:75 | UPDATE. ... "*" }) | +| update.js:203:14:203:54 | update.js:203 | update.js:203:14:203:54 | UPDATE. ... diff }) | +| update.js:203:14:203:72 | update.js:203 | update.js:203:14:203:72 | UPDATE. ... 1='*'") | +| update.js:204:14:204:54 | update.js:204 | update.js:204:14:204:54 | UPDATE. ... diff }) | +| update.js:205:14:205:54 | update.js:205 | update.js:205:14:205:54 | UPDATE. ... diff }) | +| update.js:205:14:205:74 | update.js:205 | update.js:205:14:205:74 | UPDATE. ... ", "*") | +| update.js:206:14:206:54 | update.js:206 | update.js:206:14:206:54 | UPDATE. ... diff }) | +| update.js:207:14:207:54 | update.js:207 | update.js:207:14:207:54 | UPDATE. ... diff }) | +| update.js:207:14:207:81 | update.js:207 | update.js:207:14:207:81 | UPDATE. ... , 10)") | +| update.js:208:14:208:54 | update.js:208 | update.js:208:14:208:54 | UPDATE. ... diff }) | +| update.js:209:14:209:54 | update.js:209 | update.js:209:14:209:54 | UPDATE. ... diff }) | +| update.js:209:14:209:93 | update.js:209 | update.js:209:14:209:93 | UPDATE. ... 11 } }) | +| update.js:211:14:211:33 | update.js:211 | update.js:211:14:211:33 | UPDATE.entity(Table) | +| update.js:211:14:211:82 | update.js:211 | update.js:211:14:211:82 | UPDATE. ... "*" }) | +| update.js:212:14:212:33 | update.js:212 | update.js:212:14:212:33 | UPDATE.entity(Table) | +| update.js:212:14:212:79 | update.js:212 | update.js:212:14:212:79 | UPDATE. ... 1='*'") | +| update.js:213:14:213:33 | update.js:213 | update.js:213:14:213:33 | UPDATE.entity(Table) | +| update.js:214:14:214:33 | update.js:214 | update.js:214:14:214:33 | UPDATE.entity(Table) | +| update.js:214:14:214:81 | update.js:214 | update.js:214:14:214:81 | UPDATE. ... ", "*") | +| update.js:215:14:215:33 | update.js:215 | update.js:215:14:215:33 | UPDATE.entity(Table) | +| update.js:216:14:216:33 | update.js:216 | update.js:216:14:216:33 | UPDATE.entity(Table) | +| update.js:216:14:216:88 | update.js:216 | update.js:216:14:216:88 | UPDATE. ... , 10)") | +| update.js:217:14:217:33 | update.js:217 | update.js:217:14:217:33 | UPDATE.entity(Table) | +| update.js:218:14:218:33 | update.js:218 | update.js:218:14:218:33 | UPDATE.entity(Table) | +| update.js:218:14:218:101 | update.js:218 | update.js:218:14:218:101 | UPDATE. ... 1 }, }) | +| update.js:220:14:220:33 | update.js:220 | update.js:220:14:220:33 | UPDATE.entity(Table) | +| update.js:220:14:220:102 | update.js:220 | update.js:220:14:220:102 | UPDATE. ... }] } }) | +| update.js:220:14:220:123 | update.js:220 | update.js:220:14:220:123 | UPDATE. ... "*" }) | +| update.js:221:14:221:33 | update.js:221 | update.js:221:14:221:33 | UPDATE.entity(Table) | +| update.js:221:14:221:102 | update.js:221 | update.js:221:14:221:102 | UPDATE. ... }] } }) | +| update.js:221:14:221:120 | update.js:221 | update.js:221:14:221:120 | UPDATE. ... 1='*'") | +| update.js:222:14:222:33 | update.js:222 | update.js:222:14:222:33 | UPDATE.entity(Table) | +| update.js:222:14:222:103 | update.js:222 | update.js:222:14:222:103 | UPDATE. ... ] }, }) | +| update.js:223:14:223:33 | update.js:223 | update.js:223:14:223:33 | UPDATE.entity(Table) | +| update.js:223:14:223:102 | update.js:223 | update.js:223:14:223:102 | UPDATE. ... }] } }) | +| update.js:223:14:223:122 | update.js:223 | update.js:223:14:223:122 | UPDATE. ... ", "*") | +| update.js:224:14:224:33 | update.js:224 | update.js:224:14:224:33 | UPDATE.entity(Table) | +| update.js:224:14:224:103 | update.js:224 | update.js:224:14:224:103 | UPDATE. ... ] }, }) | +| update.js:225:14:225:33 | update.js:225 | update.js:225:14:225:33 | UPDATE.entity(Table) | +| update.js:225:14:225:102 | update.js:225 | update.js:225:14:225:102 | UPDATE. ... }] } }) | +| update.js:225:14:225:129 | update.js:225 | update.js:225:14:225:129 | UPDATE. ... , 10)") | +| update.js:226:14:226:33 | update.js:226 | update.js:226:14:226:33 | UPDATE.entity(Table) | +| update.js:226:14:226:103 | update.js:226 | update.js:226:14:226:103 | UPDATE. ... ] }, }) | +| update.js:227:14:227:33 | update.js:227 | update.js:227:14:227:33 | UPDATE.entity(Table) | +| update.js:227:14:227:102 | update.js:227 | update.js:227:14:227:102 | UPDATE. ... }] } }) | +| update.js:227:14:227:141 | update.js:227 | update.js:227:14:227:141 | UPDATE. ... 11 } }) | +| update.js:229:14:229:33 | update.js:229 | update.js:229:14:229:33 | UPDATE.entity(Table) | +| update.js:229:14:229:54 | update.js:229 | update.js:229:14:229:54 | UPDATE. ... diff }) | +| update.js:229:14:229:75 | update.js:229 | update.js:229:14:229:75 | UPDATE. ... "*" }) | +| update.js:230:14:230:33 | update.js:230 | update.js:230:14:230:33 | UPDATE.entity(Table) | +| update.js:230:14:230:54 | update.js:230 | update.js:230:14:230:54 | UPDATE. ... diff }) | +| update.js:230:14:230:72 | update.js:230 | update.js:230:14:230:72 | UPDATE. ... 1='*'") | +| update.js:231:14:231:33 | update.js:231 | update.js:231:14:231:33 | UPDATE.entity(Table) | +| update.js:231:14:231:54 | update.js:231 | update.js:231:14:231:54 | UPDATE. ... diff }) | +| update.js:232:14:232:33 | update.js:232 | update.js:232:14:232:33 | UPDATE.entity(Table) | +| update.js:232:14:232:54 | update.js:232 | update.js:232:14:232:54 | UPDATE. ... diff }) | +| update.js:232:14:232:74 | update.js:232 | update.js:232:14:232:74 | UPDATE. ... ", "*") | +| update.js:233:14:233:33 | update.js:233 | update.js:233:14:233:33 | UPDATE.entity(Table) | +| update.js:233:14:233:54 | update.js:233 | update.js:233:14:233:54 | UPDATE. ... diff }) | +| update.js:234:14:234:33 | update.js:234 | update.js:234:14:234:33 | UPDATE.entity(Table) | +| update.js:234:14:234:54 | update.js:234 | update.js:234:14:234:54 | UPDATE. ... diff }) | +| update.js:234:14:234:81 | update.js:234 | update.js:234:14:234:81 | UPDATE. ... , 10)") | +| update.js:235:14:235:33 | update.js:235 | update.js:235:14:235:33 | UPDATE.entity(Table) | +| update.js:235:14:235:54 | update.js:235 | update.js:235:14:235:54 | UPDATE. ... diff }) | +| update.js:236:14:236:33 | update.js:236 | update.js:236:14:236:33 | UPDATE.entity(Table) | +| update.js:236:14:236:54 | update.js:236 | update.js:236:14:236:54 | UPDATE. ... diff }) | +| update.js:236:14:236:93 | update.js:236 | update.js:236:14:236:93 | UPDATE. ... 11 } }) | +| update.js:238:14:238:35 | update.js:238 | update.js:238:14:238:35 | UPDATE. ... Table") | +| update.js:238:14:238:84 | update.js:238 | update.js:238:14:238:84 | UPDATE. ... "*" }) | +| update.js:239:14:239:35 | update.js:239 | update.js:239:14:239:35 | UPDATE. ... Table") | +| update.js:239:14:239:81 | update.js:239 | update.js:239:14:239:81 | UPDATE. ... 1='*'") | +| update.js:240:14:240:35 | update.js:240 | update.js:240:14:240:35 | UPDATE. ... Table") | +| update.js:241:14:241:35 | update.js:241 | update.js:241:14:241:35 | UPDATE. ... Table") | +| update.js:241:14:241:83 | update.js:241 | update.js:241:14:241:83 | UPDATE. ... ", "*") | +| update.js:242:14:242:35 | update.js:242 | update.js:242:14:242:35 | UPDATE. ... Table") | +| update.js:243:14:243:35 | update.js:243 | update.js:243:14:243:35 | UPDATE. ... Table") | +| update.js:243:14:243:90 | update.js:243 | update.js:243:14:243:90 | UPDATE. ... , 10)") | +| update.js:244:14:244:35 | update.js:244 | update.js:244:14:244:35 | UPDATE. ... Table") | +| update.js:245:14:245:35 | update.js:245 | update.js:245:14:245:35 | UPDATE. ... Table") | +| update.js:245:14:245:103 | update.js:245 | update.js:245:14:245:103 | UPDATE. ... 1 }, }) | +| update.js:247:14:247:35 | update.js:247 | update.js:247:14:247:35 | UPDATE. ... Table") | +| update.js:247:14:247:104 | update.js:247 | update.js:247:14:247:104 | UPDATE. ... }] } }) | +| update.js:247:14:247:125 | update.js:247 | update.js:247:14:247:125 | UPDATE. ... "*" }) | +| update.js:248:14:248:35 | update.js:248 | update.js:248:14:248:35 | UPDATE. ... Table") | +| update.js:248:14:248:104 | update.js:248 | update.js:248:14:248:104 | UPDATE. ... }] } }) | +| update.js:248:14:248:122 | update.js:248 | update.js:248:14:248:122 | UPDATE. ... 1='*'") | +| update.js:249:14:249:35 | update.js:249 | update.js:249:14:249:35 | UPDATE. ... Table") | +| update.js:249:14:249:105 | update.js:249 | update.js:249:14:249:105 | UPDATE. ... ] }, }) | +| update.js:250:14:250:35 | update.js:250 | update.js:250:14:250:35 | UPDATE. ... Table") | +| update.js:250:14:250:104 | update.js:250 | update.js:250:14:250:104 | UPDATE. ... }] } }) | +| update.js:250:14:250:124 | update.js:250 | update.js:250:14:250:124 | UPDATE. ... ", "*") | +| update.js:251:14:251:35 | update.js:251 | update.js:251:14:251:35 | UPDATE. ... Table") | +| update.js:251:14:251:105 | update.js:251 | update.js:251:14:251:105 | UPDATE. ... ] }, }) | +| update.js:252:14:252:35 | update.js:252 | update.js:252:14:252:35 | UPDATE. ... Table") | +| update.js:252:14:252:104 | update.js:252 | update.js:252:14:252:104 | UPDATE. ... }] } }) | +| update.js:252:14:252:131 | update.js:252 | update.js:252:14:252:131 | UPDATE. ... , 10)") | +| update.js:253:14:253:35 | update.js:253 | update.js:253:14:253:35 | UPDATE. ... Table") | +| update.js:253:14:253:105 | update.js:253 | update.js:253:14:253:105 | UPDATE. ... ] }, }) | +| update.js:254:14:254:35 | update.js:254 | update.js:254:14:254:35 | UPDATE. ... Table") | +| update.js:254:14:254:104 | update.js:254 | update.js:254:14:254:104 | UPDATE. ... }] } }) | +| update.js:254:14:254:143 | update.js:254 | update.js:254:14:254:143 | UPDATE. ... 11 } }) | +| update.js:256:14:256:35 | update.js:256 | update.js:256:14:256:35 | UPDATE. ... Table") | +| update.js:256:14:256:56 | update.js:256 | update.js:256:14:256:56 | UPDATE. ... diff }) | +| update.js:256:14:256:77 | update.js:256 | update.js:256:14:256:77 | UPDATE. ... "*" }) | +| update.js:257:14:257:35 | update.js:257 | update.js:257:14:257:35 | UPDATE. ... Table") | +| update.js:257:14:257:56 | update.js:257 | update.js:257:14:257:56 | UPDATE. ... diff }) | +| update.js:257:14:257:74 | update.js:257 | update.js:257:14:257:74 | UPDATE. ... 1='*'") | +| update.js:258:14:258:35 | update.js:258 | update.js:258:14:258:35 | UPDATE. ... Table") | +| update.js:258:14:258:56 | update.js:258 | update.js:258:14:258:56 | UPDATE. ... diff }) | +| update.js:259:14:259:35 | update.js:259 | update.js:259:14:259:35 | UPDATE. ... Table") | +| update.js:259:14:259:56 | update.js:259 | update.js:259:14:259:56 | UPDATE. ... diff }) | +| update.js:259:14:259:76 | update.js:259 | update.js:259:14:259:76 | UPDATE. ... ", "*") | +| update.js:260:14:260:35 | update.js:260 | update.js:260:14:260:35 | UPDATE. ... Table") | +| update.js:260:14:260:56 | update.js:260 | update.js:260:14:260:56 | UPDATE. ... diff }) | +| update.js:261:14:261:35 | update.js:261 | update.js:261:14:261:35 | UPDATE. ... Table") | +| update.js:261:14:261:56 | update.js:261 | update.js:261:14:261:56 | UPDATE. ... diff }) | +| update.js:261:14:261:83 | update.js:261 | update.js:261:14:261:83 | UPDATE. ... , 10)") | +| update.js:262:14:262:35 | update.js:262 | update.js:262:14:262:35 | UPDATE. ... Table") | +| update.js:262:14:262:56 | update.js:262 | update.js:262:14:262:56 | UPDATE. ... diff }) | +| update.js:263:14:263:35 | update.js:263 | update.js:263:14:263:35 | UPDATE. ... Table") | +| update.js:263:14:263:56 | update.js:263 | update.js:263:14:263:56 | UPDATE. ... diff }) | +| update.js:263:14:263:95 | update.js:263 | update.js:263:14:263:95 | UPDATE. ... 11 } }) | diff --git a/javascript/frameworks/cap/test/models/cql/update/update.js b/javascript/frameworks/cap/test/models/cql/update/update.js new file mode 100644 index 000000000..e5c4c8a57 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/update/update.js @@ -0,0 +1,263 @@ +/* ========== UPDATE (entity), set ========== */ + +/* UPDATE acting as shortcut to UPDATE.entity */ +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`; +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE`Table`.set({ col1: diff }); // QBE + +var update = UPDATE(Table).set`col1 = col1 - ${diff}`; +var update = UPDATE(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE(Table).set({ col1: diff }); // QBE + +var update = UPDATE("Table").set`col1 = col1 - ${diff}`; +var update = UPDATE("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE("Table").set({ col1: diff }); // QBE + +/* With `entity` */ +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`; +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE.entity(Table).set({ col1: diff }); // QBE + +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`; +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE.entity("Table").set({ col1: diff }); // QBE + +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`; +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE.entity`Table`.set({ col1: diff }); // QBE + +/* ========== UPDATE (entity), with ========== */ + +/* Without `entity` */ +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`; +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE`Table`.with({ col1: diff }); // QBE + +/* With `entity` */ +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`; +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }); // CQN +var update = UPDATE.entity`Table`.with({ col1: diff }); // QBE + +/* ========== UPDATE (entity), set, where ========== */ + +/* Without `entity` */ +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE`Table`.set`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE`Table`.set({ col1: diff }).where({ col1: "*" }); +var update = UPDATE`Table`.set({ col1: diff }).where("col1='*'"); +var update = UPDATE`Table`.set({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE`Table`.set({ col1: diff }).where("col1=", "*"); +var update = UPDATE`Table`.set({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE`Table`.set({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE`Table`.set({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE`Table`.set({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); + +/* With `entity` */ +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE.entity`Table`.set`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity`Table`.set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity`Table`.set({ col1: diff }).where({ col1: "*" }); +var update = UPDATE.entity`Table`.set({ col1: diff }).where("col1='*'"); +var update = UPDATE.entity`Table`.set({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE.entity`Table`.set({ col1: diff }).where("col1=", "*"); +var update = UPDATE.entity`Table`.set({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE.entity`Table`.set({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE.entity`Table`.set({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity`Table`.set({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE.entity(Table).set`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity(Table).set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity(Table).set({ col1: diff }).where({ col1: "*" }); +var update = UPDATE.entity(Table).set({ col1: diff }).where("col1='*'"); +var update = UPDATE.entity(Table).set({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE.entity(Table).set({ col1: diff }).where("col1=", "*"); +var update = UPDATE.entity(Table).set({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE.entity(Table).set({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE.entity(Table).set({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity(Table).set({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE.entity("Table").set`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity("Table").set({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity("Table").set({ col1: diff }).where({ col1: "*" }); +var update = UPDATE.entity("Table").set({ col1: diff }).where("col1='*'"); +var update = UPDATE.entity("Table").set({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE.entity("Table").set({ col1: diff }).where("col1=", "*"); +var update = UPDATE.entity("Table").set({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE.entity("Table").set({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE.entity("Table").set({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity("Table").set({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); + +/* ========== UPDATE (entity), with, where ========== */ + +/* Without `entity` */ +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE`Table`.with`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE`Table`.with({ col1: diff }).where({ col1: "*" }); +var update = UPDATE`Table`.with({ col1: diff }).where("col1='*'"); +var update = UPDATE`Table`.with({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE`Table`.with({ col1: diff }).where("col1=", "*"); +var update = UPDATE`Table`.with({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE`Table`.with({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE`Table`.with({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE`Table`.with({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); + +/* With `entity` */ +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE.entity`Table`.with`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity`Table`.with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity`Table`.with({ col1: diff }).where({ col1: "*" }); +var update = UPDATE.entity`Table`.with({ col1: diff }).where("col1='*'"); +var update = UPDATE.entity`Table`.with({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE.entity`Table`.with({ col1: diff }).where("col1=", "*"); +var update = UPDATE.entity`Table`.with({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE.entity`Table`.with({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE.entity`Table`.with({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity`Table`.with({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE.entity(Table).with`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity(Table).with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity(Table).with({ col1: diff }).where({ col1: "*" }); +var update = UPDATE.entity(Table).with({ col1: diff }).where("col1='*'"); +var update = UPDATE.entity(Table).with({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE.entity(Table).with({ col1: diff }).where("col1=", "*"); +var update = UPDATE.entity(Table).with({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE.entity(Table).with({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE.entity(Table).with({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity(Table).with({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where({ col1: "*" }); +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where("col1='*'"); +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where`col1=${"*"}`; +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where("col1=", "*"); +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where`col = ${"*"}`; +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where("col1 in ('*', 10)"); +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where`col1 in ${[ ("*", 10), ]}`; +var update = UPDATE.entity("Table").with`col1 = col1 - ${diff}`.where({ col1: 10, and: { col2: 11 }, }); + +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: "*" }); +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1='*'"); +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1=${"*"}`; +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1=", "*"); +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col = ${"*"}`; +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where("col1 in ('*', 10)"); +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] }, }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity("Table").with({ col1: { xpr: [{ ref: ["col1"] }, "-", { ref: ["diff"] }] } }).where({ col1: 10, and: { col2: 11 } }); + +var update = UPDATE.entity("Table").with({ col1: diff }).where({ col1: "*" }); +var update = UPDATE.entity("Table").with({ col1: diff }).where("col1='*'"); +var update = UPDATE.entity("Table").with({ col1: diff }).where`col1=${"*"}`; +var update = UPDATE.entity("Table").with({ col1: diff }).where("col1=", "*"); +var update = UPDATE.entity("Table").with({ col1: diff }).where`col = ${"*"}`; +var update = UPDATE.entity("Table").with({ col1: diff }).where("col1 in ('*', 10)"); +var update = UPDATE.entity("Table").with({ col1: diff }).where`col1 in ${[("*", 10)]}`; +var update = UPDATE.entity("Table").with({ col1: diff }).where({ col1: 10, and: { col2: 11 } }); diff --git a/javascript/frameworks/cap/test/models/cql/update/update.ql b/javascript/frameworks/cap/test/models/cql/update/update.ql new file mode 100644 index 000000000..2c7551107 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/update/update.ql @@ -0,0 +1,6 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CQL + +from CQL::CqlClause s +select s.getLocation(), s + diff --git a/javascript/frameworks/cap/test/models/cql/upsert/upsert.expected b/javascript/frameworks/cap/test/models/cql/upsert/upsert.expected new file mode 100644 index 000000000..39a552845 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/upsert/upsert.expected @@ -0,0 +1,16 @@ +| upsert.js:2:14:5:2 | upsert.js:2 | upsert.js:2:14:5:2 | UPSERT( ... " },\\n]) | +| upsert.js:2:14:5:14 | upsert.js:2 | upsert.js:2:14:5:14 | UPSERT( ... (Table) | +| upsert.js:6:14:9:2 | upsert.js:6 | upsert.js:6:14:9:2 | UPSERT( ... " },\\n]) | +| upsert.js:6:14:9:16 | upsert.js:6 | upsert.js:6:14:9:16 | UPSERT( ... Table") | +| upsert.js:11:14:14:2 | upsert.js:11 | upsert.js:11:14:14:2 | UPSERT. ... " },\\n]) | +| upsert.js:15:14:18:2 | upsert.js:15 | upsert.js:15:14:18:2 | UPSERT. ... " },\\n]) | +| upsert.js:21:14:21:31 | upsert.js:21 | upsert.js:21:14:21:31 | UPSERT.into(Table) | +| upsert.js:21:14:24:1 | upsert.js:21 | upsert.js:21:14:24:1 | UPSERT. ... 22" }\\n) | +| upsert.js:25:14:25:31 | upsert.js:25 | upsert.js:25:14:25:31 | UPSERT.into(Table) | +| upsert.js:25:14:28:2 | upsert.js:25 | upsert.js:25:14:28:2 | UPSERT. ... " },\\n]) | +| upsert.js:29:14:29:33 | upsert.js:29 | upsert.js:29:14:29:33 | UPSERT.into("Table") | +| upsert.js:29:14:32:2 | upsert.js:29 | upsert.js:29:14:32:2 | UPSERT. ... " },\\n]) | +| upsert.js:33:14:33:33 | upsert.js:33 | upsert.js:33:14:33:33 | UPSERT.into("Table") | +| upsert.js:33:14:36:2 | upsert.js:33 | upsert.js:33:14:36:2 | UPSERT. ... " },\\n]) | +| upsert.js:37:14:40:2 | upsert.js:37 | upsert.js:37:14:40:2 | UPSERT. ... " },\\n]) | +| upsert.js:41:14:44:2 | upsert.js:41 | upsert.js:41:14:44:2 | UPSERT. ... " },\\n]) | diff --git a/javascript/frameworks/cap/test/models/cql/upsert/upsert.js b/javascript/frameworks/cap/test/models/cql/upsert/upsert.js new file mode 100644 index 000000000..78d0100ab --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/upsert/upsert.js @@ -0,0 +1,44 @@ +/* ========== into ========== */ +var upsert = UPSERT([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]).into(Table); +var upsert = UPSERT([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]).into("Table"); + +var upsert = UPSERT.into(Table, [ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var upsert = UPSERT.into("Table", [ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); + +/* ========== into, entries ========== */ +var upsert = UPSERT.into(Table).entries( + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" } +); +var upsert = UPSERT.into(Table).entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var upsert = UPSERT.into("Table").entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var upsert = UPSERT.into("Table").entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var upsert = UPSERT.into`Table`.entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); +var upsert = UPSERT.into`Table`.entries([ + { col1: "val11", col2: "val12" }, + { col1: "val21", col2: "val22" }, +]); diff --git a/javascript/frameworks/cap/test/models/cql/upsert/upsert.ql b/javascript/frameworks/cap/test/models/cql/upsert/upsert.ql new file mode 100644 index 000000000..2c7551107 --- /dev/null +++ b/javascript/frameworks/cap/test/models/cql/upsert/upsert.ql @@ -0,0 +1,6 @@ +import javascript +import advanced_security.javascript.frameworks.cap.CQL + +from CQL::CqlClause s +select s.getLocation(), s + diff --git a/javascript/frameworks/cap/test/qlpack.yml b/javascript/frameworks/cap/test/qlpack.yml new file mode 100644 index 000000000..96c3a8232 --- /dev/null +++ b/javascript/frameworks/cap/test/qlpack.yml @@ -0,0 +1,10 @@ +--- +name: advanced-security/javascript-sap-cap-queries-tests +version: 0.3.0 +extractor: javascript +dependencies: + codeql/javascript-all: "^0.8.1" + codeql/javascript-queries: "^0.8.1" + advanced-security/javascript-sap-cap-queries: "^0.3.0" + advanced-security/javascript-sap-cap-models: "^0.3.0" + advanced-security/javascript-sap-cap-all: "^0.1.1" \ No newline at end of file diff --git a/javascript/frameworks/cap/test/queries/sqlinjection.expected b/javascript/frameworks/cap/test/queries/sqlinjection.expected new file mode 100644 index 000000000..933e1888e --- /dev/null +++ b/javascript/frameworks/cap/test/queries/sqlinjection.expected @@ -0,0 +1,6 @@ +| sqlinjection.js:13:35:13:39 | query | Injection vulnerability found. | +| sqlinjection.js:15:25:15:65 | SELECT. ... book}`) | Injection vulnerability found. | +| sqlinjection.js:18:36:18:41 | query2 | Injection vulnerability found. | +| sqlinjection.js:20:25:20:63 | SELECT. ... '+book) | Injection vulnerability found. | +| sqlinjection.js:28:38:28:40 | cqn | Injection vulnerability found. | +| sqlinjection.js:31:38:31:41 | cqn1 | Injection vulnerability found. | diff --git a/javascript/frameworks/cap/test/queries/sqlinjection.js b/javascript/frameworks/cap/test/queries/sqlinjection.js new file mode 100644 index 000000000..5cc820090 --- /dev/null +++ b/javascript/frameworks/cap/test/queries/sqlinjection.js @@ -0,0 +1,36 @@ +import cds from '@sap/cds' +const { Books } = cds.entities ('sap.capire.bookshop') + +class SampleVulnService extends cds.ApplicationService { init(){ + + // contains a sample sql injection + this.on ('submitOrder', async req => { + const {book,quantity} = req.data + + let {stock} = await SELECT `stock` .from (Books,book) //alert? + + let query = SELECT.from `Books` .where (`ID=${book}`) + let books = await cds.db.run (query) //alert + + let books11 = await SELECT.from `Books` .where (`ID=${book}`) //alert + + let query2 = SELECT.from `Books` .where ('ID='+book) + let books2 = await cds.db.run (query2) //alert + + let books22 = await SELECT.from `Books` .where ('ID='+book) //alert + + let books3 = await SELECT.from `Books` .where `ID=${book}` //safe + + let id=2 + let books33 = await SELECT.from `Books` .where ('ID='+id) //safe + + let cqn = CQL`SELECT col1, col2, col3 from Books` + book + let books222 = await cds.db.run (cqn) //alert + + let cqn1 = cds.parse.cql (`SELECT * from Books`+ book) + let books111 = await cds.db.run (cqn1) //alert + }) + + return super.init() +}} +export { SampleVulnService } diff --git a/javascript/frameworks/cap/test/queries/sqlinjection.qlref b/javascript/frameworks/cap/test/queries/sqlinjection.qlref new file mode 100644 index 000000000..0401f5b18 --- /dev/null +++ b/javascript/frameworks/cap/test/queries/sqlinjection.qlref @@ -0,0 +1 @@ +sqlinjection/SqlInjection.ql \ No newline at end of file