You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Batch statements are quite limited in the current API. You can only execute
multiple queries without parameters. And if need to execute a list of
statements, you would need to join those strings separated by ";".
Proposal: Create a batch object that acts like regular connection or
transaction, and batch all executes and queries when you call .commit() on
that object. Rows can be accessed with a handle via a object returned by the
commit.
let batch:Batch = conn.batch();
batch.execute("create table if not exists test (i integer)",())?;for i in0..10{
batch.execute("insert into test values (?)",params![i])?;}// You can't use the Rows from a query before it is batched. To prevent it,// only give a handle to access rows with the BatchResponse. This should only// be wrapper of a index (u32) that can only be returned by `.query()`.let handle:BatchHandle = batch.query("select * from test",())?;let batch_res:BatchResponse = batch.commit()?;// Batch all statements// batch.query/execute(...) cannot be called here, ownership is passed to `.commit()`let rows = batch_res.get(handle);
The text was updated successfully, but these errors were encountered:
Batch statements are quite limited in the current API. You can only execute
multiple queries without parameters. And if need to execute a list of
statements, you would need to join those strings separated by ";".
Proposal: Create a batch object that acts like regular connection or
transaction, and batch all executes and queries when you call
.commit()
onthat object. Rows can be accessed with a handle via a object returned by the
commit.
The text was updated successfully, but these errors were encountered: