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

Cannot use duckdb_interrupt due to private InnerConnection #342

Open
neilyio opened this issue Jun 20, 2024 · 0 comments · May be fixed by #343
Open

Cannot use duckdb_interrupt due to private InnerConnection #342

neilyio opened this issue Jun 20, 2024 · 0 comments · May be fixed by #343

Comments

@neilyio
Copy link

neilyio commented Jun 20, 2024

The Connection hides away the raw duckdb connection object in private fields:

/// A connection to a DuckDB database.
pub struct Connection {
    db: RefCell<InnerConnection>,
    cache: StatementCache,
    path: Option<PathBuf>,
}

InnerConnection contains a ffi::duckdb_connection...

pub struct InnerConnection {
    pub db: ffi::duckdb_database,
    pub con: ffi::duckdb_connection,
    owned: bool,
}

...which is required to call ffi::duckdb_interrupt:

extern "C" {
    #[doc = "Interrupt running query\n\n connection: The connection to interrupt"]
    pub fn duckdb_interrupt(connection: duckdb_connection);
}

There's no way to call duckdb_interrupt (and other ffi functions like it) with a Connection, as we can't access its fields. Exposing a Connection::interrupt() method would be one way around this.

I'm happy to make the contribution if the maintainers can advise on how you would like this implemented.

@rebasedming rebasedming linked a pull request Jun 20, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant