Skip to content

tables(db) for empty database should be (names=[],) #209

@kescobo

Description

@kescobo

The function SQLite.tables(db) returns a NamedTuple like (name=["table1", "table2"],), but if there are no tables, it's just an empty NamedTuple(). This makes it a bit tricky to do something like if "blah" in SQLite.tables(mydb).name....

MWE:

julia> using SQLite

julia> db = SQLite.DB()
SQLite.DB(":memory:")

julia> SQLite.tables(db)
NamedTuple()

julia> for _ in 1:5; (a=rand(10), b=collect(1:10)) |> SQLite.load!(db); end

julia> SQLite.tables(db)
(name = ["sqlitejl_z3Fcq", "sqlitejl_8BDzG", "sqlitejl_L23C9", "sqlitejl_pvmFu", "sqlitejl_SFEBB"],)

Is there any time that tables() returns something with other columns?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions