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

Add fetchAsString optional parameter to oracledb dialect #1998

Merged
merged 15 commits into from
Apr 28, 2017

Conversation

atiertant
Copy link
Contributor

add fetchAsString parameter (see https://github.com/oracle/node-oracledb/blob/master/doc/api.md#propdbfetchasstring)

var knex = require('knex')({
  client: 'oracledb',
  connection: {
    host : '127.0.0.1',
    user : 'your_database_user',
    password : 'your_database_password',
    database : 'myapp_test'
  }
  fetchAsString: ['DATE', 'NUMBER', 'CLOB']
});

@elhigu
Copy link
Member

elhigu commented Apr 4, 2017

Looks fine except that it should validate input strings and include test and documentation.

testfloat: 7.32,
testdate: new Date(2017, 5, 7)
}).then(function() {
done();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to just return promise from function instead of calling done in various places.

expect(result[0]).to.be.ok;
expect(result[0].testfloat).to.be.a('string');
expect(result[0].testdate).to.be.a('string');
knexClient.destroy(done);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

destroying client here makes all of these tests dependent to each other... sadly thats pretty much how all tests of knex are written.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could make two describe creating client in before and destroy in after.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would be more clean

@elhigu
Copy link
Member

elhigu commented Apr 10, 2017

Generally tests and docs looks good. Only thing is that I don't like using done() callback in tests without a good reason, they are more error prone than just returning a promise for test hook.

describe("without fetchAsString parameter", function() {
var knexClient;

before(function(done) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary done parameter

describe("with fetchAsString parameter", function() {
var knexClient;

before(function(done) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necesssary done()

});

describe("OracleDb parameters", function() {
this.timeout(10000);
Copy link
Member

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?

@elhigu
Copy link
Member

elhigu commented Apr 27, 2017

Sorry for taking ages with this. I found still couple of minor issues from the code. And probably that timeout should be just removed or use some value that is relative to process.env.KNEX_TEST_TIMEOUT.

@atiertant
Copy link
Contributor Author

@elhigu timeout was usefull on local only and we removed unnecessary done parameter.

@elhigu
Copy link
Member

elhigu commented Apr 28, 2017

Now it looks perfect, thanks!

@elhigu elhigu merged commit dd3289b into knex:master Apr 28, 2017
@elhigu
Copy link
Member

elhigu commented Apr 28, 2017

I'll try to roll out knex 0.13 during this weekend

@atiertant
Copy link
Contributor Author

@elhigu that's a good news ! thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants