From c3e6364bfdde233f3f5bc23a91512922c36b3608 Mon Sep 17 00:00:00 2001 From: Michele Sollecito Date: Fri, 23 Mar 2018 14:39:39 +0000 Subject: [PATCH] Fixed incorrect reference to column "issuer_key" in cash selection SQL for Oracle, Postgres and SQLServer. (#601) --- .../contracts/asset/cash/selection/CashSelectionOracleImpl.kt | 4 ++-- .../asset/cash/selection/CashSelectionPostgreSQLImpl.kt | 2 +- .../asset/cash/selection/CashSelectionSQLServerImpl.kt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionOracleImpl.kt b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionOracleImpl.kt index b67f7274d4..67d6220333 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionOracleImpl.kt +++ b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionOracleImpl.kt @@ -50,7 +50,7 @@ class CashSelectionOracleImpl : AbstractCashSelection(maxRetries = 16, retrySlee (if (notary != null) " AND vs.notary_name = ?" else "") + (if (onlyFromIssuerParties.isNotEmpty()) - " AND ccs.issuer_key IN (?)" else "") + + " AND ccs.issuer_key_hash IN (?)" else "") + (if (withIssuerRefs.isNotEmpty()) " AND ccs.issuer_ref IN (?)" else "") + """) @@ -79,7 +79,7 @@ class CashSelectionOracleImpl : AbstractCashSelection(maxRetries = 16, retrySlee lock_id = $lockId """ + (if (notary != null) "notary = ${notary.name}" else "") + - (if (onlyFromIssuerParties.isNotEmpty()) "issuer_key IN ${onlyFromIssuerParties.map { it.owningKey.toStringShort() as Any }.toTypedArray()}" else "") + + (if (onlyFromIssuerParties.isNotEmpty()) "issuer_key_hash IN ${onlyFromIssuerParties.map { it.owningKey.toStringShort() as Any }.toTypedArray()}" else "") + (if (withIssuerRefs.isNotEmpty()) "issuer_ref IN ${withIssuerRefs.map { it.bytes.toHexString() as Any }.toTypedArray()}" else "") + "total <= ${amount.quantity}" } diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt index 7e25c50689..67e2db0377 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt +++ b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionPostgreSQLImpl.kt @@ -53,7 +53,7 @@ class CashSelectionPostgreSQLImpl : AbstractCashSelection() { (if (notary != null) " AND vs.notary_name = ?" else "") + (if (onlyFromIssuerParties.isNotEmpty()) - " AND ccs.issuer_key = ANY (?)" else "") + + " AND ccs.issuer_key_hash = ANY (?)" else "") + (if (withIssuerRefs.isNotEmpty()) " AND ccs.issuer_ref = ANY (?)" else "") + """) diff --git a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt index f66ada2482..829149a3ec 100644 --- a/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt +++ b/finance/src/main/kotlin/net/corda/finance/contracts/asset/cash/selection/CashSelectionSQLServerImpl.kt @@ -53,7 +53,7 @@ class CashSelectionSQLServerImpl : AbstractCashSelection(maxRetries = 16, retryS (if (notary != null) " AND vs.notary_name = ?" else "") + (if (onlyFromIssuerParties.isNotEmpty()) - " AND ccs.issuer_key IN (?)" else "") + + " AND ccs.issuer_key_hash IN (?)" else "") + (if (withIssuerRefs.isNotEmpty()) " AND ccs.issuer_ref IN (?)" else "") + """)