Sha256: bec717ecbee93477f3a061c2711cc89789c9a53af90d3188324898a8630ccc68
Contents?: true
Size: 1.1 KB
Versions: 4
Compression:
Stored size: 1.1 KB
Contents
require 'helper' module Arel module Visitors describe 'the mysql visitor' do before do @visitor = MySQL.new Table.engine end ### # :'( # http://dev.mysql.com/doc/refman/5.0/en/select.html#id3482214 it 'defaults limit to 18446744073709551615' do stmt = Nodes::SelectStatement.new stmt.offset = Nodes::Offset.new(1) sql = @visitor.accept(stmt) sql.must_be_like "SELECT FROM DUAL LIMIT 18446744073709551615 OFFSET 1" end it "should escape LIMIT" do sc = Arel::Nodes::UpdateStatement.new sc.limit = Nodes::Limit.new("omg") assert_equal("UPDATE NULL LIMIT 'omg'", @visitor.accept(sc)) end it 'uses DUAL for empty from' do stmt = Nodes::SelectStatement.new sql = @visitor.accept(stmt) sql.must_be_like "SELECT FROM DUAL" end it 'uses FOR UPDATE when locking' do stmt = Nodes::SelectStatement.new stmt.lock = Nodes::Lock.new sql = @visitor.accept(stmt) sql.must_be_like "SELECT FROM DUAL FOR UPDATE" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems