Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make Dataset#schema_and_table handle literal strings correctly

Previously, literal strings could be turned into non-literal
strings and thus quoted literal by the identifier quoting code.
  • Loading branch information...
commit 715b70900e1cc7a46b76b68f417597ab314c79fb 1 parent ed5ddae
@jeremyevans authored
Showing with 6 additions and 1 deletion.
  1. +1 −1  lib/sequel/dataset/sql.rb
  2. +5 −0 spec/core/dataset_spec.rb
View
2  lib/sequel/dataset/sql.rb
@@ -654,7 +654,7 @@ def schema_and_table(table_name, sch=(db.default_schema if db))
when SQL::Identifier
[sch, table_name.value.to_s]
when String
- [sch, table_name.to_s]
+ [sch, table_name]
else
raise Error, 'table_name should be a Symbol, SQL::QualifiedIdentifier, SQL::Identifier, or String'
end
View
5 spec/core/dataset_spec.rb
@@ -4465,6 +4465,11 @@ class << Sequel
@ds.schema_and_table('s').should == [nil, 's']
end
+ it "should correctly handle literal strings" do
+ s = Sequel.lit('s')
+ @ds.schema_and_table(s).last.should equal(s)
+ end
+
it "should correctly handle identifiers" do
@ds.schema_and_table(Sequel.identifier(:s)).should == [nil, 's']
end
Please sign in to comment.
Something went wrong with that request. Please try again.