Skip to content

Add origin table and origin name methods to prepared statement #1666

@Gabeperson

Description

@Gabeperson

I'm trying to reimplement a subset of SQLx's compile-time query type validation on top of rusqlite. The types were fairly easy as I could use the Statement::columns method, but AFAIK there's currently no way to get the nullability of columns.

It would be possible to do this with the raw ffi api through the sqlite3_column_origin_name and sqlite_column_origin_table calls combined with a pragma_table_info, as mentioned in #494 (comment), but there's no way to get a *mut sqlite3_stmt from a Statement on the main branch.

Would you be open for a PR that adds the two methods to Statement?:

fn column_origin_table(&self, col: usize) -> Option<String>
fn column_origin_name(&self, col: usize) -> Option<String>

(Or alternatively, a handle() method to Statement would also work)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions