public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(this, writer, call); } }
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(operator, writer, call); } },
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(operator, writer, call); } },
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax( this, writer, call); } };
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(operator, writer, call); } },
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax( this, writer, call); } };
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(operator, writer, call); } },
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(this, writer, call); }
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax( this, writer, call); } };
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(this, writer, call); }
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(operator, writer, call); } },
public void unparse( SqlWriter writer, SqlOperator operator, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(operator, writer, call); } },
public void unparse( SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { SqlUtil.unparseFunctionSyntax(this, writer, call); } }
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { if (call.operandCount() == 1 && call.getOperandList().get(0).getKind() == SqlKind.COLLECTION_TABLE) { // do not create ( ) around the following TABLE clause writer.keyword(getName()); call.operand(0).unparse(writer, 0, 0); } else { SqlUtil.unparseFunctionSyntax(this, writer, call); } } }
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { if (call.operandCount() == 1 && call.getOperandList().get(0).getKind() == SqlKind.COLLECTION_TABLE) { // do not create ( ) around the following TABLE clause writer.keyword(getName()); call.operand(0).unparse(writer, 0, 0); } else { SqlUtil.unparseFunctionSyntax(this, writer, call); } } }
@Override public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { if (call.getOperator() == SqlStdOperatorTable.SUBSTRING) { if (call.operandCount() != 3) { throw new IllegalArgumentException("MSSQL SUBSTRING requires FROM and FOR arguments"); } SqlUtil.unparseFunctionSyntax(MSSQL_SUBSTRING, writer, call); } else { switch (call.getKind()) { case FLOOR: if (call.operandCount() != 2) { super.unparseCall(writer, call, leftPrec, rightPrec); return; } unparseFloor(writer, call); break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } } }
@Override public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { if (call.getOperator() == SqlStdOperatorTable.SUBSTRING) { if (call.operandCount() != 3) { throw new IllegalArgumentException("MSSQL SUBSTRING requires FROM and FOR arguments"); } SqlUtil.unparseFunctionSyntax(MSSQL_SUBSTRING, writer, call); } else { switch (call.getKind()) { case FLOOR: if (call.operandCount() != 2) { super.unparseCall(writer, call, leftPrec, rightPrec); return; } unparseFloor(writer, call); break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } } }
/** * Most dialects that natively support datetime floor will use this. * In those cases the call will look like TRUNC(datetime, 'year'). * * @param writer SqlWriter * @param call SqlCall * @param funName Name of the sql function to call * @param datetimeFirst Specify the order of the datetime & timeUnit * arguments */ public static void unparseDatetimeFunction(SqlWriter writer, SqlCall call, String funName, Boolean datetimeFirst) { SqlFunction func = new SqlFunction(funName, SqlKind.OTHER_FUNCTION, ReturnTypes.ARG0_NULLABLE_VARYING, null, null, SqlFunctionCategory.STRING); SqlCall call1; if (datetimeFirst) { call1 = call; } else { // switch order of operands SqlNode op1 = call.operand(0); SqlNode op2 = call.operand(1); call1 = call.getOperator().createCall(call.getParserPosition(), op2, op1); } SqlUtil.unparseFunctionSyntax(func, writer, call1); } }
@Override public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { if (call.getOperator() == SqlStdOperatorTable.SUBSTRING) { SqlUtil.unparseFunctionSyntax(OracleSqlOperatorTable.SUBSTR, writer, call); } else { switch (call.getKind()) { case FLOOR: if (call.operandCount() != 2) { super.unparseCall(writer, call, leftPrec, rightPrec); return; } final SqlLiteral timeUnitNode = call.operand(1); final TimeUnitRange timeUnit = timeUnitNode.getValueAs(TimeUnitRange.class); SqlCall call2 = SqlFloorFunction.replaceTimeUnitOperand(call, timeUnit.name(), timeUnitNode.getParserPosition()); SqlFloorFunction.unparseDatetimeFunction(writer, call2, "TRUNC", true); break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } } } }
@Override public void unparseCall(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) { if (call.getOperator() == SqlStdOperatorTable.SUBSTRING) { SqlUtil.unparseFunctionSyntax(OracleSqlOperatorTable.SUBSTR, writer, call); } else { switch (call.getKind()) { case FLOOR: if (call.operandCount() != 2) { super.unparseCall(writer, call, leftPrec, rightPrec); return; } final SqlLiteral timeUnitNode = call.operand(1); final TimeUnitRange timeUnit = timeUnitNode.getValueAs(TimeUnitRange.class); SqlCall call2 = SqlFloorFunction.replaceTimeUnitOperand(call, timeUnit.name(), timeUnitNode.getParserPosition()); SqlFloorFunction.unparseDatetimeFunction(writer, call2, "TRUNC", true); break; default: super.unparseCall(writer, call, leftPrec, rightPrec); } } } }