01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.persistence.lobs;
19:
20: import java.io.InputStream;
21: import java.sql.Blob;
22: import java.sql.PreparedStatement;
23: import java.sql.ResultSet;
24: import java.sql.SQLException;
25:
26: public interface LOBPolicy {
27:
28: /**
29: * Answer true if SELECT FOR UPDATE is necessary to for setting the blob
30: */
31: public boolean requiresSelectForUpdate();
32:
33: public boolean supportsSelectIntoForBlobs();
34:
35: /**
36: * Answer the String to be included in an insert statement to create an
37: * empty blob
38: */
39: public String getEmptyBlobFunction();
40:
41: /**
42: * Set the blob field in the way required by the underlying database.
43: */
44: public void setBlob(Blob blob, PreparedStatement statement,
45: int index, byte[] bytes) throws SQLException;
46:
47: /**
48: * Set the blob field in the way required by the underlying database.
49: */
50: public void setBlob(Blob blob, PreparedStatement statement,
51: int index, InputStream stream, int length)
52: throws SQLException;
53:
54: /**
55: * Retrieve the blob field in the way required by the underlying database.
56: */
57: public InputStream getBinaryStream(ResultSet rs, int index)
58: throws SQLException;
59: }
|