01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.cocoon.components.modules.database;
19:
20: import java.sql.Connection;
21: import java.sql.SQLException;
22: import java.sql.Statement;
23: import java.util.Map;
24:
25: import org.apache.avalon.framework.configuration.Configuration;
26: import org.apache.avalon.framework.configuration.ConfigurationException;
27: import org.apache.avalon.framework.thread.ThreadSafe;
28:
29: /**
30: * Abstraction layer to encapsulate different DBMS behaviour for autoincrement columns.
31: *
32: * Here: Informix IUS 9.21 SERIAL columns
33: * (need another one for SERIAL8 ones!)
34: *
35: * @author <a href="mailto:haul@apache.org">Christian Haul</a>
36: * @version CVS $Id: IfxSerialAutoIncrementModule.java 433543 2006-08-22 06:22:54Z crossley $
37: */
38: public class IfxSerialAutoIncrementModule implements
39: AutoIncrementModule, ThreadSafe {
40:
41: public Object getPostValue(Configuration tableConf,
42: Configuration columnConf, Configuration modeConf,
43: Connection conn, Statement stmt, Map objectModel)
44: throws SQLException, ConfigurationException {
45:
46: return new Integer(((com.informix.jdbc.IfxStatement) stmt)
47: .getSerial());
48: }
49:
50: public boolean includeInQuery() {
51: return false;
52: }
53:
54: public boolean includeAsValue() {
55: return false;
56: }
57:
58: public Object getPreValue(Configuration tableConf,
59: Configuration columnConf, Configuration modeConf,
60: Connection conn, Map objectModel) throws SQLException,
61: ConfigurationException {
62:
63: return null;
64: }
65:
66: public String getSubquery(Configuration tableConf,
67: Configuration columnConf, Configuration modeConf)
68: throws ConfigurationException {
69:
70: return null;
71: }
72:
73: }
|