title: Run sql script from Ruby
body: <p>Using DBI::DatabaseHandle#execute or DBI::DatabaseHandle#prepare it's not possible to run an sql script (with mutiple sql statments). It fails with the following error :</p>
  
  <p><strong>ERROR:  cannot insert multiple commands into a prepared statement</strong></p>
  
  <p>I tried to use the "unprepared" way using DBI::DatabaseHandle#do (the doc says it "goes straight to the DBD‘s implementation") but it keeps throwing the same error.</p>
  
  <p>code snippet:</p>
  
  <pre><code>require 'dbd/pg'
  require 'dbi'
  
  DBI.connect("dbi:pg:database=dbname", db_user, db_password, db_params) do |dbh|
    schema = IO::read(schema_file)
    dbh.do(schema)
  end
  </code></pre>
  
  <p>I'm using </p>
  
  <p>ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]</p>
  
  <p>dbi-0.4.3</p>
  
  <p>dbd-pg-0.3.9</p>
  
  <p>pg-0.9.0-x86-mswin32</p>
  
  <p>Thank you!</p>