Examples of JDBCPreparedStatement


Examples of com.adito.jdbc.JDBCPreparedStatement

     *      java.lang.String, boolean, boolean, boolean, boolean)
     */
    public void updateNetworkPlace(int resourceId, String scheme, String resourceName, String resourceDescription, String host,
                    String uri, int port, String username, String password, boolean readOnly, boolean allowResursive,
                    boolean noDelete, boolean showHidden, boolean autoStart) throws Exception {
        JDBCPreparedStatement ps = db.getStatement("updateNetworkPlace.update");
        try {
            ps.setString(1, resourceName);
            ps.setString(2, scheme);
            ps.setString(3, host);
            ps.setString(4, uri);
            ps.setInt(5, port);
            ps.setString(6, username);
            ps.setString(7, password);
            ps.setString(8, resourceDescription);
            ps.setInt(9, readOnly ? 1 : 0);
            ps.setInt(10, allowResursive ? 1 : 0);
            ps.setInt(11, noDelete ? 1 : 0);
            ps.setInt(12, showHidden ? 1 : 0);
            ps.setInt(13, autoStart ? 1 : 0);
            Calendar now = Calendar.getInstance();
            ps.setString(14, db.formatTimestamp(now));
            ps.setInt(15, resourceId);
            ps.execute();
        } finally {
            ps.releasePreparedStatement();
        }
    }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

     *
     * @see com.adito.security.SystemDatabase#getNetworkPlaces()
     */
    public List<NetworkPlace> getNetworkPlaces() throws Exception {
        List<NetworkPlace> v = new ArrayList<NetworkPlace>();
        JDBCPreparedStatement ps = db.getStatement("getNetworkPlaces.select");
        try {
            ResultSet rs = ps.executeQuery();
            try {
                while (rs.next()) {
                    v.add(buildNetworkPlace(rs));
                }
            } finally {
                rs.close();
            }
        } finally {
            ps.releasePreparedStatement();
        }
        return v;
    }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

    public NetworkPlace deleteNetworkPlace(int id) throws Exception {
        NetworkPlace np = getNetworkPlace(id);
        if (np == null) {
            throw new Exception("Network Place " + id + " doesn't exist.");
        }
        JDBCPreparedStatement ps = null;
        ps = db.getStatement("deleteNetworkPlace.delete");
        try {
            ps.setInt(1, id);
            ps.execute();
        } finally {
            ps.releasePreparedStatement();
        }
        return np;
    }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

    /* (non-Javadoc)
     * @see com.adito.networkplaces.NetworkPlaceDatabase#getNetworkPlaces(int)
     */
    public List<NetworkPlace> getNetworkPlaces(int realmID) throws Exception {
        List<NetworkPlace> v = new ArrayList<NetworkPlace>();
        JDBCPreparedStatement ps = db.getStatement("getNetworkPlaces.realm.select");
        try {
            ps.setInt(1, realmID);
            ResultSet rs = ps.executeQuery();
            try {
                while (rs.next()) {
                    v.add(buildNetworkPlace(rs));
                }
            } finally {
                rs.close();
            }
        } finally {
            ps.releasePreparedStatement();
        }
        return v;
    }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

     *
     * @see com.adito.extensions.ApplicationShortcutDatabase#createApplicationShortcut(java.lang.String,
     *      java.lang.String, java.lang.String, java.util.Map)
     */
    public int createApplicationShortcut(String application, String name, String description, Map settings, boolean autoStart, int realmID) throws Exception {
        JDBCPreparedStatement ps = db.getStatement("createApplicationShortcut.insert");
        try {
            ps.setString(1, application);
            ps.setString(2, name);
            ps.setString(3, description);
            ps.setInt(4, autoStart ? 1 : 0);
            Calendar now = Calendar.getInstance();
            ps.setString(5, db.formatTimestamp(now));
            ps.setString(6, db.formatTimestamp(now));
            ps.setInt(7, realmID);
            ps.execute();
            int id = db.getLastInsertId(ps, "createApplicationShortcut.lastInsertId");
            JDBCPreparedStatement ps3 = db.getStatement("createApplicationShortcut.insertParameters");
            try {
                for (Iterator it = settings.keySet().iterator(); it.hasNext();) {
                    String parameter = (String) it.next();
                    String value = (String) settings.get(parameter);
                    ps3.setInt(1, id);
                    ps3.setString(2, parameter);
                    ps3.setString(3, value);
                    ps3.execute();
                    ps3.reset();
                }
            } finally {
                ps3.releasePreparedStatement();
            }
            return id;
        } finally {
            ps.releasePreparedStatement();
        }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

     * @see com.adito.extensions.ApplicationShortcutDatabase#updateApplicationShortcut(int,
     *      java.lang.String, java.lang.String, java.util.Map)
     */
    public void updateApplicationShortcut(int id, String name, String description, Map settings, boolean autoStart) throws Exception {

        JDBCPreparedStatement ps = db.getStatement("updateApplicationShortcut.update");

        // Update the actual shortcut
        try {
            ps.setString(1, name);
            ps.setString(2, description);
            ps.setInt(3, autoStart ? 1 : 0);
            Calendar now = Calendar.getInstance();
            ps.setString(4, db.formatTimestamp(now));
            ps.setInt(5, id);
            ps.execute();
        } finally {
            ps.releasePreparedStatement();
        }

        // Delete the current parameters
        ps = db.getStatement("updateApplicationShortcut.deleteParameters");
        try {
            ps.setInt(1, id);
            ps.execute();
        } finally {
            ps.releasePreparedStatement();
        }

        // Insert the parameters again
        ps = db.getStatement("createApplicationShortcut.insertParameters");
        try {
            for (Iterator it = settings.keySet().iterator(); it.hasNext();) {
                String parameter = (String) it.next();
                String value = (String) settings.get(parameter);
                ps.setInt(1, id);
                ps.setString(2, parameter);
                ps.setString(3, value);
                ps.execute();
                ps.reset();

            }
        } finally {
            ps.releasePreparedStatement();
        }

    }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

    /* (non-Javadoc)
     * @see com.adito.tunnels.TunnelDatabase#getTunnels(int)
     */
    public List<Tunnel> getTunnels(int realmID) throws Exception {
        JDBCPreparedStatement ps = db.getStatement("getTunnels.realm.select");
        List<Tunnel> v = new ArrayList<Tunnel>();
        try {
            ps.setInt(1, realmID);
            ResultSet rs = ps.executeQuery();
            try {
                while (rs.next()) {
                    v.add(buildTunnel(rs));
                }
            } finally {
                rs.close();
            }
        } finally {
            ps.releasePreparedStatement();
        }
        return v;
    }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

    /* (non-Javadoc)
     * @see com.adito.tunnels.TunnelDatabase#getTunnel(java.lang.String, int)
     */
    public Tunnel getTunnel(String name, int realmID) throws Exception {
        JDBCPreparedStatement ps = db.getStatement("getTunnel.select.name");
        ps.setString(1, name);
        ps.setInt(2, realmID);
        try {
            ResultSet rs = ps.executeQuery();
            try {
                if (rs.next()) {
                    return buildTunnel(rs);
                }
            } finally {
                rs.close();
            }
        } finally {
            ps.releasePreparedStatement();
        }
        return null;
    }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

     * (non-Javadoc)
     *
     * @see com.adito.extensions.ApplicationShortcutDatabase#removeApplicationShortcuts(java.lang.String)
     */
    public void removeApplicationShortcuts(String applicationId) throws Exception {
        JDBCPreparedStatement ps = db.getStatement("removeApplicationShortcuts.select");
        ps.setString(1, applicationId);
        try {
            ResultSet rs = ps.executeQuery();
            try {
                while (rs.next()) {
                    JDBCPreparedStatement ps2 = db.getStatement("removeApplicationShortcuts.delete.favorites");
                    ps2.setInt(1, ApplicationsPlugin.APPLICATION_SHORTCUT_RESOURCE_TYPE_ID);
                    ps2.setInt(2, rs.getInt("resource_id"));
                    try {
                        ps2.execute();
                    } finally {
                        ps2.releasePreparedStatement();
                    }
                    ps2 = db.getStatement("removeApplicationShortcuts.delete.shortcutParameters");
                    ps2.setString(1, String.valueOf(rs.getInt("resource_id")));
                    try {
                        ps2.execute();
                    } finally {
                        ps2.releasePreparedStatement();
                    }
                }
            } finally {
                rs.close();
            }
View Full Code Here

Examples of com.adito.jdbc.JDBCPreparedStatement

     *
     * @see com.adito.extensions.ApplicationShortcutDatabase#getShortcuts()
     */
    public List<ApplicationShortcut> getShortcuts() throws Exception {

        JDBCPreparedStatement ps = db.getStatement("getShortcuts.selectAll");
        Vector<ApplicationShortcut> v = new Vector<ApplicationShortcut>();
        try {
            ResultSet rs = ps.executeQuery();
            try {
                while (rs.next()) {
                    v.add(buildShortcut(rs));
                }
            } finally {
                rs.close();
            }
        } finally {
            ps.releasePreparedStatement();
        }

        return v;
    }
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.