You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
I have a few questions about example described in README.md
def main(args: Array[String]) {
val configuration = URLParser.parse("jdbc:postgresql://localhost:5233/my_database?user=postgres&password=somepassword")
val connection: Connection = new PostgreSQLConnection(configuration)
Await.result(connection.connect, 5 seconds)
val future: Future[QueryResult] = connection.sendQuery("SELECT 0")
val mapResult: Future[Any] = future.map(queryResult => queryResult.rows match {
case Some(resultSet) => {
val row : RowData = resultSet.head
row(0)
}
case None => -1
}
)
val result = Await.result( mapResult, 5 seconds )
println(result)
connection.disconnect
}
Why does the last statement return Future and just ignored? connection.disconnect? Looks like the result is just ignored, and disconnect even not finished before application shutdown. I would add Await.result here, not anywhere else.
Can't we use flatMap instead of two Await.result ?
Hi!
I have a few questions about example described in README.md
connection.disconnect
? Looks like the result is just ignored, and disconnect even not finished before application shutdown. I would add Await.result here, not anywhere else.Await.result
?Something like
?
The text was updated successfully, but these errors were encountered: