package net.sf.soapjdbc.mysql;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Date;
import java.sql.Ref;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Map;
import net.sf.soapjdbc.SoapJdbcResultSet;
import net.sf.soapjdbc.SoapJdbcResultSetMetaData;
import net.sf.soapjdbc.SoapJdbcResultSetMetaDataField;
import net.sf.soapjdbc.SoapJdbcResultSetRowData;
public class ResultSet implements java.sql.ResultSet {
private SoapJdbcResultSet mResultSet;
public ResultSet(Connection conn, Field[] fields, ArrayList rows) throws SQLException {
mResultSet = new SoapJdbcResultSet(new SoapJdbcResultSetMetaData(convertFields( fields )), new SoapJdbcResultSetRowData(convertRows(rows)));
}
private String[][] convertRows(ArrayList rows) {
String[][] newRows = new String[rows.size()][];
for (int i = 0; i < rows.size(); i++) {
byte[][] row = (byte[][]) rows.get(i);
String[] newRow = new String[row.length];
for (int j = 0; j < row.length; j++) {
if ( row[j] != null ) {
newRow[j] = new String( row[j] );
} // if
} // for
newRows[i] = newRow;
}
return newRows;
}
private SoapJdbcResultSetMetaDataField[] convertFields(Field[] fields) {
SoapJdbcResultSetMetaDataField[] newFields = new SoapJdbcResultSetMetaDataField[fields.length];
for (int i = 0; i < fields.length; i++) {
newFields[i] = new SoapJdbcResultSetMetaDataField();
try {
newFields[i].sqlType = fields[i].getSQLType();
newFields[i].originalType = MysqlDefs.typeToName( fields[i].getMysqlType() );
newFields[i].autoIncrement = fields[i].isAutoIncrement();
newFields[i].nullable = !fields[i].isNotNull();
newFields[i].signed = !fields[i].isUnsigned();
newFields[i].columnSize = fields[i].getLength();
newFields[i].columnName = fields[i].getName();
newFields[i].databaseName = fields[i].getDatabaseName();
newFields[i].tableName = fields[i].getTableName();
newFields[i].scale = fields[i].getDecimals();
newFields[i].precision = fields[i].getLength() + fields[i].getPrecisionAdjustFactor();
} catch ( SQLException se ) {
// nothing here
}
}
return newFields;
}
public boolean absolute(int row) throws SQLException {
return mResultSet.absolute(row);
}
public void afterLast() throws SQLException {
mResultSet.afterLast();
}
public void beforeFirst() throws SQLException {
mResultSet.beforeFirst();
}
public void cancelRowUpdates() throws SQLException {
mResultSet.cancelRowUpdates();
}
public void clearWarnings() {
mResultSet.clearWarnings();
}
public void close() {
mResultSet.close();
}
public void deleteRow() throws SQLException {
mResultSet.deleteRow();
}
public boolean equals(Object obj) {
return mResultSet.equals(obj);
}
public int findColumn(String columnName) throws SQLException {
return mResultSet.findColumn(columnName);
}
public boolean first() throws SQLException {
return mResultSet.first();
}
public Array getArray(int i) throws SQLException {
return mResultSet.getArray(i);
}
public Array getArray(String colName) throws SQLException {
return mResultSet.getArray(colName);
}
public InputStream getAsciiStream(int columnIndex) throws SQLException {
return mResultSet.getAsciiStream(columnIndex);
}
public InputStream getAsciiStream(String columnName) throws SQLException {
return mResultSet.getAsciiStream(columnName);
}
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
return mResultSet.getBigDecimal(columnIndex, scale);
}
public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
return mResultSet.getBigDecimal(columnIndex);
}
public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
return mResultSet.getBigDecimal(columnName, scale);
}
public BigDecimal getBigDecimal(String columnName) throws SQLException {
return mResultSet.getBigDecimal(columnName);
}
public InputStream getBinaryStream(int columnIndex) throws SQLException {
return mResultSet.getBinaryStream(columnIndex);
}
public InputStream getBinaryStream(String columnName) throws SQLException {
return mResultSet.getBinaryStream(columnName);
}
public Blob getBlob(int i) throws SQLException {
return mResultSet.getBlob(i);
}
public Blob getBlob(String colName) throws SQLException {
return mResultSet.getBlob(colName);
}
public boolean getBoolean(int columnIndex) throws SQLException {
return mResultSet.getBoolean(columnIndex);
}
public boolean getBoolean(String columnName) throws SQLException {
return mResultSet.getBoolean(columnName);
}
public byte getByte(int columnIndex) throws SQLException {
return mResultSet.getByte(columnIndex);
}
public byte getByte(String columnName) throws SQLException {
return mResultSet.getByte(columnName);
}
public byte[] getBytes(int columnIndex) throws SQLException {
return mResultSet.getBytes(columnIndex);
}
public byte[] getBytes(String columnName) throws SQLException {
return mResultSet.getBytes(columnName);
}
public Reader getCharacterStream(int columnIndex) throws SQLException {
return mResultSet.getCharacterStream(columnIndex);
}
public Reader getCharacterStream(String columnName) throws SQLException {
return mResultSet.getCharacterStream(columnName);
}
public Clob getClob(int i) throws SQLException {
return mResultSet.getClob(i);
}
public Clob getClob(String colName) throws SQLException {
return mResultSet.getClob(colName);
}
public int getConcurrency() {
return mResultSet.getConcurrency();
}
public String getCursorName() throws SQLException {
return mResultSet.getCursorName();
}
public Date getDate(int columnIndex, Calendar cal) throws SQLException {
return mResultSet.getDate(columnIndex, cal);
}
public Date getDate(int columnIndex) throws SQLException {
return mResultSet.getDate(columnIndex);
}
public Date getDate(String columnName, Calendar cal) throws SQLException {
return mResultSet.getDate(columnName, cal);
}
public Date getDate(String columnName) throws SQLException {
return mResultSet.getDate(columnName);
}
public double getDouble(int columnIndex) throws SQLException {
return mResultSet.getDouble(columnIndex);
}
public double getDouble(String columnName) throws SQLException {
return mResultSet.getDouble(columnName);
}
public int getFetchDirection() {
return mResultSet.getFetchDirection();
}
public int getFetchSize() {
return mResultSet.getFetchSize();
}
public float getFloat(int columnIndex) throws SQLException {
return mResultSet.getFloat(columnIndex);
}
public float getFloat(String columnName) throws SQLException {
return mResultSet.getFloat(columnName);
}
public int getInt(int columnIndex) throws SQLException {
return mResultSet.getInt(columnIndex);
}
public int getInt(String columnName) throws SQLException {
return mResultSet.getInt(columnName);
}
public long getLong(int columnIndex) throws SQLException {
return mResultSet.getLong(columnIndex);
}
public long getLong(String columnName) throws SQLException {
return mResultSet.getLong(columnName);
}
public ResultSetMetaData getMetaData() {
return mResultSet.getMetaData();
}
public Object getObject(int columnIndex, Map<String, Class<?>> arg1) throws SQLException {
return mResultSet.getObject(columnIndex, arg1);
}
public Object getObject(int columnIndex) throws SQLException {
return mResultSet.getObject(columnIndex);
}
public Object getObject(String columnName, Map<String, Class<?>> typeMap) throws SQLException {
return mResultSet.getObject(columnName, typeMap);
}
public Object getObject(String columnName) throws SQLException {
return mResultSet.getObject(columnName);
}
public Ref getRef(int i) throws SQLException {
return mResultSet.getRef(i);
}
public Ref getRef(String colName) throws SQLException {
return mResultSet.getRef(colName);
}
public int getRow() throws SQLException {
return mResultSet.getRow();
}
public short getShort(int columnIndex) throws SQLException {
return mResultSet.getShort(columnIndex);
}
public short getShort(String columnName) throws SQLException {
return mResultSet.getShort(columnName);
}
public Statement getStatement() {
return mResultSet.getStatement();
}
public String getString(int columnIndex) throws SQLException {
return mResultSet.getString(columnIndex);
}
public String getString(String columnName) throws SQLException {
return mResultSet.getString(columnName);
}
public Time getTime(int columnIndex, Calendar cal) throws SQLException {
return mResultSet.getTime(columnIndex, cal);
}
public Time getTime(int columnIndex) throws SQLException {
return mResultSet.getTime(columnIndex);
}
public Time getTime(String columnName, Calendar cal) throws SQLException {
return mResultSet.getTime(columnName, cal);
}
public Time getTime(String columnName) throws SQLException {
return mResultSet.getTime(columnName);
}
public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
return mResultSet.getTimestamp(columnIndex, cal);
}
public Timestamp getTimestamp(int columnIndex) throws SQLException {
return mResultSet.getTimestamp(columnIndex);
}
public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
return mResultSet.getTimestamp(columnName, cal);
}
public Timestamp getTimestamp(String columnName) throws SQLException {
return mResultSet.getTimestamp(columnName);
}
public int getType() {
return mResultSet.getType();
}
public InputStream getUnicodeStream(int columnIndex) throws SQLException {
return mResultSet.getUnicodeStream(columnIndex);
}
public InputStream getUnicodeStream(String columnName) throws SQLException {
return mResultSet.getUnicodeStream(columnName);
}
public URL getURL(int columnIndex) throws SQLException {
return mResultSet.getURL(columnIndex);
}
public URL getURL(String columnName) throws SQLException {
return mResultSet.getURL(columnName);
}
public SQLWarning getWarnings() {
return mResultSet.getWarnings();
}
public int hashCode() {
return mResultSet.hashCode();
}
public void insertRow() throws SQLException {
mResultSet.insertRow();
}
public boolean isAfterLast() throws SQLException {
return mResultSet.isAfterLast();
}
public boolean isBeforeFirst() throws SQLException {
return mResultSet.isBeforeFirst();
}
public boolean isFirst() throws SQLException {
return mResultSet.isFirst();
}
public boolean isLast() throws SQLException {
return mResultSet.isLast();
}
public boolean last() throws SQLException {
return mResultSet.last();
}
public void moveToCurrentRow() throws SQLException {
mResultSet.moveToCurrentRow();
}
public void moveToInsertRow() throws SQLException {
mResultSet.moveToInsertRow();
}
public boolean next() throws SQLException {
return mResultSet.next();
}
public boolean previous() throws SQLException {
return mResultSet.previous();
}
public void refreshRow() throws SQLException {
mResultSet.refreshRow();
}
public boolean relative(int rows) throws SQLException {
return mResultSet.relative(rows);
}
public boolean rowDeleted() throws SQLException {
return mResultSet.rowDeleted();
}
public boolean rowInserted() throws SQLException {
return mResultSet.rowInserted();
}
public boolean rowUpdated() throws SQLException {
return mResultSet.rowUpdated();
}
public void setFetchDirection(int direction) throws SQLException {
mResultSet.setFetchDirection(direction);
}
public void setFetchSize(int rows) throws SQLException {
mResultSet.setFetchSize(rows);
}
public String toString() {
return mResultSet.toString();
}
public void updateArray(int columnIndex, Array x) throws SQLException {
mResultSet.updateArray(columnIndex, x);
}
public void updateArray(String columnName, Array x) throws SQLException {
mResultSet.updateArray(columnName, x);
}
public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
mResultSet.updateAsciiStream(columnIndex, x, length);
}
public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException {
mResultSet.updateAsciiStream(columnName, x, length);
}
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
mResultSet.updateBigDecimal(columnIndex, x);
}
public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
mResultSet.updateBigDecimal(columnName, x);
}
public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
mResultSet.updateBinaryStream(columnIndex, x, length);
}
public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException {
mResultSet.updateBinaryStream(columnName, x, length);
}
public void updateBlob(int columnIndex, Blob x) throws SQLException {
mResultSet.updateBlob(columnIndex, x);
}
public void updateBlob(String columnName, Blob x) throws SQLException {
mResultSet.updateBlob(columnName, x);
}
public void updateBoolean(int columnIndex, boolean x) throws SQLException {
mResultSet.updateBoolean(columnIndex, x);
}
public void updateBoolean(String columnName, boolean x) throws SQLException {
mResultSet.updateBoolean(columnName, x);
}
public void updateByte(int columnIndex, byte x) throws SQLException {
mResultSet.updateByte(columnIndex, x);
}
public void updateByte(String columnName, byte x) throws SQLException {
mResultSet.updateByte(columnName, x);
}
public void updateBytes(int columnIndex, byte[] x) throws SQLException {
mResultSet.updateBytes(columnIndex, x);
}
public void updateBytes(String columnName, byte[] x) throws SQLException {
mResultSet.updateBytes(columnName, x);
}
public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
mResultSet.updateCharacterStream(columnIndex, x, length);
}
public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException {
mResultSet.updateCharacterStream(columnName, reader, length);
}
public void updateClob(int columnIndex, Clob x) throws SQLException {
mResultSet.updateClob(columnIndex, x);
}
public void updateClob(String columnName, Clob x) throws SQLException {
mResultSet.updateClob(columnName, x);
}
public void updateDate(int columnIndex, Date x) throws SQLException {
mResultSet.updateDate(columnIndex, x);
}
public void updateDate(String columnName, Date x) throws SQLException {
mResultSet.updateDate(columnName, x);
}
public void updateDouble(int columnIndex, double x) throws SQLException {
mResultSet.updateDouble(columnIndex, x);
}
public void updateDouble(String columnName, double x) throws SQLException {
mResultSet.updateDouble(columnName, x);
}
public void updateFloat(int columnIndex, float x) throws SQLException {
mResultSet.updateFloat(columnIndex, x);
}
public void updateFloat(String columnName, float x) throws SQLException {
mResultSet.updateFloat(columnName, x);
}
public void updateInt(int columnIndex, int x) throws SQLException {
mResultSet.updateInt(columnIndex, x);
}
public void updateInt(String columnName, int x) throws SQLException {
mResultSet.updateInt(columnName, x);
}
public void updateLong(int columnIndex, long x) throws SQLException {
mResultSet.updateLong(columnIndex, x);
}
public void updateLong(String columnName, long x) throws SQLException {
mResultSet.updateLong(columnName, x);
}
public void updateNull(int columnIndex) throws SQLException {
mResultSet.updateNull(columnIndex);
}
public void updateNull(String columnName) throws SQLException {
mResultSet.updateNull(columnName);
}
public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
mResultSet.updateObject(columnIndex, x, scale);
}
public void updateObject(int columnIndex, Object x) throws SQLException {
mResultSet.updateObject(columnIndex, x);
}
public void updateObject(String columnName, Object x, int scale) throws SQLException {
mResultSet.updateObject(columnName, x, scale);
}
public void updateObject(String columnName, Object x) throws SQLException {
mResultSet.updateObject(columnName, x);
}
public void updateRef(int columnIndex, Ref x) throws SQLException {
mResultSet.updateRef(columnIndex, x);
}
public void updateRef(String columnName, Ref x) throws SQLException {
mResultSet.updateRef(columnName, x);
}
public void updateRow() throws SQLException {
mResultSet.updateRow();
}
public void updateShort(int columnIndex, short x) throws SQLException {
mResultSet.updateShort(columnIndex, x);
}
public void updateShort(String columnName, short x) throws SQLException {
mResultSet.updateShort(columnName, x);
}
public void updateString(int columnIndex, String x) throws SQLException {
mResultSet.updateString(columnIndex, x);
}
public void updateString(String columnName, String x) throws SQLException {
mResultSet.updateString(columnName, x);
}
public void updateTime(int columnIndex, Time x) throws SQLException {
mResultSet.updateTime(columnIndex, x);
}
public void updateTime(String columnName, Time x) throws SQLException {
mResultSet.updateTime(columnName, x);
}
public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
mResultSet.updateTimestamp(columnIndex, x);
}
public void updateTimestamp(String columnName, Timestamp x) throws SQLException {
mResultSet.updateTimestamp(columnName, x);
}
public boolean wasNull() throws SQLException {
return mResultSet.wasNull();
}
}