Class: Aspera::Sync::Database
- Inherits:
-
Object
- Object
- Aspera::Sync::Database
- Defined in:
- lib/aspera/sync/database.rb
Overview
Access async sqlite database
Instance Method Summary collapse
- #counters ⇒ Object
- #file_info ⇒ Object
-
#initialize(db_path) ⇒ Database
constructor
A new instance of Database.
- #meta ⇒ Object
- #overview ⇒ Object
Constructor Details
#initialize(db_path) ⇒ Database
Returns a new instance of Database.
57 58 59 |
# File 'lib/aspera/sync/database.rb', line 57 def initialize(db_path) @db = SqLite3Wrapper.new(db_path) end |
Instance Method Details
#counters ⇒ Object
75 76 77 |
# File 'lib/aspera/sync/database.rb', line 75 def counters @db.single_table('sync_snap_counters_table') end |
#file_info ⇒ Object
79 80 81 |
# File 'lib/aspera/sync/database.rb', line 79 def file_info @db.full_table('sync_snapdb_table') end |
#meta ⇒ Object
71 72 73 |
# File 'lib/aspera/sync/database.rb', line 71 def @db.single_table('sync_snapmeta_table') end |
#overview ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/aspera/sync/database.rb', line 61 def overview tables = @db.execute("SELECT name FROM sqlite_master WHERE type='table';") tables.flat_map do |table_row| table_name = table_row['name'] @db.execute("PRAGMA table_info(#{table_name});").map do |col| {'table' => table_name}.merge(col) end end end |