Sha256: 08c05321cbae469ca45baf4cc9711aa7c1c2033ce8fcc34671b9b90560dab0df

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'ppcurses'

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 ('%s', %s)", db)

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ppcurses-0.0.16 test/insertSQLAction.rb