List of usage examples for java.sql Types TIMESTAMP
int TIMESTAMP
To view the source code for java.sql Types TIMESTAMP.
Click Source Link
The constant in the Java programming language, sometimes referred to as a type code, that identifies the generic SQL type TIMESTAMP
.
From source file:com.cloudera.sqoop.manager.SqlManager.java
/** * Resolve a database-specific type to the Java type that should contain it. * @param sqlType/* www .ja v a 2 s . c o m*/ * @return the name of a Java type to hold the sql datatype, or null if none. */ public String toJavaType(int sqlType) { // Mappings taken from: // http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html if (sqlType == Types.INTEGER) { return "Integer"; } else if (sqlType == Types.VARCHAR) { return "String"; } else if (sqlType == Types.CHAR) { return "String"; } else if (sqlType == Types.LONGVARCHAR) { return "String"; } else if (sqlType == Types.NUMERIC) { return "java.math.BigDecimal"; } else if (sqlType == Types.DECIMAL) { return "java.math.BigDecimal"; } else if (sqlType == Types.BIT) { return "Boolean"; } else if (sqlType == Types.BOOLEAN) { return "Boolean"; } else if (sqlType == Types.TINYINT) { return "Integer"; } else if (sqlType == Types.SMALLINT) { return "Integer"; } else if (sqlType == Types.BIGINT) { return "Long"; } else if (sqlType == Types.REAL) { return "Float"; } else if (sqlType == Types.FLOAT) { return "Double"; } else if (sqlType == Types.DOUBLE) { return "Double"; } else if (sqlType == Types.DATE) { return "java.sql.Date"; } else if (sqlType == Types.TIME) { return "java.sql.Time"; } else if (sqlType == Types.TIMESTAMP) { return "java.sql.Timestamp"; } else if (sqlType == Types.BINARY || sqlType == Types.VARBINARY) { return BytesWritable.class.getName(); } else if (sqlType == Types.CLOB) { return ClobRef.class.getName(); } else if (sqlType == Types.BLOB || sqlType == Types.LONGVARBINARY) { return BlobRef.class.getName(); } else { // TODO(aaron): Support DISTINCT, ARRAY, STRUCT, REF, JAVA_OBJECT. // Return null indicating database-specific manager should return a // java data type if it can find one for any nonstandard type. return null; } }
From source file:com.nextep.designer.dbgm.services.impl.DerbyStorageService.java
public IDatatype getColumnDatatype(IDataSet set, IBasicColumn c) { final int jdbcType = getColumnSqlType(set, c); final IDatatype type = c.getDatatype(); IDatatype derbyType = null;// www .j a va 2s.com switch (jdbcType) { case Types.DOUBLE: derbyType = new Datatype("DOUBLE"); //$NON-NLS-1$ break; case Types.BIGINT: derbyType = new Datatype("BIGINT"); //$NON-NLS-1$ break; case Types.TIMESTAMP: derbyType = new Datatype("TIMESTAMP"); //$NON-NLS-1$ break; default: derbyType = new Datatype("VARCHAR"); //$NON-NLS-1$ if (type.getLength() > 0) { if (type.getLength() > MAX_DERBY_VARCHAR_LENGTH) { LOGGER.warn("Dataset datatype for VARCHAR column " + c.getName() + " has been truncated to " + MAX_DERBY_VARCHAR_LENGTH); } derbyType.setLength(Math.min(type.getLength(), MAX_DERBY_VARCHAR_LENGTH)); } else { derbyType.setLength(4000); } break; } return derbyType; }
From source file:org.easyrec.mahout.store.impl.MahoutDataModelMappingDAOMysqlImpl.java
private boolean userExists(int tenantId, Date cutoffDate, long userID, int itemTypeId) { Object[] args = new Object[] { userID, tenantId, cutoffDate, itemTypeId }; int[] argTypes = new int[] { Types.INTEGER, Types.INTEGER, Types.TIMESTAMP, Types.INTEGER }; return getJdbcTemplate().queryForInt(userExistsQuery, args, argTypes) != 0; }
From source file:ca.sqlpower.matchmaker.address.AddressPool.java
public void load(Logger engineLogger) throws SQLException, SQLObjectException { setCancelled(false);/*ww w . j a v a2 s .c o m*/ setStarted(true); setFinished(false); setProgress(0); SQLTable resultTable = project.getResultTable(); Connection con = null; Statement stmt = null; ResultSet rs = null; setJobSize(getNumRowsToProcess()); try { con = project.createResultTableConnection(); stmt = con.createStatement(); StringBuilder sql = new StringBuilder("SELECT * FROM "); appendFullyQualifiedTableName(sql, resultTable); rs = stmt.executeQuery(sql.toString()); while (rs.next()) { List<Object> keyValues = new ArrayList<Object>(); int numKeys = project.getSourceTableIndex().getChildCount(); // We need to convert the column types to the base set of // String, Boolean, BigDecimal, and Date that we use in the // Transformations. Otherwise, when we cannot properly compare // the key values of these loaded. Addresses with the ones // coming through the transformations. for (int i = 0; i < numKeys; i++) { int type = project.getSourceTableIndex().getChild(i).getColumn().getType(); Class c = TypeMap.typeClass(type); if (c == BigDecimal.class) { keyValues.add(rs.getBigDecimal(SOURCE_ADDRESS_KEY_COLUMN_BASE + i)); } else if (c == Date.class) { /* * KLUDGE. DateTime types are converted to Date's, thus losing * the Time portion of the value. When paging through results * and a DateTime column is used as part of the key, then inconsistent * paging will occur as the comparison logic will be comparing just * Date values. To avoid breaking any other parts of the application * as it is only the paging that is affected by this change, * explicitly check for the Timestamp type, and retrieve the right * type from the ResultSet here, instead of altering TypeMap.typeClass(). */ if (type == Types.TIMESTAMP) { keyValues.add(rs.getTimestamp(SOURCE_ADDRESS_KEY_COLUMN_BASE + i)); } else { keyValues.add(rs.getDate(SOURCE_ADDRESS_KEY_COLUMN_BASE + i)); } } else if (c == Boolean.class) { keyValues.add(rs.getBoolean(SOURCE_ADDRESS_KEY_COLUMN_BASE + i)); } else { keyValues.add(rs.getString(SOURCE_ADDRESS_KEY_COLUMN_BASE + i)); } } String addressLine1 = rs.getString(INPUT_ADDRESS_LINE1); String addressLine2 = rs.getString(INPUT_ADDRESS_LINE2); String municipality = rs.getString(INPUT_MUNICIPALITY); String province = rs.getString(INPUT_PROVINCE); String country = rs.getString(INPUT_COUNTRY); String postalCode = rs.getString(INPUT_POSTAL_CODE); Address address = new Address(); address.setCountry(rs.getString(OUTPUT_COUNTRY)); String deliveryInstallName; try { deliveryInstallName = rs.getString(OUTPUT_DELIVERY_INSTALLATION_NAME); } catch (SQLException e) { deliveryInstallName = rs.getString(OLD_OUTPUT_DELIVERY_INSTALLATION_NAME); } address.setDeliveryInstallationName(deliveryInstallName); String deliveryInstallType; try { deliveryInstallType = rs.getString(OUTPUT_DELIVERY_INSTALLATION_TYPE); } catch (SQLException e) { deliveryInstallType = rs.getString(OLD_OUTPUT_DELIVERY_INSTALLATION_TYPE); } address.setDeliveryInstallationType(deliveryInstallType); address.setDirectionPrefix(rs.getBoolean(OUTPUT_DIRECTION_PREFIX)); address.setFailedParsingString(rs.getString(OUTPUT_FAILED_PARSING_STRING)); address.setGeneralDeliveryName(rs.getString(OUTPUT_GENERAL_DELIVERY_NAME)); address.setLockBoxNumber(rs.getString(OUTPUT_LOCK_BOX_NUMBER)); address.setLockBoxType(rs.getString(OUTPUT_LOCK_BOX_TYPE)); address.setMunicipality(rs.getString(OUTPUT_MUNICIPALITY)); address.setPostalCode(rs.getString(OUTPUT_POSTAL_CODE)); address.setProvince(rs.getString(OUTPUT_PROVINCE)); address.setRuralRouteNumber(rs.getString(OUTPUT_RURAL_ROUTE_NUMBER)); address.setRuralRouteType(rs.getString(OUTPUT_RURAL_ROUTE_TYPE)); address.setStreet(rs.getString(OUTPUT_STREET_NAME)); address.setStreetDirection(rs.getString(OUTPUT_STREET_DIRECTION)); address.setStreetNumberSuffix(rs.getString(OUTPUT_STREET_NUMBER_SUFFIX)); String streetNumSuffix; try { streetNumSuffix = rs.getString(OUTPUT_STREET_NUMBER_SUFFIX_SEPARATE); } catch (SQLException e) { streetNumSuffix = rs.getString(OLD_OUTPUT_STREET_NUMBER_SUFFIX_SEPARATE); } address.setStreetNumberSuffix(streetNumSuffix); address.setStreetNumber(rs.getInt(OUTPUT_STREET_NUMBER)); address.setStreetType(rs.getString(OUTPUT_STREET_TYPE)); address.setStreetTypePrefix(rs.getBoolean(OUTPUT_STREET_TYPE_PREFIX)); address.setSuite(rs.getString(OUTPUT_SUITE)); address.setSuitePrefix(rs.getBoolean(OUTPUT_SUITE_PREFIX)); address.setSuiteType(rs.getString(OUTPUT_SUITE_TYPE)); String typeString = rs.getString(OUTPUT_TYPE); if (typeString != null) { address.setType(RecordType.valueOf(rs.getString(OUTPUT_TYPE))); } address.setUnparsedAddressLine1(rs.getString(OUTPUT_UNPARSED_ADDRESS)); address.setUrbanBeforeRural(rs.getBoolean(OUTPUT_URBAN_BEFORE_RURAL)); Boolean valid = rs.getBoolean(OUTPUT_VALID); AddressResult result = new AddressResult(keyValues, addressLine1, addressLine2, municipality, province, postalCode, country, address, valid); result.markClean(); addresses.put(keyValues, result); incrementProgress(); } engineLogger.debug("Loaded " + addresses.size() + " addresses from the result table"); } finally { setFinished(true); if (rs != null) rs.close(); if (stmt != null) stmt.close(); if (con != null) con.close(); } }
From source file:org.apache.cassandra.cql.jdbc.HandleObjects.java
public static final ByteBuffer makeBytes(Object object, int baseType, int scaleOrLength) throws SQLException { Class<? extends Object> objectClass = object.getClass(); boolean isCollection = (Collection.class.isAssignableFrom(objectClass)); int targetSqlType = isCollection ? Types.OTHER : baseType; // Type check first switch (targetSqlType) { case Types.TINYINT: // Only Numeric classes, Strings and Booleans are supported for transformation to TINYINT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "TINYINT"); break;//from w w w .j a v a 2 s . c o m case Types.SMALLINT: // Only Numeric classes, Strings and Booleans are supported for transformation to SMALLINT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "SMALLINT"); break; case Types.INTEGER: // Only Numeric classes, Strings and Booleans are supported for transformation to INTEGER if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "INTEGER"); break; case Types.BIGINT: // Only Numeric classes, Strings and Booleans are supported for transformation to BIGINT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "BIGINT"); break; case Types.REAL: case Types.FLOAT: case Types.DOUBLE: case Types.DECIMAL: // Only Numeric classes Strings and Booleans are supported for transformation to REAL,FLOAT,DOUBLE,DECIMAL if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "the floating point types"); break; case Types.NUMERIC: //NB This as a special case variation for Cassandra!! NUMERIC is transformed to java BigInteger (varint CQL type) // // Only Numeric classes Strings and Booleans are supported for transformation to NUMERIC if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "NUMERIC"); break; case Types.BIT: // Only Numeric classes Strings and Booleans are supported for transformation to BIT if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "BIT"); break; case Types.BOOLEAN: // Only Numeric classes Strings and Booleans are supported for transformation to BOOLEAN if (!(objectClass == String.class || objectClass == Boolean.class || Number.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "BOOLEAN"); break; case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: if (!objectClass.isAssignableFrom(String.class)) throw makeBadMapping(objectClass, "String", "the various VARCHAR types"); break; case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: if (!(objectClass.isAssignableFrom(ByteBuffer.class) || objectClass.getSimpleName().equals("byte[]"))) throw makeBadMapping(objectClass, "ByteBuffer or byte[]", "the BINARY Types"); break; case Types.DATE: if (!(objectClass == String.class || objectClass == java.util.Date.class || objectClass == Date.class || objectClass == Timestamp.class)) throw makeBadMapping(objectClass, "String, Date(java and sql) or Timestamp types", "DATE"); break; case Types.TIME: if (!(objectClass == String.class || objectClass == java.util.Date.class || objectClass == Time.class || objectClass == Timestamp.class)) throw makeBadMapping(objectClass, "String, Date (java), Time or Timestamp types", "TIME"); break; case Types.TIMESTAMP: if (!(objectClass == String.class || objectClass == java.util.Date.class || objectClass == Date.class || objectClass == Timestamp.class)) throw makeBadMapping(objectClass, "String, Date(java and sql) or Timestamp types", "TIMESTAMP"); break; case Types.DATALINK: if (objectClass != URL.class) throw makeBadMapping(objectClass, "a URL type", "DATALINK"); break; case Types.JAVA_OBJECT: break; case Types.OTHER: // Only Collection classes for transformation to OTHER if (!(List.class.isAssignableFrom(object.getClass()) || Set.class.isAssignableFrom(object.getClass()) || Map.class.isAssignableFrom(object.getClass()))) throw makeBadMapping(objectClass, STR_BOOL_NUMERIC, "OTHER"); break; case Types.ROWID: if (objectClass != RowId.class) throw makeBadMapping(objectClass, "a RowId type", "ROWID"); break; default: throw new SQLNonTransientException("Unsupported transformation to Jdbc Type: " + targetSqlType); } // see if we can map to an supported Type switch (targetSqlType) { case Types.BIT: BigInteger bitvalue = objectToBITorTINYINTorSMALLINTorNUMERIC(objectClass, object); assert bitvalue != null; return JdbcInteger.instance.decompose((bitvalue == BigInteger.ZERO) ? BigInteger.ZERO : BigInteger.ONE); case Types.TINYINT: case Types.SMALLINT: case Types.NUMERIC: BigInteger varint = objectToBITorTINYINTorSMALLINTorNUMERIC(objectClass, object); assert varint != null; return JdbcInteger.instance.decompose(varint); case Types.INTEGER: Integer value = objectToINTEGER(objectClass, object); assert value != null; return JdbcInt32.instance.decompose(value); case Types.BIGINT: Long longvalue = objectToBIGINT(objectClass, object); assert longvalue != null; return JdbcLong.instance.decompose(longvalue); case Types.BOOLEAN: Boolean bool = objectToBOOLEAN(objectClass, object); assert bool != null; return JdbcBoolean.instance.decompose(bool); case Types.CHAR: case Types.VARCHAR: case Types.LONGVARCHAR: case Types.NVARCHAR: case Types.LONGNVARCHAR: return ByteBufferUtil.bytes((String) object); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: if (objectClass.isAssignableFrom(ByteBuffer.class)) { return ((ByteBuffer) object); } else if (objectClass.getSimpleName().equals("byte[]")) { return ByteBuffer.wrap((byte[]) object); } else return null; // this should not happen case Types.DATE: case Types.TIME: case Types.TIMESTAMP: Long millis = objectToDATEorTIMEorTIMESTAMP(objectClass, object); assert millis != null; return JdbcLong.instance.decompose(millis); case Types.DATALINK: String urlAsString = ((URL) object).toExternalForm(); return JdbcUTF8.instance.decompose(urlAsString); case Types.JAVA_OBJECT: return javaObject(object); case Types.OTHER: if (List.class.isAssignableFrom(objectClass)) { return handleAsList(objectClass, object); } else if (Set.class.isAssignableFrom(objectClass)) { return handleAsSet(objectClass, object); } else if (Map.class.isAssignableFrom(objectClass)) { return handleAsMap(objectClass, object); } else return null; case Types.ROWID: byte[] bytes = ((RowId) object).getBytes(); return ByteBuffer.wrap(bytes); default: LOG.warn("Unhandled JDBC type: " + targetSqlType); return null; } }
From source file:architecture.ee.web.community.page.dao.jdbc.JdbcPageDao.java
public void update(Page page, boolean isNewVersion) { int prevVersionId = page.getVersionId(); Date now = Calendar.getInstance().getTime(); if (isNewVersion) { int maxVersionId = getExtendedJdbcTemplate().queryForObject( getBoundSql("ARCHITECTURE_COMMUNITY.SELECT_MAX_PAGE_VERSION_NUMBER").getSql(), Integer.class, new SqlParameterValue(Types.NUMERIC, page.getPageId())); page.setVersionId(maxVersionId + 1); }//from w w w. ja va 2 s.c o m page.setModifiedDate(now); // update page ... getExtendedJdbcTemplate().update(getBoundSql("ARCHITECTURE_COMMUNITY.UPDATE_PAGE").getSql(), new SqlParameterValue(Types.NUMERIC, page.getPageId()), new SqlParameterValue(Types.NUMERIC, page.getObjectType()), new SqlParameterValue(Types.NUMERIC, page.getObjectId()), new SqlParameterValue(Types.VARCHAR, page.getName()), new SqlParameterValue(Types.NUMERIC, page.getVersionId()), new SqlParameterValue(Types.NUMERIC, page.getUser().getUserId()), new SqlParameterValue(Types.TIMESTAMP, page.getModifiedDate()), new SqlParameterValue(Types.NUMERIC, page.getPageId())); updateProperties(page); if (isNewVersion) { insertPageVersion(page); insertPageBody(page); } else { updatePageVersion(page, prevVersionId); updatePageBody(page, prevVersionId); } }
From source file:org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule.java
private Object downcastValue(Object value, int dataType) { if (value == null) { return null; }/*from w w w . j a v a 2s . com*/ // Try down casting the value as per its column type. try { // Some JDBC 4.0 types have been ignored to avoid compilation errors switch (dataType) { case Types.ARRAY: break; case Types.BIGINT: if (!(value instanceof BigInteger)) { value = new BigDecimal(value.toString()).longValue(); } break; case Types.BINARY: break; case Types.BIT: if (!(value instanceof Boolean)) { value = new Boolean(value.toString()); } break; case Types.BLOB: break; case Types.BOOLEAN: if (!(value instanceof Boolean)) { value = new Boolean(value.toString()); } break; case Types.CHAR: break; case Types.CLOB: break; case Types.DATALINK: break; case Types.DATE: break; case Types.DECIMAL: //ODE-872: Oracle 9g and 10g has problems with BigDecimal on Java1.5 value = new BigDecimal(new BigDecimal(value.toString()).toPlainString()); break; case Types.DISTINCT: break; case Types.DOUBLE: if (!(value instanceof Double)) { value = Double.valueOf(value.toString()).doubleValue(); } break; case Types.FLOAT: if (!(value instanceof Float)) { value = Float.valueOf(value.toString()).floatValue(); } break; case Types.INTEGER: if (!(value instanceof Integer)) { value = Double.valueOf(value.toString()).intValue(); } break; case Types.JAVA_OBJECT: break; // case Types.LONGNVARCHAR: // break; case Types.LONGVARBINARY: break; case Types.LONGVARCHAR: break; // case Types.NCHAR: // break; // case Types.NCLOB: // break; case Types.NUMERIC: //ODE-872: Oracle 9g and 10g has problems with BigDecimal on Java1.5 value = new BigDecimal(new BigDecimal(value.toString()).toPlainString()); break; // case Types.NVARCHAR: // break; case Types.OTHER: break; case Types.REAL: if (!(value instanceof Double)) { value = Float.valueOf(value.toString()).floatValue(); } break; case Types.REF: break; // case Types.ROWID: // break; case Types.SMALLINT: if (!(value instanceof Short)) { value = new Short(value.toString()).shortValue(); } break; // case Types.SQLXML: // break; case Types.STRUCT: break; case Types.TIME: break; case Types.TIMESTAMP: break; case Types.TINYINT: if (!(value instanceof Short)) { value = new Short(value.toString()).shortValue(); } break; case Types.VARBINARY: break; case Types.VARCHAR: break; default: break; } } catch (Exception e) { // couldn't cast... let's just use original value object } return value; }
From source file:org.easyrec.plugin.arm.store.dao.impl.RuleminingActionDAOMysqlImpl.java
@Override public int getNumberOfActions(Integer tenantId, Integer actionType, Date lastRun, Integer cutoff) { List<Object> args = Lists.newArrayList(); List<Integer> argt = Lists.newArrayList(); StringBuilder query = new StringBuilder("SELECT count(1) as cnt FROM "); query.append(BaseActionDAO.DEFAULT_TABLE_NAME); query.append(" WHERE ").append(BaseActionDAO.DEFAULT_TENANT_COLUMN_NAME).append("=? ").append(" AND ") .append(BaseActionDAO.DEFAULT_ACTION_TYPE_COLUMN_NAME).append("=?"); args.add(tenantId);//from ww w .j av a 2 s. co m args.add(actionType); argt.add(Types.INTEGER); argt.add(Types.INTEGER); if (lastRun != null) { query.append(" AND ").append(BaseActionDAO.DEFAULT_ACTION_TIME_COLUMN_NAME).append(">=?"); args.add(lastRun); argt.add(Types.TIMESTAMP); } if (cutoff != null) { query.append(" AND ").append(BaseActionDAO.DEFAULT_ID_COLUMN_NAME).append(">?"); args.add(cutoff); argt.add(Types.INTEGER); } return getJdbcTemplate().queryForInt(query.toString(), args.toArray(), Ints.toArray(argt)); }
From source file:org.nuxeo.ecm.core.storage.sql.db.H2Fulltext.java
protected static String asString(Object data, int type) throws SQLException { if (data == null) { return ""; }//from w w w . j av a 2 s . c o m switch (type) { case Types.BIT: case Types.BOOLEAN: case Types.INTEGER: case Types.BIGINT: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.NUMERIC: case Types.REAL: case Types.SMALLINT: case Types.TINYINT: case Types.DATE: case Types.TIME: case Types.TIMESTAMP: case Types.LONGVARCHAR: case Types.CHAR: case Types.VARCHAR: return data.toString(); case Types.CLOB: try { if (data instanceof Clob) { data = ((Clob) data).getCharacterStream(); } return IOUtils.readStringAndClose((Reader) data, -1); } catch (IOException e) { throw DbException.convert(e); } case Types.VARBINARY: case Types.LONGVARBINARY: case Types.BINARY: case Types.JAVA_OBJECT: case Types.OTHER: case Types.BLOB: case Types.STRUCT: case Types.REF: case Types.NULL: case Types.ARRAY: case Types.DATALINK: case Types.DISTINCT: throw new SQLException("Unsupported column data type: " + type); default: return ""; } }
From source file:org.owasp.proxy.http.dao.JdbcMessageDAO.java
private void addTimestamp(MapSqlParameterSource params, String name, long time) { params.addValue(name, time == 0 ? null : new Timestamp(time), Types.TIMESTAMP); }