Sha256: d4b1e51e49da1bc7bdb88032f7d3a9705e8b0e1d80466d86a1d8889d2df8683c

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require_relative '../lib/ppcurses.rb'

begin
  require 'sqlite3'
rescue LoadError => e
  abort 'Missing dependency! Run: gem install sqlite3'
end

stringAction = PPCurses::GetStringAction.new('What is your name? ')
intAction = PPCurses::GetIntegerAction.new('Input an integer? ')

def doAction(action)
  action.show()
  action.execute()
end


db = SQLite3::Database.open "test.db"
db.execute <<-SQL
  create table testTable (name varchar(30), val int);
SQL


sqlAction = PPCurses::InsertSQLDataAction.new( [stringAction, intAction],
                  "Insert into testTable(name, val) values (?, ?)", db)

screen = PPCurses::Screen.new()
screen.run { doAction(sqlAction) }


db.close
File.delete("test.db")


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ppcurses-0.0.20 test/insertSQLAction.rb
ppcurses-0.0.19 test/insertSQLAction.rb