private static void appendInterval(StringBuilder buf, String type, String value) throws SQLException {
if (!isTsi(type)) {
throw new PSQLException(GT.tr("Interval {0} not yet implemented", type),
PSQLState.SYNTAX_ERROR);
}
if (appendSingleIntervalCast(buf, SQL_TSI_DAY, type, value, "day")
|| appendSingleIntervalCast(buf, SQL_TSI_SECOND, type, value, "second")
|| appendSingleIntervalCast(buf, SQL_TSI_HOUR, type, value, "hour")
|| appendSingleIntervalCast(buf, SQL_TSI_MINUTE, type, value, "minute")
|| appendSingleIntervalCast(buf, SQL_TSI_MONTH, type, value, "month")
|| appendSingleIntervalCast(buf, SQL_TSI_WEEK, type, value, "week")
|| appendSingleIntervalCast(buf, SQL_TSI_YEAR, type, value, "year")
) {
return;
}
if (areSameTsi(SQL_TSI_QUARTER, type)) {
buf.append("CAST((").append(value).append("::int * 3) || ' month' as interval)");
return;
}
throw new PSQLException(GT.tr("Interval {0} not yet implemented", type),
PSQLState.NOT_IMPLEMENTED);
}