psrenergy/PSRClassesInterface.jl

Error with sql files with extra lines

guilhermebodin opened this issue · 0 comments

.sql files like this one with extra lines produce very non-intuitive errors.

CREATE TABLE Configurations (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    value TEXT NOT NULL
);


the error

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

julia> PSRClassesInterface.OpenSQL.execute_statements(db, raw".error_extra_lines.sql")
ERROR: SQLite.SQLiteException("not an error")
Stacktrace:
 [1] execute(db::SQLite.DB, stmt::SQLite.Stmt, params::NamedTuple{(), Tuple{}})
   @ SQLite C:\Users\guilhermebodin\.julia\packages\SQLite\aeqsS\src\SQLite.jl:544
 [2] execute
   @ C:\Users\guilhermebodin\.julia\packages\SQLite\aeqsS\src\SQLite.jl:550 [inlined]
 [3] execute(stmt::SQLite.Stmt, params::NamedTuple{(), Tuple{}}; allowduplicates::Bool, strict::Bool)
   @ SQLite C:\Users\guilhermebodin\.julia\packages\SQLite\aeqsS\src\tables.jl:147
 [4] execute
   @ C:\Users\guilhermebodin\.julia\packages\SQLite\aeqsS\src\tables.jl:141 [inlined]
 [5] execute
   @ C:\Users\guilhermebodin\.julia\packages\DBInterface\1Gmxx\src\DBInterface.jl:130 [inlined]
 [6] #execute#2
   @ C:\Users\guilhermebodin\.julia\packages\DBInterface\1Gmxx\src\DBInterface.jl:152 [inlined]
 [7] execute
   @ C:\Users\guilhermebodin\.julia\packages\DBInterface\1Gmxx\src\DBInterface.jl:152 [inlined]
 [8] execute_statements(db::SQLite.DB, file::String)
   @ PSRClassesInterface.OpenSQL C:\Users\guilhermebodin\Documents\Github\PSRClassesInterface.jl\src\OpenSQL\utils.jl:11
 [9] top-level scope
   @ REPL[4]:1

the problem is the extra lines on the file.