- con = theStorageObject.getPooledCon();
- con.setAutoCommit(false);
- LargeObjectManager lom;
- java.sql.Connection jCon;
- stmt = con.createStatement();
- ResultSet rs = theStorageObject.executeSql(stmt, "select icon_data from images where id="+getId());
- jCon = ((com.codestudio.sql.PoolManConnectionHandle)con)
- .getNativeConnection();
- lom = ((org.postgresql.Connection)jCon).getLargeObjectAPI();
- if(rs!=null) {
- if (rs.next()) {
- LargeObject lob = lom.open(rs.getInt(1));
- in = (BlobInputStream)lob.getInputStream();
- img_in = new ImageInputStream( in, con ,stmt);
- //img_data = rs.getBytes(1);
- }
- rs.close();
- }
- }
- catch (Throwable t) {
- logger.error("EntityImages.getIcon failed: "+t.toString());
- t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-
- try {
- con.setAutoCommit(true);
- }
- catch (SQLException e) {
- logger.error("EntityImages.getIcon resetting transaction mode failed: " + e.toString());
- e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
- }
- try {
- theStorageObject.freeConnection(con, stmt);
- }
- catch (Throwable e) {
- logger.error("EntityImages -- freeing connection failed: " + e.getMessage());
- }
-
- throwStorageObjectFailure(t, "EntityImages -- getIcon failed:");