-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
Update Play to 2.7.0-RC8 #446
Update Play to 2.7.0-RC8 #446
Conversation
Codecov Report
@@ Coverage Diff @@
## master #446 +/- ##
========================================
- Coverage 7.82% 7.5% -0.33%
========================================
Files 19 19
Lines 843 853 +10
Branches 10 11 +1
========================================
- Hits 66 64 -2
- Misses 777 789 +12
Continue to review full report at Codecov.
|
@@ -47,7 +47,7 @@ final class SlickModule extends Module { | |||
if (dbs.contains(default)) Seq(bind[DatabaseConfigProvider].to(bindNamed(default))) else Nil | |||
|
|||
def bindNamed(name: String): BindingKey[DatabaseConfigProvider] = | |||
bind(classOf[DatabaseConfigProvider]).qualifiedWith(new NamedDatabaseImpl(name)) |
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.
Just to avoid a deprecated API.
val conn = getConnection() | ||
conn.setAutoCommit(autocommit) | ||
conn | ||
override def getConnection(autocommit: Boolean): Connection = { |
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.
This implementation is now consistent with what we have in Play and fixes a possible connection leak if it fails to setAutoCommit
.
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.
Is this related in any way to #445 ?
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.
It is possible. But needs further investigation to confirm.
def withConnection[A](autocommit: Boolean)(block: Connection => A): A = withConnection { conn => | ||
conn.setAutoCommit(autocommit) | ||
block(conn) | ||
def withConnection[A](autocommit: Boolean)(block: Connection => A): A = { |
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.
Make this method the default base that other overloads of withConnection
will use. It is responsible to execute a block and release the connection.
} finally { | ||
if (!done) conn.rollback() | ||
conn.close() | ||
withConnection(autocommit = false) { connection => |
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.
Not using done = true
but instead handling the exceptions.
} | ||
} | ||
|
||
override def withTransaction[A](isolationLevel: TransactionIsolationLevel)(block: Connection => A): A = { |
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.
The new method override that uses TransactionIsolationLevel
.
No description provided.