binlib/: update.

This commit is contained in:
0x1eef 2022-09-02 15:45:10 -03:00
parent 049f799f3d
commit f763a9b7b3
3 changed files with 28 additions and 4 deletions

View file

@ -18,9 +18,9 @@ class Chapter
def name
if @locale == "ar"
SQLUtils.escape "".dup.concat(*CHAPTERS[number - 1]['codepoints'])
SQLUtils.escape(CHAPTERS[number - 1]['codepoints'].pack('U*'))
else
SQLUtils.escape CHAPTERS[number - 1]['translated_name']
SQLUtils.escape(CHAPTERS[number - 1]['translated_name'])
end
end
@ -28,12 +28,16 @@ class Chapter
if @locale == "ar"
name
else
SQLUtils.escape CHAPTERS[number - 1]['transliterated_name']
SQLUtils.escape(CHAPTERS[number - 1]['transliterated_name'])
end
end
def slug
SQLUtils.escape CHAPTERS[number - 1]['slug']
SQLUtils.escape(CHAPTERS[number - 1]['slug'])
end
def city
SQLUtils.escape(CHAPTERS[number - 1]['place_of_revelation'].capitalize)
end
def verses

16
binlib/sql/row_mapper.rb Normal file
View file

@ -0,0 +1,16 @@
module RowMapper
def chapter_row(quran_id, chapter_id, chapter)
[
chapter_id, chapter.number, chapter.name,
chapter.tr_name, chapter.slug, chapter.city,
quran_id
].join(",")
end
def verse_row(verse, quran_id, chapter_id)
[
verse.number, quran_id,
chapter_id, verse.content
].join(",")
end
end

View file

@ -7,4 +7,8 @@ class Verse
@number = number
@content = content
end
def content
SQLUtils.escape(@content)
end
end