Skip to content

Commit

Permalink
Fix SQL indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavothecoder committed Nov 15, 2023
1 parent f59a3cb commit 1434933
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
36 changes: 18 additions & 18 deletions lib/pod/commands/add/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ def call(feed, options = {})
return build_failure_response(details: :missing_sync_url) if podcast_feed.nil?

db.execute <<-SQL
insert into podcasts
(name, description, feed, website)
values (
"#{escape_double_quotes(podcast.name)}",
"#{escape_double_quotes(podcast.description)}",
"#{escape_double_quotes(podcast_feed)}",
"#{escape_double_quotes(podcast.website)}"
);
insert into podcasts
(name, description, feed, website)
values (
"#{escape_double_quotes(podcast.name)}",
"#{escape_double_quotes(podcast.description)}",
"#{escape_double_quotes(podcast_feed)}",
"#{escape_double_quotes(podcast.website)}"
);
SQL

inserted_podcast_id = db.query("select id from podcasts order by id desc limit 1;").first.id
parsed_feed.episodes.each do |e|
db.execute <<-SQL
insert into episodes
(title, release_date, podcast_id, duration, link, external_id)
values (
"#{escape_double_quotes(e.title)}",
"#{escape_double_quotes(e.release_date)}",
#{inserted_podcast_id},
"#{escape_double_quotes(e.duration)}",
"#{escape_double_quotes(e.link)}",
"#{e.external_id}"
);
insert into episodes
(title, release_date, podcast_id, duration, link, external_id)
values (
"#{escape_double_quotes(e.title)}",
"#{escape_double_quotes(e.release_date)}",
#{inserted_podcast_id},
"#{escape_double_quotes(e.duration)}",
"#{escape_double_quotes(e.link)}",
"#{e.external_id}"
);
SQL
end
end
Expand Down
20 changes: 10 additions & 10 deletions lib/pod/commands/sync/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ def call(podcast_id)
parsed_feed = Infrastructure::FeedParser.call(podcast.feed)
parsed_feed.episodes.each do |e|
db.execute <<-SQL
insert or ignore into episodes
(title, release_date, podcast_id, duration, link, external_id)
values (
"#{escape_double_quotes(e.title)}",
"#{escape_double_quotes(e.release_date)}",
#{podcast_id},
"#{escape_double_quotes(e.duration)}",
"#{escape_double_quotes(e.link)}",
"#{e.external_id}"
);
insert or ignore into episodes
(title, release_date, podcast_id, duration, link, external_id)
values (
"#{escape_double_quotes(e.title)}",
"#{escape_double_quotes(e.release_date)}",
#{podcast_id},
"#{escape_double_quotes(e.duration)}",
"#{escape_double_quotes(e.link)}",
"#{e.external_id}"
);
SQL
end
build_success_response(details: :podcast_synchronized)
Expand Down

0 comments on commit 1434933

Please sign in to comment.