tursodatabase / tursodatabase/libsql

rusqlite methods on Statement are `mut`, libsql should be compatible without warning

Open
#282 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Methods on rusqlite Statement generally look like this:

pub fn foo(&mut self, ...)

Note the &mut self. This means that the developer must declare Statement objects with mut in order to call methods on them. (It seems that rusqlite's implementation of Statement really is mutable.) libSQL doesn't have the same implementation, however, this means that rusqlite code that gets ported to libSQL is now littered with warnings, which is not a great experience:

    let mut stmt = conn.prepare("...")?;
warning: variable does not need to be mutable
  --> path/to/file.rs:36:9
   |
36 |     let mut stmt = conn.prepare("...")?;
   |         ----^^^^
   |         |
   |         help: remove this `mut`
   |
   = note: `#[warn(unused_mut)]` on by default

We should consider also declaring methods the same way in order to avoid this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the libSQL Statement API and the conn.prepare entry point, then compare its method receiver signatures with rusqlite's Statement methods. Determine the affected methods and update them for compatible mutability without warnings, confirming that ported rusqlite-style code no longer produces unused_mut warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sqlite
Domain
database
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.