Class: Termtter::Storage::DB
- Inherits:
-
Object
- Object
- Termtter::Storage::DB
- Includes:
- Singleton
- Defined in:
- lib/plugins/storage/DB.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
Instance Method Summary collapse
- #create_table ⇒ Object
-
#initialize ⇒ DB
constructor
A new instance of DB.
Constructor Details
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
9 10 11 |
# File 'lib/plugins/storage/DB.rb', line 9 def db @db end |
Instance Method Details
#create_table ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/plugins/storage/DB.rb', line 17 def create_table sql =<<-SQL CREATE TABLE IF NOT EXISTS user ( id int NOT NULL, screen_name text, PRIMARY KEY (id) ); CREATE TABLE IF NOT EXISTS post ( post_id int NOT NULL, -- twitter側のpostのid created_at int, -- 日付(RubyでUNIX時間に変換) in_reply_to_status_id int, -- あったほうがよいらしい in_reply_to_user_id int, -- あったほうがよいらしい post_text text, user_id int NOT NULL, PRIMARY KEY (post_id) ); SQL @db.execute_batch(sql) end |