001    package org.apache.ojb.broker.platforms;
002    
003    /* Copyright 2002-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    
019    /**
020     * This class extends <code>PlatformDefaultImpl</code> and defines specific
021     * behavior for the Hsqldb platform.
022     *
023     * @author <a href="mailto:thma@apache.org">Thomas Mahler<a>
024     * @version $Id: PlatformHsqldbImpl.java,v 1.1 2007-08-24 22:17:35 ewestfal Exp $
025     */
026    public class PlatformHsqldbImpl extends PlatformDefaultImpl
027    {
028        private static final String LAST_INSERT = "CALL IDENTITY()";
029    
030        /**
031         * Get join syntax type for this RDBMS - one on of the constants from JoinSyntaxType interface
032         */
033        public byte getJoinSyntaxType()
034        {
035            return SQL92_NOPAREN_JOIN_SYNTAX;
036        }
037    
038        public String getLastInsertIdentityQuery(String tableName)
039        {
040            return LAST_INSERT;
041        }
042        
043        /* (non-Javadoc)
044         * @see org.apache.ojb.broker.platforms.Platform#addPagingSql(java.lang.StringBuffer)
045         */
046        public void addPagingSql(StringBuffer anSqlString)
047        {
048            anSqlString.insert(6, " LIMIT ? ? ");
049        }
050    
051        /* (non-Javadoc)
052         * @see org.apache.ojb.broker.platforms.Platform#bindPagingParametersFirst()
053         */
054        public boolean bindPagingParametersFirst()
055        {
056            return true;
057        }
058    
059        /* (non-Javadoc)
060         * @see org.apache.ojb.broker.platforms.Platform#supportsPaging()
061         */
062        public boolean supportsPaging()
063        {
064            return true;
065        }
066    
067    // arminw: Check is not necessary any longer
068    //    /**
069    //     * HSQLDB does not implement CallableStatement.
070    //     *
071    //     * @see org.apache.ojb.broker.platforms.Platform#isCallableStatement(java.sql.PreparedStatement)
072    //     */
073    //    public boolean isCallableStatement(PreparedStatement stmt)
074    //    {
075    //        return false;
076    //    }
077    
078    }