Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up client and connection parameters #92

Merged
merged 8 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/v-pool/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('pool', function () {
pool.connect(function (err, client, release) {
release()
if (err) return done(err)
expect(client.binary).to.eql(true)
expect(client.connectionParameters.binary).to.eql(true)
pool.end(done)
})
})
Expand Down
15 changes: 6 additions & 9 deletions packages/vertica-nodejs/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ class Client extends EventEmitter {
value: this.connectionParameters.password,
})

this.replication = this.connectionParameters.replication

this.client_label = this.connectionParameters.client_label;
this.protocol_version = this.connectionParameters.protocol_version;

var c = config || {}
Expand All @@ -67,21 +64,20 @@ class Client extends EventEmitter {
stream: c.stream,
tls_mode: this.connectionParameters.tls_mode,
tls_trusted_certs: this.connectionParameters.tls_trusted_certs,
//tls_client_key: this.connectionParameters.tls_client_key,
//tls_client_cert: this.connectionParameters.tls_client_cert,
keepAlive: c.keepAlive || false,
keepAliveInitialDelayMillis: c.keepAliveInitialDelayMillis || 0,
encoding: this.connectionParameters.client_encoding || 'utf8',
client_label: this.connectionParameters.client_label,
})
this.queryQueue = []
this.binary = c.binary || defaults.binary
this.processID = null
this.secretKey = null
this.tls_mode = this.connectionParameters.tls_mode || 'disable'
//this.tls_client_key = this.connectionParameters.tls_client_key
//this.tls_client_cert = this.connectionParameters.tls_client_cert
this.tls_trusted_certs = this.connectionParameters.tls_trusted_certs

delete this.connectionParameters.tls_mode
delete this.connectionParameters.tls_trusted_certs

this._connectionTimeoutMillis = c.connectionTimeoutMillis || 0
}

Expand Down Expand Up @@ -656,7 +652,8 @@ class Client extends EventEmitter {
}
}

if (this.binary && !query.binary) {
const binary = this.connectionParameters.binary || defaults.binary
if (binary && !query.binary) {
query.binary = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('vertica label connection parameter', function () {

//assert creating a client connection will use default label
var client_default = new vertica.Client()
assert.equal(client_default.client_label, vertica.defaults.client_label)
assert.equal(client_default.connectionParameters.client_label, vertica.defaults.client_label)
client_default.connect()
client_default.query('SELECT GET_CLIENT_LABEL()', (err, res) => {
if (err){
Expand All @@ -39,7 +39,7 @@ describe('vertica label connection parameter', function () {
it('can be specified and used in a client connection', function(done) {
// assert creating a client connection with specified label will persist
var client_test = new vertica.Client({client_label: 'distinctLabel'})
assert.equal(client_test.client_label, 'distinctLabel')
assert.equal(client_test.connectionParameters.client_label, 'distinctLabel')
client_test.connect()
client_test.query('SELECT GET_CLIENT_LABEL()', (err, res) => {
if (err){
Expand Down