From 19dd23a03b1c0b726bfb3a4034c8d4b42458266d Mon Sep 17 00:00:00 2001 From: Jcharis Date: Sun, 8 Sep 2024 22:13:01 +0200 Subject: [PATCH] chore: add compat and modify insert fxn --- src/Jorm.jl | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/src/Jorm.jl b/src/Jorm.jl index fb3cede..3bd102d 100644 --- a/src/Jorm.jl +++ b/src/Jorm.jl @@ -411,34 +411,9 @@ end # Function to perform bulk insert function bulk_insert!(db::SQLite.DB, model::Type, data::Vector) query, params = bulk_insert_sql(model, data) - - # Execute the query within a transaction for better performance - # Jorm.execute_query(db, RawSQL("BEGIN TRANSACTION;")) Jorm.execute_query(db, query, params) - # Jorm.execute_query(db, RawSQL("COMMIT;")) -end - - -# function bulk_update!(db::SQLite.DB, model::Type, data::Vector{model}) -# # Start a transaction for better performance -# Jorm.execute_query(db, "BEGIN TRANSACTION;") - -# for item in data -# # Generate the SQL query for updating a record -# columns = join([string(field, " = ?") for field in fieldnames(model)], ", ") -# query = "UPDATE $(tablename(model)) SET $columns WHERE id = ?" - -# # Prepare the parameters -# params = Any[getfield(item, field) for field in fieldnames(model)] -# push!(params, item.id) # Add the id for the WHERE clause - -# # Execute the update query -# Jorm.execute_query(db, query, params) -# end - -# # Commit the transaction -# Jorm.execute_query(db, "COMMIT;") -# end +end + include("JormUtils.jl")