Sha256: aca49c161e9af82223c80fb65262a2b748dcf0b41256927a5d0cc5a08e5d6dd3

Contents?: true

Size: 876 Bytes

Versions: 6

Compression:

Stored size: 876 Bytes

Contents

# encoding: utf-8
require 'sqlite3'
require 'fileutils'
include FileUtils

tmpdir = File.join(LIB_DIR, "sample-data")

mkdir_p tmpdir
dbfile = File.join(tmpdir, "simple-sqlite3.db")

if File.exist?(dbfile)
    # this has a bad habit of failing on Windows
  rm dbfile
end

Shoes.app :width => 350, :height => 130 do
  info dbfile
  db = SQLite3::Database.new dbfile
  db.execute "create table t1 (t1key INTEGER PRIMARY KEY,data " \
    "TEXT,num double,timeEnter DATE)"
  db.execute "insert into t1 (data,num) values ('This is sample data',3)"
  db.execute "insert into t1 (data,num) values ('More sample data',6)"
  db.execute "insert into t1 (data,num) values ('Aurélio, Küng, Stärk, Uña, Łuksza',6)"
  db.execute "insert into t1 (data,num) values ('And a little more',9)"
  rows = db.execute "select * from t1"
  rows.each { |k, d, n| para "#{k} : #{d} : #{n}\n" }
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
scarpe-0.4.0 examples/legacy/working/simple/sqlite3.rb
scarpe-0.3.0 examples/legacy/working/simple/sqlite3.rb
scarpe-0.2.2 examples/legacy/working/simple/sqlite3.rb
lacci-0.2.1 examples/legacy/working/simple/sqlite3.rb
scarpe-0.2.1 examples/legacy/working/simple/sqlite3.rb
scarpe-0.2.0 examples/legacy/working/simple/sqlite3.rb