Examples of prepareAutoCloseStatement()


Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

        List<Long> list = new ArrayList<Long>();
        try {
            Transaction txn = Transaction.currentTxn();
            ResultSet rs = null;
            PreparedStatement pstmt = null;
            pstmt = txn.prepareAutoCloseStatement(sql);
            pstmt.setLong(1, hostId);
            rs = pstmt.executeQuery();
            while (rs.next()) {
                list.add(rs.getLong(1));
            }
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

        String sql = "SELECT backup_snap_id FROM snapshots WHERE volume_id=? and backup_snap_id is not NULL";
        try {
            Transaction txn = Transaction.currentTxn();
            ResultSet rs = null;
            PreparedStatement pstmt = null;
            pstmt = txn.prepareAutoCloseStatement(sql);
            pstmt.setLong(1, volumeId);
            rs = pstmt.executeQuery();
            List<String> list = new ArrayList<String>();
            while (rs.next()) {
                list.add(rs.getString(1));
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

                selectSql += " AND taken IS NOT NULL";
            }

            Transaction txn = Transaction.currentTxn();
            try {
                PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql);
                stmt.setLong(1, physicalNetworkId);
                ResultSet rs = stmt.executeQuery();
                if (rs != null && rs.next()) {
                    throw new CloudRuntimeException("The Physical Network is not deletable because " + errorMsg);
                }
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

                }
                sql.delete(sql.length()-1, sql.length());
                sql.append(GET_POD_CLUSTER_MAP_SUFFIX);
            }

            pstmt = txn.prepareAutoCloseStatement(sql.toString());
            ResultSet rs = pstmt.executeQuery();
            while (rs.next()) {
                Long podId = rs.getLong(1);
                Long clusterIdInPod  = rs.getLong(2);
                if(result.containsKey(podId)){
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

        sql.delete(sql.length() - 4, sql.length());
        sql.append(DetailsSqlSuffix);
        Transaction txn = Transaction.currentTxn();
        PreparedStatement pstmt = null;
        try {
            pstmt = txn.prepareAutoCloseStatement(sql.toString());
            int i = 1;
            pstmt.setLong(i++, dcId);
            pstmt.setLong(i++, podId);
            pstmt.setString(i++, scope.toString());
            if (clusterId != null) {
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

            sql.delete(sql.length() - 4, sql.length());
            sql.append(ZoneWideDetailsSqlSuffix);
            Transaction txn = Transaction.currentTxn();
            PreparedStatement pstmt = null;
            try {
                pstmt = txn.prepareAutoCloseStatement(sql.toString());
                int i = 1;
                pstmt.setLong(i++, dcId);
                pstmt.setString(i++, ScopeType.ZONE.toString());
                pstmt.setInt(i++, details.size());
                ResultSet rs = pstmt.executeQuery();
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

        StringBuilder sql = new StringBuilder(FindPoolTagDetails);

        Transaction txn = Transaction.currentTxn();
        PreparedStatement pstmt = null;
        try {
            pstmt = txn.prepareAutoCloseStatement(sql.toString());
            pstmt.setLong(1, poolId);
            pstmt.setString(2, value);

            ResultSet rs = pstmt.executeQuery();
            List<String> tags = new ArrayList<String>();
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

    protected void saveUser() {
        // insert system account
        String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (1, UUID(), 'system', '1', '1', 1)";
        Transaction txn = Transaction.currentTxn();
        try {
            PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
            stmt.executeUpdate();
        } catch (SQLException ex) {
        }
        // insert system user
        insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, user.default)" +
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

        // insert system user
        insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, user.default)" +
                " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now(), 1)";
        txn = Transaction.currentTxn();
        try {
            PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
            stmt.executeUpdate();
        } catch (SQLException ex) {
        }

        // insert admin user, but leave the account disabled until we set a
View Full Code Here

Examples of com.cloud.utils.db.Transaction.prepareAutoCloseStatement()

        // create an account for the admin user first
        insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (" + id + ", UUID(), '" + username + "', '1', '1', 1)";
        txn = Transaction.currentTxn();
        try {
            PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
            stmt.executeUpdate();
        } catch (SQLException ex) {
        }

        // now insert the user
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.