Skip to content

Commit

Permalink
Format and add type to function parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroripper committed Nov 29, 2023
1 parent 1359a00 commit 735aa5d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/OpenSQL/OpenSQL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using DataFrames

const DB = SQLite.DB

const ValidOpenSQLDataType = Union{AbstractString, Integer, Real, Bool}

"""
SQLInterface
"""
Expand Down
8 changes: 4 additions & 4 deletions src/OpenSQL/update.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ function update!(
table::String,
column::String,
id::String,
val,
)
val::T,
) where {T <: ValidOpenSQLDataType}
sanity_check(db, table, column)
DBInterface.execute(db, "UPDATE $table SET $column = '$val' WHERE id = '$id'")
return nothing
Expand All @@ -14,8 +14,8 @@ function update!(
db::SQLite.DB,
table::String,
column::String,
val,
)
val::T,
) where {T <: ValidOpenSQLDataType}
sanity_check(db, table, column)
DBInterface.execute(db, "UPDATE $table SET $column = '$val'")
return nothing
Expand Down
2 changes: 1 addition & 1 deletion src/sql_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function link_series_to_file(

if length(get_parms(db, time_series_table, attribute)) == 0
OpenSQL.create_parameters!(db, time_series_table, Dict(attribute => file_path))
else
else
OpenSQL.update!(db, time_series_table, attribute, file_path)
end
return nothing
Expand Down
1 change: 0 additions & 1 deletion test/OpenSQL/time_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ function test_time_series_2()

PSRI.close(iow)


iow = PSRI.open(
PSRI.OpenBinary.Writer,
joinpath(case_path, "cost");
Expand Down

0 comments on commit 735aa5d

Please sign in to comment.