|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.openjpa.jdbc.sql.DBDictionary
org.apache.openjpa.jdbc.sql.FirebirdDictionary
public class FirebirdDictionary
Dictionary for Firebird. Supports Firebird versions 1.5, 2.0 and 2.1.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.sql.DBDictionary |
|---|
DBDictionary.SerializedData |
| Field Summary | |
|---|---|
protected java.lang.String |
alterSequenceSQL
|
protected java.lang.String |
alterSequenceSQLFB15
|
protected java.lang.String |
alterSequenceSQLFB20
|
protected java.lang.String |
createSequenceSQL
|
protected java.lang.String |
createSequenceSQLFB15
|
protected java.lang.String |
createSequenceSQLFB20
|
protected java.lang.String |
dropSequenceSQLFB15
|
static int |
FB_VERSION_15
|
static int |
FB_VERSION_20
|
static int |
FB_VERSION_21
|
int |
firebirdVersion
|
int |
indexedVarcharMaxSizeFB15
|
protected long |
maxRowNumberInRange
|
protected java.lang.String |
nextSequenceQueryFB15
|
protected java.lang.String |
nextSequenceQueryFB20
|
static java.lang.String |
RANGE_SYNTAX_FIRST_SKIP
|
static java.lang.String |
RANGE_SYNTAX_ROWS
|
java.lang.String |
rangeSyntax
|
| Fields inherited from interface org.apache.openjpa.jdbc.sql.JoinSyntaxes |
|---|
SYNTAX_DATABASE, SYNTAX_SQL92, SYNTAX_TRADITIONAL |
| Constructor Summary | |
|---|---|
FirebirdDictionary()
|
|
| Method Summary | |
|---|---|
protected void |
appendSelectRange(SQLBuffer buf,
long start,
long end,
boolean subselect)
Use either FIRST <p> SKIP <q> or
ROWS <m> TO <n> syntax. |
protected java.lang.String |
appendSize(Column col,
java.lang.String typeName)
On Firebird 1.5 reduce the size of indexed VARCHAR column
to 252 or a value specified by user. |
void |
connectedConfiguration(java.sql.Connection conn)
Determine Firebird version and configure itself accordingly. |
protected int |
determineFirebirdVersion(java.sql.Connection con)
Determine Firebird version either by using JDBC 3 methods or, if they are not available, by parsing the value returned by DatabaseMetaData.getDatabaseProductVersion(). |
protected void |
determineRangeSyntax()
Determine range syntax to be used depending on Firebird version. |
protected java.lang.String |
getColumnNameForMetadata(java.lang.String columnName)
Return % if columnName is null,
otherwise delegate to super implementation. |
java.lang.String[] |
getCreateSequenceSQL(Sequence seq)
Return either CREATE SEQUENCE <sequence name> or
CREATE GENERATOR <sequence name>. |
java.lang.String[] |
getDropColumnSQL(Column column)
Return ALTER TABLE <table name> DROP <col name>. |
java.lang.String[] |
getDropSequenceSQL(Sequence seq)
On Firebird 1.5 return DROP GENERATOR <sequence name>. |
java.lang.String |
getPlaceholderValueString(Column col)
Return <value> AS <type>. |
protected java.lang.String |
getSequencesSQL(DBIdentifier schemaName,
DBIdentifier sequenceName)
|
protected java.lang.String |
getSequencesSQL(java.lang.String schemaName,
java.lang.String sequenceName)
Return Firebird-specific statement to select the list of sequences. |
protected java.lang.String |
getTableNameForMetadata(DBIdentifier tableName)
Returns the table name that will be used for obtaining information from DatabaseMetaData. |
protected java.lang.String |
getTableNameForMetadata(java.lang.String tableName)
Return % if tableName is null,
otherwise delegate to super implementation. |
void |
indexOf(SQLBuffer buf,
FilterValue str,
FilterValue find,
FilterValue start)
Throw UnsupportedException. |
protected int |
matchErrorState(java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> errorStates,
java.sql.SQLException ex)
Use error code as SQL state returned by Firebird is ambiguous. |
protected Sequence |
newSequence(java.sql.ResultSet sequenceMeta)
Call super implementation and trim sequence name. |
void |
substring(SQLBuffer buf,
FilterValue str,
FilterValue start,
FilterValue end)
Use SUBSTRING(<col name> FROM <m> FOR <n>). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int firebirdVersion
public int indexedVarcharMaxSizeFB15
public java.lang.String rangeSyntax
protected long maxRowNumberInRange
protected java.lang.String alterSequenceSQLFB15
protected java.lang.String alterSequenceSQLFB20
protected java.lang.String createSequenceSQLFB15
protected java.lang.String createSequenceSQLFB20
protected java.lang.String dropSequenceSQLFB15
protected java.lang.String nextSequenceQueryFB15
protected java.lang.String nextSequenceQueryFB20
protected java.lang.String alterSequenceSQL
protected java.lang.String createSequenceSQL
public static final int FB_VERSION_15
public static final int FB_VERSION_20
public static final int FB_VERSION_21
public static final java.lang.String RANGE_SYNTAX_FIRST_SKIP
public static final java.lang.String RANGE_SYNTAX_ROWS
| Constructor Detail |
|---|
public FirebirdDictionary()
| Method Detail |
|---|
public void connectedConfiguration(java.sql.Connection conn)
throws java.sql.SQLException
connectedConfiguration in class DBDictionaryjava.sql.SQLException
protected void appendSelectRange(SQLBuffer buf,
long start,
long end,
boolean subselect)
FIRST <p> SKIP <q> or
ROWS <m> TO <n> syntax. If ROWS
variant is used and end equals Long.MAX_VALUE, a
constant is used as <n> value.
appendSelectRange in class DBDictionary
protected int determineFirebirdVersion(java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLExceptionprotected void determineRangeSyntax()
public java.lang.String getPlaceholderValueString(Column col)
<value> AS <type>.
getPlaceholderValueString in class DBDictionaryprotected java.lang.String getTableNameForMetadata(java.lang.String tableName)
% if tableName is null,
otherwise delegate to super implementation.
getTableNameForMetadata in class DBDictionaryprotected java.lang.String getTableNameForMetadata(DBIdentifier tableName)
DBDictionaryDatabaseMetaData.
getTableNameForMetadata in class DBDictionaryprotected java.lang.String getColumnNameForMetadata(java.lang.String columnName)
% if columnName is null,
otherwise delegate to super implementation.
getColumnNameForMetadata in class DBDictionarypublic java.lang.String[] getDropColumnSQL(Column column)
ALTER TABLE <table name> DROP <col name>.
getDropColumnSQL in class DBDictionarypublic java.lang.String[] getCreateSequenceSQL(Sequence seq)
CREATE SEQUENCE <sequence name> or
CREATE GENERATOR <sequence name>.
If initial value of sequence is set, return also
an appropriate ALTER statement.
getCreateSequenceSQL in class DBDictionary
protected java.lang.String getSequencesSQL(java.lang.String schemaName,
java.lang.String sequenceName)
getSequencesSQL in class DBDictionary
protected java.lang.String getSequencesSQL(DBIdentifier schemaName,
DBIdentifier sequenceName)
getSequencesSQL in class DBDictionary
protected Sequence newSequence(java.sql.ResultSet sequenceMeta)
throws java.sql.SQLException
RDB$GENERATORS.RDB$GENERATOR_NAME
is CHAR(31) and using RTRIM UDF function on
Firebird 1.5 surprisingly returns a string right-padded with spaces up
to the length of 255.
newSequence in class DBDictionaryjava.sql.SQLExceptionpublic java.lang.String[] getDropSequenceSQL(Sequence seq)
DROP GENERATOR <sequence name>.
On Firebird 2.0 and later delegate to the super implementation.
getDropSequenceSQL in class DBDictionary
public void indexOf(SQLBuffer buf,
FilterValue str,
FilterValue find,
FilterValue start)
UnsupportedException. Firebird in version earlier than 2.1
has no suitable function. Firebird 2.1 has the POSITION
function but using it here results in errors like "data type unknown" or
"expression evaluation not supported".
indexOf in class DBDictionarybuf - the SQL buffer to write the indexOf invocation tostr - a query value representing the target stringfind - a query value representing the search stringstart - a query value representing the start index, or null
to start at the beginning
public void substring(SQLBuffer buf,
FilterValue str,
FilterValue start,
FilterValue end)
SUBSTRING(<col name> FROM <m> FOR <n>).
Parameters are inlined because neither parameter binding nor expressions
are accepted by Firebird here. As a result, an
UnsupportedException is thrown when something else than a
constant is used in start or end.
substring in class DBDictionarybuf - the SQL buffer to write the substring invocation tostr - a query value representing the target stringstart - a query value representing the start indexend - a query value representing the end index, or null for none
protected java.lang.String appendSize(Column col,
java.lang.String typeName)
VARCHAR column
to 252 or a value specified by user. 252 is the maximum Firebird 1.5 can
handle for one-column indexes. On Firebird 2.0 and later delegate to the
super implementation.
appendSize in class DBDictionary
protected int matchErrorState(java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> errorStates,
java.sql.SQLException ex)
matchErrorState in class DBDictionaryerrorStates - classification of SQL error states by their specific nature. The keys of the
map represent one of the constants defined in StoreException. The value corresponding to
a key represent the set of SQL Error States representing specific category of database error.
This supplied map is sourced from sql-error-state-codes.xml and filtered the
error states for the current database.ex - original SQL Exception as raised by the database driver.
- Returns:
- A constant indicating the category of error as defined in
StoreException.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||