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
Add fetchAsString optional parameter to oracledb dialect #1998
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1120fec
Add optional parameter fetchAsString to oracledb
CorvusCorrax 0e9777c
Add some checks to oracle fetchAsString
CorvusCorrax 6faa039
Merge branch 'master' of https://github.com/tgriesser/knex
CorvusCorrax 7d6bfb2
Add fetchAsString optional parameter to oracledb
atiertant abdca13
use const instead of let
atiertant 8fe3e7a
add fetchAsString test
CorvusCorrax cf8d78c
Merge pull request #5 from CorvusCorrax/master
atiertant 852cd3f
change const to var in tests
atiertant 05d814f
move oracle driver specific test to bottom
atiertant abfbb58
fix fetchAsSting multiple instance
atiertant 72979da
Fix tests
CorvusCorrax 1c464ec
replace const to var in test
atiertant f8720c7
Rework Oracle fetchAsString tests
CorvusCorrax 7292076
remove const
atiertant 532bee9
remove done and timeout
atiertant File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,29 @@ | ||
/*global it, describe, expect*/ | ||
// global it, describe, expect | ||
|
||
'use strict'; | ||
var _ = require('lodash'); | ||
var expect = require('chai').expect; | ||
var knex = require('../../../knex'); | ||
var knexInstance = knex( | ||
{ | ||
client: 'oracledb', | ||
connection: { | ||
user : "user", | ||
password : "password", | ||
connectString : 'connect-string', | ||
externalAuth : true, | ||
host : "host", | ||
database : "database" | ||
} | ||
} | ||
); | ||
var spy; | ||
var config = require('../../knexfile'); | ||
|
||
beforeEach(function() { | ||
spy = sinon.spy(knexInstance.client.driver, "getConnection"); | ||
}); | ||
describe("OracleDb externalAuth", function() { | ||
var knexInstance = knex({ | ||
client: 'oracledb', | ||
connection: { | ||
user : "user", | ||
password : "password", | ||
connectString : 'connect-string', | ||
externalAuth : true, | ||
host : "host", | ||
database : "database" | ||
} | ||
}); | ||
var spy; | ||
|
||
afterEach(function() { | ||
sinon.restore(knexInstance.client.driver.getConnection); | ||
}); | ||
before(function() { | ||
spy = sinon.spy(knexInstance.client.driver, "getConnection"); | ||
}); | ||
|
||
describe("OracleDb externalAuth", function() { | ||
it('externalAuth and connectString should be sent to the getConnection', function() { | ||
var connectionWithExternalAuth = { | ||
connectString: "connect-string", | ||
|
@@ -39,4 +36,72 @@ describe("OracleDb externalAuth", function() { | |
expect(spy).to.have.callCount(1); | ||
expect(spy).to.have.been.calledWith(connectionWithExternalAuth); | ||
}); | ||
|
||
after(function() { | ||
sinon.restore(knexInstance.client.driver.getConnection); | ||
}); | ||
|
||
}); | ||
|
||
describe("OracleDb parameters", function() { | ||
this.timeout(10000); | ||
|
||
describe("with fetchAsString parameter", function() { | ||
var knexClient; | ||
|
||
before(function(done) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not necesssary done() |
||
var conf = _.clone(config.oracledb); | ||
conf.fetchAsString = [ 'number', 'DATE', 'cLOb']; | ||
knexClient = knex(conf); | ||
done(); | ||
}); | ||
|
||
it('on float', function() { | ||
return knexClient.raw('select 7.329 as "field" from dual').then(function(result) { | ||
expect(result[0]).to.be.ok; | ||
expect(result[0].field).to.be.a('string'); | ||
}) | ||
}); | ||
|
||
it('on date', function() { | ||
return knexClient.raw('select CURRENT_DATE as "field" from dual').then(function(result) { | ||
expect(result[0]).to.be.ok; | ||
expect(result[0].field).to.be.a('string'); | ||
}) | ||
}); | ||
|
||
after(function() { | ||
return knexClient.destroy(); | ||
}); | ||
|
||
}); | ||
|
||
describe("without fetchAsString parameter", function() { | ||
var knexClient; | ||
|
||
before(function(done) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not necessary done parameter |
||
knexClient = knex(config.oracledb); | ||
done(); | ||
}); | ||
|
||
it('on float', function() { | ||
return knexClient.raw('select 7.329 as "field" from dual').then(function(result) { | ||
expect(result[0]).to.be.ok; | ||
expect(result[0].field).to.not.be.a('string'); | ||
}) | ||
}); | ||
|
||
it('on date', function() { | ||
return knexClient.raw('select CURRENT_DATE as "field" from dual').then(function(result) { | ||
expect(result[0]).to.be.ok; | ||
expect(result[0].field).to.not.be.a('string'); | ||
}) | ||
}); | ||
|
||
after(function() { | ||
return knexClient.destroy(); | ||
}); | ||
|
||
}); | ||
|
||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this timeout is here?