Sha256: a6a3dbc17accf03e1bd220623e91a3571bee3f1534ae768ce5f4186bc02fd1f1

Contents?: true

Size: 848 Bytes

Versions: 1

Compression:

Stored size: 848 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 { doAction(sql_action) }


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


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ppcurses-0.0.21 test/insertSQLAction.rb