private Object convertTemporal(Object srcObj,
                                  int srcType, int trgType) throws SQLException {

      if (srcType == trgType) {
         return srcObj;
      }

      if (isNumeric(trgType) == true ||
          (isString(trgType) == false && isTemporal(trgType) == false)) {
         throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
      }

      try {
         switch (trgType) {
            case java.sql.Types.DATE:
               if (srcType == java.sql.Types.TIMESTAMP) {
                  return new java.sql.Date(((java.sql.Timestamp)srcObj).getTime());
               } else {
                  throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
               }
            case java.sql.Types.TIMESTAMP:
               if (srcType == java.sql.Types.TIME) {
                  return new Timestamp(((java.sql.Time)srcObj).getTime());
               } else {
                  return new Timestamp(((java.sql.Date)srcObj).getTime());
               }
            case java.sql.Types.TIME:
               if (srcType == java.sql.Types.TIMESTAMP) {
                  return new Time(((java.sql.Timestamp)srcObj).getTime());
               } else {
                  throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
               }
            case java.sql.Types.CHAR:
            case java.sql.Types.VARCHAR:
            case java.sql.Types.LONGVARCHAR:
               return srcObj.toString();
            default:
               throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
         }
      } catch (NumberFormatException ex) {
         throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
      }

   }
Converts the given <code>Object</code> in the Java programming language
to the standard object mapping for the specified SQL target data type.
The conversion must be to a string or temporal type, and there are also
restrictions on the type to be converted.
<P>
<TABLE ALIGN="CENTER" BORDER CELLPADDING=10 BORDERCOLOR="#0000FF"
<CAPTION ALIGN="CENTER"><B>Parameters and Return Values</B></CAPTION>
<TR>
  <TD><B>Source SQL Type</B>
  <TD><B>Target SQL Type</B>
  <TD><B>Object Returned</B>
</TR>
<TR>
  <TD><code>TIMESTAMP</code>
  <TD><code>DATE</code>
  <TD><code>java.sql.Date</code>
</TR>
<TR>
  <TD><code>TIMESTAMP</code>
  <TD><code>TIME</code>
  <TD><code>java.sql.Time</code>
</TR>
<TR>
  <TD><code>TIME</code>
  <TD><code>TIMESTAMP</code>
  <TD><code>java.sql.Timestamp</code>
</TR>
<TR>
  <TD><code>DATE</code>, <code>TIME</code>, or <code>TIMESTAMP</code>
  <TD><code>CHAR</code>, <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
  <TD><code>java.lang.String</code>
</TR>
</TABLE>
<P>
If the source type and target type are the same,
the given object is simply returned.

@param srcObj the <code>Object</code> in the Java programming language
              that is to be converted to the target type
@param srcType the data type that is the standard mapping in SQL of the
               object to be converted; must be one of the constants in
               <code>java.sql.Types</code>
@param trgType the SQL data type to which to convert the given object;
               must be one of the following constants in
               <code>java.sql.Types</code>: <code>DATE</code>,
        <code>TIME</code>, <code>TIMESTAMP</code>, <code>CHAR</code>,
        <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
@return an <code>Object</code> value.that is
        the standard object mapping for the target SQL type
@throws SQLException if the given target type is not one of the string or
        temporal types in <code>java.sql.Types</code>
src/main/java/org/replicadb/rowset/StreamingRowSetImpl.java