Db0058: Bugfix for other half of 0056
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Swarmops.Database
|
||||
/// </summary>
|
||||
public static int DbVersionExpected
|
||||
{
|
||||
get { return 57; }
|
||||
get { return 58; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -55,3 +55,4 @@
|
||||
0055 - Fix for bug introduced with 0054, hash collisions in index [RF]
|
||||
0056 - Splitting a storedproc into two; debugging a weird multi-row select return [RF]
|
||||
0057 - Bugfix for 0056: case insensitivity caused always-true comparison w/o qualifier [RF]
|
||||
0058 - Fixing the other half of 0056
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
DROP PROCEDURE IF EXISTS `UpdateHotBitcoinAddressUnspentTotals`
|
||||
|
||||
#
|
||||
|
||||
DROP PROCEDURE IF EXISTS `UpdateHotBitcoinAddressUnspentTotal`
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
CREATE PROCEDURE `UpdateHotBitcoinAddressUnspentTotal` (
|
||||
IN hotBitcoinAddressId INTEGER
|
||||
)
|
||||
BEGIN
|
||||
|
||||
UPDATE HotBitcoinAddresses
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT HotBitcoinAddressId, SUM(AmountSatoshis) AS UnspentAmountSum
|
||||
FROM HotBitcoinAddressUnspents
|
||||
GROUP BY HotBitcoinAddressId
|
||||
) innerSelection ON HotBitcoinAddresses.HotBitcoinAddressId = innerSelection.HotBitcoinAddressId
|
||||
|
||||
SET HotBitcoinAddresses.BalanceSatoshis = innerSelection.UnspentAmountSum
|
||||
WHERE HotBitcoinAddresses.HotBitcoinAddressId=hotBitcoinAddressId;
|
||||
|
||||
END
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
CREATE PROCEDURE `UpdateHotBitcoinAddressUnspentTotals` ()
|
||||
BEGIN
|
||||
|
||||
UPDATE HotBitcoinAddresses
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT HotBitcoinAddressId, SUM(AmountSatoshis) AS UnspentAmountSum
|
||||
FROM HotBitcoinAddressUnspents
|
||||
GROUP BY HotBitcoinAddressId
|
||||
) innerSelection ON HotBitcoinAddresses.HotBitcoinAddressId = innerSelection.HotBitcoinAddressId
|
||||
|
||||
SET HotBitcoinAddresses.BalanceSatoshis = innerSelection.UnspentAmountSum;
|
||||
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user