workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

[BUG] Implement Clone to D1PreparedStatement

Open spicyzboss opened this issue 1 year ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

What version of workers-rs are you using?

0.0.18

What version of wrangler are you using?

3.16.0

Describe the bug

I'm tried to use multiple times of statement like batch but it not works, would be great if D1PreparedStatement derive Clone or Copy trait.

image

Steps To Reproduce

let d1 = ctx.env.d1("...")?;

let create_txn_statement = d1.prepare(
  "
  INSERT INTO transactions (id, amount, transaction_type_id)
  VALUES (?1, ?2, ?3);
  ",
);

d1.batch(vec![
  create_txn_statement.bind(&["1".into(), 42.into(), 1.into()]).unwrap(),
  create_txn_statement.bind(&["2".into(), 69.into(), 1.into()]).unwrap(),
]);

spicyzboss avatar Dec 02 '23 21:12 spicyzboss