クラス org.objectweb.cjdbc.driver.PreparedStatement

org.objectweb.cjdbc.driver.PreparedStatementに対する継承グラフ

Inheritance graph
[凡例]
org.objectweb.cjdbc.driver.PreparedStatementのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

説明

A SQL Statement is pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.

Note: The setXXX methods for setting IN parameter values must specify types that are compatible with the defined SQL type of the input parameter. For instance, if the IN parameter has SQL type Integer, then setInt should be used.

If arbitrary parameter type conversions are required, then the setObject method should be used with a target SQL type.

For instance, this is just a dirty copy/paste from the PostgreSQL driver ! Implementation has to be completly checked and revised.

参照:
DriverResultSet

java.sql.PreparedStatement

作者:
Emmanuel Cecchet

Nicolas Modrzyk

Marc Wick

バージョン:
1.0

PreparedStatement.java68 行で定義されています。

Public メソッド

 PreparedStatement (Connection connection, String sqlStatement) throws SQLException
void close () throws SQLException
java.sql.ResultSet executeQuery () throws SQLException
int executeUpdate () throws SQLException
void setNull (int parameterIndex, int sqlType) throws SQLException
void setBoolean (int parameterIndex, boolean x) throws SQLException
void setByte (int parameterIndex, byte x) throws SQLException
void setShort (int parameterIndex, short x) throws SQLException
void setInt (int parameterIndex, int x) throws SQLException
void setLong (int parameterIndex, long x) throws SQLException
void setFloat (int parameterIndex, float x) throws SQLException
void setDouble (int parameterIndex, double x) throws SQLException
void setBigDecimal (int parameterIndex, BigDecimal x) throws SQLException
void setBlob (int parameterIndex, java.sql.Blob x) throws SQLException
void setString (int parameterIndex, String x) throws SQLException
void setBytes (int parameterIndex, byte x[]) throws SQLException
void setDate (int parameterIndex, java.sql.Date x) throws SQLException
void setTime (int parameterIndex, Time x) throws SQLException
void setTimestamp (int parameterIndex, Timestamp x) throws SQLException
void setAsciiStream (int parameterIndex, InputStream x, int length) throws SQLException
void setUnicodeStream (int parameterIndex, InputStream x, int length) throws SQLException
void setBinaryStream (int parameterIndex, InputStream x, int length) throws SQLException
void clearParameters () throws SQLException
void setObject (int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
void setObject (int parameterIndex, Object x, int targetSqlType) throws SQLException
void setObject (int parameterIndex, Object x) throws SQLException
boolean execute () throws SQLException
String toString ()
void addBatch () throws SQLException
java.sql.ResultSetMetaData getMetaData () throws SQLException
void setArray (int i, Array x) throws SQLException
void setBlob (int i, Blob x) throws SQLException
void setCharacterStream (int i, java.io.Reader x, int length) throws SQLException
void setClob (int i, Clob x) throws SQLException
void setNull (int i, int t, String s) throws SQLException
void setRef (int i, Ref x) throws SQLException
void setDate (int i, java.sql.Date d, java.util.Calendar cal) throws SQLException
void setTime (int i, Time t, java.util.Calendar cal) throws SQLException
void setTimestamp (int i, Timestamp t, java.util.Calendar cal) throws SQLException
void setURL (int parameterIndex, java.net.URL x) throws SQLException
ParameterMetaData getParameterMetaData () throws SQLException

Protected メソッド

synchronized String compileQuery () throws SQLException
String doEscapeProcessing (String x)
void setGeneratedKeysFlag (int autoGeneratedKeys)

Protected 変数

String sql

Private メソッド

void set (int paramIndex, String s) throws SQLException

Private 変数

String[] templateStrings
String[] inStrings
StringBuffer sbuf = new StringBuffer()


コンストラクタとデストラクタ

org.objectweb.cjdbc.driver.PreparedStatement.PreparedStatement Connection  connection,
String  sqlStatement
throws SQLException
 

Constructor. Splits the SQL statement into segments - separated by the arguments. When we rebuild the thing with the arguments, we can substitute the args and join the whole thing together.

引数:
connection the instanatiating connection
sqlStatement the SQL statement with ? for IN markers
例外:
SQLException if something bad occurs
PreparedStatement.java88 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.clearParameters(), org.objectweb.cjdbc.driver.PreparedStatement.inStrings, org.objectweb.cjdbc.driver.PreparedStatement.sql, と org.objectweb.cjdbc.driver.PreparedStatement.templateStrings.

00090 { 00091 super(connection); 00092 00093 ArrayList v = new ArrayList(); 00094 int lastParmEnd = 0; 00095 00096 this.sql = sqlStatement.trim(); 00097 this.connection = connection; 00098 for (int i = 0; i < sql.length(); ++i) 00099 { 00100 if (sql.charAt(i) == '?') 00101 { 00102 v.add(sql.substring(lastParmEnd, i)); 00103 lastParmEnd = i + 1; 00104 } 00105 } 00106 v.add(sql.substring(lastParmEnd, sql.length())); 00107 00108 int size = v.size(); 00109 templateStrings = new String[size]; 00110 inStrings = new String[size - 1]; 00111 clearParameters(); 00112 00113 for (int i = 0; i < size; ++i) 00114 templateStrings[i] = (String) v.get(i); 00115 }


メソッド

void org.objectweb.cjdbc.driver.PreparedStatement.addBatch  )  throws SQLException
 

This parses the query and adds it to the current batch

例外:
SQLException if an error occurs
PreparedStatement.java769 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.compileQuery().

00770 { 00771 super.addBatch(compileQuery()); 00772 }

void org.objectweb.cjdbc.driver.PreparedStatement.clearParameters  )  throws SQLException
 

In general, parameter values remain in force for repeated used of a Statement. Setting a parameter value automatically clears its previous value. However, in coms cases, it is useful to immediately release the resources used by the current parameter values; this can be done by calling clearParameters().

例外:
SQLException if a database access error occurs
PreparedStatement.java553 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.inStrings.

参照元 org.objectweb.cjdbc.driver.PreparedStatement.PreparedStatement().

00554 { 00555 int i; 00556 00557 for (i = 0; i < inStrings.length; i++) 00558 inStrings[i] = null; 00559 }

void org.objectweb.cjdbc.driver.PreparedStatement.close  )  throws SQLException
 

Release objects for garbage collection and call Statement.close().

例外:
SQLException if an error occurs

org.objectweb.cjdbc.driver.Statementを再定義しています。

PreparedStatement.java122 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.inStrings, org.objectweb.cjdbc.driver.PreparedStatement.sql, と org.objectweb.cjdbc.driver.PreparedStatement.templateStrings.

00123 { 00124 sql = null; 00125 templateStrings = null; 00126 inStrings = null; 00127 00128 super.close(); 00129 }

synchronized String org.objectweb.cjdbc.driver.PreparedStatement.compileQuery  )  throws SQLException [protected]
 

Helper - this compiles the SQL query from the various parameters This is identical to toString() except it throws an exception if a parameter is unused.

戻り値:
the compiled query
例外:
SQLException if an error occurs
PreparedStatement.java167 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.inStrings, org.objectweb.cjdbc.driver.PreparedStatement.sbuf, と org.objectweb.cjdbc.driver.PreparedStatement.templateStrings.

参照元 org.objectweb.cjdbc.driver.PreparedStatement.addBatch(), org.objectweb.cjdbc.driver.PreparedStatement.execute(), org.objectweb.cjdbc.driver.PreparedStatement.executeQuery(), と org.objectweb.cjdbc.driver.PreparedStatement.executeUpdate().

00168 { 00169 sbuf.setLength(0); 00170 int i; 00171 00172 for (i = 0; i < inStrings.length; ++i) 00173 { 00174 if (inStrings[i] == null) 00175 throw new SQLException("Parameter " + (i + 1) + " is incorrect"); 00176 sbuf.append(templateStrings[i]).append(inStrings[i]); 00177 } 00178 sbuf.append(templateStrings[inStrings.length]); 00179 return sbuf.toString(); 00180 }

String org.objectweb.cjdbc.driver.PreparedStatement.doEscapeProcessing String  x  )  [protected]
 

Escape the input string.
<char>' </char> is replaced by <char>\' </char>
<char>\ </char> is replaced by <char>\' </char>
if connection.escapeProcessing is set to true, surround the new string with <char>\' </char>

引数:
x the string to process
戻り値:
escaped string
PreparedStatement.java358 行で定義されています。

参照先 org.objectweb.cjdbc.driver.Connection.getEscapeChar(), org.objectweb.cjdbc.driver.Connection.isEscapeBackslash(), org.objectweb.cjdbc.driver.Connection.isEscapeSingleQuote(), と org.objectweb.cjdbc.driver.PreparedStatement.sbuf.

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setString().

00359 { 00360 // use the shared buffer object. Should never clash but this 00361 // makes us thread safe! 00362 synchronized (sbuf) 00363 { 00364 sbuf.setLength(0); 00365 int i; 00366 sbuf.append(connection.getEscapeChar()); 00367 for (i = 0; i < x.length(); ++i) 00368 { 00369 char c = x.charAt(i); 00370 if ((c == '\'' && connection.isEscapeSingleQuote()) 00371 || (c == '\\' && connection.isEscapeBackslash())) 00372 sbuf.append("" + c); 00373 sbuf.append(c); 00374 } 00375 sbuf.append(connection.getEscapeChar()); 00376 } 00377 return sbuf.toString(); 00378 }

boolean org.objectweb.cjdbc.driver.PreparedStatement.execute  )  throws SQLException
 

Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery() and executeUpdate().

戻り値:
true if the next result is a ResultSet; false if it is an update count or there are no more results
例外:
SQLException if a database access error occurs
PreparedStatement.java728 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.compileQuery().

00729 { 00730 return super.execute(compileQuery()); // in Statement class 00731 }

java.sql.ResultSet org.objectweb.cjdbc.driver.PreparedStatement.executeQuery  )  throws SQLException
 

A Prepared SQL query is executed and its ResultSet is returned.

戻り値:
a ResultSet that contains the data produced by the * query - never null.
例外:
SQLException if a database access error occurs
PreparedStatement.java139 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.compileQuery(), と org.objectweb.cjdbc.driver.PreparedStatement.sql.

00140 { 00141 return super.executeQuery(sql, compileQuery()); // in Statement class 00142 }

int org.objectweb.cjdbc.driver.PreparedStatement.executeUpdate  )  throws SQLException
 

Execute a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing such as SQL DDL statements can be executed.

戻り値:
either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing.
例外:
SQLException if a database access error occurs
PreparedStatement.java153 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.compileQuery(), と org.objectweb.cjdbc.driver.PreparedStatement.sql.

00154 { 00155 return super.executeUpdateWithSkeleton(sql, compileQuery()); 00156 // in Statement class 00157 }

java.sql.ResultSetMetaData org.objectweb.cjdbc.driver.PreparedStatement.getMetaData  )  throws SQLException
 

Returns the MetaData for the last ResultSet returned.

戻り値:
The ResultSet Metadata
例外:
SQLException if an error occurs
PreparedStatement.java781 行で定義されています。

参照先 org.objectweb.cjdbc.driver.Statement.getResultSet().

00782 { 00783 java.sql.ResultSet rs = getResultSet(); 00784 if (rs != null) 00785 return rs.getMetaData(); 00786 00787 // Does anyone really know what this method does? 00788 return null; 00789 }

ParameterMetaData org.objectweb.cjdbc.driver.PreparedStatement.getParameterMetaData  )  throws SQLException
 

Retrieves the number, types and properties of this PreparedStatement object's parameters.

戻り値:
a ParameterMetaData object that contains information about the number, types and properties of this PreparedStatement object's parameters
例外:
SQLException if a database access error occurs
参照:
ParameterMetaData
から:
JDK 1.4
PreparedStatement.java952 行で定義されています。
00953 { 00954 throw new NotImplementedException("getParameterMetaData"); 00955 }

void org.objectweb.cjdbc.driver.PreparedStatement.set int  paramIndex,
String  s
throws SQLException [private]
 

There are a lot of setXXX classes which all basically do the same thing. We need a method which actually does the set for us.

引数:
paramIndex the index into the inString
s a string to be stored
例外:
SQLException if something goes wrong
PreparedStatement.java969 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.inStrings.

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setBigDecimal(), org.objectweb.cjdbc.driver.PreparedStatement.setBlob(), org.objectweb.cjdbc.driver.PreparedStatement.setBoolean(), org.objectweb.cjdbc.driver.PreparedStatement.setByte(), org.objectweb.cjdbc.driver.PreparedStatement.setBytes(), org.objectweb.cjdbc.driver.PreparedStatement.setClob(), org.objectweb.cjdbc.driver.PreparedStatement.setDate(), org.objectweb.cjdbc.driver.PreparedStatement.setDouble(), org.objectweb.cjdbc.driver.PreparedStatement.setFloat(), org.objectweb.cjdbc.driver.PreparedStatement.setInt(), org.objectweb.cjdbc.driver.PreparedStatement.setLong(), org.objectweb.cjdbc.driver.PreparedStatement.setNull(), org.objectweb.cjdbc.driver.PreparedStatement.setObject(), org.objectweb.cjdbc.driver.PreparedStatement.setShort(), org.objectweb.cjdbc.driver.PreparedStatement.setString(), org.objectweb.cjdbc.driver.PreparedStatement.setTime(), と org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp().

00970 { 00971 if (paramIndex < 1 || paramIndex > inStrings.length) 00972 throw new SQLException("Parameter index out of range."); 00973 inStrings[paramIndex - 1] = s; 00974 }

void org.objectweb.cjdbc.driver.PreparedStatement.setArray int  i,
Array  x
throws SQLException
 

参照:
java.sql.PreparedStatement#setArray(int, java.sql.Array)
PreparedStatement.java794 行で定義されています。
00795 { 00796 throw new NotImplementedException("setArray()"); 00797 }

void org.objectweb.cjdbc.driver.PreparedStatement.setAsciiStream int  parameterIndex,
InputStream  x,
int  length
throws SQLException
 

When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from ASCII to the database char format.

Note: this stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

引数:
parameterIndex the first parameter is 1...
x the parameter value
length the number of bytes in the stream
例外:
SQLException if a database access error occurs
PreparedStatement.java487 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.setBinaryStream().

00489 { 00490 setBinaryStream(parameterIndex, x, length); 00491 }

void org.objectweb.cjdbc.driver.PreparedStatement.setBigDecimal int  parameterIndex,
BigDecimal  x
throws SQLException
 

Sets a parameter to a java.lang.BigDecimal value. The driver converts this to a SQL NUMERIC value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java298 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00300 { 00301 if (x == null) 00302 set(parameterIndex, "null"); 00303 else 00304 set(parameterIndex, x.toString()); 00305 }

void org.objectweb.cjdbc.driver.PreparedStatement.setBinaryStream int  parameterIndex,
InputStream  x,
int  length
throws SQLException
 

When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

引数:
parameterIndex the first parameter is 1...
x the parameter value
length the parameter length
例外:
SQLException if a database access error occurs
PreparedStatement.java529 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.setBytes().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setAsciiStream(), org.objectweb.cjdbc.driver.PreparedStatement.setBlob(), と org.objectweb.cjdbc.driver.PreparedStatement.setUnicodeStream().

00531 { 00532 byte[] data = new byte[length]; 00533 try 00534 { 00535 x.read(data, 0, length); 00536 } 00537 catch (Exception ioe) 00538 { 00539 throw new SQLException("Problem with streaming of data"); 00540 } 00541 setBytes(parameterIndex, data); 00542 }

void org.objectweb.cjdbc.driver.PreparedStatement.setBlob int  i,
Blob  x
throws SQLException
 

参照:
java.sql.PreparedStatement#setBlob(int, java.sql.Blob)
PreparedStatement.java802 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), と org.objectweb.cjdbc.driver.PreparedStatement.setBinaryStream().

00803 { 00804 if (x == null) 00805 set(i, "null"); 00806 else 00807 setBinaryStream(i, x.getBinaryStream(), (int) x.length()); 00808 }

void org.objectweb.cjdbc.driver.PreparedStatement.setBlob int  parameterIndex,
java.sql.Blob  x
throws SQLException
 

Sets a parameter to a java.sql.Blob value.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java314 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), と org.objectweb.cjdbc.driver.PreparedStatement.setBytes().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00315 { 00316 if (x == null) 00317 set(parameterIndex, "null"); 00318 else 00319 setBytes(parameterIndex, x.getBytes(1, (int) x.length())); 00320 }

void org.objectweb.cjdbc.driver.PreparedStatement.setBoolean int  parameterIndex,
boolean  x
throws SQLException
 

Sets a parameter to a Java boolean value. The driver converts this to a SQL BIT value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java205 行で定義されています。

参照先 org.objectweb.cjdbc.driver.Connection.getPreparedStatementBooleanFalse(), org.objectweb.cjdbc.driver.Connection.getPreparedStatementBooleanTrue(), と org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00206 { 00207 set(parameterIndex, x 00208 ? connection.getPreparedStatementBooleanTrue() 00209 : connection.getPreparedStatementBooleanFalse()); 00210 }

void org.objectweb.cjdbc.driver.PreparedStatement.setByte int  parameterIndex,
byte  x
throws SQLException
 

Sets a parameter to a Java byte value. The driver converts this to a SQL TINYINT value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java220 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

00221 { 00222 set(parameterIndex, Integer.toString(x)); 00223 }

void org.objectweb.cjdbc.driver.PreparedStatement.setBytes int  parameterIndex,
byte  x[]
throws SQLException
 

Sets a parameter to a Java array of bytes. The driver converts this to a SQL VARBINARY or LONGVARBINARY (depending on the argument's size relative to the driver's limits on VARBINARYs) when it sends it to the database.

Implementation note: with org.postgresql, this creates a large object, and stores the objects oid in this column.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java392 行で定義されています。

参照先 org.objectweb.cjdbc.driver.Connection.escapeChar, org.objectweb.cjdbc.driver.Connection.getBlobFilter(), org.objectweb.cjdbc.driver.PreparedStatement.sbuf, と org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setBinaryStream(), org.objectweb.cjdbc.driver.PreparedStatement.setBlob(), org.objectweb.cjdbc.driver.PreparedStatement.setCharacterStream(), と org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00393 { 00394 String blob; 00395 try 00396 { 00397 blob = connection.getBlobFilter().encode(x); 00398 synchronized (sbuf) 00399 { 00400 sbuf.setLength(0); 00401 sbuf.append(connection.escapeChar); 00402 sbuf.append(blob); 00403 sbuf.append(connection.escapeChar); 00404 set(parameterIndex, sbuf.toString()); 00405 00406 } 00407 } 00408 catch (OutOfMemoryError oome) 00409 { 00410 blob = null; 00411 sbuf = null; 00412 System.gc(); 00413 throw new SQLException("Out of memory"); 00414 } 00415 }

void org.objectweb.cjdbc.driver.PreparedStatement.setCharacterStream int  i,
java.io.Reader  x,
int  length
throws SQLException
 

参照:
java.sql.PreparedStatement#setCharacterStream(int, java.io.Reader, int)
PreparedStatement.java814 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.setBytes().

00816 { 00817 byte[] data = new byte[length]; 00818 try 00819 { 00820 for (int j = 0; j < length; j++) 00821 { 00822 data[j] = (byte) x.read(); 00823 } 00824 } 00825 catch (Exception ioe) 00826 { 00827 throw new SQLException("Problem with streaming of data"); 00828 } 00829 setBytes(i, data); 00830 }

void org.objectweb.cjdbc.driver.PreparedStatement.setClob int  i,
Clob  x
throws SQLException
 

参照:
java.sql.PreparedStatement#setClob(int, java.sql.Clob)
PreparedStatement.java835 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), と org.objectweb.cjdbc.driver.PreparedStatement.setString().

00836 { 00837 if (x == null) 00838 set(i, "null"); 00839 else 00840 setString(i, x.getSubString(0, (int) x.length())); 00841 }

void org.objectweb.cjdbc.driver.PreparedStatement.setDate int  i,
java.sql.Date  d,
java.util.Calendar  cal
throws SQLException
 

参照:
java.sql.PreparedStatement#setDate(int, java.sql.Date, java.util.Calendar)
PreparedStatement.java863 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), と org.objectweb.cjdbc.driver.PreparedStatement.setDate().

00865 { 00866 if (d == null) 00867 { 00868 set(i, "null"); 00869 } 00870 else 00871 { 00872 if (cal == null) 00873 setDate(i, d); 00874 else 00875 { 00876 cal.setTime(d); 00877 setDate(i, new java.sql.Date(cal.getTime().getTime())); 00878 } 00879 } 00880 }

void org.objectweb.cjdbc.driver.PreparedStatement.setDate int  parameterIndex,
java.sql.Date  x
throws SQLException
 

Sets a parameter to a java.sql.Date value. The driver converts this to a SQL DATE value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java425 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setDate(), と org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00426 { 00427 if (x == null) 00428 set(parameterIndex, "null"); 00429 else 00430 set(parameterIndex, "'" + new java.sql.Date(x.getTime()).toString() + "'"); 00431 }

void org.objectweb.cjdbc.driver.PreparedStatement.setDouble int  parameterIndex,
double  x
throws SQLException
 

Sets a parameter to a Java double value. The driver converts this to a SQL DOUBLE value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java285 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00286 { 00287 set(parameterIndex, Double.toString(x)); 00288 }

void org.objectweb.cjdbc.driver.PreparedStatement.setFloat int  parameterIndex,
float  x
throws SQLException
 

Sets a parameter to a Java float value. The driver converts this to a SQL FLOAT value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java272 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00273 { 00274 set(parameterIndex, Float.toString(x)); 00275 }

void org.objectweb.cjdbc.driver.PreparedStatement.setGeneratedKeysFlag int  autoGeneratedKeys  )  [protected]
 

Set the auto generated key flag defined in Statement

引数:
autoGeneratedKeys usually Statement.RETURN_GENERATED_KEYS
参照:
Connection.prepareStatement(String, int)
PreparedStatement.java983 行で定義されています。

参照元 org.objectweb.cjdbc.driver.Connection.prepareStatement().

00984 { 00985 generatedKeysFlag = autoGeneratedKeys; 00986 }

void org.objectweb.cjdbc.driver.PreparedStatement.setInt int  parameterIndex,
int  x
throws SQLException
 

Sets a parameter to a Java int value. The driver converts this to a SQL INTEGER value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java246 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00247 { 00248 set(parameterIndex, Integer.toString(x)); 00249 }

void org.objectweb.cjdbc.driver.PreparedStatement.setLong int  parameterIndex,
long  x
throws SQLException
 

Sets a parameter to a Java long value. The driver converts this to a SQL BIGINT value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java259 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00260 { 00261 set(parameterIndex, Long.toString(x)); 00262 }

void org.objectweb.cjdbc.driver.PreparedStatement.setNull int  i,
int  t,
String  s
throws SQLException
 

参照:
java.sql.PreparedStatement#setNull(int, int, java.lang.String)
PreparedStatement.java846 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.setNull().

00847 { 00848 setNull(i, t); 00849 }

void org.objectweb.cjdbc.driver.PreparedStatement.setNull int  parameterIndex,
int  sqlType
throws SQLException
 

Sets a parameter to SQL NULL.

Note: you must specify the parameters SQL type (although PostgreSQL ignores it)

引数:
parameterIndex the first parameter is 1, etc...
sqlType the SQL type code defined in java.sql.Types
例外:
SQLException if a database access error occurs
PreparedStatement.java192 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setNull(), と org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00193 { 00194 set(parameterIndex, "null"); 00195 }

void org.objectweb.cjdbc.driver.PreparedStatement.setObject int  parameterIndex,
Object  x
throws SQLException
 

This stores an Object into a parameter.

引数:
parameterIndex the first parameter is 1...
x the object to set
例外:
SQLException if a database access error occurs
PreparedStatement.java659 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), org.objectweb.cjdbc.driver.PreparedStatement.setBigDecimal(), org.objectweb.cjdbc.driver.PreparedStatement.setBlob(), org.objectweb.cjdbc.driver.PreparedStatement.setBoolean(), org.objectweb.cjdbc.driver.PreparedStatement.setBytes(), org.objectweb.cjdbc.driver.PreparedStatement.setDate(), org.objectweb.cjdbc.driver.PreparedStatement.setDouble(), org.objectweb.cjdbc.driver.PreparedStatement.setFloat(), org.objectweb.cjdbc.driver.PreparedStatement.setInt(), org.objectweb.cjdbc.driver.PreparedStatement.setLong(), org.objectweb.cjdbc.driver.PreparedStatement.setShort(), org.objectweb.cjdbc.driver.PreparedStatement.setString(), org.objectweb.cjdbc.driver.PreparedStatement.setTime(), org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp(), と org.objectweb.cjdbc.driver.PreparedStatement.setURL().

00660 { 00661 if (x == null) 00662 set(parameterIndex, "null"); 00663 else 00664 { 00665 if (x instanceof String) 00666 setString(parameterIndex, (String) x); 00667 else if (x instanceof BigDecimal) 00668 setBigDecimal(parameterIndex, (BigDecimal) x); 00669 else if (x instanceof Short) 00670 setShort(parameterIndex, ((Short) x).shortValue()); 00671 else if (x instanceof Integer) 00672 setInt(parameterIndex, ((Integer) x).intValue()); 00673 else if (x instanceof Long) 00674 setLong(parameterIndex, ((Long) x).longValue()); 00675 else if (x instanceof Float) 00676 setFloat(parameterIndex, ((Float) x).floatValue()); 00677 else if (x instanceof Double) 00678 setDouble(parameterIndex, ((Double) x).doubleValue()); 00679 else if (x instanceof byte[]) 00680 setBytes(parameterIndex, (byte[]) x); 00681 else if (x instanceof java.sql.Date) 00682 setDate(parameterIndex, (java.sql.Date) x); 00683 else if (x instanceof Time) 00684 setTime(parameterIndex, (Time) x); 00685 else if (x instanceof Timestamp) 00686 setTimestamp(parameterIndex, (Timestamp) x); 00687 else if (x instanceof Boolean) 00688 setBoolean(parameterIndex, ((Boolean) x).booleanValue()); 00689 else if (x instanceof Blob) 00690 setBlob(parameterIndex, (Blob) x); 00691 else if (x instanceof java.net.URL) 00692 setURL(parameterIndex, (java.net.URL) x); 00693 else if (x instanceof Serializable) 00694 { 00695 ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); 00696 00697 try 00698 { 00699 // Serialize object to byte array 00700 ObjectOutputStream objectOutputStream = new ObjectOutputStream( 00701 byteOutputStream); 00702 objectOutputStream.writeObject(x); 00703 objectOutputStream.flush(); 00704 objectOutputStream.close(); 00705 setBytes(parameterIndex, byteOutputStream.toByteArray()); 00706 } 00707 catch (IOException e) 00708 { 00709 throw new SQLException("Failed to serialize object: " + e); 00710 } 00711 } 00712 else 00713 throw new SQLException("Objects of type " + x.getClass() 00714 + " are not supported."); 00715 } 00716 }

void org.objectweb.cjdbc.driver.PreparedStatement.setObject int  parameterIndex,
Object  x,
int  targetSqlType
throws SQLException
 

参照:
java.sql.PreparedStatement#setObject(int, java.lang.Object, int)
PreparedStatement.java646 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00648 { 00649 setObject(parameterIndex, x, targetSqlType, 0); 00650 }

void org.objectweb.cjdbc.driver.PreparedStatement.setObject int  parameterIndex,
Object  x,
int  targetSqlType,
int  scale
throws SQLException
 

Sets the value of a parameter using an object; use the java.lang equivalent objects for integral values.

The given Java object will be converted to the targetSqlType before being sent to the database.

Note that this method may be used to pass database-specific abstract data types. This is done by using a Driver-specific Java type and using a targetSqlType of java.sql.Types.OTHER.

引数:
parameterIndex the first parameter is 1...
x the object containing the input parameter value
targetSqlType The SQL type to be send to the database
scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after the decimal. For all other types this value will be ignored.
例外:
SQLException if a database access error occurs
PreparedStatement.java581 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), org.objectweb.cjdbc.driver.PreparedStatement.setBlob(), org.objectweb.cjdbc.driver.PreparedStatement.setBoolean(), org.objectweb.cjdbc.driver.PreparedStatement.setBytes(), org.objectweb.cjdbc.driver.PreparedStatement.setDate(), org.objectweb.cjdbc.driver.PreparedStatement.setNull(), org.objectweb.cjdbc.driver.PreparedStatement.setString(), org.objectweb.cjdbc.driver.PreparedStatement.setTime(), org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp(), と org.objectweb.cjdbc.driver.PreparedStatement.setURL().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00583 { 00584 if (x == null) 00585 { 00586 setNull(parameterIndex, targetSqlType); 00587 } 00588 else 00589 { 00590 switch (targetSqlType) 00591 { 00592 case Types.TINYINT : 00593 case Types.SMALLINT : 00594 case Types.INTEGER : 00595 case Types.BIGINT : 00596 case Types.REAL : 00597 case Types.FLOAT : 00598 case Types.DOUBLE : 00599 case Types.DECIMAL : 00600 case Types.NUMERIC : 00601 // Cast to Number is not necessary 00602 set(parameterIndex, x.toString()); 00603 break; 00604 case Types.BIT : 00605 case Types.BOOLEAN : 00606 setBoolean(parameterIndex, ((Boolean) x).booleanValue()); 00607 break; 00608 case Types.CHAR : 00609 case Types.VARCHAR : 00610 case Types.LONGVARCHAR : 00611 setString(parameterIndex, (String) x); 00612 break; 00613 case Types.BINARY : 00614 case Types.VARBINARY : 00615 case Types.LONGVARBINARY : 00616 setBytes(parameterIndex, (byte[]) x); 00617 break; 00618 case Types.DATE : 00619 setDate(parameterIndex, (java.sql.Date) x); 00620 break; 00621 case Types.TIME : 00622 setTime(parameterIndex, (Time) x); 00623 break; 00624 case Types.TIMESTAMP : 00625 setTimestamp(parameterIndex, (Timestamp) x); 00626 break; 00627 case Types.BLOB : 00628 setBlob(parameterIndex, (Blob) x); 00629 break; 00630 case Types.DATALINK : 00631 setURL(parameterIndex, (java.net.URL) x); 00632 break; 00633 case Types.JAVA_OBJECT : 00634 case Types.OTHER : 00635 setObject(parameterIndex, x); 00636 break; 00637 default : 00638 throw new SQLException("Unsupported type value"); 00639 } 00640 } 00641 }

void org.objectweb.cjdbc.driver.PreparedStatement.setRef int  i,
Ref  x
throws SQLException
 

参照:
java.sql.PreparedStatement#setRef(int, java.sql.Ref)
PreparedStatement.java854 行で定義されています。
00855 { 00856 throw new NotImplementedException("setRef()"); 00857 }

void org.objectweb.cjdbc.driver.PreparedStatement.setShort int  parameterIndex,
short  x
throws SQLException
 

Sets a parameter to a Java short value. The driver converts this to a SQL SMALLINT value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java233 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00234 { 00235 set(parameterIndex, Integer.toString(x)); 00236 }

void org.objectweb.cjdbc.driver.PreparedStatement.setString int  parameterIndex,
String  x
throws SQLException
 

Sets a parameter to a Java String value. The driver converts this to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments size relative to the driver's limits on VARCHARs) when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java331 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.doEscapeProcessing(), org.objectweb.cjdbc.driver.Connection.isEscapeBackslash(), org.objectweb.cjdbc.driver.Connection.isEscapeSingleQuote(), と org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setClob(), と org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00332 { 00333 // if the passed string is null, then set this column to null 00334 if (x == null) 00335 set(parameterIndex, "null"); 00336 else 00337 { 00338 if (escapeProcessing 00339 && (connection.isEscapeBackslash() || connection 00340 .isEscapeSingleQuote())) 00341 set(parameterIndex, doEscapeProcessing(x)); 00342 else 00343 // No escape processing 00344 set(parameterIndex, x); 00345 } 00346 }

void org.objectweb.cjdbc.driver.PreparedStatement.setTime int  i,
Time  t,
java.util.Calendar  cal
throws SQLException
 

参照:
java.sql.PreparedStatement#setTime(int, java.sql.Time, java.util.Calendar)
PreparedStatement.java886 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), と org.objectweb.cjdbc.driver.PreparedStatement.setTime().

00888 { 00889 if (t == null) 00890 set(i, "null"); 00891 else 00892 { 00893 if (cal == null) 00894 setTime(i, t); 00895 else 00896 { 00897 cal.setTime(t); 00898 setTime(i, new java.sql.Time(cal.getTime().getTime())); 00899 } 00900 } 00901 }

void org.objectweb.cjdbc.driver.PreparedStatement.setTime int  parameterIndex,
Time  x
throws SQLException
 

Sets a parameter to a java.sql.Time value. The driver converts this to a SQL TIME value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...));
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java441 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject(), と org.objectweb.cjdbc.driver.PreparedStatement.setTime().

00442 { 00443 if (x == null) 00444 set(parameterIndex, "null"); 00445 else 00446 set(parameterIndex, "{t '" + x.toString() + "'}"); 00447 }

void org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp int  i,
Timestamp  t,
java.util.Calendar  cal
throws SQLException
 

参照:
java.sql.PreparedStatement#setTimestamp(int, java.sql.Timestamp, java.util.Calendar)
PreparedStatement.java907 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set(), と org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp().

00909 { 00910 if (t == null) 00911 set(i, "null"); 00912 else 00913 { 00914 if (cal == null) 00915 setTimestamp(i, t); 00916 else 00917 { 00918 cal.setTime(t); 00919 setTimestamp(i, new java.sql.Timestamp(cal.getTime().getTime())); 00920 } 00921 } 00922 }

void org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp int  parameterIndex,
Timestamp  x
throws SQLException
 

Sets a parameter to a java.sql.Timestamp value. The driver converts this to a SQL TIMESTAMP value when it sends it to the database.

引数:
parameterIndex the first parameter is 1...
x the parameter value
例外:
SQLException if a database access error occurs
PreparedStatement.java457 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.set().

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject(), と org.objectweb.cjdbc.driver.PreparedStatement.setTimestamp().

00458 { 00459 if (x == null) 00460 set(parameterIndex, "null"); 00461 else 00462 { 00463 // Be careful don't use instanceof here since it would match derived 00464 // classes. 00465 if (x.getClass().equals(Timestamp.class)) 00466 set(parameterIndex, "'" + x.toString() + "'"); 00467 else 00468 set(parameterIndex, "'" + new Timestamp(x.getTime()).toString() + "'"); 00469 } 00470 }

void org.objectweb.cjdbc.driver.PreparedStatement.setUnicodeStream int  parameterIndex,
InputStream  x,
int  length
throws SQLException
 

When a very large Unicode value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.

** DEPRECIATED IN JDBC 2 **

Note: this stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

引数:
parameterIndex the first parameter is 1...
x the parameter value
length the parameter length
例外:
SQLException if a database access error occurs
非推奨:
PreparedStatement.java510 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.setBinaryStream().

00512 { 00513 setBinaryStream(parameterIndex, x, length); 00514 }

void org.objectweb.cjdbc.driver.PreparedStatement.setURL int  parameterIndex,
java.net.URL  x
throws SQLException
 

Sets the designated parameter to the given java.net.URL value. The driver converts this to an SQL DATALINK value when it sends it to the database.

引数:
parameterIndex the first parameter is 1, the second is 2, ...
x the java.net.URL object to be set
例外:
SQLException if a database access error occurs
から:
JDK 1.4
PreparedStatement.java936 行で定義されています。

参照元 org.objectweb.cjdbc.driver.PreparedStatement.setObject().

00937 { 00938 throw new NotImplementedException("setURL"); 00939 }

String org.objectweb.cjdbc.driver.PreparedStatement.toString  ) 
 

Returns the SQL statement with the current template values substituted.

Note: : This is identical to compileQuery() except instead of throwing SQLException if a parameter is null, it places ? instead.

戻り値:
the SQL statement
PreparedStatement.java742 行で定義されています。

参照先 org.objectweb.cjdbc.driver.PreparedStatement.inStrings, org.objectweb.cjdbc.driver.PreparedStatement.sbuf, と org.objectweb.cjdbc.driver.PreparedStatement.templateStrings.

00743 { 00744 synchronized (sbuf) 00745 { 00746 sbuf.setLength(0); 00747 int i; 00748 00749 for (i = 0; i < inStrings.length; ++i) 00750 { 00751 if (inStrings[i] == null) 00752 sbuf.append('?'); 00753 else 00754 sbuf.append(templateStrings[i]); 00755 sbuf.append(inStrings[i]); 00756 } 00757 sbuf.append(templateStrings[inStrings.length]); 00758 return sbuf.toString(); 00759 } 00760 }


変数

String [] org.objectweb.cjdbc.driver.PreparedStatement.inStrings [private]
 

PreparedStatement.java74 行で定義されています。

参照元 org.objectweb.cjdbc.driver.PreparedStatement.clearParameters(), org.objectweb.cjdbc.driver.PreparedStatement.close(), org.objectweb.cjdbc.driver.PreparedStatement.compileQuery(), org.objectweb.cjdbc.driver.PreparedStatement.PreparedStatement(), org.objectweb.cjdbc.driver.PreparedStatement.set(), と org.objectweb.cjdbc.driver.PreparedStatement.toString().

StringBuffer org.objectweb.cjdbc.driver.PreparedStatement.sbuf = new StringBuffer() [private]
 

PreparedStatement.java77 行で定義されています。

参照元 org.objectweb.cjdbc.driver.PreparedStatement.compileQuery(), org.objectweb.cjdbc.driver.PreparedStatement.doEscapeProcessing(), org.objectweb.cjdbc.driver.PreparedStatement.setBytes(), と org.objectweb.cjdbc.driver.PreparedStatement.toString().

String org.objectweb.cjdbc.driver.PreparedStatement.sql [protected]
 

PreparedStatement.java72 行で定義されています。

参照元 org.objectweb.cjdbc.driver.PreparedStatement.close(), org.objectweb.cjdbc.driver.PreparedStatement.executeQuery(), org.objectweb.cjdbc.driver.PreparedStatement.executeUpdate(), と org.objectweb.cjdbc.driver.PreparedStatement.PreparedStatement().

String [] org.objectweb.cjdbc.driver.PreparedStatement.templateStrings [private]
 

PreparedStatement.java73 行で定義されています。

参照元 org.objectweb.cjdbc.driver.PreparedStatement.close(), org.objectweb.cjdbc.driver.PreparedStatement.compileQuery(), org.objectweb.cjdbc.driver.PreparedStatement.PreparedStatement(), と org.objectweb.cjdbc.driver.PreparedStatement.toString().


このクラスの説明は次のファイルから生成されました:
CJDBCversion1.0.1に対してWed Aug 18 09:20:33 2004に生成されました。 doxygen 1.3.8