Socket
Socket
Sign inDemoInstall

odata-v4-mysql

Package Overview
Dependencies
3
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

17

build/example/sql.js

@@ -14,3 +14,3 @@ "use strict";

function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }

@@ -82,9 +82,7 @@ step((generator = generator.apply(thisArg, _arguments)).next());

odata_v4_server_1.odata.GET,
__param(0, odata_v4_server_1.odata.stream),
__param(1, odata_v4_server_1.odata.query)
__param(0, odata_v4_server_1.odata.stream), __param(1, odata_v4_server_1.odata.query)
], CountriesController.prototype, "getCountries", null);
__decorate([
odata_v4_server_1.odata.GET,
__param(0, odata_v4_server_1.odata.key),
__param(1, odata_v4_server_1.odata.query)
__param(0, odata_v4_server_1.odata.key), __param(1, odata_v4_server_1.odata.query)
], CountriesController.prototype, "getCountry", null);

@@ -118,9 +116,7 @@ CountriesController = __decorate([

odata_v4_server_1.odata.GET,
__param(0, odata_v4_server_1.odata.stream),
__param(1, odata_v4_server_1.odata.query)
__param(0, odata_v4_server_1.odata.stream), __param(1, odata_v4_server_1.odata.query)
], CitiesController.prototype, "getCities", null);
__decorate([
odata_v4_server_1.odata.GET,
__param(0, odata_v4_server_1.odata.key),
__param(1, odata_v4_server_1.odata.query)
__param(0, odata_v4_server_1.odata.key), __param(1, odata_v4_server_1.odata.query)
], CitiesController.prototype, "getCity", null);

@@ -142,4 +138,3 @@ CitiesController = __decorate([

odata_v4_server_1.odata.GET,
__param(0, odata_v4_server_1.odata.stream),
__param(1, odata_v4_server_1.odata.query)
__param(0, odata_v4_server_1.odata.stream), __param(1, odata_v4_server_1.odata.query)
], CountryLanguagesController.prototype, "getLanguages", null);

@@ -146,0 +141,0 @@ CountryLanguagesController = __decorate([

@@ -107,2 +107,42 @@ "use strict";

break;
case "substring":
this.where += "SUBSTR(";
this.Visit(params[0], context);
this.where += ", ";
this.Visit(params[1], context);
this.where += " + 1";
if (params[2]) {
this.where += ", ";
this.Visit(params[2], context);
}
else {
this.where += ", CHAR_LENGTH(";
this.Visit(params[0], context);
this.where += ")";
}
this.where += ")";
break;
case "substringof":
this.Visit(params[1], context);
if (params[0].value == "Edm.String") {
if (this.options.useParameters) {
let value = odata_v4_literal_1.Literal.convert(params[0].value, params[0].raw);
this.parameters.push(`%${value}%`);
this.where += ` like \$${this.parameters.length}`;
}
else
this.where += ` like '%${visitor_1.SQLLiteral.convert(params[0].value, params[0].raw).slice(1, -1)}%'`;
}
else {
this.where += " like ";
this.Visit(params[0], context);
}
break;
case "concat":
this.where += "CONCAT(";
this.Visit(params[0], context);
this.where += ", ";
this.Visit(params[1], context);
this.where += ")";
break;
case "round":

@@ -109,0 +149,0 @@ this.where += "ROUND(";

{
"name": "odata-v4-mysql",
"version": "0.1.0",
"version": "0.1.1",
"description": "OData to MySQL query compiler",

@@ -15,3 +15,5 @@ "main": "build/lib/index.js",

"pretdd": "npm run build",
"tdd": "mocha -w"
"tdd": "mocha -w",
"prepublish": "npm run build",
"start": "tsc && node build/example/sql.js"
},

@@ -18,0 +20,0 @@ "repository": {

@@ -106,2 +106,38 @@ import { Token } from "odata-v4-parser/lib/lexer";

break;
case "substring":
this.where += "SUBSTR(";
this.Visit(params[0], context);
this.where += ", ";
this.Visit(params[1], context);
this.where += " + 1";
if (params[2]){
this.where += ", ";
this.Visit(params[2], context);
}else{
this.where += ", CHAR_LENGTH(";
this.Visit(params[0], context);
this.where += ")";
}
this.where += ")";
break;
case "substringof":
this.Visit(params[1], context);
if (params[0].value == "Edm.String"){
if (this.options.useParameters){
let value = Literal.convert(params[0].value, params[0].raw);
this.parameters.push(`%${value}%`);
this.where += ` like \$${this.parameters.length}`;
}else this.where += ` like '%${SQLLiteral.convert(params[0].value, params[0].raw).slice(1, -1)}%'`;
}else{
this.where += " like ";
this.Visit(params[0], context);
}
break;
case "concat":
this.where += "CONCAT(";
this.Visit(params[0], context);
this.where += ", ";
this.Visit(params[1], context);
this.where += ")";
break;
case "round":

@@ -108,0 +144,0 @@ this.where += "ROUND(";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc