changed some commented out messages to use the Driver.debug and fixed first to read the underlying data into rowbuffer

This commit is contained in:
Dave Cramer 2002-06-13 13:48:28 +00:00
parent 3f857600b2
commit ad88ee1e04

View File

@ -62,6 +62,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
protected org.postgresql.jdbc2.Statement statement; protected org.postgresql.jdbc2.Statement statement;
private StringBuffer sbuf = null; private StringBuffer sbuf = null;
protected byte[][] rowBuffer=null;
protected String sqlQuery=null;
/* /*
* Create a new ResultSet - Note that we create ResultSets to * Create a new ResultSet - Note that we create ResultSets to
@ -113,9 +115,14 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
if (rows == null) if (rows == null)
throw new PSQLException("postgresql.con.closed"); throw new PSQLException("postgresql.con.closed");
if (++current_row >= rows.size()) if (++current_row >= rows.size())
return false; return false;
this_row = (byte [][])rows.elementAt(current_row); this_row = (byte [][])rows.elementAt(current_row);
rowBuffer=new byte[this_row.length][];
System.arraycopy(this_row,0,rowBuffer,0,this_row.length);
return true; return true;
} }
@ -640,6 +647,35 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
return getBinaryStream(findColumn(columnName)); return getBinaryStream(findColumn(columnName));
} }
public java.net.URL getURL(int columnIndex) throws SQLException
{
return null;
}
public java.net.URL getURL(String columnName) throws SQLException
{
return null;
}
public void updateRef(int colIndex,java.sql.Ref ref) throws SQLException {
}
public void updateRef(String colName,java.sql.Ref ref) throws SQLException {
}
public void updateBlob(int colIndex,java.sql.Blob blob) throws SQLException {
}
public void updateBlob(String colName,java.sql.Blob blob) throws SQLException {
}
public void updateClob(int colIndex,java.sql.Clob clob) throws SQLException {
}
public void updateClob(String colName,java.sql.Clob clob) throws SQLException {
}
public void updateArray(int colIndex,java.sql.Array array) throws SQLException {
}
public void updateArray(String colName,java.sql.Array array) throws SQLException {
}
/* /*
* The first warning reported by calls on this ResultSet is * The first warning reported by calls on this ResultSet is
* returned. Subsequent ResultSet warnings will be chained * returned. Subsequent ResultSet warnings will be chained
@ -896,8 +932,13 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
{ {
if (rows.size() <= 0) if (rows.size() <= 0)
return false; return false;
current_row = 0; current_row = 0;
this_row = (byte [][])rows.elementAt(current_row); this_row = (byte [][])rows.elementAt(current_row);
rowBuffer=new byte[this_row.length][];
System.arraycopy(this_row,0,rowBuffer,0,this_row.length);
return true; return true;
} }
@ -1137,8 +1178,13 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
final int rows_size = rows.size(); final int rows_size = rows.size();
if (rows_size <= 0) if (rows_size <= 0)
return false; return false;
current_row = rows_size - 1; current_row = rows_size - 1;
this_row = (byte [][])rows.elementAt(current_row); this_row = (byte [][])rows.elementAt(current_row);
rowBuffer=new byte[this_row.length][];
System.arraycopy(this_row,0,rowBuffer,0,this_row.length);
return true; return true;
} }
@ -1159,6 +1205,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
if (--current_row < 0) if (--current_row < 0)
return false; return false;
this_row = (byte [][])rows.elementAt(current_row); this_row = (byte [][])rows.elementAt(current_row);
System.arraycopy(this_row,0,rowBuffer,0,this_row.length);
return true; return true;
} }
@ -1625,6 +1672,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
synchronized (resultSet) synchronized (resultSet)
{ {
SimpleDateFormat df = null; SimpleDateFormat df = null;
if ( org.postgresql.Driver.logDebug ) org.postgresql.Driver.debug("the data from the DB is "+s);
// If first time, create the buffer, otherwise clear it. // If first time, create the buffer, otherwise clear it.
if (resultSet.sbuf == null) if (resultSet.sbuf == null)
@ -1711,6 +1759,8 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
try try
{ {
// All that's left is to parse the string and return the ts. // All that's left is to parse the string and return the ts.
if ( org.postgresql.Driver.logDebug ) org.postgresql.Driver.debug( "" + df.parse(resultSet.sbuf.toString()).getTime() );
return new Timestamp(df.parse(resultSet.sbuf.toString()).getTime()); return new Timestamp(df.parse(resultSet.sbuf.toString()).getTime());
} }
catch (ParseException e) catch (ParseException e)
@ -1719,5 +1769,9 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
} }
} }
} }
public void setSQLQuery(String sqlQuery) {
this.sqlQuery=sqlQuery;
}
} }