All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.dialect.IngresDialect Maven / Gradle / Ivy

There is a newer version: 7.0.0.Beta3
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
 * indicated by the @author tags or express copyright attribution
 * statements applied by the authors.  All third-party contributions are
 * distributed under license by Red Hat Middleware LLC.
 *
 * This copyrighted material is made available to anyone wishing to use, modify,
 * copy, or redistribute it subject to the terms and conditions of the GNU
 * Lesser General Public License, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this distribution; if not, write to:
 * Free Software Foundation, Inc.
 * 51 Franklin Street, Fifth Floor
 * Boston, MA  02110-1301  USA
 *
 */
package org.hibernate.dialect;

import java.sql.Types;

import org.hibernate.Hibernate;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.NoArgSQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;

/**
 * An Ingres SQL dialect.
 * 

* Known limitations: * - only supports simple constants or columns on the left side of an IN, making (1,2,3) in (...) or (FOR UPDATE OF, allowing * particular rows to be locked? * * @return True (Ingres does support "for update of" syntax...) */ public boolean supportsForUpdateOf() { return true; } /** * The syntax used to add a column to a table (optional). */ public String getAddColumnString() { return "add column"; } /** * The keyword used to specify a nullable column. * * @return String */ public String getNullColumnString() { return " with null"; } /** * Does this dialect support sequences? * * @return boolean */ public boolean supportsSequences() { return true; } /** * The syntax that fetches the next value of a sequence, if sequences are supported. * * @param sequenceName the name of the sequence * * @return String */ public String getSequenceNextValString(String sequenceName) { return "select nextval for " + sequenceName; } public String getSelectSequenceNextValString(String sequenceName) { return sequenceName + ".nextval"; } /** * The syntax used to create a sequence, if sequences are supported. * * @param sequenceName the name of the sequence * * @return String */ public String getCreateSequenceString(String sequenceName) { return "create sequence " + sequenceName; } /** * The syntax used to drop a sequence, if sequences are supported. * * @param sequenceName the name of the sequence * * @return String */ public String getDropSequenceString(String sequenceName) { return "drop sequence " + sequenceName + " restrict"; } /** * A query used to find all sequences */ public String getQuerySequencesString() { return "select seq_name from iisequence"; } /** * The name of the SQL function that transforms a string to * lowercase * * @return String */ public String getLowercaseFunction() { return "lowercase"; } /** * Does this Dialect have some kind of LIMIT syntax? */ public boolean supportsLimit() { return true; } /** * Does this dialect support an offset? */ public boolean supportsLimitOffset() { return false; } /** * Add a LIMIT clause to the given SQL SELECT * * @return the modified SQL */ public String getLimitString(String querySelect, int offset, int limit) { if ( offset > 0 ) { throw new UnsupportedOperationException( "offset not supported" ); } return new StringBuffer( querySelect.length() + 16 ) .append( querySelect ) .insert( 6, " first " + limit ) .toString(); } public boolean supportsVariableLimit() { return false; } /** * Does the LIMIT clause take a "maximum" row number instead * of a total number of returned rows? */ public boolean useMaxForLimit() { return true; } /** * Ingres explicitly needs "unique not null", because "with null" is default */ public boolean supportsNotNullUnique() { return false; } /** * Does this dialect support temporary tables? */ public boolean supportsTemporaryTables() { return true; } public String getCreateTemporaryTableString() { return "declare global temporary table"; } public String getCreateTemporaryTablePostfix() { return "on commit preserve rows with norecovery"; } public String generateTemporaryTableName(String baseTableName) { return "session." + super.generateTemporaryTableName( baseTableName ); } /** * Expression for current_timestamp */ public String getCurrentTimestampSQLFunctionName() { return "date(now)"; } // Overridden informational metadata ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ public boolean supportsSubselectAsInPredicateLHS() { return false; } public boolean supportsEmptyInList() { return false; } public boolean supportsExpectedLobUsagePattern () { return false; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy