1 package dinamica; 2 3 30 public class GetBlob extends GenericTransaction 31 { 32 33 36 public int service(Recordset inputParams) throws Throwable 37 { 38 39 int rc = super.service(inputParams); 41 42 Recordset rs = new Recordset(); 44 rs.append("sql", java.sql.Types.VARCHAR); 45 rs.append("filename", java.sql.Types.VARCHAR); 46 rs.append("format", java.sql.Types.VARCHAR); 47 rs.addNew(); 48 49 String sql1 = getSQL(getResource("query-info.sql"), inputParams); 51 Recordset rsInfo = getDb().get(sql1); 52 rsInfo.first(); 53 54 String sql2 = getSQL(getResource("query-blob.sql"), inputParams); 56 57 rs.setValue("sql", sql2); 59 60 rs.setValue("format", rsInfo.getValue("content_type")); 62 63 String attach = getConfig().getConfigValue("attach"); 65 if (attach!=null && attach.equals("true")) 66 { 67 if (rsInfo.containsField("filename")) 68 rs.setValue("filename", rsInfo.getValue("filename")); 69 else 70 throw new Throwable ("Cannot attach BLOB output if [filename] column is not present in the [query-info.sql] template."); 71 } 72 73 publish("blobinfo", rs); 74 75 return rc; 76 77 } 78 79 } 80 | Popular Tags |