| | |
| | | } catch (SQLException e) |
| | | { |
| | | throw new RuntimeException("initialize oralce error.", e); |
| | | } catch (Dgn7fileException e) |
| | | } catch (Dgn7Exception e) |
| | | { |
| | | throw new RuntimeException("initialize oralce error.", e); |
| | | } |
| | | } |
| | | if (_element == null) |
| | | { |
| | | return false; |
| | | } |
| | | return true; |
| | | return _element != null; |
| | | } |
| | | |
| | | public Element next() |
| | |
| | | } catch (SQLException e) |
| | | { |
| | | throw new RuntimeException("Error:" + e.getMessage(), e); |
| | | } catch (Dgn7fileException e) |
| | | } catch (Dgn7Exception e) |
| | | { |
| | | throw new RuntimeException("Error:" + e.getMessage(), e); |
| | | } |
| | |
| | | throw new RuntimeException("Not Support this method."); |
| | | } |
| | | |
| | | private boolean initializeReader() throws SQLException, Dgn7fileException |
| | | private boolean initializeReader() throws SQLException, Dgn7Exception |
| | | { |
| | | if (_resultSet != null) return true; |
| | | Statement stmtSrc = _connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); |
| | |
| | | return true; |
| | | } |
| | | |
| | | private boolean fetchElement() throws SQLException, Dgn7fileException |
| | | private boolean fetchElement() throws SQLException, Dgn7Exception |
| | | { |
| | | if (_resultSet.next()) |
| | | { |
| | |
| | | raw = getBytesFromBLOB(blob); |
| | | } catch (IOException e) |
| | | { |
| | | throw new SQLException("IOError", e); |
| | | throw new Dgn7Exception("IOError", e); |
| | | } |
| | | blob.close(); |
| | | } else if (value instanceof byte[]) |
| | |
| | | |
| | | protected static byte[] getBytesFromBLOB(BLOB blob) throws SQLException, IOException |
| | | { |
| | | byte[] raw = null; |
| | | byte[] raw; |
| | | |
| | | // BLOB blob = (BLOB) rs.getBlob(1); |
| | | int optimalSize = blob.getChunkSize(); |
| | | byte[] chunk = new byte[optimalSize]; |
| | | InputStream is = blob.getBinaryStream(0); |
| | | ByteBuffer buffer = null; // ByteBuffer.allocate(optimalSize); |
| | | int len = 0; |
| | | int len; |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | is.close(); |
| | | assert buffer != null; |
| | | buffer.position(0); |
| | | raw = buffer.array(); |
| | | } catch (IOException e) |