Skip to content

Commit

Permalink
Make 'do_execute' public and get rid of 'execute_with_settings'
Browse files Browse the repository at this point in the history
  • Loading branch information
velimovich committed Dec 3, 2019
1 parent 245ff04 commit 6ba28f6
Showing 1 changed file with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ def execute(sql, name = nil)
do_execute(sql, name)
end

def execute_with_settings(sql, name = nil, settings: {})
do_execute(sql, name, settings: settings)
end

def exec_insert(sql, name, _binds, _pk = nil, _sequence_name = nil)
new_sql = sql.dup.sub(/ (DEFAULT )?VALUES/, " VALUES")
do_execute(new_sql, name, format: nil)
Expand Down Expand Up @@ -90,12 +86,6 @@ def do_system_execute(sql, name = nil)
end
end

private

def apply_format(sql, format)
format ? "#{sql} FORMAT #{format}" : sql
end

def do_execute(sql, name = nil, format: 'JSONCompact', settings: {})
log(sql, "#{adapter_name} #{name}") do
formatted_sql = apply_format(sql, format)
Expand All @@ -106,6 +96,12 @@ def do_execute(sql, name = nil, format: 'JSONCompact', settings: {})
end
end

private

def apply_format(sql, format)
format ? "#{sql} FORMAT #{format}" : sql
end

def process_response(res)
case res.code.to_i
when 200
Expand Down

0 comments on commit 6ba28f6

Please sign in to comment.