return buf.toString();
}
private final static String constantToInterval(String type,String value)throws SQLException{
if (!type.startsWith(SQL_TSI_ROOT))
throw new PSQLException(GT.tr("Interval {0} not yet implemented",type),
PSQLState.SYNTAX_ERROR);
String shortType = type.substring(SQL_TSI_ROOT.length());
if (SQL_TSI_DAY.equalsIgnoreCase(shortType))
return "'"+value+" day'";
else if (SQL_TSI_SECOND.equalsIgnoreCase(shortType))
return "'"+value+" second'";
else if (SQL_TSI_HOUR.equalsIgnoreCase(shortType))
return "'"+value+" hour'";
else if (SQL_TSI_MINUTE.equalsIgnoreCase(shortType))
return "'"+value+" minute'";
else if (SQL_TSI_MONTH.equalsIgnoreCase(shortType))
return "'"+value+" month'";
else if (SQL_TSI_QUARTER.equalsIgnoreCase(shortType))
return "'"+ Integer.valueOf(value).intValue()*3+" month'";
else if (SQL_TSI_WEEK.equalsIgnoreCase(shortType))
return "'"+value+" week'";
else if (SQL_TSI_YEAR.equalsIgnoreCase(shortType))
return "'"+value+" year'";
else if (SQL_TSI_FRAC_SECOND.equalsIgnoreCase(shortType))
throw new PSQLException(GT.tr("Interval {0} not yet implemented","SQL_TSI_FRAC_SECOND"),
PSQLState.SYNTAX_ERROR);
else throw new PSQLException(GT.tr("Interval {0} not yet implemented",type),
PSQLState.SYNTAX_ERROR);
}