@Override public void setDate(int parameterIndex, Date value) throws SQLException { Calendar c = Calendar.getInstance(); c.setTimeInMillis(value.getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); }
@Override public void setDate(int parameterIndex, Date value) throws SQLException { Calendar c = Calendar.getInstance(); c.setTimeInMillis(value.getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); }
Calendar c = Calendar.getInstance(); c.setTimeInMillis(((Date) value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Time) { Calendar c = Calendar.getInstance(); this.setParameter(parameterIndex, NodeFactoryExtra.timeToNode(c)); } else if (value instanceof Calendar) { this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode((Calendar) value)); } else if (value instanceof URL) { this.setParameter(parameterIndex, NodeFactory.createURI(value.toString()));
Calendar c = Calendar.getInstance(); c.setTimeInMillis(((Date) value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Time) { Calendar c = Calendar.getInstance(); this.setParameter(parameterIndex, NodeFactoryExtra.timeToNode(c)); } else if (value instanceof Calendar) { this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode((Calendar) value)); } else if (value instanceof URL) { this.setParameter(parameterIndex, NodeFactory.createURI(value.toString()));
/** * Tests that the various set methods of {@link JenaPreparedStatement} * function correctly * * @throws SQLException */ @Test public void prepared_statement_setters_42() throws SQLException { JenaConnection conn = this.getConnection(); JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }"); Calendar c = Calendar.getInstance(); stmt.setObject(1, NodeFactoryExtra.dateTimeToNode(c), Types.DATE); ParameterizedSparqlString pss = stmt.getParameterizedString(); Assert.assertTrue(pss.toString().contains(Integer.toString(c.get(Calendar.YEAR)))); stmt.close(); conn.close(); }
/** * Tests that the various set methods of {@link JenaPreparedStatement} * function correctly * * @throws SQLException */ @Test public void prepared_statement_setters_58() throws SQLException { JenaConnection conn = this.getConnection(); JenaPreparedStatement stmt = (JenaPreparedStatement) conn.prepareStatement("SELECT * WHERE { ?s ?p ? }"); Calendar c = Calendar.getInstance(); stmt.setObject(1, NodeFactoryExtra.dateTimeToNode(c), Types.TIME); ParameterizedSparqlString pss = stmt.getParameterizedString(); Assert.assertTrue(pss.toString().contains(Integer.toString(c.get(Calendar.HOUR_OF_DAY)))); stmt.close(); conn.close(); }
Calendar c = Calendar.getInstance(); c.setTimeInMillis(((Date) value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Node) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(JdbcNodeUtils.toDate((Node)value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Time) { Calendar c = Calendar.getInstance(); this.setParameter(parameterIndex, NodeFactoryExtra.timeToNode(c)); } else if (value instanceof Calendar) { this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode((Calendar) value)); } else { throw new SQLException("The given value is not marshallable to the desired target type"); Calendar c = Calendar.getInstance(); c.setTimeInMillis(((Date)value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Time) { Calendar c = Calendar.getInstance(); this.setParameter(parameterIndex, NodeFactoryExtra.timeToNode(c)); } else if (value instanceof Calendar) { this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode((Calendar)value)); } else { this.setParameter(parameterIndex, NodeFactory.createLiteral(value.toString()));
Calendar c = Calendar.getInstance(); c.setTimeInMillis(((Date) value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Node) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(JdbcNodeUtils.toDate((Node)value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Time) { Calendar c = Calendar.getInstance(); this.setParameter(parameterIndex, NodeFactoryExtra.timeToNode(c)); } else if (value instanceof Calendar) { this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode((Calendar) value)); } else { throw new SQLException("The given value is not marshallable to the desired target type"); Calendar c = Calendar.getInstance(); c.setTimeInMillis(((Date)value).getTime()); this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode(c)); } else if (value instanceof Time) { Calendar c = Calendar.getInstance(); this.setParameter(parameterIndex, NodeFactoryExtra.timeToNode(c)); } else if (value instanceof Calendar) { this.setParameter(parameterIndex, NodeFactoryExtra.dateTimeToNode((Calendar)value)); } else { this.setParameter(parameterIndex, NodeFactory.createLiteral(value.toString()));