List of usage examples for java.sql Types TIME
int TIME
To view the source code for java.sql Types TIME.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TIME
.
From source file:lasige.steeldb.jdbc.BFTRowSet.java
/** * Sets the designated column in either the current row or the insert * row of this <code>CachedRowSetImpl</code> object with the given * <code>Time</code> object. * * This method updates a column value in either the current row or * the insert row of this rowset, but it does not update the * database. If the cursor is on a row in the rowset, the * method {@link #updateRow} must be called to update the database. * If the cursor is on the insert row, the method {@link #insertRow} * must be called, which will insert the new row into both this rowset * and the database. Both of these methods must be called before the * cursor moves to another row./* w w w . j a v a 2 s. c om*/ * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in this rowset * @param x the new column value * @throws SQLException if (1) the given column index is out of bounds, * (2) the cursor is not on one of this rowset's rows or its * insert row, (3) the type of the designated column is not * an SQL <code>TIME</code> or <code>TIMESTAMP</code>, or * (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code> */ public void updateTime(int columnIndex, java.sql.Time x) throws SQLException { // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); Object obj = convertTemporal(x, java.sql.Types.TIME, RowSetMD.getColumnType(columnIndex)); getCurrentRow().setColumnObject(columnIndex, obj); }
From source file:lasige.steeldb.jdbc.BFTRowSet.java
/** * Retrieves the value of the designated column in the current row * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code> * object, using the given <code>Calendar</code> object to construct an * appropriate millisecond value for the date. * * @param columnIndex the first column is <code>1</code>, the second * is <code>2</code>, and so on; must be <code>1</code> or larger * and equal to or less than the number of columns in the rowset * @param cal the <code>java.util.Calendar</code> object to use in * constructing the date/* ww w . j a va2s . c o m*/ * @return the column value; if the value is SQL <code>NULL</code>, * the result is <code>null</code> * @throws SQLException if (1) the given column name is not the name of * a column in this rowset, (2) the cursor is not on one of * this rowset's rows or its insert row, or (3) the designated * column does not store an SQL <code>TIME</code> or * <code>TIMESTAMP</code> value */ public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException { Object value; // sanity check. checkIndex(columnIndex); // make sure the cursor is on a valid row checkCursor(); setLastValueNull(false); value = getCurrentRow().getColumnObject(columnIndex); // check for SQL NULL if (value == null) { setLastValueNull(true); return null; } value = convertTemporal(value, RowSetMD.getColumnType(columnIndex), java.sql.Types.TIME); // create a default calendar Calendar defaultCal = Calendar.getInstance(); // set the time in the default calendar defaultCal.setTime((java.util.Date) value); /* * Now we can pull the pieces of the date out * of the default calendar and put them into * the user provided calendar */ cal.set(Calendar.HOUR_OF_DAY, defaultCal.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND)); return new java.sql.Time(cal.getTime().getTime()); }