Bug in JDBC driver w/BLOBs
От | Tristan Tarrant |
---|---|
Тема | Bug in JDBC driver w/BLOBs |
Дата | |
Msg-id | 1119368516.30387.23.camel@localhost.localdomain обсуждение исходный текст |
Ответы |
Re: Bug in JDBC driver w/BLOBs
|
Список | pgsql-jdbc |
- Dear all,
Now the bad news: I believe I have found a bug in the pgsql jdbc driver regarding read access of BLOBs. According to Sun's JDBC documentation, BLOBs are 1-based, but the driver makes the assumption they are 0-based.
Here is the excerpt from javadoc:
public byte[] getBytes(long pos, int length)
throws SQLException
- Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes. This byte array contains up to length consecutive bytes starting at position pos.
- pos - the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1
length - the number of consecutive bytes to be copied
--- AbstractJdbc2Blob.java~ 2005-06-21 17:11:20.000000000 +0200
+++ AbstractJdbc2Blob.java 2005-06-21 17:11:20.000000000 +0200
@@ -38,7 +38,7 @@
public byte[] getBytes(long pos, int length) throws SQLException
{
- lo.seek((int)pos, LargeObject.SEEK_SET);
+ lo.seek((int)(pos-1), LargeObject.SEEK_SET);
return lo.read(length);
}
everything works as advertised.
Am I right ? Am I completely wrong ?
Let me know.
Tristan
Вложения
В списке pgsql-jdbc по дате отправления: