01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.jdbc.support.lob;
18:
19: import java.io.InputStream;
20: import java.io.Reader;
21: import java.sql.ResultSet;
22: import java.sql.SQLException;
23:
24: /**
25: * Abstract base class for LobHandler implementations.
26: *
27: * <p>Implements all accessor methods for column names through a column lookup
28: * and delegating to the corresponding accessor that takes a column index.
29: *
30: * @author Juergen Hoeller
31: * @since 1.2
32: * @see java.sql.ResultSet#findColumn
33: */
34: public abstract class AbstractLobHandler implements LobHandler {
35:
36: public byte[] getBlobAsBytes(ResultSet rs, String columnName)
37: throws SQLException {
38: return getBlobAsBytes(rs, rs.findColumn(columnName));
39: }
40:
41: public InputStream getBlobAsBinaryStream(ResultSet rs,
42: String columnName) throws SQLException {
43: return getBlobAsBinaryStream(rs, rs.findColumn(columnName));
44: }
45:
46: public String getClobAsString(ResultSet rs, String columnName)
47: throws SQLException {
48: return getClobAsString(rs, rs.findColumn(columnName));
49: }
50:
51: public InputStream getClobAsAsciiStream(ResultSet rs,
52: String columnName) throws SQLException {
53: return getClobAsAsciiStream(rs, rs.findColumn(columnName));
54: }
55:
56: public Reader getClobAsCharacterStream(ResultSet rs,
57: String columnName) throws SQLException {
58: return getClobAsCharacterStream(rs, rs.findColumn(columnName));
59: }
60:
61: }
|