Package org.tmatesoft.sqljet.core

Examples of org.tmatesoft.sqljet.core.SqlJetException


     * @param fs
     * @throws SqlJetExceptionRemove
     */
    private void checkFS(final ISqlJetFileSystem fs) throws SqlJetException {
        if(null==fs)
            throw new SqlJetException(SqlJetErrorCode.BAD_PARAMETER,
                "Prameter 'fs' must be not null");
        if(null==fs.getName())
            throw new SqlJetException(SqlJetErrorCode.BAD_PARAMETER,
                "fs.getName() must return not null value");
    }
View Full Code Here


    public void setEnc(SqlJetEncoding enc) {
        this.enc = enc;
    }
   
    public void setSortOrder(int i, boolean desc) throws SqlJetException {
        if(i>=nField) throw new SqlJetException(SqlJetErrorCode.ERROR);
        this.aSortOrder[i]=desc;
    }
View Full Code Here

        if(i>=nField) throw new SqlJetException(SqlJetErrorCode.ERROR);
        this.aSortOrder[i]=desc;
    }
   
    public boolean getSortOrder(int i) throws SqlJetException {
        if(i>=nField) throw new SqlJetException(SqlJetErrorCode.ERROR);
        return this.aSortOrder[i];
    }
View Full Code Here

        if(i>=nField) throw new SqlJetException(SqlJetErrorCode.ERROR);
        return this.aSortOrder[i];
    }

    public void setCollating(int i, ISqlJetCollSeq coll) throws SqlJetException {
        if(i>=nField) throw new SqlJetException(SqlJetErrorCode.ERROR);
        this.aColl[i]=coll;
    }
View Full Code Here

        if(i>=nField) throw new SqlJetException(SqlJetErrorCode.ERROR);
        this.aColl[i]=coll;
    }
   
    public ISqlJetCollSeq getCollating(int i) throws SqlJetException {
        if(i>=nField) throw new SqlJetException(SqlJetErrorCode.ERROR);
        return this.aColl[i];
    }
View Full Code Here

    public SqlJetAlterTableDef(ParserRuleReturnScope parsedSql) throws SqlJetException {
        this.parsedSql = parsedSql;
        final CommonTree ast = (CommonTree)parsedSql.getTree();
        final int childCount = ast.getChildCount();
        if (childCount < 5) {
            throw new SqlJetException(SqlJetErrorCode.MISUSE, INVALID_ALTER_TABLE_STATEMENT);
        }
        final CommonTree alterNode = (CommonTree) ast.getChild(0);
        final CommonTree tableNode = (CommonTree) ast.getChild(1);
        if (!"alter".equalsIgnoreCase(alterNode.getText()) || !"table".equalsIgnoreCase(tableNode.getText())) {
            throw new SqlJetException(SqlJetErrorCode.MISUSE, INVALID_ALTER_TABLE_STATEMENT);
        }
        final CommonTree tableNameNode = (CommonTree) ast.getChild(2);
        tableName = tableNameNode.getText();
        final CommonTree actionNode = (CommonTree) ast.getChild(3);
        final String action = actionNode.getText();
        final CommonTree child = (CommonTree) ast.getChild(4);
        if ("add".equalsIgnoreCase(action)) {
            newTableName = null;
            final CommonTree newColumnNode;
            if ("column".equalsIgnoreCase(child.getText())) {
                if (childCount != 6) {
                    throw new SqlJetException(SqlJetErrorCode.MISUSE, INVALID_ALTER_TABLE_STATEMENT);
                }
                newColumnNode = (CommonTree) ast.getChild(5);
            } else {
                if (childCount != 5) {
                    throw new SqlJetException(SqlJetErrorCode.MISUSE, INVALID_ALTER_TABLE_STATEMENT);
                }
                newColumnNode = child;
            }
            newColumnDef = new SqlJetColumnDef(newColumnNode);
        } else if ("rename".equalsIgnoreCase(action)) {
            newColumnDef = null;
            assert ("to".equalsIgnoreCase(child.getText()));
            if (childCount < 6) {
                throw new SqlJetException(SqlJetErrorCode.MISUSE, INVALID_ALTER_TABLE_STATEMENT);
            }
            final CommonTree newTableNode = (CommonTree) ast.getChild(5);
            newTableName = newTableNode.getText();
        } else {
            newTableName = null;
            newColumnDef = null;
            throw new SqlJetException(SqlJetErrorCode.MISUSE, INVALID_ALTER_TABLE_STATEMENT);
        }
    }
View Full Code Here

                Set<SqlJetFileOpenPermission> realPermissions = btree.getPager().getFile().getPermissions();
                writable = realPermissions.contains(SqlJetFileOpenPermission.READWRITE);
            }
            open = true;
        } else {
            throw new SqlJetException(SqlJetErrorCode.MISUSE, "Database is open already");
        }
    }
View Full Code Here

        return open;
    }

    private void checkOpen() throws SqlJetException {
        if (!isOpen())
            throw new SqlJetException(SqlJetErrorCode.MISUSE, "Database closed");
    }
View Full Code Here

    public Object runWriteTransaction(ISqlJetTransaction op) throws SqlJetException {
        checkOpen();
        if (writable) {
            return runTransaction(op, SqlJetTransactionMode.WRITE);
        } else {
            throw new SqlJetException(SqlJetErrorCode.MISUSE, "Can't start write transaction on read-only database");
        }
    }
View Full Code Here

        checkOpen();
        return runWithLock(new ISqlJetRunnableWithLock() {
            public Object runWithLock(SqlJetDb db) throws SqlJetException {
                if (transaction) {
                    if (mode != transactionMode && transactionMode == SqlJetTransactionMode.READ_ONLY) {
                        throw new SqlJetException(SqlJetErrorCode.MISUSE, TRANSACTION_ALREADY_STARTED);
                    } else {
                        return op.run(SqlJetDb.this);
                    }
                } else {
                    beginTransaction(mode);
View Full Code Here

TOP

Related Classes of org.tmatesoft.sqljet.core.SqlJetException

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.