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

Breaking Changes between versions 1.1.3 and 1.60 #329

Open
qSeven opened this issue Mar 20, 2023 · 1 comment
Open

Breaking Changes between versions 1.1.3 and 1.60 #329

qSeven opened this issue Mar 20, 2023 · 1 comment

Comments

@qSeven
Copy link

qSeven commented Mar 20, 2023

The type returned by SQLite.tables is not compatible between versions 1.1.3

In version 1.1.3:

julia> typeof(SQLite.tables(db))
NamedTuple{(:name,), Tuple{Vector{Union{Missing, String}}}}

and in version 1.6.0

julia> typeof(SQLite.tables(db))
Vector{SQLite.DBTable} (alias for Array{SQLite.DBTable, 1})

In 1.1.3 I had to use table.name to access the tables and this broke my code when updating to 1.6.0.

According to https://pkgdocs.julialang.org/v1/compatibility/ this shouldn't happen :/

Hope this is helpful to others,
Shane

@qSeven
Copy link
Author

qSeven commented Mar 20, 2023

Another issue that breaks my code is that SQLite.tables(db) can not read a database with table names starting with numbers in 1.6.0, but can in 1.1.3

This can be detected with

db = SQLite.DB("test.db")

createSQL = " Create Table If Not Exists '1isanumber' (masterID INTEGER, computationTime DOUBLE)"
SQLite.execute(db,createSQL)
tables=SQLite.tables(db)
println(tables.name)

or with

println(tables)

in 1.6.0

In 1.1.3 this returns

["1isanumber"]

In 1.6.0 this returns

ERROR: SQLiteException("unrecognized token: \"1isanumber\"")
Stacktrace:
  [1] sqliteerror(args::SQLite.DB)
    @ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:34
  [2] macro expansion
    @ ~/.julia/packages/SQLite/aeqsS/src/base.jl:10 [inlined]
  [3] prepare_stmt_wrapper
    @ ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:109 [inlined]
  [4] SQLite.Stmt(db::SQLite.DB, sql::String; register::Bool)
    @ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:146
  [5] Stmt
    @ ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:146 [inlined]
  [6] prepare
    @ ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:180 [inlined]
  [7] execute
    @ ~/.julia/packages/DBInterface/1Gmxx/src/DBInterface.jl:130 [inlined]
  [8] #execute#2
    @ ~/.julia/packages/DBInterface/1Gmxx/src/DBInterface.jl:152 [inlined]
  [9] execute
    @ ~/.julia/packages/DBInterface/1Gmxx/src/DBInterface.jl:152 [inlined]
 [10] (::SQLite.var"#37#38"{SQLite.DB})(tbl::String)
    @ SQLite ./none:0
 [11] iterate
    @ ./generator.jl:47 [inlined]
 [12] collect(itr::Base.Generator{Vector{String}, SQLite.var"#37#38"{SQLite.DB}})
    @ Base ./array.jl:681
 [13] tables(db::SQLite.DB, sink::Function)
    @ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:783
 [14] tables(db::SQLite.DB)
    @ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:778
 [15] top-level scope
    @ ~/ComputationProjects/TEST/VS1p6p0/test.jl:7

There seems to be some disagreement about what constitutes a valid SQLite database table name https://stackoverflow.com/questions/3694276/what-are-valid-table-names-in-sqlite, but I have been using for years names that start with numbers so unfortunate for me this breaks my code. I'll stick with 1.1.3 for now and keep a look out for updates.

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

No branches or pull requests

1 participant