You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/07/10 12:08:32 UTC
[37/50] git commit: updated refs/heads/CLOUDSTACK-8581 to 1a2e80b
coverity 1116507: one off old upgrade code trivial fix however
Signed-off-by: Daan Hoogland <da...@onecht.net>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/79709cd4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79709cd4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79709cd4
Branch: refs/heads/CLOUDSTACK-8581
Commit: 79709cd490e559e8042c6909c1d60d21fe42d598
Parents: dae2e05
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Jul 7 12:52:37 2015 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Thu Jul 9 21:30:23 2015 +0200
----------------------------------------------------------------------
.../upgrade/dao/Upgrade222to224Premium.java | 24 ++++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79709cd4/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
index 921c5e6..775c140 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade222to224Premium.java
@@ -60,25 +60,25 @@ public class Upgrade222to224Premium extends Upgrade222to224 {
}
private void updateUserStats(Connection conn) {
- try {
+ try ( // update network_id information
+ PreparedStatement pstmt = conn.prepareStatement(
+ "update cloud_usage.user_statistics uus, cloud.user_statistics us set uus.network_id = us.network_id where uus.id = us.id"
+ );
+ ) {
- // update network_id information
- PreparedStatement pstmt =
- conn.prepareStatement("update cloud_usage.user_statistics uus, cloud.user_statistics us set uus.network_id = " + "us.network_id where uus.id = us.id");
pstmt.executeUpdate();
- pstmt.close();
-
s_logger.debug("Upgraded cloud_usage user_statistics with networkId");
+ } catch (Exception e) {
+ throw new CloudRuntimeException("Failed to upgrade user stats: ", e);
+ }
- // update network_id information in usage_network
- PreparedStatement pstmt1 =
- conn.prepareStatement("update cloud_usage.usage_network un, cloud_usage.user_statistics us set un.network_id = "
+ try ( // update network_id information in usage_network
+ PreparedStatement pstmt1 =
+ conn.prepareStatement("update cloud_usage.usage_network un, cloud_usage.user_statistics us set un.network_id = "
+ "us.network_id where us.account_id = un.account_id and us.data_center_id = un.zone_id and us.device_id = un.host_id");
+ ) {
pstmt1.executeUpdate();
- pstmt1.close();
-
s_logger.debug("Upgraded cloud_usage usage_network with networkId");
-
} catch (Exception e) {
throw new CloudRuntimeException("Failed to upgrade user stats: ", e);
}