after turning the poolman cache back on, I realized that posgres 7.1 setBytes
authormh <mh>
Sun, 17 Feb 2002 23:05:18 +0000 (23:05 +0000)
committermh <mh>
Sun, 17 Feb 2002 23:05:18 +0000 (23:05 +0000)
was not poolman compatible. we now use LargeObjectApi directly.

source/mircoders/entity/EntityImages.java

index 5a8b83c..f873f51 100755 (executable)
@@ -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);