1 22 23 package org.xquark.extractor.sql; 24 25 import java.io.InputStream ; 26 import java.math.BigDecimal ; 27 import java.sql.PreparedStatement ; 28 import java.sql.SQLException ; 29 import java.sql.Timestamp ; 30 import java.util.Date ; 31 32 import org.xquark.schema.SchemaException; 33 34 37 public class RuntimeVarInfo { 38 39 public PlaceHolderInfo compiledVarInfo = null; 40 public PreparedStatement pStmt = null; 41 42 public RuntimeVarInfo(PlaceHolderInfo varInfo, PreparedStatement pStmt) { 43 compiledVarInfo = varInfo; 44 this.pStmt = pStmt; 45 } 46 47 public void setParameter(String value) throws SQLException , SchemaException { 48 if (compiledVarInfo.mappingInfo == null) 49 pStmt.setString(compiledVarInfo.index, value); 50 else 51 compiledVarInfo.mappingInfo.setParameter(pStmt, compiledVarInfo.index, value); 52 } 53 54 public void setObject(Object value) throws SQLException { 55 pStmt.setObject(compiledVarInfo.index, value); 56 } 57 58 public void setBigDecimal(BigDecimal decimal) throws SQLException { 59 pStmt.setBigDecimal(compiledVarInfo.index, decimal); 60 } 61 62 public void setInputStream(InputStream stream, int size) throws SQLException { 63 pStmt.setBinaryStream(compiledVarInfo.index, stream, size); 64 } 65 66 public void setBytes(byte[] bytes) throws SQLException { 67 pStmt.setBytes(compiledVarInfo.index, bytes); 68 } 69 70 public void setBoolean(boolean bool) throws SQLException { 71 pStmt.setBoolean(compiledVarInfo.index, bool); 72 } 73 74 public void setDate(Date date) throws SQLException { 75 pStmt.setTimestamp(compiledVarInfo.index, new Timestamp (date.getTime())); 76 } 77 78 public void setFloat(float f) throws SQLException { 79 pStmt.setFloat(compiledVarInfo.index, f); 80 } 81 82 public void setDouble(double d) throws SQLException { 83 pStmt.setDouble(compiledVarInfo.index, d); 84 } 85 86 public void setLong(long l) throws SQLException { 87 pStmt.setLong(compiledVarInfo.index, l); 88 } 89 90 public void setString(String s) throws SQLException { 91 pStmt.setString(compiledVarInfo.index, s); 92 } 93 } 94 | Popular Tags |