Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is PreparedStatement.addBatch() available for efficiency purposes when performing insert/update? #99

Open
rocex opened this issue Dec 3, 2021 · 2 comments

Comments

@rocex
Copy link

rocex commented Dec 3, 2021

No description provided.

@SingingBush
Copy link
Collaborator

it's not in the interface (I checked Statement and DataSetWriter as well):

ddbc/source/ddbc/core.d

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);
}

@rocex
Copy link
Author

rocex commented Dec 3, 2021

it's not in the interface (I checked Statement and DataSetWriter as well):

ddbc/source/ddbc/core.d

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants