@clickhouse/client
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -98,3 +98,3 @@ "use strict"; | ||
exec(params) { | ||
const query = removeSemi(params.query.trim()); | ||
const query = removeTrailingSemi(params.query.trim()); | ||
return this.connection.exec({ | ||
@@ -125,10 +125,16 @@ query, | ||
query = query.trim(); | ||
query = removeSemi(query); | ||
query = removeTrailingSemi(query); | ||
return query + ' \nFORMAT ' + format; | ||
} | ||
function removeSemi(query) { | ||
const idx = query.indexOf(';'); | ||
if (idx !== -1) { | ||
return query.slice(0, idx); | ||
function removeTrailingSemi(query) { | ||
let lastNonSemiIdx = query.length; | ||
for (let i = lastNonSemiIdx; i > 0; i--) { | ||
if (query[i - 1] !== ';') { | ||
lastNonSemiIdx = i; | ||
break; | ||
} | ||
} | ||
if (lastNonSemiIdx !== query.length) { | ||
return query.slice(0, lastNonSemiIdx); | ||
} | ||
return query; | ||
@@ -135,0 +141,0 @@ } |
{ | ||
"name": "@clickhouse/client", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Official JS client for ClickHouse DB", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
263468
3810