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