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 additional config options enableQuotedIdentifier, enableArithAbor… #508

Closed

Conversation

ariskemper
Copy link
Contributor

Add additional config options enableQuotedIdentifier, enableArithAbort, enableNumericRoundabort, enableAnsiWarnings, enableAnsiPadding, enableAnsiNull, enableAnsiNullDefault, enableConcatNullYeldsNull,enableCursorCloseOnCommit, enableImplicitTransactions,dateFirst, language, dateFormat.

Relates to #507 #506 #501 #503


class Connection extends EventEmitter {
constructor(config) {
super();

var self = this;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason why you add this self variable here? Couldn't we just use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could use this, since we dont use this in some loop and constructor is not called offten.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use this, since we dont use this in some loop and constructor is not called offten.

Using this in loops is not an issue - I think you're thinking about callbacks passed to other functions. Luckily, tedious is transpiled from modern JavaScript, so you we use => functions in cases where we want to have correct this bindings in callbacks.

I'd like us to follow modern javascript guidelines, so patterns like var self = this are discouraged.

Copy link
Collaborator

@arthurschreiber arthurschreiber left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! ❤️

There's a few comments that I left for things that need a bit more fine tuning, but other than that, this PR looks great and I'm looking forward to having these changes be part of tedious!

'set transaction isolation level ' + (this.getIsolationLevelText(this.config.options.connectionIsolationLevel)) + '\n ' +
'set xact_abort ' + xact_abort;

console.log(ret);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This console.log needs to be removed. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely 👍

const enableImplicitTransactions = this.config.options.enableImplicitTransactions ? 'on' : 'off';
const xact_abort = this.config.options.abortTransactionOnError ? 'on' : 'off';

var ret = 'set textsize ' + this.config.options.textsize + '\n' +
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you make this variable const here? Or remove the variable completely and just change it back to a return.

You could also change this string to make use of template literals to make it a bit more readable if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Template literals are good so lets use it here 👍

}
};

self.config = _.merge(defaults, config);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change this back to not use _.merge? The idea here is to make sure that the connection configuration will never end up with additional config properties other than what is supported.

We had similar code as above before, but that lead us to not have a single, definitive list of supported options. See the discussion in #445.

Copy link
Contributor Author

@ariskemper ariskemper Feb 20, 2017

Choose a reason for hiding this comment

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

This could be done with list of available config options and, if config option is not in the list throwing notice?

@tvrprasad
Copy link
Contributor

@ariskemper Can you please add integration tests to connection-test.coffee for these changes? For dateFirst, you can grab tests from #503.

@ariskemper
Copy link
Contributor Author

@tvrprasad i will add integration tests for all additional options, also #503

@tvrprasad
Copy link
Contributor

@tvrprasad i will add integration tests for all additional options, also #503

Thanks @ariskemper !

@edwardsmit
Copy link
Contributor

@ariskemper Updated the tests in #503

@tvrprasad
Copy link
Contributor

@ariskemper I just merged changes from #501 by @carlosman for enableArithAbort that includes tests. Please rebase.

@tvrprasad
Copy link
Contributor

@ariskemper Please pick #503 also.

@ariskemper
Copy link
Contributor Author

@arthurschreiber @tvrprasad @edwardsmit i made requested changes with tests. Test for enableAnsiNullDefault and enableAnsiNull is still missing.

@tvrprasad
Copy link
Contributor

I think you need to rebase. Right now your PR is showing a bunch of commits from others.

@ariskemper ariskemper force-pushed the additional-config-options branch 2 times, most recently from 07c292b to 7631d6a Compare March 15, 2017 17:43
…t, enableNumericRoundabort,

enableAnsiWarnings, enableAnsiPadding, enableAnsiNull, enableAnsiNullDefault, enableConcatNullYeldsNull,enableCursorCloseOnCommit, enableImplicitTransactions,dateFirst, language, dateFormat.
@tvrprasad
Copy link
Contributor

@ariskemper There are a lot of indentation changes that creeped into this PR that make it difficult to review. Can you please clean this up so that the only changes are the ones relevant to the core intent of this PR.

If you're trying to fix indentation, you can prepare a different PR for that. Thanks!

…t, enableNumericRoundabort,

enableAnsiWarnings, enableAnsiPadding, enableAnsiNull, enableAnsiNullDefault, enableConcatNullYeldsNull,enableCursorCloseOnCommit, enableImplicitTransactions,dateFirst, language, dateFormat.
@ariskemper
Copy link
Contributor Author

@tvrprasad sorry i used github web editor for resolving conflict, which is not very good idea. I rebased with master and resolved conflicts. I think, it could easy be merged or you could use cherry pick to pick up specific commit.

@edwardsmit
Copy link
Contributor

@ariskemper Are you still working on this?

@ariskemper
Copy link
Contributor Author

ariskemper commented May 14, 2017

@edwardsmit @tvrprasad @arthurschreiber Would be great, if maintainer would pick the changes and merge it to release, since i currently don't have time to work on this.

@tvrprasad
Copy link
Contributor

@edwardsmit @tvrprasad @arthurschreiber Would be great, if maintainer would pick the changes and merge it to release, since i currently don't have time to work on this.

I'll take a crack at this.

tvrprasad pushed a commit to tvrprasad/tedious that referenced this pull request May 18, 2017
dateFormat, enableAnsiNull, enableAnsiPadding, enableAnsiWarnings,
enableConcatNullYeldsNull, enableCursorCloseOnCommit,
enableImplicitTransactions, enableNumericRoundabort, enableQuotedIdentifier,
language.

Relates to tediousjs#507 tediousjs#506 tediousjs#501 tediousjs#503

This is a cleaned up merged version of tediousjs#508.
@tvrprasad
Copy link
Contributor

Pushed a cleaned up PR (#580) attributed to @ariskemper

@tvrprasad tvrprasad closed this May 18, 2017
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.

4 participants