⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssresultset.java

📁 這是一個油Java實作的資料庫系統 是個入門的好材料
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    
    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
        try{
            MutableNumeric obj = getValue(columnIndex).getNumeric();
            wasNull = obj == null;
            if(wasNull) return null;
            return obj.toBigDecimal();
        }catch(Exception e){
            throw SmallSQLException.createFromException( e );
        }
    }
    public BigDecimal getBigDecimal(String columnName) throws SQLException {
        return getBigDecimal( findColumn( columnName ) );
    }
    public boolean isBeforeFirst() throws SQLException {
		return getCmd().isBeforeFirst();
    }
    
    
    public boolean isAfterLast() throws SQLException {
        try{
            return getCmd().isAfterLast();
        }catch(Exception e){
            throw SmallSQLException.createFromException(e);
        }
    }
    
    
    public boolean isFirst() throws SQLException {
    	return getCmd().isFirst();
    }
    
    
    public boolean isLast() throws SQLException {
    	try{
    		return getCmd().isLast();
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
    }
    
    
    public void beforeFirst() throws SQLException {
    	try{
            moveToCurrentRow();
    		getCmd().beforeFirst();
    	}catch(Exception e){
    		throw SmallSQLException.createFromException(e);
    	}
    }
    
    
    public boolean first() throws SQLException {
		try{
			if(st.rsType == ResultSet.TYPE_FORWARD_ONLY) throw SmallSQLException.create(Language.RSET_FWDONLY);
            moveToCurrentRow();
			return getCmd().first();
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
    }
    
    
	public boolean previous() throws SQLException {
		try{
            moveToCurrentRow();
			return getCmd().previous();
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
	}
    
    
	public boolean next() throws SQLException {
		try{
            moveToCurrentRow();
            return getCmd().next();
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
	}
	
	
    public boolean last() throws SQLException {
		try{
            moveToCurrentRow();
            return getCmd().last();
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
    }
    
    
	public void afterLast() throws SQLException {
		try{
			if(st.rsType == ResultSet.TYPE_FORWARD_ONLY) throw SmallSQLException.create(Language.RSET_FWDONLY);
            moveToCurrentRow();
            getCmd().afterLast();
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
	}
    
    
    public boolean absolute(int row) throws SQLException {
		try{
            moveToCurrentRow();
			return getCmd().absolute(row);
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
    }
    
    
    public boolean relative(int rows) throws SQLException {
		try{
            moveToCurrentRow();
			return getCmd().relative(rows);
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
    }
    
    
	public int getRow() throws SQLException {
		try{
			return getCmd().getRow();
		}catch(Exception e){
			throw SmallSQLException.createFromException(e);
		}
	}
    
    
    public void setFetchDirection(int direction){
        fetchDirection = direction;
    }
    
    
    public int getFetchDirection(){
        return fetchDirection;
    }
    
    
    public void setFetchSize(int rows){
        fetchSize = rows;
    }
    
    
    public int getFetchSize(){
        return fetchSize;
    }
    
    
    public int getType() throws SQLException {
    	return getCmd().from.isScrollable() ? ResultSet.TYPE_SCROLL_SENSITIVE : ResultSet.TYPE_FORWARD_ONLY;
    }
    
    
    public int getConcurrency(){
    	return isUpdatable ? ResultSet.CONCUR_UPDATABLE : ResultSet.CONCUR_READ_ONLY;
    }
    
    
    public boolean rowUpdated(){
    	return false;
    }
    
    
    public boolean rowInserted() throws SQLException {
    	return getCmd().from.rowInserted();
    }
    
    
    public boolean rowDeleted() throws SQLException {
    	return getCmd().from.rowDeleted();
    }
    
    
    public void updateNull(int columnIndex) throws SQLException {
		updateValue( columnIndex, null, SQLTokenizer.NULL);
    }
    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
		updateValue( columnIndex, x ? Boolean.TRUE : Boolean.FALSE, SQLTokenizer.BOOLEAN);
    }
    public void updateByte(int columnIndex, byte x) throws SQLException {
		updateValue( columnIndex, Utils.getShort(x), SQLTokenizer.TINYINT);
    }
    public void updateShort(int columnIndex, short x) throws SQLException {
		updateValue( columnIndex, Utils.getShort(x), SQLTokenizer.SMALLINT);
    }
    public void updateInt(int columnIndex, int x) throws SQLException {
		updateValue( columnIndex, Utils.getInteger(x), SQLTokenizer.INT);
    }
    public void updateLong(int columnIndex, long x) throws SQLException {
		updateValue( columnIndex, new Long(x), SQLTokenizer.BIGINT);
    }
    public void updateFloat(int columnIndex, float x) throws SQLException {
		updateValue( columnIndex, new Float(x), SQLTokenizer.REAL);
    }
    public void updateDouble(int columnIndex, double x) throws SQLException {
		updateValue( columnIndex, new Double(x), SQLTokenizer.DOUBLE);
    }
    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
		updateValue( columnIndex, x, SQLTokenizer.DECIMAL);
    }
    public void updateString(int columnIndex, String x) throws SQLException {
		updateValue( columnIndex, x, SQLTokenizer.VARCHAR);
    }
    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
		updateValue( columnIndex, x, SQLTokenizer.VARBINARY);
    }
    public void updateDate(int columnIndex, Date x) throws SQLException {
		updateValue( columnIndex, DateTime.valueOf(x), SQLTokenizer.DATE);
    }
    public void updateTime(int columnIndex, Time x) throws SQLException {
		updateValue( columnIndex, DateTime.valueOf(x), SQLTokenizer.TIME);
    }
    public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
		updateValue( columnIndex, DateTime.valueOf(x), SQLTokenizer.TIMESTAMP);
    }
    public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
		updateValue( columnIndex, x, SQLTokenizer.LONGVARCHAR, length);
    }
    public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
		updateValue( columnIndex, x, SQLTokenizer.LONGVARBINARY, length);
    }
    
    
    public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
        /**@todo: Implement this java.sql.ResultSet.updateCharacterStream method*/
        throw SmallSQLException.create(Language.UNSUPPORTED_OPERATION, "Reader object");
    }
    
    
    public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
    	//TODO scale to consider
		updateValue( columnIndex, x, -1);
    }
    
    
    public void updateObject(int columnIndex, Object x) throws SQLException {
    	updateValue( columnIndex, x, -1);
    }
    public void updateNull(String columnName) throws SQLException {
        updateNull( findColumn( columnName ) );
    }
    public void updateBoolean(String columnName, boolean x) throws SQLException {
        updateBoolean( findColumn( columnName ), x );
    }
    public void updateByte(String columnName, byte x) throws SQLException {
        updateByte( findColumn( columnName ), x );
    }
    public void updateShort(String columnName, short x) throws SQLException {
        updateShort( findColumn( columnName ), x );
    }
    public void updateInt(String columnName, int x) throws SQLException {
        updateInt( findColumn( columnName ), x );
    }
    public void updateLong(String columnName, long x) throws SQLException {
        updateLong( findColumn( columnName ), x );
    }
    public void updateFloat(String columnName, float x) throws SQLException {
        updateFloat( findColumn( columnName ), x );
    }
    public void updateDouble(String columnName, double x) throws SQLException {
        updateDouble( findColumn( columnName ), x );
    }
    public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
        updateBigDecimal( findColumn( columnName ), x );
    }
    public void updateString(String columnName, String x) throws SQLException {
        updateString( findColumn( columnName ), x );
    }
    public void updateBytes(String columnName, byte[] x) throws SQLException {
        updateBytes( findColumn( columnName ), x );
    }
    public void updateDate(String columnName, Date x) throws SQLException {
        updateDate( findColumn( columnName ), x );
    }
    public void updateTime(String columnName, Time x) throws SQLException {
        updateTime( findColumn( columnName ), x );
    }
    public void updateTimestamp(String columnName, Timestamp x) throws SQLException {
        updateTimestamp( findColumn( columnName ), x );
    }
    public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException {
        updateAsciiStream( findColumn( columnName ), x, length );
    }
    public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException {
        updateBinaryStream( findColumn( columnName ), x, length );
    }
    public void updateCharacterStream(String columnName, Reader x, int length) throws SQLException {
        updateCharacterStream( findColumn( columnName ), x, length );
    }
    public void updateObject(String columnName, Object x, int scale) throws SQLException {
        updateObject( findColumn( columnName ), x, scale );
    }
    public void updateObject(String columnName, Object x) throws SQLException {
        updateObject( findColumn( columnName ), x );
    }
    
    public void insertRow() throws SQLException {
		st.con.log.println("insertRow()");
        if(!isInsertRow){
            throw SmallSQLException.create(Language.RSET_NOT_INSERT_ROW);
        }
		getCmd().insertRow( st.con, values);
        clearRowBuffer();
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -