Sha256: 4bc241f27b3fc058482c4eec44b1aa72c7636455bbb19aba2dba84f543010b10

Contents?: true

Size: 1.74 KB

Versions: 13

Compression:

Stored size: 1.74 KB

Contents

#!/usr/bin/env ruby

require 'TestSetup'
require 'test/unit'
require 'rubygems'
require 'fireruby'

include FireRuby

class DDLTest < Test::Unit::TestCase
   CURDIR  = "#{Dir.getwd}"
   DB_FILE = "#{CURDIR}#{File::SEPARATOR}ddl_unit_test.fdb"
   
   def setup
      puts "#{self.class.name} started." if TEST_LOGGING
      if File::exist?(DB_FILE)
         Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
      end
      @database = Database::create(DB_FILE, DB_USER_NAME, DB_PASSWORD)
   end
   
   def teardown
      if File::exist?(DB_FILE)
         Database.new(DB_FILE).drop(DB_USER_NAME, DB_PASSWORD)
      end
      puts "#{self.class.name} finished." if TEST_LOGGING
   end
   
   def test01
      @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
         cxn.execute_immediate('CREATE TABLE DDL_TABLE_01 (TABLEID '\
                               'INTEGER NOT NULL, '\
                               'FIELD01 FLOAT, FIELD02 CHAR(50), '\
                               'FIELD03 BIGINT, FIELD04 TIMESTAMP '\
                               'NOT NULL, FIELD05 VARCHAR(600))')

         cxn.start_transaction do |tx|
            r = tx.execute('SELECT COUNT(*) FROM DDL_TABLE_01')
            assert(r.fetch[0] == 0)
            r.close
         end
         
         cxn.execute_immediate('ALTER TABLE DDL_TABLE_01 ADD PRIMARY KEY '\
                               '(TABLEID)')
                            
         cxn.execute_immediate('CREATE UNIQUE INDEX DDL_TABLE_IDX ON '\
                            'DDL_TABLE_01 (TABLEID)')
                            
         cxn.execute_immediate('DROP INDEX DDL_TABLE_IDX')
      
         cxn.execute_immediate('DROP TABLE DDL_TABLE_01')
      end
   end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
rubyfb-0.5.4-x86-mswin32-60 test/DDLTest.rb
rubyfb-0.5.4-x86-linux test/DDLTest.rb
rubyfb-0.5.4 test/DDLTest.rb
rubyfb-0.5.3-x86-mswin32-60 test/DDLTest.rb
rubyfb-0.5.3-x86-linux test/DDLTest.rb
rubyfb-0.5.3 test/DDLTest.rb
rubyfb-0.5.2-x86-mswin32-60 test/DDLTest.rb
rubyfb-0.5.2-x86-linux test/DDLTest.rb
rubyfb-0.5.2 test/DDLTest.rb
fireruby-0.4.3-mswin32 test/DDLTest.rb
fireruby-0.4.3-i586-linux test/DDLTest.rb
fireruby-0.4.2-mswin32 test/DDLTest.rb
fireruby-0.4.2-i586-linux test/DDLTest.rb