📄 hxttdialect.java
字号:
* Generate the appropriate select statement to to retreive the next value
* of a sequence.
* <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 sequences are not supported.
*/
public final String getSequenceNextValString(String sequenceName) {
//SELECT NEXTVAL('SEQUENCENAME')
//"select next_value of " + sequenceName + " from system.onerow";
return "select " + getSelectSequenceNextValString( sequenceName ) ;
}
/**
* Generate the select expression fragment that will retreive the next
* value of a sequence as part of another (typically DML) statement.
* <p/>
* This differs from {@link #getSequenceNextValString(String)} in that this
* should return an expression usable within another statement.
*
* @param sequenceName the name of the sequence
* @return The "nextval" fragment.
* @throws MappingException If sequences are not supported.
*/
public final String getSelectSequenceNextValString(String sequenceName) {
return "nextval('" + sequenceName+"')";
}
/**
* Typically dialects which support sequences can create a sequence
* with a single command. This is convenience form of
* {@link #getCreateSequenceStrings} to help facilitate that.
* <p/>
* Dialects which support sequences and can create a sequence in a
* single command need *only* override this method. Dialects
* which support sequences but require multiple commands to create
* a sequence should instead override {@link #getCreateSequenceStrings}.
*
* @param sequenceName The name of the sequence
* @return The sequence creation command
* @throws MappingException If sequences are not supported.
*/
public final String getCreateSequenceString(String sequenceName) {
// create sequence if not exists userID start WITH 100 increment by 2 maxvalue 2000 cache 5 cycle;
return "create sequence " + sequenceName;
}
/**
* Typically dialects which support sequences can drop a sequence
* with a single command. This is convenience form of
* {@link #getDropSequenceStrings} to help facilitate that.
* <p/>
* Dialects which support sequences and can drop a sequence in a
* single command need *only* override this method. Dialects
* which support sequences but require multiple commands to drop
* a sequence should instead override {@link #getDropSequenceStrings}.
*
* @param sequenceName The name of the sequence
* @return The sequence drop commands
* @throws MappingException If sequences are not supported.
*/
public final String getDropSequenceString(String sequenceName) {
//drop sequence if exists userID;
return "drop sequence " + sequenceName;
}
/**
* Get the select command used retrieve the names of all sequences.
*
* @return The select command; or null if sequences are not supported.
* @see org.hibernate.tool.hbm2ddl.SchemaUpdate
*/
public final String getQuerySequencesString() {
return null;
//select sequence_name from domain.sequences";
//"select sequence_schema || '.' || sequence_name from information_schema.ext_sequences";
}
// limit/offset support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* Does this dialect support some form of limiting query results
* via a SQL clause?
*
* @return True if this dialect supports some form of LIMIT.
*/
public final boolean supportsLimit() {
return true;//false;
}
/**
* ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit.
* Does this dialect require us to bind the parameters in reverse order?
*
* @return true if the correct order is limit, offset
*/
public final boolean bindLimitParametersInReverseOrder() {
return true;//false;
}
// IDENTITY support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* Does this dialect support identity column key generation?
*
* @return True if IDENTITY columns are supported; false otherwise.
*/
public boolean supportsIdentityColumns() {
return true;//false;
}
/**
* Whether this dialect have an Identity clause added to the data type or a
* completely seperate identity data type
*
* @return boolean
*/
/* public boolean hasDataTypeInIdentityColumn() {
return true;//false;//true;
}*/
/**
* Get the select command to use to retrieve the last generated IDENTITY
* value for a particuar table
*
* @param table The table into which the insert was done
* @param column The PK column.
* @param type The {@link java.sql.Types} type code.
* @return The appropriate select command
* @throws MappingException If IDENTITY generation is not supported.
*/
public final String getIdentitySelectString(String table, String column, int type){
//return getIdentitySelectString();
return new StringBuffer().append("select currval('")
.append(table)
.append("','")
.append(column)
.append("')")
.toString();
/* return new StringBuffer().append("select currval('")
.append(table)
.append('_')
.append(column)
.append("_seq')")
.toString();
return type==Types.BIGINT ?
"select dbinfo('serial8') from systables where tabid=1" :
"select dbinfo('sqlca.sqlerrd1') from systables where tabid=1";
*/
}
/**
* Get the select command to use to retrieve the last generated IDENTITY
* value.
*
* @return The appropriate select command
* @throws MappingException If IDENTITY generation is not supported.
*/
/* public String getIdentitySelectString() {
//return "select last_insert_id()";
return "select @@identity";
//"select identity_val_local() from sysibm.sysdummy1"
//call identity()"
//"SELECT LAST_IDENTITY() FROM %TSQL_sys.snf";
}*/
/**
* The syntax used during DDL to define a column as being an IDENTITY of
* a particular type.
*
* @param type The {@link java.sql.Types} type code.
* @return The appropriate DDL fragment.
* @throws MappingException If IDENTITY generation is not supported.
*/
/* public String getIdentityColumnString(int type) {
return getIdentityColumnString();
/* return type==Types.BIGINT ?
"bigserial not null" :
"serial not null";
return type==Types.BIGINT ?
"serial8 not null" :
"serial not null";
* /
}*/
/**
* The syntax used during DDL to define a column as being an IDENTITY.
*
* @return The appropriate DDL fragment.
* @throws MappingException If IDENTITY generation is not supported.
*/
public final String getIdentityColumnString() {
return "not null auto_increment"; //starts with 1, implicitly
//return "identity not null"; //starts with 1, implicitly
//"autoincrement";
//identity";
//return "generated by default as identity (start with 1)"; //not null is implicit
}
/**
* 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 The appropriate keyword.
*/
public final String getIdentityInsertString() {
//return null;
return "null";
}
// lock acquisition support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* Does this dialect support <tt>FOR UPDATE</tt> in conjunction with
* outer joined rows?
*
* @return True if outer joined rows can be locked via <tt>FOR UPDATE</tt>.
*/
public final boolean supportsOuterJoinForUpdate() {
return false;//true;//???
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -