Skip to content

Commit

Permalink
Derby: Upcase and quote column names
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Odorcic committed Oct 15, 2010
1 parent 7d26b0e commit 7ea9be0
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions lib/arjdbc/derby/adapter.rb
Expand Up @@ -314,20 +314,8 @@ def recreate_database(db_name)
end
end

# For DDL it appears you can quote "" column names, but in queries (like insert it errors out?)
def quote_column_name(name) #:nodoc:
name = name.to_s
if /^(references|integer|key|group|year)$/i =~ name
%Q{"#{name.upcase}"}
elsif /[A-Z]/ =~ name && /[a-z]/ =~ name
%Q{"#{name}"}
elsif name =~ /[\s-]/
%Q{"#{name.upcase}"}
elsif name =~ /^[_\d]/
%Q{"#{name.upcase}"}
else
name
end
%Q{"#{name.to_s.upcase.gsub(/"/, '""')}"}
end

def quoted_true
Expand Down

0 comments on commit 7ea9be0

Please sign in to comment.