Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm-geokit blows up with dm-mysql-adapter #2

Open
ghost opened this issue May 12, 2011 · 1 comment
Open

dm-geokit blows up with dm-mysql-adapter #2

ghost opened this issue May 12, 2011 · 1 comment

Comments

@ghost
Copy link

ghost commented May 12, 2011

Hi,

dm-geokit tries to push through some raw SQL to calculate the *_distance column. The dm-mysql-adapter quotes and truncates what it believes to be a column name, meaning the query fails. This is a monkey patch to fix it:

DataMapper::Adapters::MysqlAdapter::SQL.module_eval do
  def quote_name(name)
    if name.include? '('
      name
    else
      "`#{name[0, self.class::IDENTIFIER_MAX_LENGTH].gsub('`', '``')}`"
    end
  end
end

You may want to check for the existence of dm-mysql-adapter and add this if found.

@dodeja
Copy link

dodeja commented May 24, 2011

I have the same issue while using Postgres. Any pointers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant