2 import java
.io
.InputStream
;
4 import java
.math
.BigDecimal
;
5 import java
.util
.Calendar
;
8 import java
.sql
.Connection
;
9 import java
.sql
.Statement
;
10 import java
.sql
.PreparedStatement
;
11 import java
.sql
.ResultSet
;
14 import java
.sql
.ResultSetMetaData
;
15 import java
.sql
.ParameterMetaData
;
16 import java
.sql
.SQLException
;
18 import java
.sql
.Array
;
19 import java
.sql
.SQLXML
;
20 import java
.sql
.RowId
;
22 import java
.sql
.NClob
;
23 public class JdbcSqlPreparedStatement
extends JdbcSqlStatement
24 implements PreparedStatement
26 public JdbcSqlParameterMetaData pmtd
;
27 JdbcSqlPreparedStatement(Connection con
)
31 public void clearParameters() throws SQLException
36 public boolean execute() throws SQLException
40 public ResultSet
executeQuery() throws SQLException
43 throw getException(CSQL_NOT_QUERY
);
49 public int executeUpdate() throws SQLException
52 throw getException(CSQL_NOT_UPDATE
);
55 public ResultSetMetaData
getMetaData() throws SQLException
61 public ParameterMetaData
getParameterMetaData() throws SQLException
63 pmtd
= new JdbcSqlParameterMetaData();
67 public void setByte(int param
, byte value
) throws SQLException
69 jniStmt
.setByte(param
, value
);
72 public void setDate(int param
, java
.sql
.Date value
) throws SQLException
74 jniStmt
.setDate(param
, value
);
77 public void setDouble(int param
, double value
) throws SQLException
79 jniStmt
.setDouble(param
, value
);
82 public void setFloat(int param
, float value
) throws SQLException
84 jniStmt
.setFloat(param
, value
);
87 public void setInt(int param
, int value
) throws SQLException
89 jniStmt
.setInt(param
, value
);
92 public void setLong(int param
, long value
) throws SQLException
94 jniStmt
.setLong(param
, value
);
97 public void setNull (int param
, int sqlType
) throws SQLException
99 jniStmt
.setNull(param
);
102 public void setObject(int param
, Object obj
) throws SQLException
104 if(obj
instanceof Double
)
105 setDouble(param
, ((Double
)obj
).doubleValue() );
106 else if(obj
instanceof Float
)
107 setFloat(param
, ((Float
)obj
).floatValue() );
108 else if(obj
instanceof Long
)
109 setLong(param
, ((Long
)obj
).longValue() );
110 else if(obj
instanceof Integer
)
111 setInt(param
, ((Integer
)obj
).intValue() );
112 else if(obj
instanceof Short
)
113 setShort(param
, ((Short
)obj
).shortValue() );
114 else if(obj
instanceof Byte
)
115 setByte(param
, ((Byte
)obj
).byteValue() );
116 else if(obj
instanceof java
.sql
.Date
)
117 setDate(param
, ((java
.sql
.Date
) obj
));
118 else if(obj
instanceof java
.sql
.Time
)
119 setTime(param
, ((java
.sql
.Time
) obj
));
120 else if(obj
instanceof java
.sql
.Timestamp
)
121 setTimestamp(param
, ((java
.sql
.Timestamp
) obj
));
122 else if(obj
instanceof String
)
123 setString(param
, ((String
) obj
));
125 throw getException(CSQL_INVALID_DATATYPE
);
129 public void setShort(int param
, short value
) throws SQLException
131 jniStmt
.setShort(param
, value
);
134 public void setString(int param
, String value
) throws SQLException
136 jniStmt
.setString(param
, value
);
139 public void setTime(int param
, java
.sql
.Time value
) throws SQLException
141 jniStmt
.setTime(param
, value
);
144 public void setTimestamp(int param
, java
.sql
.Timestamp value
) throws SQLException
146 jniStmt
.setTimestamp(param
, value
);
154 public void addBatch() throws SQLException
156 throw getException(CSQL_NOT_SUPPORTED
);
158 public void setArray (int i
, Array value
) throws SQLException
160 throw getException(CSQL_NOT_SUPPORTED
);
162 public void setAsciiStream(int parameterIndex
, InputStream value
, int length
)
165 throw getException(CSQL_NOT_SUPPORTED
);
167 public void setBigDecimal(int parameterIndex
, BigDecimal value
) throws SQLException
169 throw getException(CSQL_NOT_SUPPORTED
);
171 public void setBinaryStream(int parameterIndex
, InputStream value
, int length
)
174 throw getException(CSQL_NOT_SUPPORTED
);
176 public void setBlob(int i
, Blob value
) throws SQLException
178 throw getException(CSQL_NOT_SUPPORTED
);
180 public void setBoolean (int param
, boolean value
) throws SQLException
182 throw getException(CSQL_NOT_SUPPORTED
);
184 public void setBytes(int param
, byte value
[]) throws SQLException
186 throw getException(CSQL_NOT_SUPPORTED
);
188 public void setCharacterStream(int param
, Reader reader
, int length
)
191 throw getException(CSQL_NOT_SUPPORTED
);
193 public void setClob (int i
, Clob value
) throws SQLException
195 throw getException(CSQL_NOT_SUPPORTED
);
197 public void setDate(int param
, java
.sql
.Date value
, Calendar cal
)
200 throw getException(CSQL_NOT_SUPPORTED
);
202 public void setNull (int param
, int sqlType
, String typeName
)
205 throw getException(CSQL_NOT_SUPPORTED
);
207 public void setObject (int param
, Object value
, int targetSqlType
)
210 throw getException(CSQL_NOT_SUPPORTED
);
212 public void setObject (int param
, Object value
,
213 int targetSqlType
, int scale
) throws SQLException
215 throw getException(CSQL_NOT_SUPPORTED
);
217 public void setRef(int i
, Ref value
) throws SQLException
219 throw getException(CSQL_NOT_SUPPORTED
);
221 public void setTime(int param
, java
.sql
.Time value
, Calendar cal
)
224 throw getException(CSQL_NOT_SUPPORTED
);
226 public void setTimestamp(int param
, java
.sql
.Timestamp value
,
227 Calendar cal
) throws SQLException
229 throw getException(CSQL_NOT_SUPPORTED
);
231 public void setUnicodeStream (int param
, InputStream value
, int length
)
234 throw getException(CSQL_NOT_SUPPORTED
);
236 public void setURL(int parameterName
, URL value
) throws SQLException
238 throw getException(CSQL_NOT_SUPPORTED
);
241 public void setBlob(int paramIndex
, InputStream value
) throws SQLException
243 throw getException(CSQL_NOT_SUPPORTED
);
245 public void setBlob(int paramIndex
, InputStream value
, long length
) throws SQLException
247 throw getException(CSQL_NOT_SUPPORTED
);
249 public void setClob(int paramIndex
, Reader value
) throws SQLException
251 throw getException(CSQL_NOT_SUPPORTED
);
253 public void setClob(int paramIndex
, Reader value
, long length
) throws SQLException
255 throw getException(CSQL_NOT_SUPPORTED
);
257 public void setNCharacterStream(int paramIndex
, Reader value
)
260 throw getException(CSQL_NOT_SUPPORTED
);
262 public void setNCharacterStream(int paramIndex
,Reader value
,long length
)
265 throw getException(CSQL_NOT_SUPPORTED
);
267 public void setNClob(int paramIndex
, NClob value
)
270 throw getException(CSQL_NOT_SUPPORTED
);
272 public void setNClob(int paramIndex
, Reader value
)
275 throw getException(CSQL_NOT_SUPPORTED
);
277 public void setNClob(int paramIndex
, Reader value
, long length
)
280 throw getException(CSQL_NOT_SUPPORTED
);
282 public void setNString(int paramIndex
, String value
)
285 throw getException(CSQL_NOT_SUPPORTED
);
287 public void setCharacterStream(int param
, Reader reader
)
290 throw getException(CSQL_NOT_SUPPORTED
);
292 public void setCharacterStream(int param
, Reader reader
, long length
)
295 throw getException(CSQL_NOT_SUPPORTED
);
297 public void setBinaryStream(int parameterIndex
, InputStream value
)
300 throw getException(CSQL_NOT_SUPPORTED
);
302 public void setBinaryStream(int parameterIndex
, InputStream value
, long length
)
305 throw getException(CSQL_NOT_SUPPORTED
);
307 public void setAsciiStream(int parameterIndex
, InputStream value
)
310 throw getException(CSQL_NOT_SUPPORTED
);
312 public void setAsciiStream(int parameterIndex
, InputStream value
, long length
)
315 throw getException(CSQL_NOT_SUPPORTED
);
317 public void setSQLXML(int paramIndex
, SQLXML xmlObj
) throws SQLException
319 throw getException(CSQL_NOT_SUPPORTED
);
321 public void setRowId(int paramIndex
, RowId x
) throws SQLException
323 throw getException(CSQL_NOT_SUPPORTED
);