Package java.sql

Examples of java.sql.Date


        String  columnValue = getString( columnIndex );

        if ( columnValue == null ) { return null; }
        else
        {
            return new Date( parseDateTime( columnValue ) );
        }
    }
View Full Code Here


        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);

        return new Date(cal.getTimeInMillis());
    }
View Full Code Here

     */
    public Date getDate(int parameterIndex) throws SQLException
  {
    checkStatus();
    try {
      Date v =  getParms().getParameterForGet(parameterIndex-1).getDate(getCal());
      wasNull = (v == null);
      return v;
    } catch (StandardException e)
    {
      throw EmbedResultSet.noStateChangeException(e);
View Full Code Here

     */
    public Date getDate(int parameterIndex, Calendar cal) throws SQLException
  {
    checkStatus();
    try {
            Date v = getParms().
                    getParameterForGet(parameterIndex-1).getDate(cal);
      wasNull = (v == null);
      return v;
    } catch (StandardException e)
    {
View Full Code Here

    {
      return null;
    }
    else
    {
      return new Date(parse(getDateFormat(locale), value, locale).getTime());
    }
  }
View Full Code Here

  public Date getDate( Calendar cal)
  {
        if (isNull())
            return null;
       
        return new Date(getTimeInMillis(cal));
  }
View Full Code Here

            {
              try
              {
                Object tsc = timestampClass.cast(databaseFieldValue);
                Method dateValueMethod = timestampClass.getMethod("dateValue");
                Date dateValue = (Date) dateValueMethod.invoke(tsc);
                long time = dateValue.getTime();
                assertEquals(f.name(),time,((Long)avroField).longValue());
              }
              catch(Exception ex)
              {
                String errMsg = "SQLException reading oracle.sql.TIMESTAMP value for field " + f.name();
                LOG.error(errMsg);
                throw new RuntimeException(errMsg, ex);
              }
            }
            else if (dateClass.isInstance(databaseFieldValue))
            {
              try
              {
                Object dsc = dateClass.cast(databaseFieldValue);
                Method dateValueMethod = dateClass.getMethod("dateValue");
                Date dateValue = (Date) dateValueMethod.invoke(dsc);
                long time = dateValue.getTime();
                assertEquals(f.name(),time,((Long)avroField).longValue());
              }
              catch (Exception ex)
              {
                String errMsg = "SQLException reading oracle.sql.DATE value for field " + f.name();
View Full Code Here

                        if ( topologyCapabilities != null && newCaps.isActive() ) {
                            notifiyListeners();
                        }
                    }
                }
            }, scheduler.AT(new Date(System.currentTimeMillis() + this.backgroundLoadDelay * 1000)));
        logger.debug("Job processing started");
    }
View Full Code Here

      int i = 0;
      prep.setString(++i, "prepstmt_test_col1");
      prep.setInt(++i, 1);
      prep.setInt(++i, 1);
      if (isDateTimeSupported()) {
        prep.setDate(++i, new Date(System.currentTimeMillis()));
        prep.setTimestamp(++i, new Timestamp(System.currentTimeMillis()));
      }
      prep.setInt(++i, 1);
      if (isBooleanSupported()) {
        prep.setBoolean(++i, true);
View Full Code Here

    public void testPersist() {
        long time = ((long) (System.currentTimeMillis() / 1000)) * 1000;

        SQLDateIdEntity e = new SQLDateIdEntity();
        e.setId(new Date(time));
        e.setData(1);

        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        em.persist(e);
        em.getTransaction().commit();
        assertEquals(time, e.getId().getTime());
        em.close();

        em = emf.createEntityManager();
        e = em.find(SQLDateIdEntity.class, new Date(time));
        assertEquals(1, e.getData());
        em.close();
    }
View Full Code Here

TOP

Related Classes of java.sql.Date

Copyright © 2018 www.massapicom. 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.