Sha256: 0ed17f5da6ab91376e1dfab264fd716e176d6b1e145f0ee79a4fccc2a0a47623

Contents?: true

Size: 843 Bytes

Versions: 6

Compression:

Stored size: 843 Bytes

Contents

#!/usr/bin/env ruby

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

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

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

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


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


sql_action = PPCurses::InsertSQLDataAction.new( [string_action, integer_action],
                                                'Insert into testTable(name, val) values (?, ?)', db)

screen = PPCurses::Screen.new
screen.run { do_action(sql_action) }


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


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ppcurses-0.1.1 test/insertSQLAction.rb
ppcurses-0.1.0 test/insertSQLAction.rb
ppcurses-0.0.25 test/insertSQLAction.rb
ppcurses-0.0.24 test/insertSQLAction.rb
ppcurses-0.0.23 test/insertSQLAction.rb
ppcurses-0.0.22 test/insertSQLAction.rb