1 15 package org.apache.tapestry.contrib.jdbc; 16 17 import java.sql.PreparedStatement ; 18 import java.sql.SQLException ; 19 import java.sql.Timestamp ; 20 import java.sql.Types ; 21 22 29 30 public class TimestampParameter implements IParameter 31 { 32 private Timestamp _timestamp; 33 34 public TimestampParameter(Timestamp timestamp) 35 { 36 _timestamp = timestamp; 37 } 38 39 public void set(PreparedStatement statement, int index) throws SQLException 40 { 41 if (_timestamp == null) 42 statement.setNull(index, Types.TIMESTAMP); 43 else 44 statement.setTimestamp(index, _timestamp); 45 } 46 47 public String toString() 48 { 49 StringBuffer buffer = new StringBuffer ("Timestamp<"); 50 buffer.append(_timestamp); 51 buffer.append('>'); 52 53 return buffer.toString(); 54 } 55 } 56 | Popular Tags |