Skip to content

Commit a526f53

Browse files
committed
Addressing PR comments
1 parent 8613200 commit a526f53

File tree

2 files changed

+21
-36
lines changed

2 files changed

+21
-36
lines changed

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenDialect.java

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,54 +100,39 @@ protected String columnType(int sqlTypeCode) {
100100
case SqlTypes.BOOLEAN:
101101
case SqlTypes.BIT:
102102
case SqlTypes.TINYINT:
103-
return "TT_TINYINT";
103+
return "tt_tinyint";
104104
case SqlTypes.SMALLINT:
105-
return "TT_SMALLINT";
105+
return "tt_smallint";
106106
case SqlTypes.INTEGER:
107-
return "TT_INTEGER";
107+
return "tt_integer";
108108
case SqlTypes.BIGINT:
109-
return "TT_BIGINT";
109+
return "tt_bigint";
110110
//note that 'binary_float'/'binary_double' might
111111
//be better mappings for Java Float/Double
112112

113-
case SqlTypes.CHAR:
114-
return "CHAR($l)";
115113
case SqlTypes.VARCHAR:
116114
case SqlTypes.LONGVARCHAR:
117-
return "VARCHAR2($l)";
115+
return "varchar2($l)";
118116

119-
case SqlTypes.BINARY:
120-
return "BINARY($l)";
121-
case SqlTypes.VARBINARY:
122117
case SqlTypes.LONGVARBINARY:
123-
return "VARBINARY($l)";
118+
return "varbinary($l)";
124119

125120
//'numeric'/'decimal' are synonyms for 'number'
126121
case SqlTypes.NUMERIC:
127122
case SqlTypes.DECIMAL:
128-
return "NUMBER($p,$s)";
123+
return "number($p,$s)";
129124
case SqlTypes.FLOAT:
130-
return "BINARY_FLOAT";
125+
return "binary_float";
131126
case SqlTypes.DOUBLE:
132-
return "BINARY_DOUBLE";
127+
return "binary_double";
133128

134129
case SqlTypes.DATE:
135-
return "TT_DATE";
130+
return "tt_date";
136131
case SqlTypes.TIME:
137-
return "TT_TIME";
138-
case SqlTypes.TIMESTAMP:
139-
return "TIMESTAMP";
140-
//`timestamp` has more precision than `tt_timestamp`
132+
return "tt_time";
141133
case SqlTypes.TIMESTAMP_WITH_TIMEZONE:
142134
return "timestamp($p)";
143135

144-
case SqlTypes.BLOB:
145-
return "BLOB";
146-
case SqlTypes.CLOB:
147-
return "CLOB";
148-
case SqlTypes.NCLOB:
149-
return "NCLOB";
150-
151136
default:
152137
return super.columnType( sqlTypeCode );
153138
}

hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/TimesTenSqlAstTranslator.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,8 @@ protected void renderRowsToClause(Expression offsetClauseExpression, Expression
163163
clauseStack.pop();
164164
}
165165
}
166-
else if ( offsetClauseExpression != null && fetchClauseExpression == null ) {
167-
throw new UnsupportedOperationException(
168-
"Only passing setFirstResult(m) and not setMaxResults(n) to 'ROWS m TO n' clause not supported."
169-
);
170-
}
171-
else if ( offsetClauseExpression != null && fetchClauseExpression != null ) {
172-
// We have offset and maxRows/limit. We use 'SELECT ROWS offset TO limit' syntax
166+
else if ( offsetClauseExpression != null ) {
167+
// We have an offset. We use 'SELECT ROWS m TO n' syntax
173168
appendSql( "rows " );
174169

175170
// Render offset parameter
@@ -186,9 +181,14 @@ else if ( offsetClauseExpression != null && fetchClauseExpression != null ) {
186181
// Render maxRows/limit parameter
187182
clauseStack.push( Clause.FETCH );
188183
try {
189-
// TimesTen includes both m and n rows of 'ROWS m to n';
190-
// We need to substract 1 row to fit maxRows
191-
renderFetchPlusOffsetExpressionAsLiteral( fetchClauseExpression, offsetClauseExpression, -1 );
184+
if ( fetchClauseExpression != null ) {
185+
// We need to substract 1 row to fit maxRows
186+
renderFetchPlusOffsetExpressionAsLiteral( fetchClauseExpression, offsetClauseExpression, -1 );
187+
}
188+
else{
189+
// We dont have a maxRows param, we will just use a MAX_VALUE
190+
appendSql( Integer.MAX_VALUE );
191+
}
192192
}
193193
finally {
194194
clauseStack.pop();

0 commit comments

Comments
 (0)