Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Conversation

@rfk
Copy link
Contributor

@rfk rfk commented Apr 4, 2018

This also tweaks the implementation to preserve any existing mode flags on the connection, rather than overwriting them with just the modes from the required list. That's in line with how profile-server and oauth-server approach it.

@vladikoff r?

@rfk rfk requested a review from vladikoff April 4, 2018 01:19
@ghost ghost assigned rfk Apr 4, 2018
@ghost ghost added the waffle:active label Apr 4, 2018
}

options.master.sql_mode = options.sql_mode
options.slave.sql_mode = options.sql_mode
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The MySQL module docs don't mention this sql_mode option, so I wasn't sure if it was doing anything, so I deleted it.

This also tweaks the implementation to preserve any existing mode
flags on the connection, rather than overwriting them with just the
modes from the required list.
@rfk rfk force-pushed the configurable-required-sql-modes branch from 19aed23 to fa6d130 Compare April 4, 2018 01:24
.then(
assert.fail,
err => {
assert.equal(err.message, 'ER_WRONG_VALUE_FOR_VAR')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fact that MySQL rejects this value, is a useful test that we are actually attempting to call SET SESSION sql_mode = blah with the provided value.

Copy link
Contributor

@philbooth philbooth left a comment

Choose a reason for hiding this comment

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

👍 LGTM!

},
requiredSQLModes: {
doc: 'Comma-separated list of SQL mode flags to enforce on each connection',
default: '',
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, let's just not forget to actually set this at some point :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you leave it unset, it should use the hard-coded defaults from const REQUIRED_SQL_MODES; perhaps the config doc here could have made that clearer.

@vladikoff vladikoff merged commit a229ddc into master Apr 4, 2018
@shane-tomlinson shane-tomlinson deleted the configurable-required-sql-modes branch April 18, 2018 12:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants