From 9cb69e6aa30651bf2166b2ff59e892f29f7491b1 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Feb 2002 23:05:18 +0000 Subject: [PATCH] after turning the poolman cache back on, I realized that posgres 7.1 setBytes was not poolman compatible. we now use LargeObjectApi directly. --- source/mircoders/entity/EntityImages.java | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/source/mircoders/entity/EntityImages.java b/source/mircoders/entity/EntityImages.java index 5a8b83c5..f873f51e 100755 --- a/source/mircoders/entity/EntityImages.java +++ b/source/mircoders/entity/EntityImages.java @@ -118,14 +118,30 @@ public class EntityImages extends EntityUploadedMedia theLog.printDebugInfo("settimage :: trying to insert image"); // setting values - String sql = "update images set img_height='"+webdbImage.getImageHeight() + + LargeObjectManager lom; + java.sql.Connection jCon; + jCon = ((com.codestudio.sql.PoolManConnectionHandle)con) + .getNativeConnection(); + lom = ((org.postgresql.Connection)jCon).getLargeObjectAPI(); + int oidImage = lom.create(); + int oidIcon = lom.create(); + LargeObject lobImage = lom.open(oidImage); + LargeObject lobIcon = lom.open(oidIcon); + lobImage.write(imageData); + lobIcon.write(iconData); + lobImage.close(); + lobIcon.close(); + String sql = "update images set img_height='" + +webdbImage.getImageHeight() + "',img_width='" + webdbImage.getImageWidth() + "',icon_height='" + webdbImage.getIconHeight() + - "',icon_width='" + webdbImage.getIconWidth() + "', image_data=?, icon_data=? where id="+getId(); + "',icon_width='" + webdbImage.getIconWidth() + + "', image_data="+oidImage+", icon_data="+oidIcon + +" where id="+getId(); theLog.printDebugInfo("settimage :: updating sizes: "+ sql); pstmt = con.prepareStatement(sql); - pstmt.setBytes(1, imageData); - pstmt.setBytes(2, iconData); + //pstmt.setBytes(1, imageData); + //pstmt.setBytes(2, iconData); pstmt.executeUpdate(); sql="update content set is_produced='0' where to_media="+getId(); pstmt = con.prepareStatement(sql); -- 2.11.0