1 28 29 package com.caucho.amber.type; 30 31 import com.caucho.java.JavaWriter; 32 import com.caucho.util.L10N; 33 34 import java.io.IOException ; 35 import java.sql.ResultSet ; 36 import java.sql.SQLException ; 37 38 41 public class BlobType extends Type { 42 private static final L10N L = new L10N(BlobType.class); 43 44 private static final BlobType BLOB_TYPE = new BlobType(); 45 46 private BlobType() 47 { 48 } 49 50 53 public static BlobType create() 54 { 55 return BLOB_TYPE; 56 } 57 58 61 public String getName() 62 { 63 return "java.sql.Blob"; 64 } 65 66 69 public int generateLoad(JavaWriter out, String rs, 70 String indexVar, int index) 71 throws IOException 72 { 73 out.print("" + rs + ".getBlob(" + indexVar + " + " + index + ")"); 74 75 return index + 1; 76 } 77 78 81 public void generateSet(JavaWriter out, String pstmt, 82 String index, String value) 83 throws IOException 84 { 85 out.println(pstmt + ".setBlob(" + index + "++, " + value + ");"); 86 } 87 88 91 public Object getObject(ResultSet rs, int index) 92 throws SQLException 93 { 94 return rs.getBlob(index); 95 } 96 } 97 | Popular Tags |