From: Dossy Date: 2002-07-14T02:23:27+09:00 Subject: Re: DBI create table question On 2002.07.14, Jim Freeze wrote: > << This does NOT work >> > --- begin dbi.rb ----- > require 'dbi' > > DBI.connect('DBI:Mysql:test', 'name', 'pass') { | dbh | > > sql = <<-EOF > drop table if exists passport; > CREATE TABLE passport(id INT UNSIGNED NOT NULL AUTO_INCREMENT, [...] You can only execute ONE SQL statement at a time via DBI. Try: dbh.do("DROP TABLE IF EXISTS PASSPORT") sql = <<-EOF CREATE TABLE passport(id INT UNSIGNED NOT NULL AUTO_INCREMENT, email VARCHAR(64) NOT NULL, type ENUM('text', 'html') NOT NULL, passport_date DATE NOT NULL, last_activity DATE NOT NULL, INDEX (email), PRIMARY KEY (id)); EOF dbh.do(sql) -- Dossy -- Dossy Shiobara mail: dossy@panoptic.com Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70)