Sha256: fde32028bd720ead79163171a68677d6e7ab9f2fca6ca8b92219bc20c13e2e61
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
#!/usr/bin/env ruby require './TestSetup' require 'test/unit' require 'rubygems' require 'rubyfb' include Rubyfb class BlobTest < Test::Unit::TestCase DB_FILE = File.join(DB_DIR, "blob_unit_test.fdb") TXT_FILE = File.join(DB_DIR, "data.txt") DATA = "aasdfjakhdsfljkashdfslfhaslhasyhfawyufalwuhlhsdlkfhasljlkshflalksjhasjhalsjhdf\nasdflkajshdfjkahsdfjajdfalsdfasdf\nasdfasdfasdkljfhajdfhkjasdfagdsflalkjfgagsdflasdf\nasdfasdfasdf" def setup puts "#{self.class.name} started." if TEST_LOGGING # Remove existing database files. @database = Database.new(DB_FILE) if File.exist?(DB_FILE) @database.drop(DB_USER_NAME, DB_PASSWORD) end Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD) end def teardown # Remove existing database files. if File.exist?(DB_FILE) @database.drop(DB_USER_NAME, DB_PASSWORD) end puts "#{self.class.name} finished." if TEST_LOGGING end def test01 d = nil @database.connect(DB_USER_NAME, DB_PASSWORD) do |cxn| cxn.execute_immediate('create table blob_test (data blob sub_type 0)') cxn.start_transaction do |tx| s = Statement.new(cxn, tx, 'INSERT INTO BLOB_TEST VALUES(?)', 3) s.execute_for([DATA]) # Perform a select of the value inserted. r = cxn.execute('SELECT * FROM BLOB_TEST', tx) d = r.fetch assert_equal(d[0].to_s, DATA) # Clean up. s.close r.close end cxn.execute_immediate('DROP TABLE BLOB_TEST') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyfb-0.5.8 | test/BlobTest.rb |