|
Mimer JDBC/MIDP 2.12 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--com.mimer.jdbc.Statement
|
+--com.mimer.jdbc.PreparedStatement
A PreparedStatement contains a pre-compiled SQL statement which may have parameter markers. The statement may be executed several times with different parameters without having to recompile the SQL syntax.
Statements with output parameters may not be executed using this object.
See ResultSet for information on which Mimer SQL
data types may be set with which setter method.
| Method Summary | |
void |
addBatch()
Adds a set of input parameters to a PreparedStatement batch. |
void |
clearBatch()
Clears the current batch. |
void |
clearParameters()
Clears the currently set parameters. |
void |
close()
Closes the PreparedStatement. |
boolean |
execute()
Execute the prepared statement with the current set of parameters. |
int[] |
executeBatch()
Executing the current batch. |
ResultSet |
executeQuery()
Executes a query that returns a result set. |
int |
executeUpdate()
Executes an SQL-statement that don't return a result set. |
ResultSetMetaData |
getMetaData()
Returns a ResultSetMetaData object describing the result sets that will be returned when this object is executed. |
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x,
int length)
Sets the specified parameter to the contents of the supplied stream. |
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x,
int length)
Sets the specified parameter to the contents of the supplied stream. |
void |
setBlob(int parameterIndex,
Blob x)
Set an Blob object. |
void |
setBoolean(int parameterIndex,
boolean x)
Sets a boolean parameter value. |
void |
setByte(int parameterIndex,
byte x)
Sets the specified column to the value of a byte. |
void |
setBytes(int parameterIndex,
byte[] x)
|
void |
setCharacterStream(int parameterIndex,
java.io.Reader x,
int length)
Sets the specified column to the contents of the supplied stream. |
void |
setClob(int parameterIndex,
Clob x)
Set a Clob object. |
void |
setInt(int parameterIndex,
int x)
Sets the specified column to the value of a int. |
void |
setLong(int parameterIndex,
long x)
Sets the specified column to the value of a long. |
void |
setNull(int parameterIndex,
int sqlType)
Set a parameter to null. |
void |
setNull(int parameterIndex,
int sqlType,
java.lang.String typeName)
Set a parameter to null. |
void |
setObject(int parameterIndex,
java.lang.Object x)
Sets the specified column to the value of a Object. |
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType)
Sets the specified column to the value of a Object. |
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
int scale)
Sets the specified column to the value of a Object. |
void |
setShort(int parameterIndex,
short x)
Sets the specified column to the value of a short. |
void |
setString(int parameterIndex,
java.lang.String x)
Sets the specified column to the value of string. |
| Methods inherited from class com.mimer.jdbc.Statement |
addBatch, cancel, clearWarnings, execute, executeQuery, executeUpdate, getConnection, getFetchDirection, getFetchSize, getMaxFieldSize, getMaxRows, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetType, getUpdateCount, getWarnings, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setQueryTimeout |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public void addBatch()
throws SQLException
See Statement.addBatch for a discussion on the difference between Statement batches
and PreparedStatement batches.
SQLException - if an error occurs. If the PreparedStatement object is not open, SQLSTATE HY010 is thrown. HY010 is also thrown
when the PreparedStatement is not an INSERT, UPDATE or DELETE SQL statement.executeBatch()
public void clearBatch()
throws SQLException
clearBatch in class StatementSQLException - if an error occurs. If the Statement object is closed, SQLSTATE HY010 is thrown.addBatch(java.lang.String),
executeBatch()
public void clearParameters()
throws SQLException
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the PreparedStatement wasn't open.
public void close()
throws SQLException
PreparedStatement.
close in class StatementSQLException - if an error occurs.
public boolean execute()
throws SQLException
getResultSet method to obtain the ResultSet object.
SQLException - if an error occurs. HY010 is thrown if the statement is not open, or if there where batches added to this PreparedStatement. HY000 is thrown if the statement contains parameter markers, in this case you must use a PreparedStatement object instead. HY000 may also be thrown when the SQL statement was not supported by the driver, see Statement for an overview on which statements that are not supported and why. 42000 is thrown if the SQL contained a syntax error. 34000 is thrown if a UPDATE/DELETE WHERE CURRENT OF specified a cursor that doesn't exist. S1008 is thrown if the execution is cancelled.executeUpdate(java.lang.String),
executeQuery(java.lang.String),
Statement.getResultSet()
public int[] executeBatch()
throws SQLException
executeBatch in class StatementSQLException - if an error occurs. If the PreparedStatement object is not open, SQLSTATE HY010 is thrown. This call may execute a lot
of server side code and may return any server runtime error. S1008 is thrown if the execution is cancelled.addBatch(java.lang.String)
public ResultSet executeQuery()
throws SQLException
SQLException - if an error occurs. HY010 is thrown if the statement is not open. HY000 is thrown if the statement contains parameter markers, in this case you must use a PreparedStatement object instead. HY000 may also be thrown when the SQL statement was not supported by the driver, see Statement for an overview on which statements that are not supported and why. 42000 is thrown if the SQL contained a syntax error or the statement wasn't a query. 34000 is thrown if a UPDATE/DELETE WHERE CURRENT OF specified a cursor that doesn't exist. S1008 is thrown if the execution is cancelled.executeUpdate(java.lang.String),
execute(java.lang.String)
public int executeUpdate()
throws SQLException
SQLException - if an error occurs. HY010 is thrown if the statement is not open. HY000 is thrown if the statement contains parameter markers, in this case you must use a PreparedStatement object instead. HY000 may also be thrown when the SQL statement was not supported by the driver, see Statement for an overview on which statements that are not supported and why. 42000 is thrown if the SQL contained a syntax error or the statement was a query. 34000 is thrown if a UPDATE/DELETE WHERE CURRENT OF specified a cursor that doesn't exist. S1008 is thrown if the execution is cancelled.executeQuery(java.lang.String),
execute(java.lang.String)
public ResultSetMetaData getMetaData()
throws SQLException
A ResultSetMetaData object is always internally created at the same time the PreparedStatement object is created.
This method simply returns this object.
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the cursor is not open.
public void setAsciiStream(int parameterIndex,
java.io.InputStream x,
int length)
throws SQLException
parameterIndex - The parameter number.x - The data.length - The length of the data. This is ignored for all parameter types except
CLOB:s. When inserting CLOB data, the server want to know the length of the data in
advance. There is no way to use this method to insert CLOB:s larger than 2 GB. To insert
larger CLOB:s, use Clob objects instead which from JDBC 3 includes methods for this.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22001 if the stream was shorter than specified. HY000 if there was a read eror in the supplied InputStream.
DataTruncation - if the input stream was longer than the parameter could hold.
public void setBinaryStream(int parameterIndex,
java.io.InputStream x,
int length)
throws SQLException
parameterIndex - The parameter number.x - The data.length - The length of the data in bytes. This is ignored for all parameter types except
BLOB:s. When inserting BLOB data, the server want to know the length of the data in
advance. There is no way to use this method to insert BLOB:s larger than 2 GB. To insert
larger BLOB:s, use Blob objects instead which from JDBC 3 includes methods for this.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22001 if the stream was shorter than specified. HY000 if there was a read eror in the supplied InputStream.
DataTruncation - if the input stream was longer than the parameter could hold.
public void setBlob(int parameterIndex,
Blob x)
throws SQLException
parameterIndex - The column index.x - The Blob object.
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the PreparedStatement is not open. 07009 is thrown if the parameterIndex is not valid. 2200G is thrown if the column type wasn't castable from a Blob object, see {link ResultSet} for an overview of which Java types are castable to which SQL types.
public void setBoolean(int parameterIndex,
boolean x)
throws SQLException
Mimer SQL does not support a SQL BOOLEAN data type. When the setBoolean is used to set parameter values, the following values will be used:
| true | false | |
| character data types | "true" | "false" |
| numerical data types | 1 | 0 |
parameterIndex - The parameter number.x - The boolean value.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22003 if the server data type was a numeric data type and the value was larger than the data type could hold. 22001 if the server data type was a character string and the value could not be fitted into the string.
public void setByte(int parameterIndex,
byte x)
throws SQLException
parameterIndex - The parameter number.x - The byte.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22003 if the server data type was a numeric data type and the value was larger than the data type could hold. 22001 if the server data type was a character string and the value could not be fitted into the string.
public void setBytes(int parameterIndex,
byte[] x)
throws SQLException
SQLException
public void setCharacterStream(int parameterIndex,
java.io.Reader x,
int length)
throws SQLException
If the parameter type is a latin1-based character string and the stream contains characters that cannot be converted to a latin1 (ISO 8859-1) based string, an SQLException is thrown.
parameterIndex - The parameter number.x - The data.length - The length of the input stream in characters. This is ignored for all parameter types except
CLOB:s. When inserting CLOB data, the server want to know the length of the data in
advance. There is no way to use this method to insert CLOB:s larger than 2 GB. JDBC 3 offers a
a way to work with objects larger than 2 GB through the Clob object.
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the PreparedStatement is not open. 07009 is thrown if the parameterIndex is not valid. 2200G is thrown if the column type wasn't castable from a character stream, see {link ResultSet} for an overview of which Java types are castable to which SQL types.
public void setClob(int parameterIndex,
Clob x)
throws SQLException
parameterIndex - The column index.x - The Clob object.
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the PreparedStatement is not open. 07009 is thrown if the parameterIndex is not valid. 2200G is thrown if the column type wasn't castable from a Clob object, see {link ResultSet} for an overview of which Java types are castable to which SQL types.
public void setInt(int parameterIndex,
int x)
throws SQLException
parameterIndex - The parameter number.x - The int.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22003 if the server data type was a numeric data type and the value was larger than the data type could hold. 22001 if the server data type was a character string and the value could not be fitted into the string.
public void setLong(int parameterIndex,
long x)
throws SQLException
parameterIndex - The parameter number.x - The long.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22003 if the server data type was a numeric data type and the value was larger than the data type could hold. 22001 if the server data type was a character string and the value could not be fitted into the string.
public void setNull(int parameterIndex,
int sqlType)
throws SQLException
parameterIndex - The column index.sqlType - The SQL type of the column. A value from Types.
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the PreparedStatement is not open. 07009 is thrown if the parameterIndex is not valid. 23000 is thrown if the parameter wasn't nullable.
public void setNull(int parameterIndex,
int sqlType,
java.lang.String typeName)
throws SQLException
This version of the setNull is supposed to be used on user-defined types and REF type parameters.
Mimer SQL servers up until 9.2 including this driver does not support these SQL datatypes. The sqlType
and typeName parameters are ignored.
parameterIndex - The column index.sqlType - The SQL type of the column. A value from Types.typeName - The name of the type.
SQLException - if an error occurs. SQLSTATE HY010 is thrown if the PreparedStatement is not open. 07009 is thrown if the parameterIndex is not valid. 23000 is thrown if the parameter wasn't nullable.
public void setObject(int parameterIndex,
java.lang.Object x)
throws SQLException
parameterIndex - The parameter number.x - The object.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. This method may throw most SQLSTATE:s thrown by the other setter methods of this object.
public void setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType)
throws SQLException
parameterIndex - The parameter number.x - The object.targetSqlType -
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. This method may throw most SQLSTATE:s thrown by the other setter methods of this object.
public void setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
int scale)
throws SQLException
parameterIndex - The parameter number.x - The object.targetSqlType - scale -
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. This method may throw most SQLSTATE:s thrown by the other setter methods of this object.
public void setShort(int parameterIndex,
short x)
throws SQLException
parameterIndex - The parameter number.x - The short.
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22003 if the server data type was a numeric data type and the value was larger than the data type could hold. 22001 if the server data type was a character string and the value could not be fitted into the string.
public void setString(int parameterIndex,
java.lang.String x)
throws SQLException
parameterIndex - The parameter number.x - The String
SQLException - if an error occurs. SQLSTATE 07009 is thrown if the parameter does not exist. HY010 if the PreparedStatement is not open. 2200G if this method can't be used to convert to the server data type. 22003 if the server data type was a numeric data type and the value was larger than the data type could hold. 22001 if the server data type was a character string and the value could not be fitted into the string.
|
Mimer JDBC/MIDP 2.12 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||