Package net.canarymod.database.exceptions

Examples of net.canarymod.database.exceptions.DatabaseReadException


                toRet = ps.executeQuery();
            }
        }
        catch (SQLException ex) {
            throw new DatabaseReadException("Error Querying MySQL ResultSet in "
                    + tableName);
        }
        catch (Exception ex) {
            Logger.getLogger(MySQLDatabase.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here


    public int updatePermission(String path, String owner, String type, String world, boolean value) {
        PermissionDataAccess data = new PermissionDataAccess(world);
        try {
            Database.get().load(data, new String[]{ "path", "owner", "type" }, new Object[]{ path, owner, type });
            if (!data.hasData()) {
                throw new DatabaseReadException("Could not load a permission path! (" + path + ")");
            }
            data.value = value;
            Database.get().update(data, new String[]{ "path", "owner", "type" }, new Object[]{ path, owner, type });
        }
        catch (DatabaseReadException e) {
View Full Code Here

                toRet = ps.executeQuery();
            }
        }
        catch (SQLException ex) {
            throw new DatabaseReadException("Error Querying SQLite ResultSet in "
                    + tableName);
        }
        catch (Exception ex) {
            Logger.getLogger(SQLiteDatabase.class.getName()).log(Level.SEVERE, null, ex);
        }
View Full Code Here

    @Override
    public void load(DataAccess data, String[] fieldNames, Object[] fieldValues) throws DatabaseReadException {
        File file = new File("db/" + data.getName() + ".xml");

        if (!file.exists()) {
            throw new DatabaseReadException("Table " + data.getName() + " does not exist!");
        }
        if (fieldNames.length != fieldValues.length) {
            throw new DatabaseReadException("Field and Value field lenghts are inconsistent!");
        }
        try {
            FileInputStream in = new FileInputStream(file);
            Document table = fileBuilder.build(in);
            in.close();

            loadData(data, table, fieldNames, fieldValues);
        }
        catch (JDOMException e) {
            throw new DatabaseReadException(e.getMessage(), e);
        }
        catch (IOException e) {
            throw new DatabaseReadException(e.getMessage(), e);
        }
        catch (DatabaseAccessException e) {
            throw new DatabaseReadException(e.getMessage(), e);
        }
    }
View Full Code Here

    @Override
    public void loadAll(DataAccess typeTemplate, List<DataAccess> datasets, String[] fieldNames, Object[] fieldValues) throws DatabaseReadException {
        File file = new File("db/" + typeTemplate.getName() + ".xml");

        if (!file.exists()) {
            throw new DatabaseReadException("Table " + typeTemplate.getName() + " does not exist!");
        }
        if (fieldNames.length != fieldValues.length) {
            throw new DatabaseReadException("Field and Value field lenghts are inconsistent!");
        }
        try {
            FileInputStream in = new FileInputStream(file);
            Document table = fileBuilder.build(in);
            in.close();

            loadAllData(typeTemplate, datasets, table, fieldNames, fieldValues);
        }
        catch (JDOMException e) {
            throw new DatabaseReadException(e.getMessage(), e);
        }
        catch (IOException e) {
            throw new DatabaseReadException(e.getMessage(), e);
        }
        catch (DatabaseAccessException e) {
            throw new DatabaseReadException(e.getMessage(), e);
        }

    }
View Full Code Here

TOP

Related Classes of net.canarymod.database.exceptions.DatabaseReadException

Copyright © 2018 www.massapicom. 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.