📄 dialect.java
字号:
return getForUpdateString();
}
/**
* Retrieves the <tt>FOR UPDATE OF column_list NOWAIT</tt> syntax specific
* to this dialect, where the given aliases represent the aliases of the
* columns which are to be write locked.
*
* @return The appropriate <tt>FOR UPDATE colunm_list</tt> NOWAIT clause string.
*/
public String getForUpdateNowaitString(String aliases) {
return getForUpdateString( aliases );
}
/**
* Retrieves the <tt>FOR UPDATE</tt> syntax specific to this dialect.
*
* @return The appropriate <tt>FOR UPDATE</tt> clause string.
*/
public String getForUpdateString() {
return " for update";
}
/**
* Retrieves the <tt>FOR UPDATE NOWAIT</tt> syntax specific to this dialect.
*
* @return The appropriate <tt>FOR UPDATE NOWAIT</tt> clause string.
*/
public String getForUpdateNowaitString() {
return getForUpdateString();
}
/**
* Does this dialect support the <tt>UNIQUE</tt> column syntax?
*
* @return boolean
*/
public boolean supportsUnique() {
return true;
}
/**
* Does this dialect support adding Unique constraints via create and alter table ?
* @return boolean
*/
public boolean supportsUniqueConstraintInCreateAlterTable() {
return true;
}
/**
* The syntax used to add a column to a table (optional).
*/
public String getAddColumnString() {
throw new UnsupportedOperationException( "No add column syntax supported by Dialect" );
}
public String getDropForeignKeyString() {
return " drop constraint ";
}
public String getTableTypeString() {
return "";
}
/**
* The syntax used to add a foreign key constraint to a table.
*
* @param referencesPrimaryKey if false, constraint should be
* explicit about which column names the constraint refers to
*
* @return String
*/
public String getAddForeignKeyConstraintString(
String constraintName,
String[] foreignKey,
String referencedTable,
String[] primaryKey,
boolean referencesPrimaryKey
) {
StringBuffer res = new StringBuffer( 30 );
res.append( " add constraint " )
.append( constraintName )
.append( " foreign key (" )
.append( StringHelper.join( ", ", foreignKey ) )
.append( ") references " )
.append( referencedTable );
if(!referencesPrimaryKey) {
res.append(" (")
.append( StringHelper.join(", ", primaryKey) )
.append(')');
}
return res.toString();
}
/**
* The syntax used to add a primary key constraint to a table.
*
* @return String
*/
public String getAddPrimaryKeyConstraintString(String constraintName) {
return " add constraint " + constraintName + " primary key ";
}
/**
* The keyword used to specify a nullable column.
*
* @return String
*/
public String getNullColumnString() {
return "";
}
/**
* Does this dialect support identity column key generation?
*
* @return boolean
*/
public boolean supportsIdentityColumns() {
return false;
}
/**
* Does this dialect support sequences?
*
* @return boolean
*/
public boolean supportsSequences() {
return false;
}
public boolean supportsInsertSelectIdentity() {
return false;
}
/**
* Append a clause to retrieve the generated identity value for the
* given <tt>INSERT</tt> statement.
*/
public String appendIdentitySelectToInsert(String insertString) {
return insertString;
}
protected String getIdentitySelectString() throws MappingException {
throw new MappingException( "Dialect does not support identity key generation" );
}
/**
* The syntax that returns the identity value of the last insert, if
* identity column key generation is supported.
*
* @param type TODO
* @throws MappingException if no native key generation
*/
public String getIdentitySelectString(String table, String column, int type)
throws MappingException {
return getIdentitySelectString();
}
protected String getIdentityColumnString() throws MappingException {
throw new MappingException( "Dialect does not support identity key generation" );
}
/**
* The keyword used to specify an identity column, if identity
* column key generation is supported.
*
* @param type the SQL column type, as defined by <tt>java.sql.Types</tt>
* @throws MappingException if no native key generation
*/
public String getIdentityColumnString(int type) throws MappingException {
return getIdentityColumnString();
}
/**
* The keyword used to insert a generated value into an identity column (or null).
* Need if the dialect does not support inserts that specify no column values.
*
* @return String
*/
public String getIdentityInsertString() {
return null;
}
/**
* The keyword used to insert a row without specifying any column values.
* This is not possible on some databases.
*/
public String getNoColumnsInsertString() {
return "values ( )";
}
/**
* Generate the appropriate select statement to to retreive the next value
* of a sequence, if sequences are supported.
* <p/>
* This should be a "stand alone" select statement.
*
* @param sequenceName the name of the sequence
* @return String The "nextval" select string.
* @throws MappingException if no sequences
*/
public String getSequenceNextValString(String sequenceName) throws MappingException {
throw new MappingException( "Dialect does not support sequences" );
}
/**
* Generate the select expression fragment that will retreive the next
* value of a sequence, if sequences are supported.
* <p/>
* This differs from {@link #getSequenceNextValString(String)} in that this
* should return an expression usable within another select statement.
*
* @param sequenceName the name of the sequence
* @return String
* @throws MappingException if no sequences
*/
public String getSelectSequenceNextValString(String sequenceName) throws MappingException {
throw new MappingException( "Dialect does not support sequences" );
}
/**
* The syntax used to create a sequence, if sequences are supported.
*
* @param sequenceName the name of the sequence
* @return String
* @throws MappingException if no sequences
*/
protected String getCreateSequenceString(String sequenceName) throws MappingException {
throw new MappingException( "Dialect does not support sequences" );
}
/**
* The multiline script used to create a sequence, if sequences are supported.
*
* @param sequenceName the name of the sequence
* @return String[]
* @throws MappingException if no sequences
*/
public String[] getCreateSequenceStrings(String sequenceName) throws MappingException {
return new String[]{getCreateSequenceString( sequenceName )};
}
/**
* The syntax used to drop a sequence, if sequences are supported.
*
* @param sequenceName the name of the sequence
* @return String
* @throws MappingException if no sequences
*/
protected String getDropSequenceString(String sequenceName) throws MappingException {
throw new MappingException( "Dialect does not support sequences" );
}
/**
* The multiline script used to drop a sequence, if sequences are supported.
*
* @param sequenceName the name of the sequence
* @return String[]
* @throws MappingException if no sequences
*/
public String[] getDropSequenceStrings(String sequenceName) throws MappingException {
return new String[]{getDropSequenceString( sequenceName )};
}
/**
* A query used to find all sequences
*
* @see org.hibernate.tool.hbm2ddl.SchemaUpdate
*/
public String getQuerySequencesString() {
return null;
}
/**
* Get the <tt>Dialect</tt> specified by the current <tt>System</tt> properties.
*
* @return Dialect
* @throws HibernateException
*/
public static Dialect getDialect() throws HibernateException {
String dialectName = Environment.getProperties().getProperty( Environment.DIALECT );
if ( dialectName == null ) throw new HibernateException( "The dialect was not set. Set the property hibernate.dialect." );
try {
return ( Dialect ) ReflectHelper.classForName( dialectName ).newInstance();
}
catch ( ClassNotFoundException cnfe ) {
throw new HibernateException( "Dialect class not found: " + dialectName );
}
catch ( Exception e ) {
throw new HibernateException( "Could not instantiate dialect class", e );
}
}
/**
* Get the <tt>Dialect</tt> specified by the given properties or system properties.
*
* @param props
* @return Dialect
* @throws HibernateException
*/
public static Dialect getDialect(Properties props) throws HibernateException {
String dialectName = props.getProperty( Environment.DIALECT );
if ( dialectName == null ) return getDialect();
try {
return ( Dialect ) ReflectHelper.classForName( dialectName ).newInstance();
}
catch ( ClassNotFoundException cnfe ) {
throw new HibernateException( "Dialect class not found: " + dialectName );
}
catch ( Exception e ) {
throw new HibernateException( "Could not instantiate dialect class", e );
}
}
/**
* Retrieve a set of default Hibernate properties for this database.
*
* @return a set of Hibernate properties
*/
public final Properties getDefaultProperties() {
return properties;
}
/**
* Completely optional cascading drop clause
*
* @return String
*/
public String getCascadeConstraintsString() {
return "";
}
/**
* Create an <tt>OuterJoinGenerator</tt> for this dialect.
*
* @return OuterJoinGenerator
*/
public JoinFragment createOuterJoinFragment() {
return new ANSIJoinFragment();
}
/**
* Create a <tt>CaseFragment</tt> for this dialect.
*
* @return OuterJoinGenerator
*/
public CaseFragment createCaseFragment() {
return new ANSICaseFragment();
}
/**
* The name of the SQL function that transforms a string to
* lowercase
*
* @return String
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -