|
25 | 25 | import java.sql.Types; |
26 | 26 |
|
27 | 27 | import org.fugerit.java.core.db.daogen.ByteArrayDataHandler; |
| 28 | +import org.fugerit.java.core.db.daogen.CharArrayDataHandler; |
28 | 29 | import org.fugerit.java.core.db.helpers.BlobData; |
29 | 30 | import org.fugerit.java.core.db.helpers.DAOID; |
30 | 31 |
|
@@ -98,12 +99,22 @@ public Field newField(int value) { |
98 | 99 | return (new IntField(value)); |
99 | 100 | } |
100 | 101 |
|
| 102 | + public Field newField(ByteArrayDataHandler value) { |
| 103 | + return new BlobDataField( BlobData.valueOf( (ByteArrayDataHandler)value ) ); |
| 104 | + } |
| 105 | + |
| 106 | + public Field newField(CharArrayDataHandler value) { |
| 107 | + return new ClobDataField( value ); |
| 108 | + } |
| 109 | + |
101 | 110 | public Field newField(Object value) { |
102 | 111 | Field field = null; |
103 | 112 | if ( value instanceof BlobData ) { |
104 | 113 | field = new BlobDataField( (BlobData)value ); |
| 114 | + } else if( value instanceof CharArrayDataHandler ) { |
| 115 | + field = newField( ((CharArrayDataHandler)value) ); |
105 | 116 | } else if( value instanceof ByteArrayDataHandler ) { |
106 | | - field = new BlobDataField( BlobData.valueOf( (ByteArrayDataHandler)value ) ); |
| 117 | + field = newField( ((ByteArrayDataHandler)value) ); |
107 | 118 | } else if (value instanceof DAOID) { |
108 | 119 | field = this.newField( (DAOID)value ); |
109 | 120 | } else { |
@@ -186,6 +197,27 @@ public void setField(PreparedStatement ps, int index) throws SQLException { |
186 | 197 |
|
187 | 198 | } |
188 | 199 |
|
| 200 | +class ClobDataField extends Field { |
| 201 | + |
| 202 | + public String toString() { |
| 203 | + return this.getClass().getName()+"[value:"+this.value+"]"; |
| 204 | + } |
| 205 | + |
| 206 | + public ClobDataField( CharArrayDataHandler value ) { |
| 207 | + this.value = value; |
| 208 | + } |
| 209 | + |
| 210 | + /* (non-Javadoc) |
| 211 | + * @see it.finanze.secin.shared.dao.Field#setField(java.sql.PreparedStatement, int) |
| 212 | + */ |
| 213 | + public void setField(PreparedStatement ps, int index) throws SQLException { |
| 214 | + ps.setCharacterStream(index, this.value.toReader() ); |
| 215 | + } |
| 216 | + |
| 217 | + private CharArrayDataHandler value; |
| 218 | + |
| 219 | +} |
| 220 | + |
189 | 221 | class StringField extends Field { |
190 | 222 |
|
191 | 223 | public String toString() { |
|
0 commit comments