Skip to content

API for accessing column names and typesΒ #15

Description

@dvic

In Esqlite we can do

    %% All columns
    {ok, Stmt} = esqlite3:prepare(Db, "select * from test_table"),
    ?assertEqual([<<"varchar(10)">>, <<"INT">>], esqlite3:column_decltypes(Stmt)),

and

{ok, Stmt} = esqlite3:prepare(C, "select 1 as one"),
    ?assertEqual([<<"one">>], esqlite3:column_names(Stmt)),

    {ok, Stmt1} = esqlite3:prepare(C, <<"select 1 as πŸ˜€"/utf8>>),
    ?assertEqual([<<"πŸ˜€"/utf8>>], esqlite3:column_names(Stmt1)),
    
    {ok, Stmt2} = esqlite3:prepare(C, <<"select 1">>),
    ?assertEqual([<<"1">>], esqlite3:column_names(Stmt2)),

(copied from one of the tests)

Can we somehow support this as well? (without necessarily exposing prepared statements and such)?

My use case: I'm trying to write a ascii table snapshot of parts of my database and I want to be able to do this dynamically without knowing the columns upfront.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions