PreparedStatement interface Creates an object representing a pre-compiled SQL statement

xiaoxiao2021-03-06  40

PREPAREDSTATEMENT interface

The PreparedStateMent interface creates an object that represents the pre-compiled SQL statement.

The SQL statement is precompiled and stored in the PreparedStatement object. This object can then be used to effectively perform this statement multiple times.

Java.sql package

Public interface prepaaredStatement

Extend "statement"

Table 101 lists methods for DB2 Everyplace support in the PreparedStateMent interface.

Table 101. PreparedStatement interface method

Method Return Value Type Method Void ClearParameters () Clears the current parameter value immediately. Boolean Execute () Executes any kind of SQL statement. ResultSet ExecuteQuery () executes SQL queries in this PreparedStatement object and returns the result set generated by the query. Int executeUpdate () executes SQL INSERT, UPDATE, or DELETE statements in this preparedStatement object. Void SetBigDecimal (Int ParameterIndex, BigDecimal X) Sets the specified parameter to java.lang.bigDecimal value. This method is not available in the Palm OS's DB2 Everyplace JDBC driver. Void SetBoolean (INT ParameterIndex, Boolean X) Sets the specified parameter to the Java Boolean value. When it is sent to the database, the DB2 Everyplace JDBC driver converts it to the SQL Smallint value. Void SetBlob (INT I, BLOB X) JDBC 2.0 Sets the BLOB parameter. Void SetBytes (Int ParameterIndex, Byte [] x) Sets the specified parameter as an array of Java. Void SetDate (int ParameterIndex, Date X) Set the specified parameter to the java.sql.date value. Void setDouble (int ParameterIndex, Double X) Sets the specified parameter to the Java double precision value. When it is sent to the database, the DB2 Everyplace JDBC driver converts it to the SQL Decimal value. Void setFloat (int ParameterIndex, Float X) Sets the specified parameter to Java floating point value. When BigDecimal is converted to a floating point, if BigDecimal is too large and cannot be represented as a floating point, it will be converted to float.negative_infinity or float.positive_infinity as needed. Void Setint (INT ParameterIndex, INT X) Sets the specified parameter to the Java INT value. Void setlong (INT ParameterIndex, long x) Specifies the specified parameter as a Java long integer value. Void SetNull (int parameterIndex, int SQLTYPE) Sets the specified parameter to SQL NULL. Void SetObject (int ParameterIndex, Object X, int targetsqltype) uses a given object to set the value of the specified parameter. DB2 Everyplace Limit:

TargetsqlType must correspond to one of the data types supported by DB2 Everyplace. Support for basic conversion and string conversion. For example, if TargetsqlType is Types.integer, the x should be an Integer or String object. If TargetsqlType is types.decimal, then x can also be Double, Float, or LONG objects. If targetsqltype is types.smallint, then x can also be a Boolean object. On the Palm OS, if targetsqltype is types.decimal, X should be a String object. Void SetShort (INT ParameterIndex, Short X) Sets the specified parameter to the Java Short value. Void SetString (Int ParameterIndex, String X) Sets the specified parameter to the java string value. Void SetTime (INT ParameterIndex, Time X) Sets the specified parameter to the java.sql.time value. Void setTimeStamp (INT ParameterIndex, TimeStamp X) sets the specified parameter to java.sql.timestamp value. Related task

转载请注明原文地址:https://www.9cbs.com/read-62892.html

New Post(0)