1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Added a check for not calling next() before getting objects from the result set,

moved the check for columnIndex into same call
check at the top of all getXXX
added appropriate error
This commit is contained in:
Dave Cramer
2002-03-09 17:36:14 +00:00
parent c422b5ca6b
commit ee2154829e
4 changed files with 18 additions and 14 deletions

View File

@ -162,9 +162,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
*/
public String getString(int columnIndex) throws SQLException
{
if (columnIndex < 1 || columnIndex > fields.length)
throw new PSQLException("postgresql.res.colrange");
checkResultSet( columnIndex );
wasNullFlag = (this_row[columnIndex - 1] == null);
if (wasNullFlag)
return null;
@ -315,9 +313,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
*/
public byte[] getBytes(int columnIndex) throws SQLException
{
if (columnIndex < 1 || columnIndex > fields.length)
throw new PSQLException("postgresql.res.colrange");
checkResultSet( columnIndex );
wasNullFlag = (this_row[columnIndex - 1] == null);
if (!wasNullFlag)
{
@ -424,6 +420,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
*/
public InputStream getAsciiStream(int columnIndex) throws SQLException
{
checkResultSet( columnIndex );
wasNullFlag = (this_row[columnIndex - 1] == null);
if (wasNullFlag)
return null;
@ -469,6 +466,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
*/
public InputStream getUnicodeStream(int columnIndex) throws SQLException
{
checkResultSet( columnIndex );
wasNullFlag = (this_row[columnIndex - 1] == null);
if (wasNullFlag)
return null;
@ -511,6 +509,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
*/
public InputStream getBinaryStream(int columnIndex) throws SQLException
{
checkResultSet( columnIndex );
wasNullFlag = (this_row[columnIndex - 1] == null);
if (wasNullFlag)
return null;
@ -724,8 +723,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
{
Field field;
if (columnIndex < 1 || columnIndex > fields.length)
throw new PSQLException("postgresql.res.colrange");
checkResultSet( columnIndex );
wasNullFlag = (this_row[columnIndex - 1] == null);
if (wasNullFlag)
@ -941,6 +939,7 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
public java.io.Reader getCharacterStream(int i) throws SQLException
{
checkResultSet( i );
wasNullFlag = (this_row[i - 1] == null);
if (wasNullFlag)
return null;