@apla/clickhouse
Advanced tools
Comparing version 1.5.0 to 1.5.1
{ | ||
"name": "@apla/clickhouse", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Yandex ClickHouse database interface", | ||
@@ -5,0 +5,0 @@ "main": "src/clickhouse.js", |
@@ -175,4 +175,13 @@ var http = require ('http'); | ||
var req = http.request (reqParams, httpResponseHandler.bind (this, stream, reqParams, reqData, cb)); | ||
var req = http.request (reqParams, httpResponseHandler.bind ( | ||
this, stream, reqParams, reqData, cb | ||
)); | ||
req.on ('error', function (e) { | ||
// user should define callback or add event listener for the error event | ||
if (!cb || (cb && stream.listeners ('error').length)) | ||
stream.emit ('error', e); | ||
return cb && cb (e); | ||
}); | ||
stream.req = req; | ||
@@ -179,0 +188,0 @@ |
@@ -39,3 +39,3 @@ var ClickHouse = require ("../src/clickhouse"); | ||
it ("pings with options as host", function (done) { | ||
it.skip ("pings with options as host", function (done) { | ||
var ch = new ClickHouse (host); | ||
@@ -42,0 +42,0 @@ ch.ping (function (err, ok) { |
@@ -16,2 +16,14 @@ var ClickHouse = require ("../src/clickhouse"); | ||
it ("will not throw on http error", function (done) { | ||
var ch = new ClickHouse ({host: host, port: 59999, useQueryString: true}); | ||
var stream = ch.query ("ABCDEFGHIJKLMN", {syncParser: true}, function (err, result) { | ||
// assert (err); | ||
// done (); | ||
}); | ||
stream.on ('error', function (err) { | ||
done(); | ||
}); | ||
}); | ||
it ("returns error for unknown sql", function (done) { | ||
@@ -76,3 +88,3 @@ var ch = new ClickHouse ({host: host, port: port, useQueryString: true}); | ||
assert (err); | ||
assert (err.message.match (/Syntax error/)); | ||
assert (err.message === 'Empty query' || err.message.match (/Syntax error/)); | ||
assert.ifError ('lineno' in err); | ||
@@ -79,0 +91,0 @@ assert.ifError ('colno' in err); |
@@ -80,4 +80,2 @@ var ClickHouse = require ("../src/clickhouse"); | ||
// https://stackoverflow.com/questions/41333617/correct-usage-of-writev-in-node-js | ||
// stream.cork (); | ||
stream.write ('8'); | ||
@@ -84,0 +82,0 @@ stream.write ('73'); |
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
1423
63701
17