@apla/clickhouse
Advanced tools
Comparing version 1.5.1 to 1.5.2
{ | ||
"name": "@apla/clickhouse", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "Yandex ClickHouse database interface", | ||
@@ -5,0 +5,0 @@ "main": "src/clickhouse.js", |
@@ -153,3 +153,3 @@ var http = require ('http'); | ||
} catch (e) { | ||
if (!reqData.format.match (/^(JSON|JSONCompact)$/)) { | ||
if (!reqData.format || !reqData.format.match (/^(JSON|JSONCompact)$/)) { | ||
data = str.toString ('utf8'); | ||
@@ -288,2 +288,5 @@ } else { | ||
} else if (chQuery.match (/INSERT\s+INTO\s+\S+\s+(?:\([^\)]+\)\s+)?SELECT/mi)) { | ||
reqData.finalized = true; | ||
options.omitFormat = true; | ||
} else { | ||
@@ -290,0 +293,0 @@ |
@@ -39,3 +39,3 @@ var ClickHouse = require ("../src/clickhouse"); | ||
it.skip ("pings with options as host", function (done) { | ||
it ("pings with options as host", function (done) { | ||
var ch = new ClickHouse (host); | ||
@@ -42,0 +42,0 @@ ch.ping (function (err, ok) { |
@@ -80,2 +80,4 @@ var ClickHouse = require ("../src/clickhouse"); | ||
// https://stackoverflow.com/questions/41333617/correct-usage-of-writev-in-node-js | ||
// stream.cork (); | ||
stream.write ('8'); | ||
@@ -168,2 +170,4 @@ stream.write ('73'); | ||
assert.equal (result.data.length, 2); | ||
done (); | ||
@@ -183,4 +187,34 @@ | ||
it.skip ("piping data from csv file", function (done) { | ||
it ("inserts from select", function (done) { | ||
var ch = new ClickHouse ({host: host, port: port, queryOptions: {database: dbName}}); | ||
var now = new Date (); | ||
var stream = ch.query ("INSERT INTO t3 SELECT * FROM t2", {}, function (err, result) { | ||
assert (!err, err); | ||
ch.query ("SELECT * FROM t3", {syncParser: true, queryOptions: {database: dbName}}, function (err, result) { | ||
assert.equal (result.data[2][0], 1); | ||
assert.equal (result.data[2][1], 2.22); | ||
assert.equal (result.data[2][2], null); | ||
assert.equal (result.data[2][3], now.toISOString().replace (/\..*/, '').replace ('T', ' ')); | ||
assert.equal (result.data[3][0], 20); | ||
assert.equal (result.data[3][1], 1.11); | ||
assert.equal (result.data[3][2], "wrqwefqwef"); | ||
assert.equal (result.data[3][3], "2017-07-07 12:12:12"); | ||
assert.equal (result.data.length, 4); | ||
done (); | ||
}); | ||
}); | ||
// stream.end (); | ||
}); | ||
it ("piping data from csv file", function (done) { | ||
this.timeout (5000); | ||
@@ -187,0 +221,0 @@ |
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
64173
1449
16