📄 ssresultset.java
字号:
public int getFetchDirection(){
return fetchDirection;
}
public void setFetchSize(int rows){
fetchSize = rows;
}
public int getFetchSize(){
return fetchSize;
}
public int getType() throws SQLException {
return getCmd().join.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().join.rowInserted();
}
public boolean rowDeleted() throws SQLException {
return getCmd().join.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 Utils.createUnsupportedException("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()");
getCmd().insertRow( st.con, values);
cancelRowUpdates();
}
public void updateRow() throws SQLException {
try {
if(values == null) return;
st.con.log.println("updateRow()");
final CommandSelect command = getCmd();
command.updateRow( st.con, values);
command.relative(0); //refresh the row
cancelRowUpdates();
} catch (Exception e) {
throw Utils.createSQLException(e);
}
}
public void deleteRow() throws SQLException {
st.con.log.println("deleteRow()");
getCmd().deleteRow(st.con);
cancelRowUpdates();
}
public void refreshRow() throws SQLException {
relative(0);
}
public void cancelRowUpdates() {
if(values != null){
for(int i=values.length-1; i>=0; i--){
values[i].clear();
}
}
}
public void moveToInsertRow() throws SQLException {
if(isUpdatable){
isInsertRow = true;
}else{
throw Utils.createSQLException("ResultSet is read only.");
}
}
public void moveToCurrentRow(){
isInsertRow = false;
cancelRowUpdates();
}
public Statement getStatement() {
return st;
}
public Object getObject(int i, Map map) throws SQLException {
return getObject( i );
}
public Ref getRef(int i) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.getRef method*/
throw Utils.createUnsupportedException("Ref object");
}
public Blob getBlob(int i) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.getBlob method*/
throw Utils.createUnsupportedException("Blob object");
}
public Clob getClob(int i) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.getClob method*/
throw Utils.createUnsupportedException("Clob object");
}
public Array getArray(int i) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.getArray method*/
throw Utils.createUnsupportedException("Array");
}
public Object getObject(String columnName, Map map) throws SQLException {
return getObject( columnName );
}
public Ref getRef(String columnName) throws SQLException {
return getRef( findColumn( columnName ) );
}
public Blob getBlob(String columnName) throws SQLException {
return getBlob( findColumn( columnName ) );
}
public Clob getClob(String columnName) throws SQLException {
return getClob( findColumn( columnName ) );
}
public Array getArray(String columnName) throws SQLException {
return getArray( findColumn( columnName ) );
}
public Date getDate(int columnIndex, Calendar cal) throws SQLException {
try{
if(cal == null){
return getDate(columnIndex);
}
Expression expr = getValue(columnIndex);
wasNull = expr.isNull();
if(wasNull) return null;
return new Date(DateTime.addDateTimeOffset( expr.getLong(), cal.getTimeZone() ));
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public Date getDate(String columnName, Calendar cal) throws SQLException {
return getDate( findColumn( columnName ), cal );
}
public Time getTime(int columnIndex, Calendar cal) throws SQLException {
try{
if(cal == null){
return getTime(columnIndex);
}
Expression expr = getValue(columnIndex);
wasNull = expr.isNull();
if(wasNull) return null;
return new Time(DateTime.addDateTimeOffset( expr.getLong(), cal.getTimeZone() ));
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public Time getTime(String columnName, Calendar cal) throws SQLException {
return getTime( findColumn( columnName ), cal );
}
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
try{
if(cal == null){
return getTimestamp(columnIndex);
}
Expression expr = getValue(columnIndex);
wasNull = expr.isNull();
if(wasNull) return null;
return new Timestamp(DateTime.addDateTimeOffset( expr.getLong(), cal.getTimeZone() ));
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
return getTimestamp( findColumn( columnName ), cal );
}
public URL getURL(int columnIndex) throws SQLException {
try{
Expression expr = getValue(columnIndex);
wasNull = expr.isNull();
if(wasNull) return null;
return new URL( expr.getString() );
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public URL getURL(String columnName) throws SQLException {
return getURL( findColumn( columnName ) );
}
public void updateRef(int columnIndex, Ref x) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.updateRef method*/
throw Utils.createUnsupportedException("Ref");
}
public void updateRef(String columnName, Ref x) throws SQLException {
updateRef( findColumn( columnName ), x );
}
public void updateBlob(int columnIndex, Blob x) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.updateBlob method*/
throw Utils.createUnsupportedException("Blob");
}
public void updateBlob(String columnName, Blob x) throws SQLException {
updateBlob( findColumn( columnName ), x );
}
public void updateClob(int columnIndex, Clob x) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.updateClob method*/
throw Utils.createUnsupportedException("Clob");
}
public void updateClob(String columnName, Clob x) throws SQLException {
updateClob( findColumn( columnName ), x );
}
public void updateArray(int columnIndex, Array x) throws SQLException {
/**@todo: Implement this java.sql.ResultSet.updateArray method*/
throw Utils.createUnsupportedException("Array");
}
public void updateArray(String columnName, Array x) throws SQLException {
updateArray( findColumn( columnName ), x );
}
/*========================================================
private methods
=========================================================*/
/**
* Get the expression of a column.
* This expression can be used to request a value of the current row.
*/
final private Expression getValue(int columnIndex) throws SQLException{
if(values != null){
ExpressionValue value = values[ metaData.getColumnIdx( columnIndex ) ];
if(!value.isEmpty())
return value;
}
return metaData.getColumnExpression(columnIndex);
}
final private ExpressionValue getUpdateValue(int columnIndex) throws SQLException{
if(values == null){
int count = metaData.getColumnCount();
values = new ExpressionValue[count];
while(count-- > 0){
values[count] = new ExpressionValue();
}
}
return values[ metaData.getColumnIdx( columnIndex ) ];
}
final private void updateValue(int columnIndex, Object x, int dataType) throws SQLException{
getUpdateValue( columnIndex ).set( x, dataType );
if(st.con.log.isLogging()){
st.con.log.println("parameter '"+metaData.getColumnName(columnIndex)+"' = "+x+"; type="+dataType);
}
}
final private void updateValue(int columnIndex, Object x, int dataType, int length) throws SQLException{
getUpdateValue( columnIndex ).set( x, dataType, length );
if(st.con.log.isLogging()){
st.con.log.println("parameter '"+metaData.getColumnName(columnIndex)+"' = "+x+"; type="+dataType+"; length="+length);
}
}
final private CommandSelect getCmd() throws SQLException {
if(cmd == null){
throw Utils.createSQLException("ResultSet is closed.");
}
st.con.testClosedConnection();
return cmd;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -