HHH-16048 Handle integer division emulation also for TiDB
This commit is contained in:
parent
d7a46451ce
commit
7f14b2cbf8
|
@ -18,6 +18,7 @@ import org.hibernate.sql.ast.spi.AbstractSqlAstTranslator;
|
|||
import org.hibernate.sql.ast.tree.MutationStatement;
|
||||
import org.hibernate.sql.ast.tree.Statement;
|
||||
import org.hibernate.sql.ast.tree.delete.DeleteStatement;
|
||||
import org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression;
|
||||
import org.hibernate.sql.ast.tree.expression.CastTarget;
|
||||
import org.hibernate.sql.ast.tree.expression.ColumnReference;
|
||||
import org.hibernate.sql.ast.tree.expression.Expression;
|
||||
|
@ -54,6 +55,20 @@ public class TiDBSqlAstTranslator<T extends JdbcOperation> extends AbstractSqlAs
|
|||
this.dialect = (TiDBDialect) super.getDialect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitBinaryArithmeticExpression(BinaryArithmeticExpression arithmeticExpression) {
|
||||
if ( isIntegerDivisionEmulationRequired( arithmeticExpression ) ) {
|
||||
appendSql( OPEN_PARENTHESIS );
|
||||
arithmeticExpression.getLeftHandOperand().accept( this );
|
||||
appendSql( " div " );
|
||||
arithmeticExpression.getRightHandOperand().accept( this );
|
||||
appendSql( CLOSE_PARENTHESIS );
|
||||
}
|
||||
else {
|
||||
super.visitBinaryArithmeticExpression(arithmeticExpression);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void visitInsertSource(InsertSelectStatement statement) {
|
||||
if ( statement.getSourceSelectStatement() != null ) {
|
||||
|
|
Loading…
Reference in New Issue