001/* 002 * JKNIV, whinstone one contract to access your database. 003 * 004 * Copyright (C) 2017, the original author or authors. 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software Foundation, Inc., 018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 019 */ 020package net.sf.jkniv.whinstone.jdbc.dialect; 021 022import net.sf.jkniv.sqlegance.dialect.SqlFeatureFactory; 023import net.sf.jkniv.sqlegance.dialect.SqlFeatureSupport; 024 025/** 026 * Default dialect do Oracle 027 * 028 * <p> 029 * Limit clause: 030 * <code>select name from author LIMIT 1 OFFSET 2</code> 031 * <code> 032 * select * from ( select row_.*, rownum rownum_ from 033 (select name from author ) 034 row_ where rownum <= 5) where rownum_ > 15 035 * </code> 036 * </p> 037 * 038 * <ul> 039 * <li>Supports limits? true</li> 040 * <li>Supports limit off set? true</li> 041 * <li>Supports rownum? true</li> 042 * </ul> 043 * 044 * @author Alisson Gomes 045 * @since 0.6.0 046 */ 047public class Oracle12cDialect extends OracleDialect 048{ 049 public Oracle12cDialect() 050 { 051 super(); 052 addFeature(SqlFeatureFactory.newInstance(SqlFeatureSupport.CONN_HOLDABILITY, false)); 053 } 054 055 /* 056 @Override 057 public PreparedStatement prepare(Connection conn, Sql isql, String query) 058 { 059 PreparedStatement stmt = null; 060 int rsType = isql.getResultSetType().getTypeScroll(); 061 int rsConcurrency = isql.getResultSetConcurrency().getConcurrencyMode(); 062 //int rsHoldability = isql.getResultSetHoldability().getHoldability(); 063 try 064 { 065 if (isql.isInsertable()) 066 { 067 Insertable insertTag = isql.asInsertable(); 068 if (insertTag.isAutoGenerateKey() && insertTag.getAutoGeneratedKey().isAutoStrategy()) 069 { 070 String[] columns = insertTag.getAutoGeneratedKey().getColumnsAsArray(); 071 stmt = conn.prepareStatement(query, columns); 072 } 073 } 074 if (stmt == null) 075 stmt = conn.prepareStatement(query, rsType, rsConcurrency); 076 if (isql.getTimeout() > 0) 077 stmt.setQueryTimeout(isql.getTimeout()); 078 } 079 catch (SQLException sqle) 080 { 081 throw new RepositoryException("Cannot prepare statement [" + sqle.getMessage() + "]", sqle); 082 } 083 return stmt; 084 } 085 */ 086}