01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc;
12:
13: import com.versant.core.common.NewObjectOID;
14: import com.versant.core.metadata.ClassMetaData;
15: import com.versant.core.jdbc.metadata.JdbcField;
16: import com.versant.core.jdbc.metadata.JdbcColumn;
17:
18: import java.sql.ResultSet;
19: import java.sql.SQLException;
20: import java.sql.PreparedStatement;
21:
22: /**
23: * Adds JDBC specific methods that pass through to the real OID. This saves
24: * having to call getRealOID() before casting to JdbcOID in a lot of the JDBC
25: * code.
26: */
27: public final class JdbcNewObjectOID extends NewObjectOID implements
28: JdbcOID {
29:
30: public JdbcNewObjectOID() {
31: }
32:
33: public JdbcNewObjectOID(ClassMetaData cmd) {
34: super (cmd);
35: }
36:
37: public NewObjectOID newInstance(ClassMetaData cmd) {
38: return new JdbcNewObjectOID(cmd);
39: }
40:
41: public boolean copyKeyFields(ResultSet rs, int firstCol)
42: throws SQLException {
43: return ((JdbcOID) realOID).copyKeyFields(rs, firstCol);
44: }
45:
46: public boolean copyKeyFields(ResultSet rs, JdbcField[] pks,
47: int[] pkFieldIndexs) throws SQLException {
48: return ((JdbcOID) realOID)
49: .copyKeyFields(rs, pks, pkFieldIndexs);
50: }
51:
52: public boolean validateKeyFields(ResultSet rs, int firstCol)
53: throws SQLException {
54: return ((JdbcOID) realOID).validateKeyFields(rs, firstCol);
55: }
56:
57: public int setParams(PreparedStatement ps, int firstParam)
58: throws SQLException {
59: return ((JdbcOID) realOID).setParams(ps, firstParam);
60: }
61:
62: public int setParams(PreparedStatement ps, int firstParam,
63: JdbcColumn[] pkc) throws SQLException {
64: return ((JdbcOID) realOID).setParams(ps, firstParam, pkc);
65: }
66:
67: }
|