Does the sqlite3 gem add a hash to the sqlite file name?

75 views
Skip to first unread message

David Hooey

unread,
Apr 7, 2020, 12:00:00 PM4/7/20
to sqlite3-ruby
Wonder if the ruby sqlite3 gem is adding the hash to the database filename? This has just started since I upgraded the gem.

I am getting a filename like the following:

sqlanalyzer_kV9H94Za3G_HofxNm4Potw.db

where I'm expecting a filename like the following:

sqlanalyzer.db

The following code is used to create the database file.

require 'sqlite3'

module SQLAnalyzer

    class DB

        @@db_file_name = 'sqlanalyzer.db'

        def self.get_db(memory = 500, db_file_name = 'sqlanalyzer.db')
            @@db_file_name = db_file_name
            db = SQLite3::Database.new(@@db_file_name)
            db.execute('PRAGMA page_size = 32768')
            db.execute("PRAGMA cache_size = #{(memory.to_i * 1024 * 1024) / 32768.to_i}")
            db.execute('PRAGMA synchronous = OFF')
            db.execute('PRAGMA count_changes = 0')
            db.execute('PRAGMA journal_mode = OFF')
            db.execute('PRAGMA temp_store = MEMORY')
            db.results_as_hash = true
            db
        end

        def self.get_db_file_name
            @@db_file_name
        end

    end

end

Default filename should be used as only the memory parameter is being passed in:

@extractor = SQLAnalyzer::Extractor.new(CSQLAnalyzer::DB.get_db(500), Dir.pwd, false)

Thanks!
Dave

Reply all
Reply to author
Forward
0 new messages