# coding: utf-8
require 'sqlite3'

# 接続
db = SQLite3::Database.new("test_ruby.sqlite")

# テーブル作成
db.execute('create table test (name text, val real)');
db.execute('create index name_idx on test(name)');

# データ挿入
for n in 1..10000
  s = sprintf("test%05d", n)
  db.execute('insert into test (name, val) values (?, ?)', s, rand) 
end

# 切断
db.close
print "OK\n"
