Sha256: 12a67b82ceb93d6f968e12ad4974309c5ac00403b9d03840ff6c798d2e4f325f

Contents?: true

Size: 1012 Bytes

Versions: 6

Compression:

Stored size: 1012 Bytes

Contents

require File.dirname(__FILE__) + "/spec_helper"

describe DataObject do
  
  # These specs only fail in MySQL because:
  # 1) An insert happened in the previous connection
  # 2) We are searching for NULL
  # 
  # It turns out that this is actually by design o.O:
  #   http://dev.mysql.com/doc/refman/5.0/en/myodbc-usagenotes-functionality.html
  #
  #   Certain ODBC applications (including Delphi and Access) may have trouble 
  #   obtaining the auto-increment value using the previous examples. In this case, 
  #   try the following statement as an alternative:
  #     SELECT * FROM tbl WHERE auto IS NULL;
  it "should return an empty reader" do
    database.adapter.connection do |connection|
      sql = 'SELECT `id`, `name` FROM `zoos` WHERE (`id` IS NULL)'.gsub(/\`/, database.adapter.class::COLUMN_QUOTING_CHARACTER)
      command = connection.create_command(sql)

      command.execute_reader do |reader|
        reader.has_rows?.should eql(ENV['ADAPTER'] == 'mysql')
      end
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datamapper-0.2.3 spec/dataobjects_spec.rb
datamapper-0.3.0 spec/dataobjects_spec.rb
datamapper-0.3.2 spec/dataobjects_spec.rb
datamapper-0.2.4 spec/dataobjects_spec.rb
datamapper-0.2.5 spec/dataobjects_spec.rb
datamapper-0.3.1 spec/dataobjects_spec.rb