Package java.sql

Examples of java.sql.Date


        }
    }

    protected Date getDate(Object rs, int param)
    {
        Date value;

        try
        {
            value = ((ResultSet) rs).getDate(param);
        }
View Full Code Here


     * @param param The parameter position
     * @return The object value
     **/
    public Object getObject(Object rs, int param)
    {
        Date value = getDate(rs, param);

        if (value == null)
        {
            return null;
        }
        else
        {
            if( getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_UTIL_DATE))
            {
                return new java.util.Date(value.getTime());
            }
            else
            {
                return value;
            }
View Full Code Here

            {
                ((PreparedStatement) ps).setNull(param, getTypeInfo().getDataType());
            }
            else if (value instanceof java.util.Calendar)
            {
                ((PreparedStatement) ps).setDate(param, new Date(((java.util.Calendar)value).getTime().getTime()));
            }
            else if (value instanceof java.util.Date)
            {
                ((PreparedStatement) ps).setDate(param, new Date(((java.util.Date)value).getTime()));
            }
            else
            {
                // If the "value" was a java.sql.Date it would have been handled above, so this will give ClassCastException!
                ((PreparedStatement) ps).setDate(param, (Date)value);
View Full Code Here

      }

    });


    controlDate.setDate(new Date(System.currentTimeMillis()));
    controlDate.addDateChangedListener(new DateChangedListener() {

      public void dateChanged(java.util.Date oldDate, java.util.Date newDate) {
        grid.getOtherGridParams().put(ApplicationConsts.DELIV_DATE_LESS_OR_EQUALS_TO,controlDate.getValue());
        grid.reloadData();
View Full Code Here

  @Test
  public void check_if_support_all_normal_types() throws FailToCastObjectException {
    String d = "2009-02-01";
    String t = "12:23:23";
    String dt = d + " " + t;
    Date date = Castors.me().castTo(d, Date.class);
    Time time = Castors.me().castTo(t, Time.class);
    Timestamp ts = Castors.me().castTo(dt, Timestamp.class);
    EntityTypes exp = new EntityTypes();
    exp.name = "XX";
    exp.enum_s = TT.B;
View Full Code Here

public class Timestamp2SqlDate extends Castor<Timestamp, Date> {

  @Override
  public Date cast(Timestamp src, Class<?> toType, String... args)
      throws FailToCastObjectException {
    return new Date(src.getTime());
  }
View Full Code Here

            if (d < 0)
                d = -d;
            d = d / (24L * 60L * 60L * 1000L);
            d = d % (4000L * 365L); // limit year to a reasonable value.
            d = d * (24L * 60L * 60L * 1000L);
            return new Date(d);
           
        case Types.TIME:
            long t = r.nextLong();
            if (t < 0)
                t = -t;
View Full Code Here

            ;
            ResultSet rs = null;
            try {
                rs = ps.executeQuery();
                rs.next();
                Date d = rs.getDate(1);
                boolean wn = rs.wasNull();
                if (isNull) {
                    assertNull(d);
                    assertTrue(wn);
                } else {
                    assertEquals("2004-02-14", d.toString());
                    assertNotNull(d);
                    assertFalse(wn);
                }
                worked = true;
View Full Code Here

            else
                assertEquals("0x4,0x3", showFirstTwo(is));
            return true;
        }
        case Types.DATE: {
            Date d = rs.getDate(1);
            boolean wn = rs.wasNull();
            if (wn)
                assertNull(d);
            else
                assertEquals(Date.valueOf("2004-02-14"), d);
View Full Code Here

                checkProcedureOutput(param,paramType,data);
            return true;
        }

        case Types.DATE: {
            Date val = cs.getDate(param);
            boolean wn = cs.wasNull();
            if (!wn)
                checkProcedureOutput(param,paramType,val);           
            return true;
        }
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.