|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.dialect.Dialect org.hibernate.dialect.PostgreSQL81Dialect
public class PostgreSQL81Dialect
An SQL dialect for Postgres
For discussion of BLOB support in Postgres, as of 8.4, have a peek at http://jdbc.postgresql.org/documentation/84/binary-data.html. For the effects in regards to Hibernate see http://in.relation.to/15492.lace
Field Summary |
---|
Fields inherited from class org.hibernate.dialect.Dialect |
---|
CLOSED_QUOTE, DEFAULT_BATCH_SIZE, LEGACY_LOB_MERGE_STRATEGY, NEW_LOCATOR_LOB_MERGE_STRATEGY, NO_BATCH, QUOTE, STREAM_XFER_LOB_MERGE_STRATEGY |
Constructor Summary | |
---|---|
PostgreSQL81Dialect()
|
Method Summary | |
---|---|
boolean |
bindLimitParametersInReverseOrder()
ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. |
SQLExceptionConversionDelegate |
buildSQLExceptionConversionDelegate()
Build an instance of a SQLExceptionConversionDelegate for
interpreting dialect-specific error or SQLState codes. |
boolean |
dropConstraints()
Do we need to drop constraints before dropping tables in this dialect? |
String |
getAddColumnString()
The syntax used to add a column to a table (optional). |
String |
getCascadeConstraintsString()
Completely optional cascading drop clause |
String |
getCaseInsensitiveLike()
The name of the SQL function that can do case insensitive like comparison. |
String |
getCreateSequenceString(String sequenceName)
Typically dialects which support sequences can create a sequence with a single command. |
protected String |
getCreateSequenceString(String sequenceName,
int initialValue,
int incrementSize)
Overloaded form of Dialect.getCreateSequenceString(String) , additionally
taking the initial value and increment size to be applied to the sequence
definition. |
String |
getCreateTemporaryTablePostfix()
Get any fragments needing to be postfixed to the command for temporary table creation. |
String |
getCreateTemporaryTableString()
Command used to create a temporary table. |
String |
getCurrentTimestampSelectString()
Retrieve the command used to retrieve the current timestamp from the database. |
String |
getDropSequenceString(String sequenceName)
Typically dialects which support sequences can drop a sequence with a single command. |
String |
getForUpdateString()
Get the string to append to SELECT statements to acquire locks for this dialect. |
String |
getForUpdateString(String aliases)
Get the FOR UPDATE OF column_list fragment appropriate for this dialect given the aliases of the columns to be write locked. |
String |
getIdentityColumnString(int type)
The syntax used during DDL to define a column as being an IDENTITY of a particular type. |
String |
getIdentitySelectString(String table,
String column,
int type)
Get the select command to use to retrieve the last generated IDENTITY value for a particular table |
String |
getLimitString(String sql,
boolean hasOffset)
Apply s limit clause to the query. |
Class |
getNativeIdentifierGeneratorClass()
The class (which implements IdentifierGenerator )
which acts as this dialects native generation strategy. |
String |
getNoColumnsInsertString()
The fragment used to insert a row without specifying any column values. |
String |
getQuerySequencesString()
Get the select command used retrieve the names of all sequences. |
String |
getReadLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect. |
ResultSet |
getResultSet(CallableStatement ps)
Given a callable statement previously processed by Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int) ,
extract the ResultSet from the OUT parameter. |
String |
getSelectClauseNullString(int sqlType)
Workaround for postgres bug #1453 |
String |
getSelectSequenceNextValString(String sequenceName)
Generate the select expression fragment that will retrieve the next value of a sequence as part of another (typically DML) statement. |
String |
getSequenceNextValString(String sequenceName)
Generate the appropriate select statement to to retrieve the next value of a sequence. |
SqlTypeDescriptor |
getSqlTypeDescriptorOverride(int sqlCode)
Returns the SqlTypeDescriptor that should be used to handle the given JDBC type code. |
ViolatedConstraintNameExtracter |
getViolatedConstraintNameExtracter()
|
String |
getWriteLockString(int timeout)
Get the string to append to SELECT statements to acquire WRITE locks for this dialect. |
boolean |
hasDataTypeInIdentityColumn()
Whether this dialect have an Identity clause added to the data type or a completely separate identity data type |
boolean |
isCurrentTimestampSelectStringCallable()
Should the value returned by Dialect.getCurrentTimestampSelectString()
be treated as callable. |
int |
registerResultSetOutParameter(CallableStatement statement,
int col)
Registers an OUT parameter which will be returning a ResultSet . |
boolean |
supportsCaseInsensitiveLike()
|
boolean |
supportsCommentOn()
|
boolean |
supportsCurrentTimestampSelection()
Does this dialect support a way to retrieve the database's current timestamp value? |
boolean |
supportsEmptyInList()
Does this dialect support empty IN lists? For example, is [where XYZ in ()] a supported construct? |
boolean |
supportsExpectedLobUsagePattern()
Expected LOB usage pattern is such that I can perform an insert via prepared statement with a parameter binding for a LOB value without crazy casting to JDBC driver implementation-specific classes... |
boolean |
supportsIdentityColumns()
Does this dialect support identity column key generation? |
boolean |
supportsLimit()
Does this dialect support some form of limiting query results via a SQL clause? |
boolean |
supportsLobValueChangePropogation()
Does the dialect support propagating changes to LOB values back to the database? Talking about mutating the internal value of the locator as opposed to supplying a new locator instance... |
boolean |
supportsOuterJoinForUpdate()
Does this dialect support FOR UPDATE in conjunction with outer joined rows? |
boolean |
supportsPooledSequences()
Does this dialect support "pooled" sequences. |
boolean |
supportsRowValueConstructorSyntax()
Is this dialect known to support what ANSI-SQL terms "row value constructor" syntax; sometimes called tuple syntax. |
boolean |
supportsSequences()
Does this dialect support sequences? |
boolean |
supportsTemporaryTables()
Does this dialect support temporary tables? |
boolean |
supportsTupleDistinctCounts()
Does this dialect support `count(distinct a,b)`? |
boolean |
supportsUnboundedLobLocatorMaterialization()
Is it supported to materialize a LOB locator outside the transaction in which it was created? Again, part of the trickiness here is the fact that this is largely driver dependent. |
boolean |
supportsUnionAll()
Does this dialect support UNION ALL, which is generally a faster variant of UNION? |
String |
toBooleanValueString(boolean bool)
The SQL literal value to which this database maps boolean values. |
boolean |
useInputStreamToInsertBlob()
Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PostgreSQL81Dialect()
Method Detail |
---|
public SqlTypeDescriptor getSqlTypeDescriptorOverride(int sqlCode)
SqlTypeDescriptor
that should be used to handle the given JDBC type code. Returns
null
if there is no override.
getSqlTypeDescriptorOverride
in class Dialect
sqlCode
- A Types
constant indicating the SQL column type
SqlTypeDescriptor
to use as an override, or null
if there is no override.public String getAddColumnString()
Dialect
getAddColumnString
in class Dialect
public String getSequenceNextValString(String sequenceName)
Dialect
getSequenceNextValString
in class Dialect
sequenceName
- the name of the sequence
public String getSelectSequenceNextValString(String sequenceName)
Dialect
Dialect.getSequenceNextValString(String)
in that this
should return an expression usable within another statement.
getSelectSequenceNextValString
in class Dialect
sequenceName
- the name of the sequence
public String getCreateSequenceString(String sequenceName)
Dialect
Dialect.getCreateSequenceStrings(java.lang.String)
to help facilitate that.
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 Dialect.getCreateSequenceStrings(java.lang.String)
.
getCreateSequenceString
in class Dialect
sequenceName
- The name of the sequence
public String getDropSequenceString(String sequenceName)
Dialect
Dialect.getDropSequenceStrings(java.lang.String)
to help facilitate that.
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 Dialect.getDropSequenceStrings(java.lang.String)
.
getDropSequenceString
in class Dialect
sequenceName
- The name of the sequence
public String getCascadeConstraintsString()
Dialect
getCascadeConstraintsString
in class Dialect
public boolean dropConstraints()
Dialect
dropConstraints
in class Dialect
public boolean supportsSequences()
Dialect
supportsSequences
in class Dialect
public String getQuerySequencesString()
Dialect
getQuerySequencesString
in class Dialect
SchemaUpdate
public boolean supportsLimit()
Dialect
supportsLimit
in class Dialect
public String getLimitString(String sql, boolean hasOffset)
Dialect
variable
limit clauses when they support limits. Thus, when building the
select command we do not actually need to know the limit or the offest
since we will just be using placeholders.
Here we do still pass along whether or not an offset was specified
so that dialects not supporting offsets can generate proper exceptions.
In general, dialects will override one or the other of this method and
Dialect.getLimitString(String, int, int)
.
getLimitString
in class Dialect
sql
- The query to which to apply the limit.hasOffset
- Is the query requesting an offset?
public boolean bindLimitParametersInReverseOrder()
Dialect
bindLimitParametersInReverseOrder
in class Dialect
public boolean supportsIdentityColumns()
Dialect
supportsIdentityColumns
in class Dialect
public String getForUpdateString(String aliases)
Dialect
getForUpdateString
in class Dialect
aliases
- The columns to be write locked.
public String getIdentitySelectString(String table, String column, int type)
Dialect
getIdentitySelectString
in class Dialect
table
- The table into which the insert was donecolumn
- The PK column.type
- The Types
type code.
public String getIdentityColumnString(int type)
Dialect
getIdentityColumnString
in class Dialect
type
- The Types
type code.
public boolean hasDataTypeInIdentityColumn()
Dialect
hasDataTypeInIdentityColumn
in class Dialect
public String getNoColumnsInsertString()
Dialect
getNoColumnsInsertString
in class Dialect
public String getCaseInsensitiveLike()
Dialect
getCaseInsensitiveLike
in class Dialect
public boolean supportsCaseInsensitiveLike()
supportsCaseInsensitiveLike
in class Dialect
true
if the underlying Database supports case insensitive like comparison, false
otherwise.
The default is false
.public Class getNativeIdentifierGeneratorClass()
Dialect
IdentifierGenerator
)
which acts as this dialects native generation strategy.
Comes into play whenever the user specifies the native generator.
getNativeIdentifierGeneratorClass
in class Dialect
public boolean supportsOuterJoinForUpdate()
Dialect
supportsOuterJoinForUpdate
in class Dialect
public boolean useInputStreamToInsertBlob()
Dialect
PreparedStatement.setBinaryStream(int, java.io.InputStream, int)
).
useInputStreamToInsertBlob
in class Dialect
public boolean supportsUnionAll()
Dialect
supportsUnionAll
in class Dialect
public String getSelectClauseNullString(int sqlType)
getSelectClauseNullString
in class Dialect
sqlType
- The Types
type code.
public boolean supportsCommentOn()
supportsCommentOn
in class Dialect
public boolean supportsTemporaryTables()
Dialect
supportsTemporaryTables
in class Dialect
public String getCreateTemporaryTableString()
Dialect
getCreateTemporaryTableString
in class Dialect
public String getCreateTemporaryTablePostfix()
Dialect
getCreateTemporaryTablePostfix
in class Dialect
public boolean supportsCurrentTimestampSelection()
Dialect
supportsCurrentTimestampSelection
in class Dialect
public boolean isCurrentTimestampSelectStringCallable()
Dialect
Dialect.getCurrentTimestampSelectString()
be treated as callable. Typically this indicates that JDBC escape
syntax is being used...
isCurrentTimestampSelectStringCallable
in class Dialect
Dialect.getCurrentTimestampSelectString()
return
is callable; false otherwise.public String getCurrentTimestampSelectString()
Dialect
getCurrentTimestampSelectString
in class Dialect
public boolean supportsTupleDistinctCounts()
Dialect
supportsTupleDistinctCounts
in class Dialect
public String toBooleanValueString(boolean bool)
Dialect
toBooleanValueString
in class Dialect
bool
- The boolean value
public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter()
getViolatedConstraintNameExtracter
in interface ConversionContext
getViolatedConstraintNameExtracter
in class Dialect
public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
Dialect
SQLExceptionConversionDelegate
for
interpreting dialect-specific error or SQLState codes.
When Dialect.buildSQLExceptionConverter()
returns null, the default
SQLExceptionConverter
is used to interpret SQLState and
error codes. If this method is overridden to return a non-null value,
the default SQLExceptionConverter
will use the returned
SQLExceptionConversionDelegate
in addition to the following
standard delegates:
buildSQLExceptionConversionDelegate
in class Dialect
public int registerResultSetOutParameter(CallableStatement statement, int col) throws SQLException
Dialect
ResultSet
. How this is accomplished varies greatly
from DB to DB, hence its inclusion (along with Dialect.getResultSet(java.sql.CallableStatement)
) here.
registerResultSetOutParameter
in class Dialect
statement
- The callable statement.col
- The bind position at which to register the OUT param.
SQLException
- Indicates problems registering the OUT param.public ResultSet getResultSet(CallableStatement ps) throws SQLException
Dialect
Dialect.registerResultSetOutParameter(java.sql.CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.
getResultSet
in class Dialect
ps
- The callable statement.
SQLException
- Indicates problems extracting the result set.public boolean supportsPooledSequences()
Dialect
supportsPooledSequences
in class Dialect
Dialect.getCreateSequenceStrings(String, int, int)
,
Dialect.getCreateSequenceString(String, int, int)
protected String getCreateSequenceString(String sequenceName, int initialValue, int incrementSize)
Dialect
Dialect.getCreateSequenceString(String)
, additionally
taking the initial value and increment size to be applied to the sequence
definition.
The default definition is to suffix Dialect.getCreateSequenceString(String)
with the string: " start with {initialValue} increment by {incrementSize}" where
{initialValue} and {incrementSize} are replacement placeholders. Generally
dialects should only need to override this method if different key phrases
are used to apply the allocation information.
getCreateSequenceString
in class Dialect
sequenceName
- The name of the sequenceinitialValue
- The initial value to apply to 'create sequence' statementincrementSize
- The increment value to apply to 'create sequence' statement
public boolean supportsEmptyInList()
Dialect
supportsEmptyInList
in class Dialect
public boolean supportsExpectedLobUsagePattern()
Dialect
supportsExpectedLobUsagePattern
in class Dialect
public boolean supportsLobValueChangePropogation()
Dialect
Blob.setBinaryStream(long)
,
Blob.setBytes(long, byte[])
,
Blob.setBytes(long, byte[], int, int)
,
or Blob.truncate(long)
.
For CLOBs, the internal value might be changed by:
Clob.setAsciiStream(long)
,
Clob.setCharacterStream(long)
,
Clob.setString(long, String)
,
Clob.setString(long, String, int, int)
,
or Clob.truncate(long)
.
NOTE : I do not know the correct answer currently for
databases which (1) are not part of the cruise control process
or (2) do not Dialect.supportsExpectedLobUsagePattern()
.
supportsLobValueChangePropogation
in class Dialect
public boolean supportsUnboundedLobLocatorMaterialization()
Dialect
Dialect.supportsExpectedLobUsagePattern()
also support the ability to materialize a LOB outside the owning transaction...
supportsUnboundedLobLocatorMaterialization
in class Dialect
public String getForUpdateString()
Dialect
getForUpdateString
in class Dialect
public String getWriteLockString(int timeout)
Dialect
getWriteLockString
in class Dialect
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.
public String getReadLockString(int timeout)
Dialect
getReadLockString
in class Dialect
timeout
- in milliseconds, -1 for indefinite wait and 0 for no wait.
public boolean supportsRowValueConstructorSyntax()
Dialect
supportsRowValueConstructorSyntax
in class Dialect
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |