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
);
48 isFirstExecute
= false;
53 public int executeUpdate() throws SQLException
56 throw getException(CSQL_NOT_UPDATE
);
59 public ResultSetMetaData
getMetaData() throws SQLException
65 public ParameterMetaData
getParameterMetaData() throws SQLException
67 pmtd
= new JdbcSqlParameterMetaData();
71 public void setByte(int param
, byte value
) throws SQLException
73 jniStmt
.setByte(param
, value
);
76 public void setDate(int param
, java
.sql
.Date value
) throws SQLException
78 jniStmt
.setDate(param
, value
);
81 public void setDouble(int param
, double value
) throws SQLException
83 jniStmt
.setDouble(param
, value
);
86 public void setFloat(int param
, float value
) throws SQLException
88 jniStmt
.setFloat(param
, value
);
91 public void setInt(int param
, int value
) throws SQLException
93 jniStmt
.setInt(param
, value
);
96 public void setLong(int param
, long value
) throws SQLException
98 jniStmt
.setLong(param
, value
);
101 public void setNull (int param
, int sqlType
) throws SQLException
103 jniStmt
.setNull(param
);
106 public void setObject(int param
, Object obj
) throws SQLException
108 if(obj
instanceof Double
)
109 setDouble(param
, ((Double
)obj
).doubleValue() );
110 else if(obj
instanceof Float
)
111 setFloat(param
, ((Float
)obj
).floatValue() );
112 else if(obj
instanceof Long
)
113 setLong(param
, ((Long
)obj
).longValue() );
114 else if(obj
instanceof Integer
)
115 setInt(param
, ((Integer
)obj
).intValue() );
116 else if(obj
instanceof Short
)
117 setShort(param
, ((Short
)obj
).shortValue() );
118 else if(obj
instanceof Byte
)
119 setByte(param
, ((Byte
)obj
).byteValue() );
120 else if(obj
instanceof java
.sql
.Date
)
121 setDate(param
, ((java
.sql
.Date
) obj
));
122 else if(obj
instanceof java
.sql
.Time
)
123 setTime(param
, ((java
.sql
.Time
) obj
));
124 else if(obj
instanceof java
.sql
.Timestamp
)
125 setTimestamp(param
, ((java
.sql
.Timestamp
) obj
));
126 else if(obj
instanceof String
)
127 setString(param
, ((String
) obj
));
129 throw getException(CSQL_INVALID_DATATYPE
);
133 public void setShort(int param
, short value
) throws SQLException
135 jniStmt
.setShort(param
, value
);
138 public void setString(int param
, String value
) throws SQLException
140 jniStmt
.setString(param
, value
);
143 public void setTime(int param
, java
.sql
.Time value
) throws SQLException
145 jniStmt
.setTime(param
, value
);
148 public void setTimestamp(int param
, java
.sql
.Timestamp value
) throws SQLException
150 jniStmt
.setTimestamp(param
, value
);
158 public void addBatch() throws SQLException
160 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::addBatch called");
161 throw getException(CSQL_NOT_SUPPORTED
);
163 public void setArray (int i
, Array value
) throws SQLException
165 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setArray called");
166 throw getException(CSQL_NOT_SUPPORTED
);
168 public void setAsciiStream(int parameterIndex
, InputStream value
, int length
)
171 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setAsciiStream called");
172 throw getException(CSQL_NOT_SUPPORTED
);
174 public void setBigDecimal(int parameterIndex
, BigDecimal value
) throws SQLException
176 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBigDecimal called");
177 throw getException(CSQL_NOT_SUPPORTED
);
179 public void setBinaryStream(int parameterIndex
, InputStream value
, int length
)
182 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBinaryStream called");
183 throw getException(CSQL_NOT_SUPPORTED
);
185 public void setBlob(int i
, Blob value
) throws SQLException
187 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBlob called");
188 throw getException(CSQL_NOT_SUPPORTED
);
190 public void setBoolean (int param
, boolean value
) throws SQLException
192 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBoolean called");
193 throw getException(CSQL_NOT_SUPPORTED
);
195 public void setBytes(int param
, byte value
[]) throws SQLException
197 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBytes called");
198 throw getException(CSQL_NOT_SUPPORTED
);
200 public void setCharacterStream(int param
, Reader reader
, int length
)
203 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setCharacterStream called");
204 throw getException(CSQL_NOT_SUPPORTED
);
206 public void setClob (int i
, Clob value
) throws SQLException
208 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setClob called");
209 throw getException(CSQL_NOT_SUPPORTED
);
211 public void setDate(int param
, java
.sql
.Date value
, Calendar cal
)
214 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setDate called");
215 throw getException(CSQL_NOT_SUPPORTED
);
217 public void setNull (int param
, int sqlType
, String typeName
)
220 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setNull called");
221 throw getException(CSQL_NOT_SUPPORTED
);
223 public void setObject (int param
, Object value
, int targetSqlType
)
226 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setObject(int, Object, int) called");
227 throw getException(CSQL_NOT_SUPPORTED
);
229 public void setObject (int param
, Object value
, int targetSqlType
, int scale
) throws SQLException
231 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setObject(int, Object, int, int) called");
232 throw getException(CSQL_NOT_SUPPORTED
);
234 public void setRef(int i
, Ref value
) throws SQLException
236 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setRef called");
237 throw getException(CSQL_NOT_SUPPORTED
);
239 public void setTime(int param
, java
.sql
.Time value
, Calendar cal
)
242 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setTime called");
243 throw getException(CSQL_NOT_SUPPORTED
);
245 public void setTimestamp(int param
, java
.sql
.Timestamp value
,
246 Calendar cal
) throws SQLException
248 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setTimeStamp called");
249 throw getException(CSQL_NOT_SUPPORTED
);
251 public void setUnicodeStream (int param
, InputStream value
, int length
)
254 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setUnicodeStream called");
255 throw getException(CSQL_NOT_SUPPORTED
);
257 public void setURL(int parameterName
, URL value
) throws SQLException
259 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setURL called");
260 throw getException(CSQL_NOT_SUPPORTED
);
263 public void setBlob(int paramIndex
, InputStream value
) throws SQLException
265 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBlob(int, InputStream) called");
266 throw getException(CSQL_NOT_SUPPORTED
);
268 public void setBlob(int paramIndex
, InputStream value
, long length
) throws SQLException
270 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBlob(int, InputStream, long) called");
271 throw getException(CSQL_NOT_SUPPORTED
);
273 public void setClob(int paramIndex
, Reader value
) throws SQLException
275 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setClob(int, Reader) called");
276 throw getException(CSQL_NOT_SUPPORTED
);
278 public void setClob(int paramIndex
, Reader value
, long length
) throws SQLException
280 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setClob(int, Reader, long) called");
281 throw getException(CSQL_NOT_SUPPORTED
);
283 public void setNCharacterStream(int paramIndex
, Reader value
)
286 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setNCharacterStream(int, Reader) called");
287 throw getException(CSQL_NOT_SUPPORTED
);
289 public void setNCharacterStream(int paramIndex
,Reader value
,long length
)
292 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setNCharacterStream(int, Reader, long) called");
293 throw getException(CSQL_NOT_SUPPORTED
);
295 public void setNClob(int paramIndex
, NClob value
)
298 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setNClob(int, NClob) called");
299 throw getException(CSQL_NOT_SUPPORTED
);
301 public void setNClob(int paramIndex
, Reader value
)
304 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setNClob(int, Reader) called");
305 throw getException(CSQL_NOT_SUPPORTED
);
307 public void setNClob(int paramIndex
, Reader value
, long length
)
310 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setNClob(int, Reader, long) called");
311 throw getException(CSQL_NOT_SUPPORTED
);
313 public void setNString(int paramIndex
, String value
)
316 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setNString called");
317 throw getException(CSQL_NOT_SUPPORTED
);
319 public void setCharacterStream(int param
, Reader reader
)
322 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setCharacterStream(int, Reader) called");
323 throw getException(CSQL_NOT_SUPPORTED
);
325 public void setCharacterStream(int param
, Reader reader
, long length
)
328 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setCharacterStream(int, Reader, long) called");
329 throw getException(CSQL_NOT_SUPPORTED
);
331 public void setBinaryStream(int parameterIndex
, InputStream value
)
334 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBinaryStream(int, InputStream) called");
335 throw getException(CSQL_NOT_SUPPORTED
);
337 public void setBinaryStream(int parameterIndex
, InputStream value
, long length
)
340 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setBinaryStream(int, InputStream, long) called");
341 throw getException(CSQL_NOT_SUPPORTED
);
343 public void setAsciiStream(int parameterIndex
, InputStream value
)
346 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setAsciiStream(int, InputStream) called");
347 throw getException(CSQL_NOT_SUPPORTED
);
349 public void setAsciiStream(int parameterIndex
, InputStream value
, long length
)
352 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setAsciiStream(int, InputStream, long) called");
353 throw getException(CSQL_NOT_SUPPORTED
);
355 public void setSQLXML(int paramIndex
, SQLXML xmlObj
) throws SQLException
357 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setSQLXML called");
358 throw getException(CSQL_NOT_SUPPORTED
);
360 public void setRowId(int paramIndex
, RowId x
) throws SQLException
362 if (JSqlError
.isDebug
) System
.out
.println("JdbcSqlPreparedStatement::setRowId called");
363 throw getException(CSQL_NOT_SUPPORTED
);