New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dbgate-query-splitter

Package Overview
Dependencies
Maintainers
0
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbgate-query-splitter - npm Package Compare versions

Comparing version 4.10.1 to 4.10.2

18

lib/splitQuery.js

@@ -40,13 +40,2 @@ "use strict";

}
function isStringEnd(s, pos, endch, escapech) {
if (!escapech) {
return s[pos] == endch;
}
if (endch == escapech) {
return s[pos] == endch && s[pos + 1] != endch;
}
else {
return s[pos] == endch && s[pos - 1] != escapech;
}
}
const WHITESPACE_TOKEN = {

@@ -93,4 +82,7 @@ type: 'whitespace',

const escapech = context.options.stringEscapes[ch];
while (pos < context.end && !isStringEnd(s, pos, endch, escapech)) {
if (endch == escapech && s[pos] == endch && s[pos + 1] == endch) {
while (pos < context.end) {
if (s[pos] == endch) {
break;
}
if (escapech && s[pos] == escapech) {
pos += 2;

@@ -97,0 +89,0 @@ }

@@ -17,2 +17,10 @@ "use strict";

});
test('correct split 2 queries - with escaped string', () => {
const output = (0, splitQuery_1.splitQuery)("INSERT INTO names (name) VALUES('one\\\\');INSERT INTO names (name) VALUES('two\\\\');", options_1.mysqlSplitterOptions);
expect(output).toEqual(["INSERT INTO names (name) VALUES('one\\\\')", "INSERT INTO names (name) VALUES('two\\\\')"]);
});
test('incorrect used escape', () => {
const output = (0, splitQuery_1.splitQuery)("query1\\", options_1.mysqlSplitterOptions);
expect(output).toEqual(["query1\\"]);
});
test('delete empty query', () => {

@@ -19,0 +27,0 @@ const output = (0, splitQuery_1.splitQuery)(';;;\n;;SELECT * FROM `table1`;;;;;SELECT * FROM `table2`;;; ;;;', options_1.mysqlSplitterOptions);

{
"version": "4.10.1",
"version": "4.10.2",
"name": "dbgate-query-splitter",

@@ -4,0 +4,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc