Package java.sql

Examples of java.sql.Time


        cal.set(Calendar.SECOND, Integer.parseInt(components[2]));

        // No millisecond resolution for Time
        cal.set(Calendar.MILLISECOND, 0);

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


        SQLTime.setTimeInCalendar(cal, encodedTime);

        cal.set(Calendar.MILLISECOND, nanos/1000000);
       
        return new Time(cal.getTimeInMillis());
    }
View Full Code Here

    values.add(new Date());
    values.add(new Long(26564l));
    values.add(true);
    values.add(1.235);
    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));
    values.add(new Float(1.0f));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
    StringBuilder builder = new StringBuilder();
    builder.append(new Integer(12) + "," + new String("sam") + ","
        + new Date() + "," + new Long(26564l) + "," + true + ","
        + 1.235 + "," + 'a' + "," + new Time(new Date().getTime())
        + "," + new Time(new Date().getTime()) + "," + new Float(1.0f));

    outval.set(builder.toString());
    verify(context).write(outkey, outval);
  }
View Full Code Here

    values.add(new Date());
    values.add(new Long(26564l));
    values.add(true);
    values.add(1.235);
    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));
    values.add(new Float(1.0f));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
    StringBuilder builder = new StringBuilder();
    builder.append(new Integer(12) + delimiter + new String("sam") + delimiter
        + new Date() + delimiter + new Long(26564l) + delimiter + true + delimiter
        + 1.235 + delimiter + 'a' + delimiter + new Time(new Date().getTime())
        + delimiter + new Time(new Date().getTime()) + delimiter + new Float(1.0f));

    outval.set(builder.toString());
    verify(context).write(outkey, outval);
  }
View Full Code Here

    values.add(new Long(26564l));
    values.add(true);
    values.add(1.235);
    values.add(new Float(1.0f));
    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);

    Schema pairSchema = DBMapper.getPairSchema(val.getColumns());
View Full Code Here

    values.add(new Long(26564l));
    values.add(true);
    values.add(1.235);
    // values.add(new Float(1.0f));
    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);

    Schema pairSchema = DBMapper.getPairSchema(val.getColumns());
View Full Code Here

    values.add(new Long(26564l));
    values.add(true);
    values.add(1.235);
    // values.add(new Float(1.0f));
    values.add('a');
    values.add(new Time(new Date().getTime()));
    values.add(new Time(new Date().getTime()));

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);

    Schema pairSchema = DBMapper.getPairSchema(val.getColumns());
View Full Code Here

        assertDatesEqual(orig, (Date) _mgr.copyDate(orig));

        orig = new java.sql.Date(1999);
        assertDatesEqual(orig, (Date) _mgr.copyDate(orig));

        orig = new Time(1999);
        assertDatesEqual(orig, (Date) _mgr.copyDate(orig));

        Timestamp torig = new Timestamp(1999);
        torig.setNanos(2001);
        assertDatesEqual(torig, (Date) _mgr.copyDate(torig));
View Full Code Here

    public void setDate(PreparedStatement stmnt, int idx, Date val, Column col)
        throws SQLException {
        if (col != null && col.getType() == Types.DATE)
            setDate(stmnt, idx, new java.sql.Date(val.getTime()), null, col);
        else if (col != null && col.getType() == Types.TIME)
            setTime(stmnt, idx, new Time(val.getTime()), null, col);
        else if (val instanceof Timestamp)
            setTimestamp(stmnt, idx,(Timestamp) val, null, col);  
        else
            setTimestamp(stmnt, idx, new Timestamp(val.getTime()), null, col);
    }
View Full Code Here

    public void setDate(PreparedStatement stmnt, int idx, Date val, Column col)
        throws SQLException {
        if (col != null && col.getType() == Types.DATE)
            setDate(stmnt, idx, new java.sql.Date(val.getTime()), null, col);
        else if (col != null && col.getType() == Types.TIME)
            setTime(stmnt, idx, new Time(val.getTime()), null, col);
        else if (val instanceof Timestamp)
            setTimestamp(stmnt, idx,(Timestamp) val, null, col);  
        else
            setTimestamp(stmnt, idx, new Timestamp(val.getTime()), null, col);
    }
View Full Code Here

TOP

Related Classes of java.sql.Time

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.