Is PreparedStatement.addBatch() available for efficiency purposes when performing insert/update?
rocex opened this issue · comments
Is PreparedStatement.addBatch() available for efficiency purposes when performing insert/update?
it's not in the interface (I checked Statement and DataSetWriter as well):
Lines 353 to 391 in d5a8a1f
interface PreparedStatement : Statement, DataSetWriter { | |
/// Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement. | |
int executeUpdate(); | |
/// Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement. | |
int executeUpdate(out Variant insertId); | |
/// Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query. | |
ResultSet executeQuery(); | |
/// Retrieves a ResultSetMetaData object that contains information about the columns of the ResultSet object that will be returned when this PreparedStatement object is executed. | |
ResultSetMetaData getMetaData(); | |
/// Retrieves the number, types and properties of this PreparedStatement object's parameters. | |
ParameterMetaData getParameterMetaData(); | |
/// Clears the current parameter values immediately. | |
void clearParameters(); | |
// from DataSetWriter | |
void setFloat(int parameterIndex, float x); | |
void setDouble(int parameterIndex, double x); | |
void setBoolean(int parameterIndex, bool x); | |
void setLong(int parameterIndex, long x); | |
void setInt(int parameterIndex, int x); | |
void setShort(int parameterIndex, short x); | |
void setByte(int parameterIndex, byte x); | |
void setBytes(int parameterIndex, byte[] x); | |
void setUlong(int parameterIndex, ulong x); | |
void setUint(int parameterIndex, uint x); | |
void setUshort(int parameterIndex, ushort x); | |
void setUbyte(int parameterIndex, ubyte x); | |
void setUbytes(int parameterIndex, ubyte[] x); | |
void setString(int parameterIndex, string x); | |
void setSysTime(int parameterIndex, SysTime x); | |
void setDateTime(int parameterIndex, DateTime x); | |
void setDate(int parameterIndex, Date x); | |
void setTime(int parameterIndex, TimeOfDay x); | |
void setVariant(int parameterIndex, Variant x); | |
void setNull(int parameterIndex); | |
void setNull(int parameterIndex, int sqlType); | |
} |
it's not in the interface (I checked Statement and DataSetWriter as well):
Lines 353 to 391 in d5a8a1f
interface PreparedStatement : Statement, DataSetWriter { /// Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement. int executeUpdate(); /// Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement. int executeUpdate(out Variant insertId); /// Executes the SQL query in this PreparedStatement object and returns the ResultSet object generated by the query. ResultSet executeQuery(); /// Retrieves a ResultSetMetaData object that contains information about the columns of the ResultSet object that will be returned when this PreparedStatement object is executed. ResultSetMetaData getMetaData(); /// Retrieves the number, types and properties of this PreparedStatement object's parameters. ParameterMetaData getParameterMetaData(); /// Clears the current parameter values immediately. void clearParameters(); // from DataSetWriter void setFloat(int parameterIndex, float x); void setDouble(int parameterIndex, double x); void setBoolean(int parameterIndex, bool x); void setLong(int parameterIndex, long x); void setInt(int parameterIndex, int x); void setShort(int parameterIndex, short x); void setByte(int parameterIndex, byte x); void setBytes(int parameterIndex, byte[] x); void setUlong(int parameterIndex, ulong x); void setUint(int parameterIndex, uint x); void setUshort(int parameterIndex, ushort x); void setUbyte(int parameterIndex, ubyte x); void setUbytes(int parameterIndex, ubyte[] x); void setString(int parameterIndex, string x); void setSysTime(int parameterIndex, SysTime x); void setDateTime(int parameterIndex, DateTime x); void setDate(int parameterIndex, Date x); void setTime(int parameterIndex, TimeOfDay x); void setVariant(int parameterIndex, Variant x); void setNull(int parameterIndex); void setNull(int parameterIndex, int sqlType); }
Yes, I checked this, too.
This is really a sad thing. When I use Java and SQLite, using addbatch is 10 times faster than not using addbatch, so I think if it is implemented on DDBC, it can be at least so fast.