Skip to content

Changes to tables are not captured; valid queries can not be executed. #101

@sadish-d

Description

@sadish-d

It doesn't look like changes in a table are consistently reflected in the SQLConnection objects since they are not mutable.

import SQLite
import FunSQL: DBInterface, SQLConnection, reflect

conn1 = DBInterface.connect(SQLConnection{SQLite.DB})
conn2 = DBInterface.connect(SQLConnection{SQLite.DB})
DBInterface.execute(conn2, "CREATE TABLE t (id int)")

@assert conn1.catalog == reflect(conn1)  # passes
@assert conn2.catalog == reflect(conn2)  # fails

SQLite.DBInterface.execute(conn2, "SELECT * FROM t")  # executes
FunSQL.DBInterface.execute(conn2, From(:t))  # does not execute

While reflect captures updates, a lot of places in the code make direct references to the (immutable) catalog field of the SQLConnection object. This means FunSQL.DBInterface.execute is unable to execute queries that are valid.

I wonder if there is a way to capture updates to the catalog, either by making SQLConnection mutable, or by using reflect instead of directly accessing the catalog field.

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