mirror of
https://github.com/postgres/postgres.git
synced 2025-05-24 00:03:23 -04:00
fixed change in behavior introduced in bytea / getBytes changes. This patch reverts back unintentional change in behavior to return raw value even when not bytea column
This commit is contained in:
parent
c41b6b1b9c
commit
512a3aef36
@ -391,22 +391,30 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
if (columnIndex < 1 || columnIndex > fields.length)
|
if (columnIndex < 1 || columnIndex > fields.length)
|
||||||
throw new PSQLException("postgresql.res.colrange");
|
throw new PSQLException("postgresql.res.colrange");
|
||||||
|
|
||||||
//If the data is already binary then just return it
|
wasNullFlag = (this_row[columnIndex - 1] == null);
|
||||||
|
if (!wasNullFlag)
|
||||||
|
{
|
||||||
if (binaryCursor)
|
if (binaryCursor)
|
||||||
|
{
|
||||||
|
//If the data is already binary then just return it
|
||||||
return this_row[columnIndex - 1];
|
return this_row[columnIndex - 1];
|
||||||
|
}
|
||||||
if (connection.haveMinimumCompatibleVersion("7.2"))
|
else if (connection.haveMinimumCompatibleVersion("7.2"))
|
||||||
{
|
{
|
||||||
//Version 7.2 supports the bytea datatype for byte arrays
|
//Version 7.2 supports the bytea datatype for byte arrays
|
||||||
|
if (fields[columnIndex - 1].getPGType().equals("bytea"))
|
||||||
|
{
|
||||||
return PGbytea.toBytes(getString(columnIndex));
|
return PGbytea.toBytes(getString(columnIndex));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Version 7.1 and earlier supports LargeObjects for byte arrays
|
return this_row[columnIndex - 1];
|
||||||
wasNullFlag = (this_row[columnIndex - 1] == null);
|
}
|
||||||
// Handle OID's as BLOBS
|
}
|
||||||
if (!wasNullFlag)
|
else
|
||||||
{
|
{
|
||||||
|
//Version 7.1 and earlier supports LargeObjects for byte arrays
|
||||||
|
// Handle OID's as BLOBS
|
||||||
if ( fields[columnIndex - 1].getOID() == 26)
|
if ( fields[columnIndex - 1].getOID() == 26)
|
||||||
{
|
{
|
||||||
LargeObjectManager lom = connection.getLargeObjectAPI();
|
LargeObjectManager lom = connection.getLargeObjectAPI();
|
||||||
@ -415,6 +423,10 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
lob.close();
|
lob.close();
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this_row[columnIndex - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -318,22 +318,30 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
if (columnIndex < 1 || columnIndex > fields.length)
|
if (columnIndex < 1 || columnIndex > fields.length)
|
||||||
throw new PSQLException("postgresql.res.colrange");
|
throw new PSQLException("postgresql.res.colrange");
|
||||||
|
|
||||||
//If the data is already binary then just return it
|
wasNullFlag = (this_row[columnIndex - 1] == null);
|
||||||
|
if (!wasNullFlag)
|
||||||
|
{
|
||||||
if (binaryCursor)
|
if (binaryCursor)
|
||||||
|
{
|
||||||
|
//If the data is already binary then just return it
|
||||||
return this_row[columnIndex - 1];
|
return this_row[columnIndex - 1];
|
||||||
|
}
|
||||||
if (connection.haveMinimumCompatibleVersion("7.2"))
|
else if (connection.haveMinimumCompatibleVersion("7.2"))
|
||||||
{
|
{
|
||||||
//Version 7.2 supports the bytea datatype for byte arrays
|
//Version 7.2 supports the bytea datatype for byte arrays
|
||||||
|
if (fields[columnIndex - 1].getPGType().equals("bytea"))
|
||||||
|
{
|
||||||
return PGbytea.toBytes(getString(columnIndex));
|
return PGbytea.toBytes(getString(columnIndex));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Version 7.1 and earlier supports LargeObjects for byte arrays
|
return this_row[columnIndex - 1];
|
||||||
wasNullFlag = (this_row[columnIndex - 1] == null);
|
}
|
||||||
// Handle OID's as BLOBS
|
}
|
||||||
if (!wasNullFlag)
|
else
|
||||||
{
|
{
|
||||||
|
//Version 7.1 and earlier supports LargeObjects for byte arrays
|
||||||
|
// Handle OID's as BLOBS
|
||||||
if ( fields[columnIndex - 1].getOID() == 26)
|
if ( fields[columnIndex - 1].getOID() == 26)
|
||||||
{
|
{
|
||||||
LargeObjectManager lom = connection.getLargeObjectAPI();
|
LargeObjectManager lom = connection.getLargeObjectAPI();
|
||||||
@ -342,6 +350,10 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
|||||||
lob.close();
|
lob.close();
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return this_row[columnIndex - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user