From 45672cf7e2af791c45aae03c0f1f4abdc6cbfdee Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Mon, 23 Jul 2012 19:21:43 +0400 Subject: [PATCH] Added workaround to KT-2493 to get maven build back to life. --- .../src/main/kotlin/kotlin/jdbc/Connections.kt | 2 +- .../src/main/kotlin/kotlin/jdbc/DataSources.kt | 12 ++++++------ .../src/main/kotlin/kotlin/jdbc/Statements.kt | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Connections.kt b/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Connections.kt index 41ad699fc96..f950379106e 100644 --- a/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Connections.kt +++ b/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Connections.kt @@ -10,7 +10,7 @@ import java.math.BigDecimal fun Connection.statement(block: (Statement) -> T): T { val statement = createStatement() if (statement != null) { - return statement.use(block) + return statement.useSql(block) } else { throw IllegalStateException("No Statement returned from $this") } diff --git a/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/DataSources.kt b/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/DataSources.kt index 8925868a591..b0693e1966c 100644 --- a/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/DataSources.kt +++ b/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/DataSources.kt @@ -7,7 +7,7 @@ import kotlin.template.StringTemplate /** * Processes a connection from the pool using the given function block */ -fun DataSource.use(block : (Connection) -> T): T { +fun DataSource.useDataSource(block : (Connection) -> T): T { // TODO rename to "use" when KT-2493 is fixed val connection = getConnection() if (connection != null) { try { @@ -24,33 +24,33 @@ fun DataSource.use(block : (Connection) -> T): T { * Helper method to process a statement on this collection */ fun DataSource.statement(block: (Statement) -> T): T { - return use{ it.statement(block) } + return useDataSource{ it.statement(block) } } /** * Perform an SQL update on the connection */ fun DataSource.update(sql: String): Int { - return use{ it.update(sql) } + return useDataSource{ it.update(sql) } } /** * Perform a query on the connection and processes the result set with a function */ fun DataSource.query(sql: String, block: (ResultSet) -> T): T { - return use{ it.query(sql, block) } + return useDataSource{ it.query(sql, block) } } /** * Performs the update using the given SQL using a [[StringTemplate]] */ fun DataSource.update(template : StringTemplate) : Int { - return use{ it.update(template) } + return useDataSource{ it.update(template) } } /** * Perform a query on the connection using the SQL from the [[StringTemplate]] and processes the result set with a function */ fun DataSource.query(template : StringTemplate, resultBlock : (ResultSet) -> T) : T { - return use{ it.query(template, resultBlock) } + return useDataSource{ it.query(template, resultBlock) } } diff --git a/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Statements.kt b/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Statements.kt index 72030555dab..ca2361d6dc2 100644 --- a/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Statements.kt +++ b/libraries/kotlin-jdbc/src/main/kotlin/kotlin/jdbc/Statements.kt @@ -8,7 +8,7 @@ import java.sql.Statement /** * Uses the statement with the given block then closes the statement */ -fun S.use(block : (S) -> T) : T { +fun S.useSql(block : (S) -> T) : T { // TODO rename to "use" when KT-2493 is fixed try { return block(this) } finally {