mirror of
https://github.com/lingble/clickhouse.git
synced 2025-11-06 22:17:50 +00:00
Fix username & password use
This commit is contained in:
@@ -84,6 +84,7 @@ Exec by callback way:
|
||||
clickhouse.query(query).exec(function (err, rows) {
|
||||
...
|
||||
});
|
||||
````
|
||||
|
||||
***
|
||||
|
||||
|
||||
16
index.js
16
index.js
@@ -599,11 +599,27 @@ class ClickHouse {
|
||||
} else if (query.match(/^insert/i)) {
|
||||
reqParams['url'] = me.url + '?query=' + encodeURIComponent(query + ' FORMAT TabSeparated') + '&' + querystring.stringify(configQS);
|
||||
|
||||
if (me.opts.username) {
|
||||
reqParams['url'] = reqParams['url'] + '&user=' + me.opts.username;
|
||||
}
|
||||
|
||||
if (this.opts.password) {
|
||||
reqParams['url'] = reqParams['url'] + '&password=' + me.opts.password;
|
||||
}
|
||||
|
||||
if (data) {
|
||||
reqParams['body'] = me._getBodyForInsert(query, data);
|
||||
}
|
||||
} else {
|
||||
reqParams['url'] = me.url + '?query=' + encodeURIComponent(query) + '&' + querystring.stringify(configQS);
|
||||
|
||||
if (me.opts.username) {
|
||||
reqParams['url'] = reqParams['url'] + '&user=' + me.opts.username;
|
||||
}
|
||||
|
||||
if (this.opts.password) {
|
||||
reqParams['url'] = reqParams['url'] + '&password=' + me.opts.password;
|
||||
}
|
||||
}
|
||||
|
||||
reqParams['headers'] = {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
],
|
||||
"name": "clickhouse",
|
||||
"version": "1.2.14",
|
||||
"version": "1.2.15",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TimonKK/clickhouse.git"
|
||||
|
||||
Reference in New Issue
Block a user