OracleTimestamp bugs in some Add.* methods
Posted: Thu 09 Nov 2006 15:53
If you execute the C# snippet at the bottom of this post, you'll see that, given the minimum timestamp for an Oracle Timestamp data type, the only methods that succeed are AddMonths and AddYears. Of course, if you execute the following SQL statement, you'll see that there's nothing wrong, say, with adding 1 day to the minimum timestamp:
select to_timestamp('-4712-01-01','syyyy-mm-dd') + 1 from dual;
OracleTimeStamp t = new OracleTimeStamp(-4712, 1, 1, 0, 0, 0, 0, OracleDbType.TimeStamp);
try
{
t.AddMilliseconds(1);
}
catch (Exception ex)
{
}
try
{
t.AddSeconds(1);
}
catch (Exception ex)
{
}
try
{
t.AddMinutes(1);
}
catch (Exception ex)
{
}
try
{
t.AddHours(1);
}
catch (Exception ex)
{
}
try
{
t.AddDays(1);
}
catch (Exception ex)
{
}
try
{
t.AddMonths(1);
}
catch (Exception ex)
{
}
try
{
t.AddYears(1);
}
select to_timestamp('-4712-01-01','syyyy-mm-dd') + 1 from dual;
OracleTimeStamp t = new OracleTimeStamp(-4712, 1, 1, 0, 0, 0, 0, OracleDbType.TimeStamp);
try
{
t.AddMilliseconds(1);
}
catch (Exception ex)
{
}
try
{
t.AddSeconds(1);
}
catch (Exception ex)
{
}
try
{
t.AddMinutes(1);
}
catch (Exception ex)
{
}
try
{
t.AddHours(1);
}
catch (Exception ex)
{
}
try
{
t.AddDays(1);
}
catch (Exception ex)
{
}
try
{
t.AddMonths(1);
}
catch (Exception ex)
{
}
try
{
t.AddYears(1);
}