You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by fr...@apache.org on 2001/11/10 00:31:38 UTC
cvs commit: jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver AvalonDBResultSet.java
froehlich 01/11/09 15:31:38
Modified: apps/db/src/java/org/apache/avalon/db/driver
AvalonDBResultSet.java
Log:
some changes to get the <simple-select> enabled
Revision Changes Path
1.5 +52 -6 jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBResultSet.java
Index: AvalonDBResultSet.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/driver/AvalonDBResultSet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AvalonDBResultSet.java 2001/11/01 08:19:28 1.4
+++ AvalonDBResultSet.java 2001/11/09 23:31:38 1.5
@@ -14,9 +14,9 @@
import org.apache.avalon.db.transport.ResultSetReply;
import org.apache.avalon.db.results.RowSet;
import org.apache.avalon.db.results.Columns;
+import org.apache.avalon.db.data.Row;
-
import java.math.BigDecimal;
import java.io.InputStream;
@@ -44,14 +44,15 @@
*
* @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
* @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class AvalonDBResultSet extends AbstractDriver implements ResultSet {
private AvalonDBConnection mAvalonDBConnection;
private RowSet mRowSet;
+ private Row mRow;
private int mResultSetConcurrency;
- private int mCursor = -1;
+ private int mCursor = 0;
private int mOffset = 0;
public AvalonDBResultSet(AvalonDBConnection avalonDBConnection, RowSet rowSet) {
@@ -80,8 +81,13 @@
* @exception SQLException if a database access error occurs
*/
public boolean next() throws SQLException {
- mCursor++;
- return (mCursor < mRowSet.getRowCount());
+ if(mRowSet.getRowCount() == 0) {
+ return false;
+ } else {
+ mRow = mRowSet.getRow(this.mCursor);
+ mCursor++;
+ return true;
+ }
}
/**
@@ -137,7 +143,7 @@
* @exception SQLException if a database access error occurs
*/
public String getString(int columnIndex) throws SQLException {
- return mRowSet.getRow(this.mCursor)[columnIndex].toString();
+ return (String)mRow.getValue(columnIndex);
}
/**
@@ -153,6 +159,7 @@
* @exception SQLException if a database access error occurs
*/
public boolean getBoolean(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Boolean) {
return ((Boolean) obj).booleanValue();
@@ -160,6 +167,8 @@
// "true" is true, all else false.
return Boolean.valueOf(obj.toString()).booleanValue();
}
+ */
+ return false;
}
/**
@@ -175,12 +184,15 @@
* @exception SQLException if a database access error occurs
*/
public byte getByte(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Byte) {
return ((Byte) obj).byteValue();
} else {
return Byte.parseByte(obj.toString());
}
+ */
+ return 0;
}
/**
@@ -196,12 +208,15 @@
* @exception SQLException if a database access error occurs
*/
public short getShort(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Short) {
return ((Short) obj).shortValue();
} else {
return Short.parseShort(obj.toString());
}
+ */
+ return 0;
}
/**
@@ -217,12 +232,16 @@
* @exception SQLException if a database access error occurs
*/
public int getInt(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Integer) {
return ((Integer) obj).intValue();
} else {
return Integer.parseInt(obj.toString());
}
+ */
+ return 0;
+
}
/**
@@ -238,12 +257,15 @@
* @exception SQLException if a database access error occurs
*/
public long getLong(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Long) {
return ((Long) obj).longValue();
} else {
return Long.parseLong(obj.toString());
}
+ */
+ return 0;
}
/**
@@ -259,12 +281,15 @@
* @exception SQLException if a database access error occurs
*/
public float getFloat(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Float) {
return ((Float) obj).floatValue();
} else {
return Float.parseFloat(obj.toString());
}
+ */
+ return 0;
}
/**
@@ -280,12 +305,15 @@
* @exception SQLException if a database access error occurs
*/
public double getDouble(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Double) {
return ((Double) obj).doubleValue();
} else {
return Double.parseDouble(obj.toString());
}
+ */
+ return 0;
}
/**
@@ -322,6 +350,7 @@
public byte[] getBytes(int columnIndex) throws SQLException {
// is this a byte representation of a string. i.e. 2 bytes per char?
// or a plain byte array. or both.
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Byte[]) {
Byte[] bytesObj = (Byte[]) obj;
@@ -333,6 +362,8 @@
} else {
return obj.toString().getBytes();
}
+ */
+ return null;
}
/**
@@ -348,12 +379,15 @@
* @exception SQLException if a database access error occurs
*/
public Date getDate(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Date) {
return (Date) obj;
} else {
return Date.valueOf(obj.toString());
}
+ */
+ return null;
}
/**
@@ -369,12 +403,15 @@
* @exception SQLException if a database access error occurs
*/
public Time getTime(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Time) {
return (Time) obj;
} else {
return Time.valueOf(obj.toString());
}
+ */
+ return null;
}
/**
@@ -390,12 +427,15 @@
* @exception SQLException if a database access error occurs
*/
public Timestamp getTimestamp(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof Timestamp) {
return (Timestamp) obj;
} else {
return Timestamp.valueOf(obj.toString());
}
+ */
+ return null;
}
/**
@@ -920,7 +960,10 @@
* @exception SQLException if a database access error occurs
*/
public Object getObject(int columnIndex) throws SQLException {
+ /*
return mRowSet.getRow(this.mCursor)[columnIndex];
+ */
+ return null;
}
/**
@@ -1025,12 +1068,15 @@
* 2.0 API</a>
*/
public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+ /*
Object obj = mRowSet.getRow(this.mCursor)[columnIndex];
if (obj instanceof BigDecimal) {
return (BigDecimal) obj;
} else {
throw new SQLException("Can;t convert to BIGDecimal");
}
+ */
+ return null;
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>