test/insertSQLAction.rb in ppcurses-0.0.18 vs test/insertSQLAction.rb in ppcurses-0.0.19

- old
+ new

@@ -4,15 +4,15 @@ require_relative '../lib/ppcurses.rb' begin require 'sqlite3' rescue LoadError => e - abort "Missing dependency! Run: gem install sqlite3" + abort 'Missing dependency! Run: gem install sqlite3' end -stringAction = PPCurses::GetStringAction.new("What is your name? "); -intAction = PPCurses::GetIntegerAction.new("Input an integer? "); +stringAction = PPCurses::GetStringAction.new('What is your name? ') +intAction = PPCurses::GetIntegerAction.new('Input an integer? ') def doAction(action) action.show() action.execute() end @@ -23,12 +23,15 @@ create table testTable (name varchar(30), val int); SQL sqlAction = PPCurses::InsertSQLDataAction.new( [stringAction, intAction], - "Insert into testTable(name, val) values ('%s', %s)", db) + "Insert into testTable(name, val) values (?, ?)", db) screen = PPCurses::Screen.new() screen.run { doAction(sqlAction) } + db.close File.delete("test.db") + +