Method: Database#create
- Defined in:
- lib/csvr/sqlitedb.rb
#create ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/csvr/sqlitedb.rb', line 14 def create puts "Inserting #{@rows.size} rows into database" db = SQLite3::Database.open("#{@db}.db") db.execute "CREATE TABLE IF NOT EXISTS #{@table}(#{@headers})" @rows.each { |row| db.execute "INSERT INTO #{@table} #{row}" } db.close end |