#!/usr/bin/env ruby
#coding: utf-8
require 'cgi'
c = CGI.new(:accept_charaset => "UTF-8")
print("Content-type: text/html; charset=utf-8\n\n")
check = c['check']
require 'sqlite3'
db = SQLite3::Database.new("../sql/test.sq3")
if check == "OK"
db.execute("delete from main");
begin
db.execute("drop table main");
rescue
print"<p>テーブルの再構築に失敗しました。</p>"
else
db.execute("create table main(id INTEGER PRIMARY KEY AUTOINCREMENT,name,lon,lat,sta)");
db.execute("insert into main(name,lon,lat,sta) values('NAME','LON','LAT','STA')");
print"<p>データベースの中身を消去しました。</p>"
end
else
print"<p>データベースは保持されたままです。</p>"
end
print"<p><a href=\"etsuran.rb\">もどる</a></p>"