Examples of Timestamp


Examples of java.sql.Timestamp

        rs.addColumn("B", Types.VARCHAR, 0, 0);
        rs.addColumn("C", Types.TIMESTAMP, 0, 0);
        if ("jdbc:columnlist:connection".equals(conn.getMetaData().getURL())) {
            return rs;
        }
        rs.addRow(a * 2, b.toUpperCase(), new Timestamp(c.getTime() + 1));
        return rs;
    }
View Full Code Here

Examples of java.sql.Timestamp


    // Source = TIMESTAMP
   
    @Test public void testTimestampToString() throws Exception {
        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "cast(TIMESTAMP '2003-11-01 12:05:02.0' AS varchar(4000))"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of java.sql.Timestamp

   * @return Outgoing value of target type
   * @throws TransformationException if value is an incorrect input type or
   * the transformation fails
   */
  public Object transformDirect(Object value) throws TransformationException {
    return new Timestamp( ((java.sql.Date) value).getTime() );
  }
View Full Code Here

Examples of java.sql.Timestamp

     * @param Calendar object used to construct the Date object.
     * @return The parameter at the given index is returned as a Timestamp object.
     * @throws SQLException if param datatype is not TIMESTAMP
     */
    public Timestamp getTimestamp(int parameterIndex, java.util.Calendar cal) throws SQLException {
        Timestamp value = DataTypeTransformer.getTimestamp(getObject(parameterIndex));

        if (value == null) {
            return null;
        }
       
View Full Code Here

Examples of java.sql.Timestamp

     * @param timeValue Time value, never null
     * @return Translated string
     */
    public String translateLiteralTime(Time timeValue) {
      if (!hasTimeType()) {
        return translateLiteralTimestamp(new Timestamp(timeValue.getTime()));
      }
        return "{t '" + formatDateValue(timeValue) + "'}"; //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of java.sql.Timestamp

     * @param dateObject
     * @return Formatted string
     */
    public String formatDateValue(java.util.Date dateObject) {
        if (dateObject instanceof Timestamp && getTimestampNanoPrecision() < 9) {
          Timestamp ts = (Timestamp)dateObject;
          Timestamp newTs = new Timestamp(ts.getTime());
          if (getTimestampNanoPrecision() > 0) {
            int mask = (int)Math.pow(10, 9-getTimestampNanoPrecision());
            newTs.setNanos(ts.getNanos()/mask*mask);
          } else {
            newTs.setNanos(0);
          }
          dateObject = newTs;
        }
        return getTypeFacility().convertDate(dateObject, DEFAULT_TIME_ZONE, getDatabaseCalendar(), dateObject.getClass()).toString();       
    }   
View Full Code Here

Examples of java.sql.Timestamp

    }

    // Source = TIMESTAMP
   
    @Test public void testTimestampToString() throws Exception {
        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "to_char({ts '2003-11-01 12:05:02.01'}, 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of java.sql.Timestamp

      column.setNameInSource("dt");
        helpTest(LANG_FACTORY.createColumnReference("dt", LANG_FACTORY.createNamedTable("x", null, null), column, Timestamp.class), "string", "to_char(x.dt, 'YYYY-MM-DD HH24:MI:SS')"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    @Test public void testTimestampToDate() throws Exception {
        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "trunc(cast({ts '2003-11-01 12:05:02.01'} AS date))"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

Examples of java.sql.Timestamp

        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "trunc(cast({ts '2003-11-01 12:05:02.01'} AS date))"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    @Test public void testTimestampToTime() throws Exception {
        Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);       
        helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "case when {ts '2003-11-01 12:05:02.01'} is null then null else to_date('1970-01-01 ' || to_char({ts '2003-11-01 12:05:02.01'}, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS') end"); //$NON-NLS-1$ //$NON-NLS-2$
    }   
View Full Code Here

Examples of java.sql.Timestamp

           
        adjustCalendar(date, initial, target);
       
        target.set(Calendar.MILLISECOND, 0);
       
        Timestamp tsInTz = new Timestamp(target.getTimeInMillis());
       
        if(date instanceof Timestamp) {
            tsInTz.setNanos(((Timestamp)date).getNanos());
        }
       
        target.setTimeInMillis(time);
        return tsInTz;     
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.